Compaction.mp4

Compaction

Commits:

# /handoff skill added
pnpm reset 03.10.01
pnpm cherry-pick 03.10.01

Compaction is Claude Code's mechanism for turning a large conversation into a smaller summary so the session can keep going after the context window fills up.

It is useful to understand, but it is not the workflow we are optimizing for in this course.

What happens at the context limit

A Claude Code session starts with plenty of room in the context window. As you work, the conversation fills up with prompts, tool calls, code, summaries, and implementation details.

Eventually, the session can move out of the smart zone and toward the context limit. Claude Code reserves part of the context window as an auto-compact buffer. When the session crosses into that reserved region, Claude Code can automatically compact the conversation.

Compaction takes the existing conversation and asks an LLM to summarize the useful parts into a smaller form.

What compacting preserves

When you compact, Claude Code tries to preserve the important context from the session:

For example, if you just implemented a feature and want to do QA, you can tell the compaction step that your next goal is QA. That gives the summarizer a better chance of preserving the context you need next.

After compaction, the session may drop from a large context usage percentage down to a much smaller one. The conversation can continue, but now it is continuing from a summary of the previous session rather than the full original context.