Memory Lives Beyond the Context Window

Does curating an agent's memory beat letting it search? The curation lost, and everything ships so the result can be re-run.

Rashid Azarang6 min read
Memory Lives Beyond the Context Window

Ask an AI engineer where an agent's memory lives and they will point at the context window. Almost all of the debate lives there too: bigger windows, smarter compaction, what to load and what to drop. The context window is where memory gets discussed because it is where memory is visible.

But watch a real agent answer a real question and something else shows up. The answer rarely comes from what was sitting in context when the question arrived. The agent greps a repository. It opens a file it has never seen. It calls a tool that queries a database. The knowledge that mattered was not in the window. It was reachable from the window. That distinction is the whole subject.

A new preprint, Agent Memory Allocation, is built on exactly that distinction. This post is the accessible version of the argument, plus the two results that stand out.

Memory is everything the agent can reach

Here is the reframe the paper makes. An agent's effective memory is not its context window. It is a stack of tiers:

  1. Boot-resident memory. What loads into context at startup: instruction files, tool catalogs, memory indexes. Expensive real estate, always visible, always paid for.
  2. Searchable files. Everything on the filesystem the agent can find with search and open on demand. Huge, cheap, and invisible until a query touches it.
  3. Tool-gated stores. Databases, APIs, anything behind a tool call. Unlimited capacity, but the agent has to know to ask.
  4. The world. Live sources that no store can cache faithfully.

If this sounds like an operating system's memory hierarchy, that is deliberate. RAM, disk, network. The classic vocabulary maps surprisingly well: what stays resident, what gets paged in, what gets promoted to a faster tier, what gets evicted. The paper borrows those policy names on purpose, because forty years of systems research already worked out how to think about hierarchies like this.

But the mapping breaks in one important place, and the break is the interesting part. When a CPU pages memory in from disk, the copy is faithful. When an agent reads a one-line summary of a document instead of the document, the copy is lossy. An index entry that says what a file contains can be wrong, and it gets more wrong as the file evolves. Agent memory has a property that hardware memory does not: it goes stale. Any honest theory of agent memory has to price that in.

The framework was tested the uncomfortable way

Frameworks are cheap. The paper exists because the framework made predictions, and the predictions were frozen before any data was examined. Analyzers were committed before the experiments ran, and the verdicts were produced mechanically against criteria fixed in advance. A prediction that failed, failed on the record. Two results matter most.

Saved memories almost never get read again. The agent system under study has a durable memory directory, the kind of place where an agent writes down facts so future sessions can use them. Standard practice, and it feels obviously useful. Measured over the system's real history: of 157 files promoted into durable memory, 2 were ever read again. The prediction that promotion produces returns was refuted. Writing things down is not the same as remembering them, because remembering requires a future retrieval that actually happens.

Plain search beat the curated index. This one stings, because the curated setup is the one that feels professional. Two retrieval policies ran on the same corpus with the same questions. Policy one: the agent consults a hand-authored index that summarizes every file, then opens what the index recommends. Policy two: the agent just searches, greps the corpus, and reads what it finds. Search won on accuracy, 72.5 percent against 47.1 percent. The mechanism is routing: the index sent the agent to the correct file about half the time, while search found it four times out of five. The summaries were not wrong, exactly. They were lossy, and the loss landed precisely where the answers lived.

A result from one private system is an anecdote, so the finding was replicated in public at scale: 141 releasable documents, 120 questions frozen in advance, symmetric rules that gave both policies the same stopping conditions. Search won again, by 12.5 points on accuracy, and it stopped on a wrong answer about half as often. The corpus, the questions, the gold answers, the harness, and the adjudicator all ship with the paper. Anyone who doubts the result can re-run it. That is the point of shipping it.

What this changes in practice

The practical reading is not "never curate" or "delete your memory directory." It is narrower and more useful:

  • Default to findable, not summarized. Before writing an index that describes your files for the agent, check whether the agent with a search tool already beats the index you were about to write. In these measurements, it did.
  • Treat saved memories as a claim, not a feature. If your agent saves facts for later, measure whether later ever arrives. Count reads, not writes. Here the read count was 2 out of 157.
  • Price staleness. Every summary, digest, and index entry is a cached copy that drifts from its source. If nothing validates it, it decays silently, and the agent trusts it anyway.
  • Freeze predictions before measuring. The only reason these results are believable is that the criteria were fixed before the data existed. This costs little and changes everything about what a measurement is allowed to claim.

One honesty note. Not every prediction survived: the replication's token-headroom prediction failed on the harder of its two measures, and the paper says so at the same prominence as the wins. Pre-registration means the misses are part of the record. That is what separates a measurement from a marketing claim.

Read the paper

The full paper, with the formal framework, the four-system analysis covering MemGPT and the Claude Code harness, and every experiment with its verdict, is free to read:

Re-run the replication. A confirming answer strengthens the record, and a different answer matters even more. That is what the harness is for.

More from the blog