Use /compact to Reclaim Context Space During Long Sessions
Long Claude Code sessions eventually fill the context window — you'll notice responses getting slower or Claude forgetting earlier parts of the conversation. Instead of starting over, run /compact.
/compact
This tells Claude to summarize the entire conversation so far into a compressed form, then continues the session with that summary. You keep the important context — decisions made, files changed, what you were working on — but free up thousands of tokens of space.
You can also pass a focus hint to guide what gets preserved:
/compact focus on the auth refactor and test failures
This is especially useful when you're deep into a multi-step task and don't want to lose your place. Without the focus hint, Claude decides what's important. With it, you ensure the specific thread you care about survives compression.
A few things to know:
/compactruns automatically when context gets critically low, but running it proactively gives you more control over what's preserved.- After compaction, Claude won't remember exact tool outputs or verbose error messages from earlier — just the gist.
- You can run it multiple times in a session. Each round compresses further.
- It's different from
/clear, which wipes everything./compactpreserves context intelligently.
Think of /compact as saving your game — you lose the moment-to-moment replay, but you keep all the progress.
via Claude Code
Log in to leave a comment.
When Claude starts referencing files you've since deleted, remembering old code you've already changed, or getting confused by contradictory instructions from a long session — type /clear to wipe the slate clean. Unlike /compact which preserves context, /clear gives you a true fresh start without restarting the CLI.
Not every task needs deep reasoning. Type /fast to switch Claude Code into fast mode — same model, faster output — for quick edits, simple questions, and routine changes. Toggle it off when you need Claude to think harder on complex problems.
Long sessions eat through your context window as conversation history piles up. Type /compact to summarize the conversation so far and reclaim space — keeping Claude's understanding of what you're working on while freeing up room for more work.