Introduction
You add memory to your agent, it works great in testing, you ship it. Weeks later, outputs degrade and nobody can figure out why. The agent is pulling in old information that's no longer true, retrieving context that's loosely related but clutters reasoning, and sometimes carrying forward bad assumptions across sessions. Production memory needs to decay, surface contradictions, and stay debuggable โ none of which you get for free.
Why this matters
- Memory is the most common silent failure mode for agents in production.
- Bad context is worse than no context โ irrelevant memories actively confuse the model.
- Without decay, memory becomes a slow-motion data-quality crisis.
- Without provenance, debugging memory issues is guesswork.
Core concepts
Decay and freshness
Every memory has an age. Confidence drops with age; some memories expire entirely. Decay rates differ by memory type โ schema facts decay slowly, user preferences faster, transient context fastest.
Contradiction surfacing
New information that contradicts existing memory shouldn't silently overwrite. Surface it: log, tag, and (in some cases) ask the user.
Provenance and audit
Every memory needs to know where it came from (which session, which user input, which model output) so you can debug and revoke.
Retrieval relevance vs. similarity
Vector similarity is not the same as task relevance. Add hard filters (recency, source, scope) and rerankers; semantic similarity alone over-retrieves.
Practical patterns
Time-bucketed memory
Slot memories into "this session," "recent," "long-term." Different retrieval strategies and decay curves per bucket.
Confidence-weighted retrieval
Score memories by recency ร source-trust ร usage-count; surface the top-N by combined score, not just similarity.
Memory eval suite
Run scripted multi-session conversations and check whether the agent's answers stay consistent and current.
Forgetting policies
Explicit rules for when memory expires: time, count, contradiction, user delete. Tested in CI.
Pitfalls to avoid
- Treating memory as a vector DB problem only โ graph and relational structure also matter.
- No way for users to inspect, correct, or delete what the agent thinks it knows about them.
- Memory growth unbounded; latency and quality both degrade.
- Retrieval thresholds that worked at 100 memories fail at 100,000.
Key takeaways
- 1Decay is a feature, not a bug.
- 2Surface contradictions; don't silently overwrite.
- 3Make memory inspectable and revocable.
- 4Test memory across sessions, not just within one.
Go deeper ยท external resources
Curated reading list to take you from primer to practitioner. All links are external and free to read.