A Self-Evolving Framework for Efficient Terminal Agents via Observational Context Compression

Jincheng Ren, Siwei Wu, Yizhi Li, Kang Zhu, Shu Xu, Boyu Feng, Ruibin Yuan, Wei Zhang, Riza Batista-Navarro, Jian Yang, Chenghua Lin

TL;DR

Large language model (LLM) agents operating in terminal environments quickly get bogged down by massive, low-information execution logs, driving up token costs and diluting critical signals. To solve this, the authors introduce TACO, a plug-and-play, training-free framework that autonomously learns, refines, and reuses structured compression rules from agent trajectories. TACO reduces token consumption by up to 27% while consistently maintaining or even improving task success rates across multiple benchmarks.

What Problem Does This Paper Address?

CLI (Command Line Interface) and terminal agents face a unique challenge: terminal outputs have highly uneven information density. They are often filled with massive amounts of redundant noise (such as verbose package installation lines or repetitive build traces), yet they contain sparse, exact strings (like error traces, file paths, or test names) that are absolutely crucial for the agent's next action.

Standard context compression methods fall short here. Generic LLM summarization often blurs, omits, or paraphrases these exact strings, which breaks downstream tool use. On the flip side, static, human-crafted rules are too brittle to scale across different repositories, languages, and task domains. As a result, modern terminal agents typically preserve raw, uncompressed logs, leading to rapid context saturation, high token costs, and degraded reasoning performance.

Figure 1: Effective-text extraction reveals substan- tial removable redundancy in terminal-agent histo- ries on TB 2.0.

Methods

TACO (Terminal Agent Compression framework) reframes observation compression from a one-shot shortening operation into a continual, unsupervised knowledge-acquisition process. It acts as a plug-and-play adapter before observations enter the agent's history, utilizing three core components:

  1. Terminal Observation Compression: Filters non-critical outputs using structured rules (regex patterns for stripping/keeping lines) while leaving explicit error signals completely untouched.
  2. Intra-Task Rule Set Evolution: Dynamically updates rules online based on implicit agent feedback. For instance, if an agent repeats a command or explicitly requests a full output, TACO flags this behavior as an "over-compression complaint," suppresses the faulty rule, and prompts an LLM to generate a more conservative replacement.
  3. Global Rule Pool Evolution: Stores, scores, and ranks successful rules across tasks. This allows compression knowledge gained in one workflow (e.g., collapsing pip install progress bars) to be automatically retrieved and reused in subsequent tasks.

Crucially, TACO operates entirely without external rewards or ground-truth answers. It uses a novel, reward-free metric called Retention—which measures the stability and overlap of the top-ranked rules—to determine when the self-evolution process has successfully converged.

Figure 2: Overview of TACO.

Datasets

The authors evaluated TACO across six diverse, terminal-heavy benchmarks using multiple open- and closed-source backbone models:

  • TerminalBench (TB 1.0 and TB 2.0): Centered on realistic, hard command-line interface tasks.
  • SWE-Bench Lite: Focuses on resolving real-world GitHub software engineering issues.
  • CompileBench: Evaluates compilation and build-centric workflows.
  • DevEval: A repository-level code generation benchmark aligned with real-world codebases.
  • CRUST-Bench: A comprehensive benchmark for C-to-safe-Rust transpilation.

Key Insights and Ideas

  • Preservation Over Shortening: Stronger token reduction does not automatically equal better task performance. While static human rules or raw LLM summarization sometimes remove more tokens than TACO, they yield lower accuracy because they discard task-critical details. Selective, preservation-aware filtering is vital.
  • Behavior as a Supervisor: Agents naturally signal when they have been "blinded" by over-compression through their actions (e.g., re-running a command to recover details). TACO elegantly leverages these implicit behavioral cues to self-correct its rules without needing human labels.
  • Amortized Cold-Start Costs: Although TACO requires multiple iterations to discover and stabilize its rule pool initially, this self-evolution process reliably converges. Once converged, the Global Rule Pool can be frozen and reused instantly, eliminating test-time scaling overhead for future deployments.

Key Results

  • Token Reductions: On downstream benchmarks, TACO consistently cut total end-to-end token consumption by 12% to 27%.
  • Performance Boosts: Instead of degrading capability, removing contextual clutter actually unlocked latent agent performance. TACO yielded a 1% to 4% absolute accuracy gain on TerminalBench under standard evaluations.
  • Fixed-Budget Efficiency: Under identical token budgets, TACO improved agent accuracy by 2% to 3%, demonstrating that it helps models utilize their context windows far more effectively.
Figure 3: Agent Accuracy Under Identical Token Budgets.

Limitations and Future Work

The authors note that TACO operates strictly at the observation-compression layer rather than the model-capability layer. It does not alter the underlying LLM's intrinsic reasoning limits; it simply ensures the agent receives cleaner, less redundant inputs.

Additionally, while highly effective for text-based terminal environments, future work could explore extending this self-evolving, rule-based compression paradigm to other long-horizon agent domains that suffer from verbose environmental noise, such as web navigation logs or multi-modal GUI interaction traces.

Summary updated

BibTeX
@inproceedings{ren2026self,
  author = {Jincheng Ren and Siwei Wu and Yizhi Li and Kang Zhu and Shu Xu and Boyu Feng and Ruibin Yuan and Wei Zhang and Riza Batista-Navarro and Jian Yang and Chenghua Lin},
  title = {{A Self-Evolving Framework for Efficient Terminal Agents via Observational Context Compression}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=MMhankfnpV},
}
Figure