AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents
arXiv cs.CL · 2 Oct 2026, 03:54 AEST
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.
Key facts
- 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.
Read aloud
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. 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.
Sources in this cluster
- AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents
arXiv cs.CL · 2 Oct 2026, 03:54 AEST