Compacting Context
When the context window fills up, Claude Code (or you) can summarize the important parts and clear out the noise.
As a conversation grows, the context window fills up and Claude Code starts losing track of earlier detail. By default, this is handled automatically once you hit roughly 85–95% of the window: Claude Code summarizes the key information, discards the noise, and carries the summary forward. If you notice confusion setting in before that threshold, you can manually trigger it with /compact, optionally telling it what to prioritize (e.g. /compact keep info about API calls).
What's grown since the video: the /rewind menu (covered under Checkpoints) now offers two more targeted variants — “Summarize from here” and “Summarize up to here” — letting you compress a specific stretch of the conversation rather than the whole thing. And a project-root CLAUDE.md now survives compaction automatically: Claude Code re-reads it from disk after compacting, so your core instructions don't get lost in the summary.
Real-life use cases
Freeing space mid-debug without losing the goal
Deep into a long debugging session with a lot of log output cluttering context, a developer runs /compact focus on the root cause and the fix applied so far to reclaim space while keeping what actually matters.
Compacting only the noisy middle
Using /rewind, a user summarizes only the messy exploratory middle portion of a session, keeping the clear initial brief and the final working solution fully intact and out of the summary.
Source
- Source video: “Claude Code Explained” — 27 concepts in 27 minutes (YouTube)https://www.youtube.com/watch?v=ZlDnsf_DOzg
- Checkpointinghttps://code.claude.com/docs/en/checkpointing