What Compaction Preserves and What It Destroys
Compaction is a one-way door. Understanding exactly what survives — and what doesn't — determines whether you lose critical context or walk away clean.
Quick Reference
- →Auto-compaction triggers when context window approaches capacity
- →Project-root CLAUDE.md always survives — reloaded from disk after compaction
- →Subdirectory CLAUDE.md files do NOT survive — re-loaded only when Claude re-enters that directory
- →Verbal instructions given only in conversation are destroyed
- →Compaction sequence: clear old tool outputs → summarize history → error if still full
- →/compact accepts an optional focus directive to guide what gets preserved in the summary
- →Compact before 5-minute prompt cache expires (~270s) to stay in the warm cache window
- →If it must persist, put it in CLAUDE.md — not in the conversation
What Compaction Does
Compaction summarizes your conversation history to reclaim token budget. When the context window fills, Claude needs to discard something. Instead of stopping, it compresses the oldest parts of the conversation into a summary and continues. The summary is shorter than the original — that is the point, and also the loss.
Clear old tool outputs
The first pass removes the raw output of old tool calls — file reads, bash results, grep results from earlier turns. The responses stay but the raw output bodies are dropped.
Summarize conversation history
The oldest conversation turns are compressed into a summary. Key decisions and code changes are preserved at a high level. Granular instruction details, specific error messages, and verbal corrections are lost.
Error if still full
If the window is still too full after compaction (very rare), Claude surfaces an error. At this point you need /clear and a fresh session.
Once the conversation history is summarized, the original detail is gone for that session. You cannot un-compact. The information loss is permanent within the session — though the full transcript is saved to disk in transcript.jsonl and can be read manually.