← cd ../blog

$ cat building-memory-that-knows-when-to-forget.md

Building memory that knows when to forget

engineering6 min

A practical model for keeping agent context useful without letting recall become noise.

Agent memory is usually described as a storage problem. In production it behaves more like a prioritisation problem: every remembered item competes for attention, tokens, latency, and trust.

The useful question is not whether an agent can retrieve a fact. It is whether that fact still deserves to influence the next decision.

## memory needs a lifecycle

I split memory into capture, consolidation, retrieval, and retirement. Capture stays permissive. Consolidation attaches provenance and merges repetition. Retrieval is constrained by the active task. Retirement lowers the influence of stale evidence instead of deleting it immediately.

That lifecycle makes failure visible. If recall is poor, you can identify whether the information was never captured, consolidated incorrectly, ranked badly, or allowed to outlive its usefulness.

## measure the wrong memories too

Recall metrics alone reward systems that return more context. I also track distraction: how often retrieved items are ignored, contradicted, or cause a tool choice to change without improving the result.

A good memory system is not the one that remembers everything. It is the one that makes the next correct action easier to justify.

▊ end of file