---
title: "An agent does not pay for memory once. It pays again every turn"
locale: "en"
url: "https://irz.fr/en/articles/agent-context-budget-en"
markdown_url: "https://irz.fr/en/articles/agent-context-budget-en.md"
category: "ai"
tags: ["agents", "context", "memory", "cost", "architecture"]
published_at: "2026-08-26T10:52:00.000Z"
author: "Léa Perrin"
translation: "https://irz.fr/fr/articles/agent-contexte-budget-fr.md"
---

# An agent does not pay for memory once. It pays again every turn

Storing a memory is only half the problem. On every model call, an agent still has to decide what deserves context space, what can be compacted and what should stay outside.

A memory left in a database is cheap. Put it back into a prompt and it joins the old conversation, tool results, instructions and current message on the same **input-token** bill. An agent replaying its whole history never pays once to remember; the same material returns to the invoice every turn.

That is the most useful move in Gaurav Dadhich's *Agentic Context Management* paper.[1](https://arxiv.org/abs/2607.21503) The paper proposes five primitives — architecting, ingesting, scoping, anticipating, and compacting & consolidation — but its stronger distinction is simpler: **memory is what can persist; context is what you choose to pay for on the next call**.

IRZ has already looked at another side of agent memory: durable claims need provenance, staleness and a way to record what replaced them. The question here comes one step later. A memory can be perfectly true and still not deserve space in the next few thousand tokens.

## The bill returns

Suppose every turn adds roughly `t` tokens to an agent's history. The first call sends `t`, the second about `2t`, then `3t`, and so on. After `N` turns, cumulative input resembles:

` t × (1 + 2 + ... + N) `

