Three-layer compression
Three layers, each handling a different scale: Layer 1 (micro): Every turn, silently replace old tool results with short placeholders. Keeps the last 3 results intact. Layer 2 (auto): When token estimate exceeds threshold, save the full transcript to disk and ask the LLM to summarize. Fresh context with continuity. Layer 3 (manual): The model can trigger compression itself via the compact tool when it knows it needs a fresh start.
Fill in the blanks: Micro compaction
Loading practice…
Ordering exercise: Compaction layer activation order
Loading practice…
Terminal
bash
# Run the context compaction agent
make 06-context-compaction
# Try: Have a long conversation, then type "compact"
# to trigger manual compaction and see the summary.See three-layer compaction in action. Have a longer conversation and watch how the agent manages its context window.