AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents
On the map: LLM agents and tool use → Software engineering coding agents
Abstract (arXiv)
Coding agents solve repository-level software engineering tasks through long trajectories of code inspection, search, editing, and testing. As a task progresses, earlier exploration becomes stale, so managing context is more than avoiding overflow: an agent must decide when to compact, what working state to preserve, and how to continue from it. We introduce AutoCompact, which trains a coding agent to make these decisions as part of its policy. To collect training data, we run the base agent on coding tasks and use a judge to review its compaction decisions, summaries, and actions after compaction. Flawed outputs are replaced with corrected ones before being executed in the environment, so each trajectory continues from the corrected decisions. We use these trajectories for supervised fine-tuning, then jointly optimize coding and compaction through reinforcement learning with task-success rewards. Experiments on SWE-bench Verified and SWE-PolyBench Verified show that AutoCompact improves pass rates over the base model by an absolute 9.2% and 5.0%, respectively. The improvements hold across all evaluated inference budgets, with a 256K context window that never overflows and with a 16K window whose overflow triggers fallback compaction.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 21 of its 25 references that are in the map. First posted on arXiv 1 Oct 2026.
Builds on
21 of 25 references.
Closest ancestors · 8
Same direction, newest first
- 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agents26 Jun
- 2025Context as a Tool: Context Management for Long-Horizon SWE-Agents26 Dec
- 2025SWE-rebench: An Automated Pipeline for Task Collection and Decontaminated Evaluation of Software Engineering Agents26 May
- 2025SWE-smith: Scaling Data for Software Engineering Agents30 Apr
- 2025SWE-PolyBench: A multi-language benchmark for repository level evaluation of coding agents11 Apr
- 2024Training Software Engineering Agents and Verifiers with SWE-Gym30 Dec
- 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agents23 Jul
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering6 May
Other references · 13
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
- 2025Qwen3 Technical Reportcited by 8,195
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,295
- 2025SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolutioncited by 246
- 2023Synapse: Trajectory-as-Exemplar Prompting with Memory for Computer Controlcited by 180
- 2025SimpleTIR: End-to-End Reinforcement Learning for Multi-Turn Tool-Integrated Reasoningcited by 145
- 2025Scaling Long-Horizon LLM Agent via Context-Foldingcited by 136
- 2025ReSum: Unlocking Long-Horizon Search Intelligence via Context Summarizationcited by 132
- 2025ACON: Optimizing Context Compression for Long-horizon LLM Agentscited by 126
- 2025AgentFold: Long-Horizon Web Agents with Proactive Context Managementcited by 95
- 2026Self-Compacting Language Model Agentscited by 11
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026CodeScout: An Effective Recipe for Reinforcement Learning of Code Search Agents
- 2026CliffCompaction: Cost-Efficient Compaction for Long-Horizon Coding Agents
- 2026Teaching Agents to Code Reliably
- 2026Latent Programming Horizons in Coding Agents
- 2026TRIM: Reducing AI-Generated CodeSlop via Agent Trajectory Minimization
- 2026FastContext: Training Efficient Repository Explorer for Coding Agents
- 2026SlopCodeBench: Benchmarking How Coding Agents Degrade Over Long-Horizon Iterative Tasks
- 2025Prometheus: Towards Long-Horizon Codebase Navigation for Repository-Level Problem Solving