Design a decay policy for an agent that has been talking to one user for two years
After two years of daily use, an agent's memory store has 10,000+ facts about one user. Many are stale. Design a decay policy that keeps the store useful without losing important history.
Score each memory on recency, frequency, and importance; demote (not delete) below threshold; treat episodic and semantic differently; exempt safety facts and user-set preferences entirely.
Imagine a personal assistant who has worked with you for two years and now has filing cabinets full of notes about you. Some notes are still relevant (your coffee order, the people you work with). Some are very dated (where you parked your car in March 2024). Some are non-negotiable no matter how old (your allergies, your spouse's name). A good filing system moves dated notes from the active drawer into a basement archive, where you can still ask for them by name but they no longer clutter the top drawer. The non-negotiable ones stay pinned to the desk forever. Memory decay for an agent works the same way: demote the dated, keep the always-relevant, and never trash anything that might still matter.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: name the three decay signals and explain why each alone is insufficient; defend demotion over deletion; differentiate episodic, semantic, and procedural half-lives; specify the exemption list; name Zep, Mem0, Letta and how they differ.
Real products, models, and research that use this idea.
- Zep maintains a temporal knowledge graph in 2026 with fact-level timestamps, decay weights, and graph-walk retrieval; it is the closest production system to the decay design described here.
- Mem0 in 2026 emphasizes deduplication and merging at write time rather than time-based decay; complementary to Zep's approach.
- Letta (formerly MemGPT) exposes core_memory_append, core_memory_replace, and archival_insert as tools so the model decides what to retain.
- Anthropic's Claude memory features in 2026 expose memory operations as tool calls with implicit decay through summarization rather than explicit timestamps.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you decide which class a newly extracted memory belongs to (episodic, semantic, procedural)?
QWhat happens when a memory in cold storage is recalled and used? Does it move back to hot?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating decay as a single time-based score. Recency alone evicts a stable preference the user has held for two years and queries about once a month.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.