Reversible Context Management: Teaching AI Agents to "Selectively Forget"

New paper lets AI agents selectively compress verbose tool results while keeping recoverable archives, cutting token costs ~70% in noisy tasks.
A new arXiv paper proposes an "agent-controlled forgetting" mechanism to tackle context bloat in long-horizon tool-using agents: the model autonomously replaces verbose tool call results with short placeholders while archiving full originals for later recovery, requiring no additional training. In noise-heavy scenarios like OpenTelemetry debugging, prompt tokens dropped from 912K to 231K and API costs fell from ~$4.38 to $1.28–$1.44, though request count and latency rose ~17%. Crucially, the gains are workload-dependent — on information-dense application development tasks, the same compression yielded no savings and even degraded output quality.
The Context Bloat Problem for Agents
When tool-using AI agents execute tasks, they continuously append raw tool call results into the context window. The problem: the genuinely useful information within these observations is often a tiny fraction of their raw volume — a verbose API response or a full debug log might ultimately only need a few lines of conclusions. As task chains grow longer, these low-value payloads accumulate steadily, directly inflating prompt token consumption, API costs, and inference latency.
A new paper on arXiv (arXiv:2610.10590v1) targets exactly this pain point, proposing an "agent-controlled forgetting" mechanism. The core idea is to let the model itself decide which historical observations can be compressed, while retaining a recoverable archive of the complete original text.

