CliffCompaction: Cost-Efficient Compaction for Long-Horizon Coding Agents
Coding agents often struggle with long-running tasks that require millions of tokens of context. As these sessions grow, the computational cost of managing the context increases, and the sheer volume of information can actually hinder an agent's performance. CliffCompaction is a new, rule-based technique designed to manage this context efficiently. By automatically compacting information when a session hits a specific token limit, it reduces costs by up to 50% while maintaining or even improving the agent's success rate on complex coding benchmarks.
How It Works
Unlike traditional methods that summarize past conversations—which can lead to "context drift" or the loss of important details—CliffCompaction focuses on maintaining high precision. It does this by never rephrasing or rewriting content. Instead, it uses a simple set of rules to truncate or drop less critical information, such as long tool results or verbose tool calls, while keeping essential data intact. The ai agents story also surfaces in OpenAI Says AI Found Possible Navier–Stokes..., adding another angle.
Crucially, CliffCompaction does not "compact a compaction." Each time the agent reaches its token limit, the system discards the previous compacted block and creates a fresh one from the most recent, active session. This "cliff-like" approach prevents the accumulation of errors that typically occurs when summaries are repeatedly summarized, ensuring that the agent always works with high-fidelity information.
Efficiency and Cost Savings
By managing the context this way, CliffCompaction significantly reduces the need for expensive, repetitive processing of long histories. Because the system only triggers compaction when necessary, it remains "cache-friendly," allowing the agent to reuse existing data for longer periods. These savings make advanced techniques like test-time scaling—where a model is run multiple times to improve its output—much more affordable. For example, researchers found that using CliffCompaction allowed them to perform multiple rollouts of a model for less than the cost of two full-context runs, leading to substantial performance gains on tasks like Terminal-Bench. The ai agents story also surfaces in Google opens early access to AI..., adding another angle.
Performance on Complex Tasks
CliffCompaction has proven effective across various benchmarks, including SWE-bench Verified and KernelBench. On KernelBench, which tests an agent's ability to continually improve code over millions of tokens, CliffCompaction achieved state-of-the-art results. It reached significant speedups in CUDA kernel development, outperforming specialized search algorithms and trained agents despite being a general-purpose tool. Because it is scaffold-agnostic, it can be easily integrated as an API proxy with existing coding tools like Claude Code, allowing developers to implement it without needing to modify their underlying agent architecture. The ai agents story also surfaces in Claude autonomously improved models across 10..., adding another angle. as detailed in the full paper on Arxiv
Comments (0)
to join the discussion
No comments yet
Be the first to share your thoughts!