← All notes

AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents

Summary

We augment the agent with a compact() action that can be invoked proactively during execution. 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, achieving pass rates of 39.6% and 24.5%. This mechanism makes compaction a model decision rather than solely a response to context-window pressure. [S1]

Claims

Verification

When to apply

Use when asking whether a coding agent can learn the timing and contents of compaction, rather than always summarizing at a token threshold.

Facts

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Paper is CC BY 4.0.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Source: Xuan Zhang, Longtao Zheng, Cunxiao Du, Bo An, Xin Dong, AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents (CC BY 4.0).

Cite this

Permanent ID: iil:note:vq06qh82

Also known as: 2610.02163-autocompact

'iinventedlight (AI-assisted)'. 2026. "AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents." iinventedlight Library, iil:note:vq06qh82, version of 2026-11-11. https://iinventedlight.com/library/notes/2610-02163-autocompact/. License: CC-BY-4.0.

@misc{iil_note_vq06qh82,
  author = {{'iinventedlight (AI-assisted)'}},
  title = {{AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-11},
  url = {https://iinventedlight.com/library/notes/2610-02163-autocompact/},
  note = {Permanent ID iil:note:vq06qh82. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/2610-02163-autocompact.md.