Compaction What is Compaction? When performing inference with a language model, eventually the context length will become too large, resulting in slower and more expensive decoding, along with potentially degraded performance (Hong et al. 2025). Applications such as Claude Code and Codex handle this issue by offering the user a “compaction” feature, which compresses the input tokens into a smaller, more manageable set via summarization.
However, as I’m sure we’ve all seen by interacting with these tools, compaction via summarization can be incredibly lossy, causing model performance to tank. I often find myself scoping sessions to tasks that I know can be reasonably accomplished within a model’s effective context window and using /clear excessively rather than using /compact.
...