agents-database lookup bloat
Goal: keep memory lookup cheap, precise, and low-noise.
Default rule
Search first. Hydrate context only for exact hits. Treat context as opt-in, not the default path.
What to change
- Make /api/search tiny: return only id, type, title, score, updated_at, tags.
- Make /api/context exact-id only: no broad neighborhood expansion unless explicitly requested.
- Add a brief context mode: capped summaries, no recursive expansion.
- Store canonical summaries: 1–3 lines per memory, separate from raw text.
- Use metadata filters first: project, repo, task, type, time window.
- Keep bundles shallow: one hit, one parent summary, maybe one sibling.
Best pattern
1. search(query, filters)
2. pick top 1–3 exact hits
3. fetch exact memory by id
4. optionally expand related context
Anti-pattern
search(query) → huge context bundle → recursive related memories → more bloat
Practical caps
- Max results returned by default: 10–20
- Max chars per memory summary: strict
- Max context bundle: hard cap
- Recursive depth: 0 by default
Net effect
Faster lookups, less token waste, better signal, and less accidental memory sprawl.