Compact-Bench: Measuring What Context Compaction Costs Long-Horizon Coding Agents

Ruopei Sun, Jianfeng Cai, Kangwen Zhao, Wengang Zhou, Houqiang Li
10/22/2026
cs.SEcs.AI
benchmark-dataset

Official code: cai-jianfeng/compact-bench (1 star, Python, Apache-2.0, last commit 2026-10-20).

Abstract

Context compaction lets long-horizon coding agents continue beyond their context windows, but can erase the state needed to finish a task. Prior evaluations measure efficiency, retained information, or end-to-end success, leaving the effect of a specific history replacement difficult to isolate.

Show full abstract

Compact-Bench pairs full-history and summary-only continuations from a shared repository state, and evaluates recurring details and successive production compactions. It covers 35 SWE-bench repairs, 146 agentic sessions, and 106 production chains. Across 14 summarizer backbones, stable damage ranges from 5-64% of 22 full-history successes: Claude Opus 4.8 preserves the most repairs, while DeepSeek-Flash damages the most. With Kimi-K3 as summarizer, the Kimi Code prompt preserves the most task continuations (19/22), whereas Claude Code retains the most recurring details (15.0%). LLM summaries retain at most 16.0% of recurring details, compared with 79.1% for mechanical extraction; production summaries retain 15.7% at the first boundary. Failures recur across methods: one repair is damaged by 13/14 backbones, and another by all 5 prompts. These results show that reliable compaction requires preserving the progress needed to complete a task, and that retaining relevant information alone does not ensure successful continuation. Code is available at https://github.com/cai-jianfeng/compact-bench and data is available at https://huggingface.co/datasets/caijanfeng/compact-bench.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
10Python, ShellOct 20, 20261 months agoApache-2.0

Similar Papers

Cite this paper

@article{sun2026compactbench,
  title  = {Compact-Bench: Measuring What Context Compaction Costs Long-Horizon Coding Agents},
  author = {Ruopei Sun and Jianfeng Cai and Kangwen Zhao and Wengang Zhou and Houqiang Li},
  year   = {2026},
  eprint = {2610.31710},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2610.31710v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2610.31710.svg)](https://codeofpaper.com/paper/2610.31710)

Discussion