Compaction
Summarizing history to make room
Library › Context Problems
Truncation throws the oldest turns away. Compaction keeps them, but small: the model reads the history and writes a summary that stands in for it. The system prompt is not part of the history and does not get compacted; it is pinned at the front and survives intact. So the window after a compaction is the same system prompt, followed by a summary a fraction of the size, and a great deal of space that was not there before.
⬇ Compaction worksheet (3 pages)




