CliffCompaction:让长程编程智能体的上下文压缩成本降低最多 50%
CliffCompaction: Cost-Efficient Compaction for Long-Horizon Coding Agents
这篇讲了怎么把智能体跑长任务的 token 开销砍一半,方法只有一条:压缩只删不改,还开源了能在 Claude Code 里直接用的实现。
CliffCompaction 是一种自动压缩技术,在受限上下文下将智能体运行成本最多降低 50%,同时在 Terminal-Bench 上保持或提升成绩。其核心原则是只截断或丢弃内容、从不改写,且每次压缩只作用于原始内容,避免上下文漂移累积。在并行测试时扩展场景下,Kimi K2.6 借助它追平 Opus 4.7,并以更低成本超过 Opus 4.6 和 GPT-5.3 Codex。在 KernelBench 上,该方法在 400 步后达到 3.58 倍 CUDA 内核加速,超过了专门的搜索算法和训练型智能体。作者已开源兼容 Claude Code、Codex 等工具链的 API 代理实现。
CliffCompaction: Cost-Efficient Compaction for Long-Horizon Coding Agents
Agents often work on complex problems that require millions of tokens of context, which necessitates compacting across sessions due to limited context windows. We develop CliffCompaction, an autocompaction technique that reduces cost by up to 50% under a bounded context while maintaining or improving performance on Terminal-Bench and achieving new levels of efficiency for test-time scaling and state-of-the-art results on KernelBench. The per-rollout savings of CliffCompaction make the performance--cost trade-off of test-time scaling more efficient, adding over 10 percentage points on Terminal-Bench for less than the cost of two full-context runs. Under parallel test-time scaling, CliffCompaction lets Kimi K2.6 match Opus 4.7, and exceed Opus 4.6 and GPT-5.3 Codex at lower cost. The key to CliffCompaction's effectiveness is that it keeps compacted information faithful by only truncating or dropping content, never rephrasing or rewriting it. We never compact a compaction---each pass operates only on original content, and prior compacted output is discarded, preventing context drift from accumulating. These properties sustain continual learning over sessions exceeding a million tokens: on KernelBench, CliffCompaction reaches CUDA kernel speedups of $2.23\times$ after 200 steps and $3.58\times$ after 400 steps, surpassing specialized search algorithms and trained agents despite being a general-purpose compaction technique. We open-source a scaffold-agnostic API-proxy implementation of CliffCompaction usable with Claude Code, Codex and other harnesses.