Agentic Context Management: Solving Agent Memory and Cost by Treating Them as Lifecycle and Architecture Problems
Gaurav Dadhich
cs.AI, cs.IR
2026-07-24
Reframes production agent memory as a five-primitive lifecycle; naive context accumulation costs O(n^2) tokens while validated compaction reaches O(n) without an accuracy cliff.
Production agents slowly lose their grip: they forget across sessions, contradict themselves at handoff, hallucinate once the context fills up, and pay a bigger token bill with every turn. The authors' central claim is that these failures rarely come from weak reasoning; they come from an agent that cannot manage what sits in its own context window. The usual fix treats memory as a storage-and-retrieval problem. The authors say that frame is too narrow. Deciding what to remember, structuring it, picking a store per data type, consolidating and forgetting while keeping provenance, judging what is relevant now, anticipating what comes next, and compacting to a budget without loss together form a full lifecycle, of which storage is only two moments.
The authors name this discipline Agentic Context Management (ACM) and split it into five primitives:
The reference implementation, Maximem Synap, has a few choices worth noting: ingestion is asynchronous (returns an ID, processes in the background), compaction returns an explicit validation score and auto-retries on failure, identity is derived from credentials rather than asserted by the client, and retrieval is a hybrid of vector similarity and graph traversal.
The cost argument is the hardest part of the paper. Naively appending every turn into context gives cumulative token cost C = tn(n+1)/2, that is O(n^2). Capping each turn at a budget W gives nW, that is O(n). With 500 tokens per turn and a 4000-token budget, the naive approach costs 3.2x the bounded one at 50 turns and 31.3x at 500 turns.
Three routes compared:
| Route | Cost | Fidelity | Failure mode |
| Full append | O(n^2) | Full, until context rot | Cost explosion |
| Crude summary | O(n) | Lossy, unchecked | Accuracy cliff |
| Validated compaction | O(n) | Preserved, checked | Target: none |
The authors cite a case where compressing 18,282 tokens to 122 dropped accuracy from 66.7% to 57.1%, worse than having no context at all. On benchmarks, LongMemEval (all 500 questions, gpt-5-mini as answer model and judge) scores 92.0% overall, and LoCoMo categories 1-4 score 93.2%. The comparison numbers, SuperMemory around 85% and Zep at 71.2%, are explicitly flagged as each vendor's self-reported result under its own methodology, not a controlled comparison.
For people building agents, the paper pays off in two ways. First, it promotes "context going off the rails" from a plumbing annoyance into a structured discipline, and the five primitives double as a self-audit checklist: does your system do entity resolution? cross-user isolation? validated compaction? Second, the O(n^2) accounting is crisp. Long-conversation token cost is not linear but quadratic, which is a real problem for cost-sensitive production. The validated-compaction route is more trustworthy than blind summarization.
The weaknesses should be stated plainly. The benchmarks measure recall (accuracy) only, not latency, token efficiency, or resistance to context rot under load, which are exactly the production properties the paper claims to address. A 92.0% LongMemEval score is largely a function of gpt-5-mini plus this configuration, not an abstract property of the system. The comparison table is self-reported and uncontrolled; SuperMemory uses different models and judges, so it is not strictly comparable. The hardest category, multi-session reasoning, sits at 75.2%, which means memory does not close the reasoning gap. Finally, this is an architecture write-up for the Maximem product itself, with motivation and implementation both orbiting Maximem Synap; readers should separate the methodological takeaway from the product pitch.