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.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Two years of daily agent conversation is a memory-systems stress test that did not exist in production until recently. The store grows past any reasonable retrieval budget. The user expects the agent to still know what it learned about them. A naive cleanup pass either keeps everything (and the active store becomes useless) or evicts aggressively (and the user-facing failure mode is the agent forgetting something they expected it to remember).
The design space is multi-dimensional and the failure modes are sharp. This answer walks through the salience scoring, the demotion versus deletion decision, the differential decay by memory type, and the exemption list, and grounds each in what production systems (Zep, Mem0, Letta) actually do.
Why a single signal fails
Three single-signal designs and the failure each one creates.
Recency only. Evict memories not accessed in N days. Failure mode: a stable user preference held for two years and queried twice a year gets evicted. The user notices and complains.
Frequency only. Evict memories accessed fewer than K times. Failure mode: a safety-critical fact (allergy, medical condition) is referenced rarely but must never be lost. Or a high-frequency conversational tic accumulates score without being useful.
Importance only. Evict memories the model marked as low-importance at write time. Failure mode: importance flags are set at write time without knowing how the user will use the agent later; the model judges wrong and evicts something useful, or hoards everything labeled high-importance and the store still grows.
The robust design is a weighted combination of all three. None of the signals is individually sufficient; together they cover the failure modes.
The coefficients should be tuned per memory type. Episodic memories weight recency more heavily; semantic memories weight frequency and importance more heavily; safety memories ignore the score entirely (see exemption section).
Situations where this technique stops working.
2–4 min · Everything important, quickly.
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.
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)?
Use a small classifier at extract time. The Mem0 extractor already produces typed memories. For higher fidelity, run a second-pass model that takes the extracted fact and the source message and emits a type tag plus an importance flag. The classification only happens once per memory at write, so the cost is bounded.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases 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.
60 second bullets to scan on the way to the call.
The three independent signals that should feed a decay score
Why demotion is preferred over deletion below threshold
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.