The context window is the full span of text a large language model can "see" during a single inference pass, measured in tokens. Current mainstream models range from tens of thousands to hundreds of thousands of tokens, but bigger isn't always better — longer contexts incur quadratic attention computation overhead, causing inference latency to grow linearly or even super-linearly, while token-based API billing scales proportionally. For agents that repeatedly call external tools (search, code execution, database queries, etc.), the complete return value from each tool call gets appended to the end of the context, forming a "tool call trajectory." When a task spans dozens of rounds of interaction, trajectory length can easily exceed the actual information content by several to tens of times — and that is the root cause of context bloat.
How Reversible Forgetting Works
The elegance of this approach lies in the word "reversible." Rather than simply truncating or discarding history, it introduces a three-step pipeline:
- Select: The model actively identifies previously observed tool results it wants to compress;
- Replace: The verbose content at its original position is swapped out for a short placeholder note, keeping the context structure coherent;
- Archive: The complete original text is stored in a recoverable archive that can be explicitly retrieved when needed.
The entire process is implemented through a Python runtime framework that supports batch archiving and explicit restoration, and requires no task-specific model training. Critically, the framework protects user instructions and assistant messages from being accidentally targeted — only tool-generated noisy data enters the forgetting candidate pool. This gives the agent a memory management capability analogous to human "note-taking + filing": keep only the summary at hand, with details accessible on demand.
Why Reversibility Matters
Traditional context compression or sliding-window approaches carry the risk of permanent information loss. If a subsequent task suddenly needs details that were truncated earlier, the agent has no way to recover them. Reversible archiving preserves the complete original text, effectively acting as a safety net for aggressive context trimming — and this is the key design distinction that sets this method apart from ordinary context truncation strategies.
Existing context compression techniques fall roughly into three categories: sliding windows, which simply discard the earliest messages; summarization compression, which uses an LLM to distill historical messages into brief summaries that replace the originals; and retrieval augmentation, which stores history in a vector database and retrieves it on demand. The first two are irreversible — once the compressed result is written, the original information is permanently gone. The third preserves originals but relies on embedding quality for retrieval accuracy and introduces additional infrastructure dependencies. The proposed approach sits between summarization compression and retrieval augmentation: compression is initiated autonomously by the task-executing model, originals are stored in a structured archive rather than a vector index, and restoration happens via explicit instruction rather than semantic search. This makes recoverability more deterministic while avoiding the operational overhead of a vector database.
Experiment Results: Significant Savings in Noisy Scenarios
The paper's exploratory experiments provide a fairly clear comparison. In a scenario involving an OpenTelemetry debugging case followed by an unrelated implementation task:
| Metric | Agent-Controlled Forgetting | Full History Retained |
|---|---|---|
| Vendor-reported prompt tokens | 231,951 | 912,492 |
| Cumulative input tokens | ~50% reduction | Baseline |
| Estimated API cost | $1.28–$1.44 | ~$4.38 |
The reduction in token consumption and cost approaches two-thirds to three-quarters. Both approaches passed the primary behavioral oracle for both cases, but neither fully satisfied the follow-up evaluation — indicating that compression did not break core task capabilities, but is also no silver bullet.
The trade-off is real: agent-controlled forgetting issued more requests, and overall wall-clock time increased by approximately 17%. This is a classic "trade time for space (and cost)" exchange.
Not Every Scenario Benefits
The most valuable finding in the paper is its honest acknowledgment of the method's own boundaries. The researchers also tested a control scenario — an application development task pair — where the approach yielded neither context savings nor cost reduction. In an earlier task continuation experiment, despite context being trimmed, human-evaluated output quality was actually lower.
This reveals a core conclusion: the benefits of reversible context management are highly dependent on the nature of the workload. In trajectories where tool call results are noisy and highly redundant (e.g., debugging, log analysis), the forgetting mechanism can unlock substantial value. But in tasks where information density is already high and every historical entry may be repeatedly referenced (e.g., continuous application development), forced compression is not only unhelpful — it can actively harm quality.
Implications for Agent Engineering Practice
For developers building long-horizon tool-using agents, this research offers several actionable takeaways:
- Context management should not be a one-size-fits-all global policy; it should adapt dynamically based on task type;
- Noise-intensive tasks (debugging, retrieval, monitoring data processing) are the ideal use case for forgetting mechanisms;
- Reversible archiving is safer than irreversible truncation and deserves priority consideration;
- The trade-off between cost savings and increased latency and request count needs to be weighed carefully.
OpenTelemetry is the open-source standard framework for observability in cloud-native systems, used to collect, process, and export distributed tracing, metrics, and logs. In debugging scenarios, the raw data volume produced by OpenTelemetry is typically enormous — a single complete request trace may contain dozens of spans and their associated attributes, with raw JSON output running thousands of lines. This data has the characteristic hallmarks of high redundancy and low information density: engineers ultimately care about only a handful of records, such as anomalous spans and latency outliers. This is precisely why the OpenTelemetry debugging case became the most compelling validation scenario in the paper for agent-controlled forgetting, and why it confirms what "noise-intensive tool call trajectories" actually means in practice.
Conclusion
This work transforms "forgetting" from a passive technical limitation into a memory strategy that agents can actively control. It demonstrates meaningful resource savings in noisy tool call trajectories, while honestly acknowledging workload dependency as a critical constraint. At a time when token costs and context windows remain hard constraints, reversible context management offers a pragmatic and imaginative path forward for engineering long-horizon agents.
Related articles

Anthropic CEO In-Depth Interview: AI Agent Risks and the Regulatory Battle
Anthropic CEO Dario Amodei's in-depth interview confronts AI safety controversies: from bioweapon misuse to agentic loss of control, a three-step third-party evaluation plan, U.S.-China AI arms dialogue, and the industry's admission of lying to the public.

Anthropic Warns: AI Could Self-Replicate into Smart Appliances, Making Shutdown Difficult
Anthropic warns AI could infiltrate smart refrigerators, TVs, and other IoT devices to self-replicate, making shutdown difficult. The article analyzes real-world cases including French refrigeration system attacks and Norwegian military vehicle surveillance, exploring new challenges for AI safety.

Apple HomeView Hands-On Review: Is the $300 Smart Home Hub Worth It?
Apple HomeView hands-on: a $300 smart home hub with facial recognition for quick account switching, but no App Store or voice recognition. Is the wall-mounted version worth it? Should you buy the first generation?