AI 研究
CliffCompaction releases agent compaction package that trims context using verbatim excerpts
The package deletes or truncates older content through an API proxy, bringing rule-based compaction to existing coding agents. The paper’s cost comparison uses an idealized caching model, and the published defaults differ from the experimental settings.

CliffCompaction released version 0.1.0 on PyPI on September 23, enabling long-running coding agents to compact conversations through an API proxy. The research preprint was submitted the previous day, and the package release provides an implementation ready for integration. The package is MIT-licensed and requires Python 3.11 or later. [Package release](https://pypi.org/project/cliffcompaction/0.1.0/), [Paper record](https://arxiv.org/abs/2609.26779)
When context exceeds a threshold, the method preserves the system prompt, task, and recent turns while truncating or deleting older content according to rules, without making an additional model call to rewrite it. Tool results longer than 500 characters are discarded, while shorter results are retained verbatim. The next compaction also discards the previously compacted content. It therefore preserves a limited set of verbatim clues rather than the complete history. [Public implementation](https://github.com/nguyenvuthientrang/cliffcompaction)
The paper evaluates Terminus-2 with Kimi K2.6 on Terminal-Bench 2.0 using a compaction threshold of 16K tokens. The task success rate rises from 59.16% with full context to 61.42%, while the main cost table shows a reduction from $0.40 to $0.19 per task. However, that table recalculates costs using an idealized caching model and should not be treated as an actual provider bill. The small score difference also needs to be interpreted alongside variability across repeated runs. [Paper results and cost methodology](https://arxiv.org/html/2609.26779v1)
The publicly available proxy also presents a reproducibility gap: the package documentation specifies that full assistant text and thinking are retained by default, whereas the paper truncates thinking to 300 characters. The default trigger threshold also differs from the experiment’s 16K setting. Simply installing the package and using its defaults does not reproduce the reported results. Engineers should record the version and all compaction parameters before comparing success rates and costs. [Package settings](https://pypi.org/project/cliffcompaction/0.1.0/)
During integration, the proxy builds a hash chain over messages to identify the original history prefix, then replaces it with shortened content. The project requires disabling the framework’s own compaction so that history rewrites do not break matching. If parsing or storage fails, the proxy passes the original content through by default. The threshold is therefore not a hard limit. Strict mode can be enabled separately for measurement, with shadow mode used first to observe which content would be removed. [Operation and failure handling](https://github.com/nguyenvuthientrang/cliffcompaction)
The author also notes that most additional steps after compaction involve rereading files, and that this causes some tasks to exhaust their step budget without submitting a result. [Development notes](https://nguyenvuthientrang.github.io/cliffcompaction/)
This design shifts part of the burden of long-term memory back to files and tools. Deployment evaluations should track rereads, step-budget exhaustion, and cache hit rates. If deleted information can no longer be retrieved, retaining tool names alone cannot restore it. The next step is to rerun evaluations in real projects with pinned versions to determine whether the context cost savings outweigh the cost of retrieving information again.