Every long-running agent harness eventually has to throw away part of its own history. The conventional answer is a threshold: when the context window is 80% full, summarize the older events and keep the last few turns verbatim. A recent study (arXiv:2611.34147, submitted 25 November 2026) asks what happens if the model makes that decision instead, through an API it can call whenever it likes, and measures the result across four frontier models and two task families. The short version: the mechanism works, the benefit is a property of the model rather than of the design, and the cheapest part of the whole paper is a serving-layer trick nobody was looking for.
Architecture: two places the compaction decision can live
Harness-driven (the baseline). At 80% of the context budget, the harness summarizes the earlier history, preserving the initial instructions and the 10 most recent events. The model has no say and no visibility.
Model-driven (the thing under test). The model is given four things: a context API that lets it choose which events to replace with a summary, a live context-usage indicator, an instruction to consider compacting only once usage passes 85%, and a context-pressure warning appended to the request as the window fills. Compacted events are archived under a tag, and the model can go back and retrieve them later.
The distinction that matters for anyone building a harness is not "summarize vs. don't" — both arms summarize. It is who holds the trigger, and at what granularity. The harness compacts a prefix on a timer; the model compacts a selected set of events whenever it judges them spent. The archive-and-retrieve path is what makes the second one safe enough to try: a wrong compaction is recoverable at the cost of a retrieval.
What the measurements show
Two benchmarks: a document-research task (90 questions over a large pre-parsed corpus of U.S. federal receipts and expenditures, where reading documents fills the window fast) and an ML-engineering task (22 Kaggle competitions, where the agent must track experiments, implementation choices and execution feedback). Context budgets were swept from 8K to 512K tokens, each a hard limit on request size; on overflow a fallback drops the oldest events and retries, and three failures score the run wrong.
The headline is real and large: the strongest model nearly tripled its score at a 32K budget on the document task, 21% to 56%, with no extra training. That is the number worth knowing, and it is also the number most likely to be quoted without what follows.
The benefit does not generalise across models. All four received the same API and the same instructions. Three called it in 42-53% of tasks; the fourth called it in 4% of tasks — it simply declined to use the affordance. One of the three showed markedly less improvement than the leader. A harness feature whose value ranges from "nearly 3x" to "never invoked" is not a feature with a single expected value.
Compacting harder costs retrievals. When the leading model compacts, the request shrinks by a median factor of 3.7; the others manage 2.1, 1.8 and 1.5. But it goes back for archived content after 19% of its compaction calls, against 7% and 3% for two of the others. Aggressive compaction buys window space and sells it back in retrieval turns.
Timing is prompt-sensitive to an uncomfortable degree. With the 85% instruction, most models wait near that line. Remove the instruction and one model's median first compaction drops from about 84% of the budget to 29%; another from 83% to 40%; the model that almost never compacted starts compacting at a median of 16%. The paper calls this context anxiety, after prior work on models misjudging their remaining budget. A single sentence of prompt is the difference between a model that compacts at four-fifths full and one that compacts at a sixth full.
Token savings are smaller and patchier than the accuracy headline. At a 32K budget one model processed 41% fewer cumulative input tokens (36M against 62M) while scoring slightly higher, 43% against 41%. At 64K the same model saved about 11% while scoring 57% against 52%. The leading model on accuracy showed no comparable token saving at all.
The serving-layer finding, which is the most portable result
Editing a context breaks prefix caching in a specific and avoidable way. A KV cache stays valid up to the point of an edit and is invalidated for everything after it — including text that did not change. So replacing a middle slice of history with a summary forces the engine to recompute the whole surviving suffix, and a shorter context is not automatically a cheaper one.
Reusing the KV cache of that unchanged suffix cut prefilled input tokens per request by up to 15%, with no measurable impact on task reward. The saving is largest on the document task precisely because the suffix is big there: roughly 10K tokens, about 60% of the prompt on average, is retrieved document text that survives an edit.
This is the part to take seriously even if model-managed context is not on your roadmap, because it applies to any harness that edits history, including the 80%-threshold baseline. Caveat the authors state plainly: the prototype was one open 27B model in one serving engine, it approximates full recomputation, and it measures prefill compute, not end-to-end latency or cost.
Tradeoffs
Autonomy versus predictability. A harness threshold is boring and reproducible: you know when compaction happens and can reason about it in a postmortem. Model-driven compaction is an extra non-determinism in the state of the context, and the state of the context determines everything else.
No training required, which cuts both ways. The gains arrive from prompting alone, so the mechanism is cheap to try. It also means the behaviour rests on whatever context discipline the model happened to acquire in training, which is exactly the thing an integrator cannot control or inspect.
The instruction is load-bearing. Given that one sentence shifts first-compaction timing by fifty points of budget, the prompt is part of the system's configuration surface, not its documentation.
Archive-and-retrieve makes errors recoverable but not free. Every unnecessary compaction becomes a later retrieval turn, and retrieval turns are both latency and tokens.
Failure modes to design against
A model that ignores the API. Ship the affordance and get zero behaviour change, while paying for the tool definitions in every request. Check invocation rate per model before assuming a benefit.
Premature compaction (context anxiety). The model compacts at a sixth of its budget, discards evidence it will need, and either retrieves it back or answers worse. Watch first-compaction timing as a metric in its own right.
Compacting the wrong events. Nothing in the design makes the model's selection correct. The archive bounds the damage; it does not prevent it.
Cache invalidation turning a token win into a compute loss. Without suffix reuse, an edit that shortens the prompt can increase prefill work on the next turn. Measure prefill tokens, not just context length.
Overflow masking. When a request exceeds the hard budget, dropping the oldest events and retrying changes the comparison between strategies. Any evaluation needs to report how often the fallback fired.
Benchmark size. 90 questions and 22 competitions are small enough that model-to-model differences on the order of a few points should not be read as rankings.
Review checklist
For a team considering giving an agent control of its own context:
What fraction of tasks does each model you ship actually call the context API in?
What is the median context usage at first compaction, with and without your timing instruction?
What fraction of compactions are followed by a retrieval of the archived content?
Does compaction change cumulative input tokens, or only maximum context size? Report both; they diverge.
Does your serving engine reuse the KV cache of the unchanged suffix after a context edit? If not, is your shorter prompt actually cheaper?
How often does the hard-limit fallback fire, and are those runs scored as failures?
Is the compaction decision recoverable — is there an archive, and can the model find it by tag?
Can you reproduce an incident given that the context state is now partly model-determined?
What the study does not establish
The paper's own limitations are unusually direct. Both benchmarks are small. Context pressure is simulated by shrinking the budget rather than by genuinely long-horizon work, and the overflow fallback can itself move scores. Four models were tested and their training is unknown, so the explanation offered for the leader's stronger results is labelled a conjecture rather than a finding. The KV-reuse result rests on a single open model in a single engine. Note also that co-designing trained context management with the serving stack is the discussion's proposal, not a demonstrated method: everything measured here comes from prompting models that were not trained for the task.
Related
R284 — ablating a research harness: folded history beats rolling summaries, and pruning unused lessons beats hoarding them.
R059 — when agent memory loses to searching the raw history.
R300 — how the memory cost of a million-token context collapsed.
R184 — agents with memory stop re-checking tools that changed under them.
R339 — measuring whether an agent's output was necessary, rather than whether it passed.