That sum grows as **O(N²)**.[1](https://arxiv.org/abs/2607.21503), a result that needs no special agent framework: replay a longer history after every turn and the cumulative input follows the same curve.

Dadhich illustrates the accounting with 500 new tokens per turn and a bounded 4,000-token context. In that model, full-history replay uses about six times the cumulative tokens at 100 turns and thirteen times at 200 turns.[1](https://arxiv.org/abs/2607.21503) These are not measured cloud invoices: the example does not capture model-specific prices, generation, tools or the cost of the memory system itself.

It does show why a larger maximum context window is not an economic solution by itself. A two-million-token window can technically accept more history. It does not make sending that history two hundred times free.

> **Memory and its rent**
> IRZ diagram showing persistent memory, a context admission filter and a model call, with cost, relevance and scope checks.
> - MEMORY
> - everything that
can persist
> - ADMISSION
> - useful now?
right scope?
worth the cost?
> - LLM
> - input
tokens
> Data can remain durable without being injected on every turn. The recurring cost appears between storage and active context.

## Three budgets

Instead of adding another grand phrase to AI's already crowded vocabulary, “context management” can be reduced to three fairly ordinary budgets.

The first is a **token budget**: how much history, documentation, tool output and retrieved memory is worth sending now? Dadhich's paper spends much of its economic argument here, using bounded context fed by retrieval and compaction.[1](https://arxiv.org/abs/2607.21503)

The second is an **information budget**. Compaction spends fewer tokens because it removes detail, but a summary cannot always know which detail will matter fifteen turns later. The paper therefore argues for validated compaction rather than blind shortening.[1](https://arxiv.org/abs/2607.21503) Its reference implementation, Synap, is described as emitting a validation score and compression ratio, with retries when validation is low. The internal mechanism is proprietary, so this remains a product description rather than a line-by-line reproducible method.

The third is an **isolation budget**. In an organisation, information may belong to one user, team or customer without becoming global truth. The paper describes a hierarchy of scopes plus a global knowledge layer.[1](https://arxiv.org/abs/2607.21503) That architecture can reduce accidental retrieval at the wrong level, but it is not a security proof on its own. Permissions, storage and access-control implementation still matter.

> Before the next call
> **Three different budgets**
> - What will this context cost if it returns now?: Tokens
> - What might compaction delete when future relevance is still unknown?: Information
> - Does this belong to one user, customer, team or global knowledge?: Scope
> - Persistent information does not need to be present on every turn to remain available.: Time
> IRZ synthesis from the lifecycle proposed in Agentic Context Management.

## Compression deletes

Compaction moves part of the problem out of storage and into judgement, because someone or something has to decide what can disappear now without becoming tomorrow's missing fact.

If 20,000 tokens have to fit into 4,000, something has to go. A system might remove reasoning traces, keep final decisions, convert turns into structured facts or write a narrative summary. Every method contains a theory about what future tasks will need.

Dadhich models periodic compaction inside a bounded window. With window cost `W`, compaction every `p` turns and compaction cost `c × W`, cumulative context cost remains linear in turn count: `N × W × (1 + c/p)`.[1](https://arxiv.org/abs/2607.21503) Under the paper's illustrative parameters, the theoretical saving becomes very large across long conversations.[1](https://arxiv.org/abs/2607.21503)

The risk moves to fidelity. A summary can be excellent for the five questions you expect today and terrible for the sixth question nobody predicted.

A January 2026 paper, *Active Context Compression*, gives the agent itself a tool for deciding when to consolidate knowledge and prune raw history.[4](https://arxiv.org/abs/2601.07190) Across only five SWE-bench Lite tasks, it reduced total tokens by 22.7% while keeping the same result, three successes out of five in both configurations.[4](https://arxiv.org/abs/2601.07190) That makes agent-controlled compression measurable, but five tasks are nowhere near enough to declare the problem solved.

## Measure the trade

MemoryCPT, released in early August, attacks the same problem from another direction. Its pipeline learns to construct and retrieve memory while explicitly putting cost into its objective.[5](https://arxiv.org/abs/2608.04843) The authors introduce **Quality per Cost** rather than reporting answer quality alone.[5](https://arxiv.org/abs/2608.04843)

Two systems can answer equally well while sending very different amounts of context downstream, and an extremely cheap memory system can cut its bill by deleting exactly what made the answer correct. The useful object is therefore a curve across answer quality, context passed to the model, memory-system work and latency rather than a one-column leaderboard.

LongMemEval already showed why memory deserves specific evaluation. Its 500 questions cover extraction, multi-session reasoning, temporal reasoning, knowledge updates and abstention.[3](https://arxiv.org/abs/2410.10813) The benchmark also decomposes long-term memory design into indexing, retrieval and reading choices rather than treating memory as a single block.[3](https://arxiv.org/abs/2410.10813)

## 92%, with notes

The Agentic Context Management paper reports **92.0% on LongMemEval** and **93.2% on LoCoMo** for Synap.[1](https://arxiv.org/abs/2607.21503)[2](https://github.com/maximem-ai/eval_benchmark_runs_output) The public results repository lists 460 correct answers out of 500 on LongMemEval. Multi-session reasoning is the weakest category at 75.2%, while several categories reach 100% under that configuration.[2](https://github.com/maximem-ai/eval_benchmark_runs_output)

Those numbers are useful without forming a universal ranking. The repository itself notes that results change with the answer model, judge, prompts and ingestion granularity.[2](https://github.com/maximem-ai/eval_benchmark_runs_output) In this setup, `gpt-5-mini` handles both answering and judging, while LoCoMo's adversarial category 5 is excluded.[2](https://github.com/maximem-ai/eval_benchmark_runs_output)

There is another limitation. Per-run artifacts — answers, retrieved context and judge verdicts — are described as available on request rather than all committed publicly in the repository.[2](https://github.com/maximem-ai/eval_benchmark_runs_output) The methodology and category totals are inspectable, but this is not the same thing as a complete independent reproduction.

The paper also names three dimensions current benchmarks do not capture well enough: **production latency, token efficiency per task and resistance to context rot**.[1](https://arxiv.org/abs/2607.21503) Those are exactly the measurements required to validate the economic argument outside the algebra.

## Anticipation, closed

The paper's most attractive primitive is also its least open one: anticipation. Instead of waiting for the agent to ask for a memory, the system tries to retrieve likely-needed context beforehand.[1](https://arxiv.org/abs/2607.21503)

Dadhich reports a hit rate above 60% across clients for this anticipatory retrieval.[1](https://arxiv.org/abs/2607.21503) The mechanism is proprietary and the paper describes it as active work. The number should therefore stay at its actual evidence level: **an observation reported by the implementation's author**, not an independently reproduced benchmark.

This distinction is useful across the whole paper. Agent-memory claims come in at least three kinds:

- “this cumulative sum grows quadratically” can be checked on paper;
- “the system scores 460/500 on this benchmark” can be audited against a methodology and artifacts;
- “anticipation works in more than 60% of production cases” depends on a system and data the reader cannot fully inspect.

All three claims may be true while deserving different levels of confidence, especially when a research paper is also describing the author's own product.

## Keep it outside

The practical consequence is almost an empty space: agent memory does not have to place everything back in front of the model. Before injecting an item, the system should be able to explain **why it belongs now**, which scope owns it, what it costs, what form it should take and what happens when the window fills. Well-sourced information can stay durable while spending a hundred turns outside active context.

That is the difference from IRZ's earlier article about memory evidence. A memory can be true but irrelevant now. It can be relevant but needlessly detailed. It can help one team and become dangerously overgeneral when retrieved for another customer.

Good context architecture is therefore not a search for the largest possible prompt; it is a system for granting **temporary admission**. Memory becomes useful precisely when the agent knows a fact exists, knows where to retrieve it, and still decides to leave it alone for now.

## References

1. [Gaurav Dadhich, Agentic Context Management: Solving Agent Memory and Cost by Treating Them as Lifecycle and Architecture Problems, 23 July 2026](https://arxiv.org/abs/2607.21503)
2. [Maximem, Synap Agent Memory Benchmark Results](https://github.com/maximem-ai/eval_benchmark_runs_output)
3. [Di Wu et al., LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memory](https://arxiv.org/abs/2410.10813)
4. [Nikhil Verma, Active Context Compression: Autonomous Memory Management in LLM Agents, January 2026](https://arxiv.org/abs/2601.07190)
5. [Songxin Lei et al., MemoryCPT: An End-to-End Agent Memory Framework for Cost-Performance Trade-off, August 2026](https://arxiv.org/abs/2608.04843)
