Retrieval Memory — Vector Stores, Scoring, and the Art of Remembering the Right Thing

The standard answer to agent memory is "embed it and put it in a vector store" — and it's half right. Semantic search over past experience is genuinely the workhorse of episodic recall. But raw similarity is a weak model of what "relevant memory" means: similar is not important, recent, or true. The difference between a memory system and a junk drawer with an embedding index is the scoring, filtering, and hygiene this post covers.

Post 3 ended with demotion: what leaves the window lands in a durable store. This post is about getting it back out well. It builds on ideas from Agentic RAG and Vector Search Internals — but memory retrieval differs from document RAG in ways that matter, and treating them as identical is a design error this post keeps returning to.

Memory retrieval is not document RAG

Document RAG retrieves from a corpus that is curated, mostly static, and written to be read. Memory retrieval works against a store that is self-generated, append-heavy, time-sensitive, and full of near-duplicates — every session deposits more, much of it mundane, some of it superseded. Three differences drive the design:

Scoring: similarity is one signal of three

The design that has become canonical scores candidate memories on a blend, not similarity alone:

The blend (a weighted sum works; exact weights are an eval problem, post 8) fixes the characteristic vector-only failures: the hundredth similar-but-trivial greeting outranking the one crucial constraint, and a long-dead decision surfacing as if current. Two refinements earn their complexity quickly: last-accessed reinforcement (retrieving a memory refreshes its recency — frequently-useful memories stay warm, a direct borrow from how human recall strengthens with use) and retrieval-triggered reconciliation (when top-scoring memories contradict each other, surface the conflict to the consolidation process rather than injecting both).

Write-side hygiene decides read-side quality

Most retrieval-memory failures are written, not read. The store degrades without discipline at insert time:

Injection: the last foot of the problem

Retrieved memories must still enter the window well. Three practices prevent the common injuries. Budget strictly — memory competes with task context for tokens; a handful of high-scoring memories under a hard token budget beats a generous top-k that crowds out the actual work. Label provenance — injected memories should be visibly memories (“From memory (2026-08-12, confidence: high): …”), so the model can weigh them rather than absorb them as present-tense ground truth; this single formatting habit defuses most stale-memory incidents. Let the agent ask — beyond automatic injection, expose retrieval as a tool the agent can call (“search memory for how we fixed the auth flake”) — recall-on-demand catches what the implicit query missed, and is the bridge to post 6, where memory becomes something the agent actively operates rather than passively receives.

The takeaway: vector search is the right engine and the wrong whole answer — memory retrieval differs from document RAG because the store is self-generated, time-sensitive, and self-contradicting. Score on relevance × recency × importance (with last-accessed reinforcement), enforce write-side hygiene — select, write self-contained, dedupe at the door, attach structure — and inject with budget, provenance labels, and an on-demand retrieval tool. The store you can trust is the one you were disciplined about filling.

Key takeaways

Further reading

Sources & References