Memory · Agents · Evaluation

Lost in Compaction

First page
Lost in Compaction
Paper summary

Context compaction is now standard in long-running agent systems, and it silently drops the instructions users most expect to persist. This work names that class, Session Constraints, instructions like "do not delete any emails until I confirm" meant to bind behavior for the rest of a session, and introduces COMPINT to evaluate compactors across multi-turn chat, agentic trajectory, and long-horizon research. Current compactors retain only 17% of injected constraints on average, and most leave the task worse off than running it without compaction at all. Retention swings with the compactor, the prompt, the context length, the phrasing, and where the constraint was injected, which is what makes the loss structural rather than a quirk of one setup. The fix is small and does not touch the compactor or the model: an SC-aware extractor running alongside as a plug-and-play module recovers over 90% retention in all three scenarios.

Ask this paper

Abstract

When the context window is under pressure, LLM systems compact prior context to continue ongoing tasks. We study Side Constraints (SCs), user-issued instructions such as "do not delete any emails until I confirm," that constrain an LLM's behavior across subsequent turns but can be silently dropped during compaction. In an inbox experiment, an agent deleted emails without approval in 30/100 sessions after compaction, compared with none before compaction. To systematically evaluate SC preservation, we introduce CONPACT, an evaluation suite measuring semantic retention and downstream compliance across three scenarios: multi-turn chat, multi-turn tool use, and long-horizon research. The evaluated compactors retain only 17% of injected SCs on average. Loss occurs across compactors and settings, with retention varying by compactor, context length, SC framing, and injection location. We propose an SC extractor that maintains constraints separately from the task summary and appends them to the compacted context, achieving over 90% retention across all three scenarios without modifying the compactor or LLM. Code and data are available at https://github.com/ZhiqiEliWang/compaction-integrity.

Every Monday
Get next week’s papers.
Subscribe on Substack