Two commands, both free up context space, but they work very differently. Using the wrong one is one of the most common small mistakes in Claude Code.
The one-line version
/clearwipes the conversation completely. Fresh start. Nothing carried forward./compactsummarises the conversation into a shorter version and continues from there.
/clear — the fresh start
/clear
Everything in the current conversation is gone — messages, file contents Claude read, the whole thread. You’re starting from zero, as if you just opened a new session.
Use /clear when:
- You’re switching to a completely unrelated task
- The current context is full of noise from a finished task
- You want Claude to approach something with fresh eyes, no baggage
Don’t use it when you’re mid-task and still need the conversation history. That context is gone and won’t come back.
/compact — the summary
/compact
Claude reads the entire conversation, writes a concise summary of what matters, and replaces the full history with that summary. The thread continues — you don’t lose the plot — but the raw details are compressed away to free up space.
Use /compact when:
- You’re in a long session and it’s getting sluggish
- Claude seems to forget things you said earlier (the context is full)
- You want to continue the same task but need more room
Don’t use it when the conversation is already short (nothing to gain) or when you’re about to switch topics entirely (use /clear instead — a summary of irrelevant work is still irrelevant).
Side by side
/clear | /compact | |
|---|---|---|
| What it does | Wipes everything | Summarises and continues |
| Context after | Empty | Compressed summary |
| Continuity | None — fresh start | Yes — thread continues |
| Best for | Task switch | Long session, same task |
| Risk | Lose useful context | Summary might drop a detail |
| Undo | No | No (but less destructive) |
The daily rhythm
A good session hygiene pattern:
- Start a task — work naturally
- Session gets long →
/compactto free space and keep going - Task is done, switching to something new →
/clearto start fresh - Repeat
The single most common cause of “Claude got worse halfway through” is a context window packed with stale information from a previous task. A well-timed /clear between tasks, or a /compact during a long one, is the fix.