AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents
Summary
Trains long-horizon coding agents to proactively decide when to compact their own context — a form of model-harness co-design: the harness provides the compaction mechanism, the model learns when to invoke it, what working state to preserve, and how to continue afterward. Data collection: run the base agent on coding tasks, use a judge to review its compaction decisions, summaries, and post-compaction actions; flawed outputs are replaced with corrected ones before environment execution so trajectories continue from corrected decisions. These trajectories feed supervised fine-tuning, then joint RL optimizes coding and compaction with task-success rewards. Absolute gains: +9.2 points on SWE-bench Verified, +5.0 on SWE-PolyBench Verified. Improvements hold across all inference budgets — including with a 256K context window that never overflows (so learned compaction helps even when context space isn't the limit) and with a 16K window whose overflow triggers fallback compaction. Latest in the AutoHarness → AutoContext → AutoCompact trend of moving harness responsibilities into the model itself; related to Meta's Context Language Models paper. Open questions: scaling, robustness across harnesses, combining rule-based compaction packaged in harnesses with model-invoked proactive compaction.
- Venue
- arXiv:2610.02163 (cs.CL), submitted 1 Oct 2026
- Source
- arxiv
- Access
- free
- Language
- en
- Added
- Oct 3, 2026
- Verified
- Oct 3, 2026
- Found via
- #random-papers
Tags
Topics
coding agents, context management, compaction, RL, SWE-bench, harness co-design, long-horizon tasks
Research notes
- Discovery: @omarsar0 (elvis, building @dair_ai) X post 2026-10-03 12:11 PM ET (https://x.com/omarsar0/status/2106416745686995025), ~5.9K views
- DAIR.AI 'Chat with Paper' page: https://academy.dair.ai/papers/autocompact-learning-when-to-compact-context-in-long-horizon-coding-agents-2610.02163
- Self-thread reply links: Context Language Models (https://academy.dair.ai/papers/context-language-models-2609.37725), AutoHarness (https://academy.dair.ai/papers/autoharness)
- License: CC BY 4.0
Similar entries
- Paper An Empirical Study of Harness Design for Coding Agents
- Paper GLM-5: from Vibe Coding to Agentic Engineering
- Paper Huxley-Gödel Machine: Human-Level Coding Agent Development by an Approximation of the Optimal Self-Improving Machine
- Paper Marathoner: Ultra-Long-Horizon Autonomous Intelligence
- Paper Context Language Models
- Paper AREX-2: Advancing Self-Improving Agents through Long-Horizon Reflective Tasks