What is Compaction?
Compaction is what Claude Code does when the Context Window nears its limit: it swaps earlier conversation for a shorter summary and keeps working on top of it. It happens automatically and can be triggered by hand with /compact; related controls include /autocompact and the environment variable CLAUDE_CODE_AUTO_COMPACT_WINDOW. After compaction Claude sees the summary, not the original word-for-word conversation.
Why does Compaction exist?
The model can only read so much at once, so a long session eventually fills up. Without compaction you would have to start over or let old content crowd out new. Compaction is the compromise: keep the gist, regain space. The cost is lost detail, and the official Auto Mode page warns about it: a one-off boundary you stated in conversation, such as "don't push until I review", can be lost if compaction removes that message, so use an ask or deny rule for a durable guarantee.
How does it work, and what survives?
Points from the official changelog: since v2.1.304 Compaction re-sends the Skill list to Claude afterwards, and /reload-skills sends only new or changed skills; since v2.1.309 an oversized nested CLAUDE.md loads only its start, stopping repeated compaction after reading under it; v2.1.307 fixed "Autocompact is thrashing" errors in turns that read many PDF pages or images; since v2.1.296 Subagent frontmatter can set autoCompactWindow (100000 to 1000000). A third-party writeup (claudefa.st) says the project-root CLAUDE.md is re-injected from disk while nested ones are not, and invoked skill bodies are capped at 5,000 tokens each and 25,000 total; its other claim that the startup skill listing does not reload contradicts the official v2.1.304 note and should be treated as out of date.
So what does this mean for me?
Three practical points: put long-lived rules in CLAUDE.md or Permission Rules rather than only in conversation; an oversized CLAUDE.md or heavy tool output makes Compaction more frequent, so keep them lean; and when Claude seems to forget something you just said, first ask whether compaction just happened. These three points are my reading of the official information, not official operating advice.
A publicly checkable example: the Claude Code v2.1.309 release notes say sessions compacted repeatedly after reading files under a very large nested CLAUDE.md, so a nested CLAUDE.md over the size limit now loads only its start. It shows compaction is not only the result of a full window: the size of what you feed in can push it into a loop.
Pros: long sessions can continue without starting over. Cons: detail and one-off instructions can be lost, and oversized inputs can cause repeated compaction.