Context Compaction
Long sessions cannot stay as raw turns. Compaction is how agents survive hour-long jobs.
Meeting minutes with action items, not a transcript.
Visual Workflows
Start here — scroll inside each diagram frame to explore, then use + / − to zoom up to 200% if needed.
Overview
Scroll inside the frame to explore · use + / − to zoom up to 200%
Scroll inside the frame to explore · use + / − to zoom up to 200%
This turn
Scroll inside the frame to explore · use + / − to zoom up to 200%
Meeting minutes with action items, not a transcript.
Key Takeaways
- 1.Compaction rewrites an old thread into a shorter running state.
- 2.It is summarization plus structured fields — not a vague paragraph.
- 3.A bad compaction is a false memory.
- 4.Long sessions cannot stay as raw turns.
- 5.Compaction is how agents survive hour-long jobs.
Real Example
Scenario
Compaction: pack only what this turn needs.
What you would do
In Context Engineering, apply Context Compaction to this scenario: Compaction: pack only what this turn needs. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.
Commands
Commands to Remember
Compaction rewrites an old thread into a shorter running stateIt is summarization plus structured fields — not a vague paragraphA bad compaction is a false memoryKeep a pointer to the raw log
Cheat Sheet
Quick recap
quick ref- •Compaction
- •Budget
- •Don't dump
Common Mistakes
- ✕Skipping evaluation for Context Compaction before production
- ✕No logging or tracing around context compaction steps
- ✕Ignoring cost and latency implications
