arXiv:2610.31710cs.SEOct 2026

Manuscript Offprint

arXiv:2610.31710

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

Ruopei Sun, Jianfeng Cai, Kangwen Zhao, Wengang Zhou, Houqiang Li

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. 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 and data are available online.

1 Introduction

Long-horizon coding agents accumulate instructions, tool observations, test results, and partial decisions. Compaction allows them to work beyond the context window, but the resulting summary must carry enough state to resume unfinished work. Long-context benchmarks test retrieval, reasoning, and generation from extended inputs (Bai et al., 2024; Zhang et al., 2024; Hsieh et al., 2024; Shaham et al., 2023; An et al., 2024; Lee et al., 2025; Bai et al., 2025; Kuratov et al., 2024; Liu et al., 2024b), and information access can depend on input position (Liu et al., 2024a). Agent histories add a further requirement: preserving which actions have been taken, which hypotheses have been rejected, and what remains to be done.

End-to-end benchmarks evaluate repository repair, code generation, and interactive tool use (Jimenez et al., 2024; Yang et al., 2024; Wang et al., 2025; Xia et al., 2025; Jain et al., 2025; Liu et al., 2024c; Yao et al., 2025; Zhou et al., 2024; Xie et al., 2024). A final score, however, does not isolate the effect of replacing a history midway through a task. Recent compaction evaluations examine constraint loss, archived-fact retrieval, future-trajectory support, and execution instability; methods also learn or schedule summarization and remove observations (Wang et al., 2026; Subramani, 2026; Chen et al., 2026; Min et al., 2026; Li et al., 2026a; Wu et al., 2025b; Sun et al., 2026; Li et al., 2026b; Cim et al., 2026; Lindenbauer et al., 2025). Compact-Bench targets the history replacement itself: it compares full-history and summary-only continuation at a shared boundary, then examines detail retention in real agent sessions.

The benchmark asks: For the same task and pre-compaction state, how does continuation change when an agent receives only a summary instead of its full history? Task Preservation compares full-history and summary-only continuations from the same repository snapshot, using the same agent, step budget, and executable tests. Recurring-Detail Retention measures preservation of structured details that recur in later requests across 146 sessions (143 real and 3 simulator-synthesized). Production-Chain Retention follows these details across successive compactions in 106 real sessions. Together, the three evaluations connect controlled task outcomes with information retention in deployed workflows.

Across 14 summarizer backbones, stable Task Preservation damage ranges from 5 – 64% of the

22 validated full-history successes, with Claude Opus 4.8 preserving the most repairs. Of 126 instance-backbone pairs damaged in the first round, 120 meet the three-run confirmation criterion. Task preservation and detail retention also distinguish different configurations: Kimi Code gives the most passing continuations (19/22), whereas Claude Code retains the most recurring details (15.0%). Paired traces reveal a shared failure pattern: summaries can retain the target file and relevant strings while losing the progress needed to finish a repair. Overall, our contributions are:

• We introduce Compact-Bench, a benchmark for evaluating whether context compaction preserves a coding agent’s ability to resume work. It combines controlled task continuations with recurring-detail and production-chain measurements.

• We compare 14 summarizer backbones and 5 production prompts. Stable task damage ranges from 5 – 64% among 22 full-history successes, with Claude Opus 4.8 preserving the most repairs. With Kimi-K3 as summarizer, Kimi Code preserves the most task continuations (19/22), while Claude Code retains the most recurring details (15.0%).

• We show that retained repair evidence does not guarantee successful continuation. Paired traces reveal failures even when summaries preserve target files and relevant code strings. Together with the different task-preservation and detail-retention leaders, this finding motivates evaluating compaction through both retained information and agent behavior.