Agentic Context Management: Five Primitives for Agent Memory and Cost
An arXiv paper names a problem every team running agents in production encounters daily: context management. An agent’s context, made up of conversation history, tool definitions, and tool outputs, accumulates turn after turn. Token cost grows quadratically with session length, and the agent loses information exactly when it’s needed most.
Gaurav Dadhich calls this discipline Agentic Context Management (ACM) and breaks it into five primitives: architecture, ingestion, scoping, anticipation, and compaction. The core claim is that context should be treated as a lifecycle. You decide what to remember, structure it, choose the right store for each data type, consolidate and forget while preserving provenance, anticipate what the next turn will need, and compact within a budget without losing what matters.
Why it matters to you. If you’ve watched an agent degrade after twenty turns or paid a disproportionate API bill for a session that could have closed in five steps, the paper offers a framework to understand where things break. It’s the same pattern Anthropic publishes among its internal recipes for production agents and what the playbook From Long Chat to Fresh Session lets you apply today, even without dedicated infrastructure.
In Detail
What came before.
The dominant approach to agent memory is RAG: save data in a vector database and retrieve it with similarity search when needed. It works for static documents, but breaks when the “document” is the conversation itself, growing and changing every turn. The paper starts here: treating memory as search and retrieval is too narrow.
The proposed framework.
ACM treats context as a lifecycle with five phases:
- Architecture: decide memory structure before you start. Which data types go where (short history in context, consolidated facts in a structured store, raw outputs in a separate archive).
- Ingestion: extract and structure what’s worth remembering, instead of saving everything.
- Scoping: filter by relevance and organizational scope. A production agent serves a hierarchy of scopes (personal, team, organization), because context relevant to one user can be useless or harmful to another.
- Anticipation: predict what the next turn will need and prepare its retrieval, rather than waiting for an explicit request.
- Compaction: reduce context to a fixed budget without losing what counts. This is the trickiest phase, where you balance cost against accuracy.
The economics.
The paper’s most useful argument is the math of cost. If you accumulate context without managing it, token cost grows quadratically: every turn re-reads the entire history. If you summarize blindly at turn’s end, cost becomes linear but accuracy crashes beyond a certain point (what the paper calls the accuracy cliff). Validated compaction instead keeps cost linear while preserving fidelity, because it chooses what to compress based on what actually matters.
For those not building infrastructure, the practical lesson is simple: periodically compact an agent’s context, but deliberately. A blind summary cuts everything the same way and loses the details that count.
The numbers.
The reference implementation, Maximem Synap, scores 92% on LongMemEval and 93.2% on LoCoMo (as claimed in the paper, section 6, July 2026). These are long-context memory benchmarks that test whether an agent remembers information across extended conversations. The numbers are the author’s, on specific configurations. Code and evaluation data are linked in the paper, but independent replication isn’t yet available.
Limitations.
The paper is a framework proposal, backed by a reference implementation. Benchmarks measure recall accuracy, but the paper itself flags what current benchmarks don’t capture: latency, token efficiency, and resilience as context degrades over time. The gap between a reference implementation and a multi-tenant production system is large, and the paper acknowledges it. For readers, the main value lies in vocabulary and framing: naming the five phases helps you reason about where your own agent breaks, even without deploying Maximem Synap.