/context draws your window as a colored grid and suggests cuts.
Compare it with a freshly cleared session and you see which rows, such as messages, MCP or memory, are filling the window.
/btw asks a side question without growing the history.
Use it for a quick lookup so the main task's context stays clean.
/clear costs nothing and stops old history being re-read on every turn.
Three unrelated tasks in one session means all three are re-read on each turn of the fourth. /clear name labels the old session so /resume can find it.
After compaction Claude Code re-reads at most five recent files.
A file over 5,000 tokens comes back only as a path, so a large file you were editing may need a fresh read.
A SessionStart hook with the compact matcher reruns after every compaction.
Its output is added to the compacted context, so it is the place to restore what you never want lost.
Rules with paths: frontmatter can be summarized away by compaction.
They arrive as message history. If a rule must survive, drop the paths: line or move it to the root CLAUDE.md.
A long idle session is compacted just before its cache expires.
Past about 200K tokens on the one-hour cache, Claude Code compacts shortly before expiry. idleCompaction: false turns it off.
Rewind does not see files that only Bash changed.
Checkpoints track edits made with Claude's edit tools. Use git for Bash-only changes and for subagent edits.