ع
Learn Tracks Reference Guides Saved
Compare & decide

/clear vs /compact in Claude Code

Both free up context space — but /clear is a fresh start and /compact is a summary that keeps the thread going. Picking the wrong one either loses useful context or keeps stale noise.

3 min read · Updated 2026-06-16
/clear vs /compact in Claude Code

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

  • /clear wipes the conversation completely. Fresh start. Nothing carried forward.
  • /compact summarises 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 doesWipes everythingSummarises and continues
Context afterEmptyCompressed summary
ContinuityNone — fresh startYes — thread continues
Best forTask switchLong session, same task
RiskLose useful contextSummary might drop a detail
UndoNoNo (but less destructive)

The daily rhythm

A good session hygiene pattern:

  1. Start a task — work naturally
  2. Session gets long/compact to free space and keep going
  3. Task is done, switching to something new/clear to start fresh
  4. 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.

Topics

Questions people ask

Does /clear lose my progress?
Not your saved progress (XP, completions, files on disk). It only clears the conversation context — the messages and file contents Claude is currently holding in memory. Your actual work is untouched.
How often should I /compact?
When a long session starts feeling sluggish or Claude seems to forget things you said earlier. That's usually a sign the context is full. /compact summarises it and makes room.
Can I undo a /clear?
No. Once you clear, the conversation context is gone. If you might need continuity, use /compact instead — it preserves a summary.
Put it into practice
Take the guided course
Start