Artificial intelligence researchers have introduced a new inference-time framework called SELFCOMPACT, designed to solve a persistent bottleneck in long-horizon AI agent tasks: the accumulation of stale, context-clogging data known as "context rot." Developed by a team of authors including Tianjian Li, Jingyu Zhang, William Jurayj, Xi Wang, Chuanyang Jin, Mehrdad Farajtabar, Eric Nalisnick, and Daniel Khashabi, the method allows language models to dynamically decide when and how to compress their own accumulated operational histories.

As AI agents tackle increasingly complex, multi-step workflows involving intricate chains of thought and iterative tool calls, they quickly generate massive traces of data. These long agent trajectories inevitably accumulate stale content that anchors subsequent generations, eventually stretching beyond the limits of the model’s context window. Until now, existing scaffolds have attempted to mitigate this issue through fixed-interval compaction routines triggered purely by arbitrary token thresholds. However, researchers point out that such rigid triggers pay no heed to the actual underlying structure of a trajectory, risking the catastrophic discard of vital partial results right in the middle of a complex derivation or an active search phase.

To address this structural shortcoming, SELFCOMPACT introduces a dynamic approach that pairs two core inference-time elements. The first is a specialized compaction tool that the language model can actively invoke to summarize its accumulated context. The second is a lightweight, structured rubric that explicitly specifies when the model should fire the tool—such as when a sub-task has successfully resolved or when a trajectory is clearly converging—and crucially, when it should suppress it, such as during an active derivation or when the agent is stuck.

According to the research team, both components are strictly necessary for the system to function effectively on its own. Left to their own devices, open-weight models utilize a standalone compaction tool unevenly, often invoking it at unhelpful moments or failing to use it altogether. Conversely, a rubric alone lacks the autonomous execution capability to act. By combining the two, the framework elicits effective, adaptive compaction without requiring any expensive fine-tuning or external supervision.

Extensive empirical evaluations conducted across six distinct benchmarks—encompassing competitive mathematics and complex agentic search tasks—and tested across seven different models revealed substantial performance and efficiency gains. The results demonstrate that SELFCOMPACT consistently matches or exceeds traditional fixed-interval summarization methods while operating at a fraction of the token cost. Compared against a standard baseline with no summarization mechanisms, the new scaffold improved performance by up to 18.1 points on math benchmarks and between 5 and 9 points on agentic search tasks, all while achieving a 30 to 70 percent reduction in per-question operational costs.

The findings also shed light on a deeper cognitive limitation in current large language models, which the researchers describe as a meta-cognitive gap. Although unprompted models cannot reliably discern when their own working context is degrading or becoming obsolete, a lightweight rubric successfully bridges this gap. This realization reframes the timing of context compaction not as an intrinsic limitation of the model that requires extensive retraining, but rather as an adaptive capability that external scaffolds can supply dynamically at inference time.

The release of SELFCOMPACT arrives alongside ongoing academic exploration into multi-environment agent coordination and rubric-based alignment frameworks. As the industry continues to push toward more autonomous, generalist AI agents capable of sustained interaction across diverse digital environments, managing long-form memory and computational overhead remains a central frontier. By enabling models to intelligently prune and summarize their own operational trails without external intervention, frameworks like SELFCOMPACT offer a scalable pathway toward more efficient and capable autonomous systems.