/clear, /compact, or a new session: when to reset Claude Code
Once you accept that a lean session beats a bloated one, the next question is how to trim one. Claude Code gives you two commands that sound similar but do different things, /clear and /compact, plus the always-available option of just starting a new session. I mixed them up for a while. Here is what each one actually does and the rule I use to pick.
What /clear does
/clear wipes the conversation history and starts you fresh, as if you had just opened the session. The slate is genuinely clean: none of the earlier back-and-forth carries forward into the model's context.
The part people miss is that the old conversation is not gone. Claude Code saves it, so you can resume it later if it turns out you needed something from it. /clear is a reset for the current working context, not a delete.
Use it when you are done with one thing and moving to another. The history from the last task is pure ballast for the next one.
What /compact does
/compact replaces the raw conversation with a structured summary. Instead of hauling every message and every tool output forward, the model condenses the session into a compact record of what happened and keeps working from that. Continuity is preserved; the bulk is not.
You can steer it. Passing instructions tells it what to keep front and center:
/compact focus on the auth refactor and the failing tests, drop the exploration
Use it when a single task is running long and the window is filling, but you still need the thread. The classic case is a big feature or debugging session where the early exploration is done and you want to keep momentum without dragging all of it along.
Auto-compact
You do not have to remember to do this every time. As a session approaches the limits of its context window, Claude Code compacts automatically, squeezing older tool outputs first and then the conversation if it needs to. Doing it yourself at a natural break point just gives you a cleaner, better-targeted summary than waiting for the automatic pass.
The rule I use
| Situation | Do this |
|---|---|
| Switching to an unrelated task | /clear (or start a new session) |
| One long task, window getting full, thread still matters | /compact |
| The session has gone sideways and you want a true blank slate | New session |
| You are near the limit and did nothing | Auto-compact handles it, but a manual /compact is cleaner |
The short version: /clear when the past does not matter, /compact when it does but there is too much of it. Both beat letting a session sprawl, because a sprawling session is slower, more prone to cache-miss cost spikes, and more vulnerable to context rot.
Where this fits
Resetting well is one piece of keeping context lean, which is itself one of the habits that quietly run up your Claude Code usage. If you find yourself compacting the same long session over and over, that is often a sign the work wants to be split across fresh sessions, or handed to sub-agents, instead.
More in How-to