Study FAQ
How do I compact a Claude conversation without losing decision-critical context?
Also asked as 2
- What should I preserve when summarizing a long Claude conversation?
- How should a Claude API workflow continue from compaction while keeping evidence and open decisions?
Answer
Use compaction to summarize older conversation turns when the next decision can proceed from a concise state record. Preserve current policy and authorization constraints, decisions already made, open questions, and references to the original evidence. Keep a protected record of the session ID and the history range summarized. Apply the appropriate access and retention policy to both the source and its summary.
On supported Claude Messages API models and deployments, on-demand compaction uses compaction: {"type": "summarize"} and the compact-2026-09-04 beta header. Use the same system prompt and tools for the summarization request. Verify stop_reason: "compaction" and the returned block, then send the signed block back unchanged, first in messages, in place of the summarized messages. Include the same beta header whenever you send that block. Threshold compaction uses compact_20260112 in context_management.edits and the compact-2026-01-12 beta header. It runs at the configured input-token trigger. Append the response with its compaction block so the API can drop older blocks on later requests. Check the availability and compatibility table for the mode you choose. Keep the top-level on-demand compaction request separate from requests using context_management.
Check that the handoff preserves pending decisions and expected evidence references before relying on it. If the summary is unavailable or drops an essential detail, use a smaller evidence set or retrieve the original record. Reapply any still-active policy instructions that lived in the summarized on-demand history. Validate the next output against the underlying evidence and the workflow’s evaluation criteria.
Claude compaction overview · Compaction on demand · Compaction at a token threshold
Full explanation
Context Windows, Compaction, and Tool-Context Control
Study guide · CCAR-F
Read the full explanation