The conversation outgrows its context
Even with 1M-token windows, very long conversations eventually feel "full" — attention degrades, cost climbs, latency suffers. Compaction is the deliberate process of replacing old turns with summaries to keep the active context lean.
Three compaction strategies
- Sliding window — keep the last N turns verbatim; drop earlier ones. Cheap; loses context.
- Summary buffer — replace older turns with a running summary. Keeps gist; loses verbatim.
- Hybrid — pinned system + summary of older + last N verbatim turns. The default for serious systems.
What to keep verbatim
- The current task and its intermediate results.
- Tool calls in the active loop.
- Anything the user just referred to ("as you said earlier").
What to summarize
- Resolved sub-tasks.
- Background context that won't be quoted again.
- Tool results no longer relevant.