AnswerQA

When do I run /compact vs /clear vs /rewind?

Answer

Three commands, three different recovery shapes. /clear wipes the conversation; /compact summarizes the whole conversation; /rewind goes back to a specific message and offers per-component restore (code, conversation, both) or targeted summarize from that point.

By Kalle Lamminpää Verified May 7, 2026

Three commands, three recovery shapes: /clear starts an empty-context conversation, /compact lossy-summarizes the whole conversation in place, /rewind jumps to a specific past message and lets you pick what to restore. The remembered conversation is still accessible via --resume after /clear, so “wipe” is the day-to-day effect, not the permanent one.

Side-by-side

What it doesWhat survivesWhen to reach for it
/clearStarts a new empty-context conversation; the previous one is retrievable via --resumeCLAUDE.md, auto memory, working directory, all files; nothing from the live conversationSession is wandering; cheaper to re-prime than to debug
/compact [instructions]Replaces the whole conversation with an AI-generated summarySummary of everything; context budget freedConversation has good info but is bloating context; you want to keep working
/rewind (Restore code)Reverts file changes from a chosen point onward; conversation untouchedConversation history; Bash side-effects are not checkpointed and stay appliedEdit went wrong; you want Claude to know what was tried and rejected
/rewind (Restore conversation)Rewinds messages from a chosen point onward; code untouchedFiles as they are; the chosen message’s original prompt returns to inputConversation took a wrong turn after correct edits; want to redirect
/rewind (Restore code + conversation)Both, from the chosen point onwardThe state captured at the selected checkpoint, not turn zero unless that is what you pickedBig swing went wrong; you want a clean retry from a specific point
/rewind (Summarize from here)Compresses messages from chosen point onward into a summary; the chosen prompt returns to inputEarlier messages in full; later messages compressedSpecific stretch is bloating context; the rest of the conversation is fine

Decision tree by symptom

“Claude made an edit I do not want.” /rewind → Restore code. Or, if Claude also went down a bad reasoning path before the edit, Restore code + conversation. The original prompt comes back to your input field so you can edit and retry.

“Conversation is fine but the latest 20 messages are bloating context.” /rewind → Summarize from here, picking the message where things started getting long. Earlier context stays intact; only the noisy stretch compresses.

“Context is full, every turn is sluggish, but the whole conversation has good signal.” /compact (with optional instructions: /compact Focus on code samples and the current plan). Summarizes everything; conversation continues from the summary.

“Auto-compact thrashed and I am still here.” Run /compact to force a deeper summary, then move further reads into a subagent so noisy work stays out of parent context. If still thrashing, /clear and re-prime from a tighter prompt.

“I have been correcting the same misread for ten turns and Claude is not getting it.” /clear. The context is now full of failed approaches; the model is anchored on them. Start fresh and bake your learning into the new prompt.

“I want to go back to the start of this task and try a different approach.” /rewind → Restore code + conversation, picking the message that opened the task. You get the same starting state and can take a different route from there.

How they differ in one paragraph

/rewind is targeted: pick a message, choose code-only / conversation-only / both / summarize-from-there. Files restore from checkpoints captured before each edit. /compact is whole-session: summarize everything since session start; no targeting, no per-component choice. /clear is destructive: empty the conversation entirely; no recovery, no summary kept. The most recoverable to least recoverable order is /rewind/compact/clear.

Footguns

/rewind does not undo Bash side-effects. Checkpointing tracks Edit/Write/MultiEdit. A Bash(rm -rf node_modules) is not in the rewind log; the directory stays gone whether you rewind or not. The same for Bash(git push), Bash(npm publish), anything network or destructive. /rewind is local undo for in-session file edits; git is the only undo for everything else.

/compact is lossy. The summary keeps what the summarizer chose to keep. A specific instruction Claude followed earlier (“do not touch src/storage/”) may not survive the summary if it does not feel salient to the summarizer. Pass explicit instructions to /compact to bias what is preserved: /compact Focus on the auth module plan and the in-scope file list, drop earlier exploration. Without instructions, you are at the summarizer’s mercy.

/rewind Summarize from here is targeted; /compact is whole-session. New users use them interchangeably. The right shape: if early context (the original task brief, the architecture overview, the rules) is what matters, summarize from a later point so it stays uncompressed. Use /compact when even the early context is worth losing detail on.

/clear keeps CLAUDE.md, auto memory, and your working directory. It does not reset the project. New users sometimes worry that /clear will wipe their files; it will not. The conversation is what dies. The next session reads CLAUDE.md again and you start fresh with the same project.

External file edits do not register as checkpoints. If you edited a file in your own editor while Claude was running, that edit is not in the checkpoint log. Rewinding past that point keeps your manual edit but rewinds Claude’s edits; the result is a hybrid state that may not match what you remember. Commit your manual edits to git before relying on /rewind for recovery.

When NOT to use this

  • Auto-compact has not even fired yet. Premature /compact wastes a turn and may degrade context Claude was using. Watch /context first; only compress when budget is over 70% and you still need to keep going.
  • You can git stash instead. For “I made a manual mistake in my editor”, git stash is faster than /rewind. Reserve /rewind for changes Claude made.
  • The conversation is over. If the work is shipped and you are done, /exit is the right command (it leaves the CLI; the conversation is preserved and reachable via --resume). /clear starts a fresh empty-context conversation in the same session and is the wrong tool for “I am done for the day”.
  • You want exactly-once side-effects. A /rewind followed by re-running the prompt may produce slightly different output. If the prior run already pushed to GitHub or charged a customer, rewinding the conversation does not undo that; the world moved on. Use /rewind for in-progress work, not for retroactively rolling back deployments.

Sources

  • Commands reference
    Authoritative for `/clear` (empty context), `/compact [instructions]` (summarize the whole conversation), `/rewind` (rewind to a previous point or summarize from there), and `/context` (colored-grid budget view).
  • Checkpointing
    How `/rewind` works: every user prompt creates a checkpoint; menu offers Restore code+conversation / Restore conversation / Restore code / Summarize from here. Bash and external file edits are not tracked.
  • Explore the context window
    What survives compaction (CLAUDE.md and auto memory re-injected from disk) vs what is lost (path-scoped rules, per-turn nuance). Context for choosing between targeted and whole-session compression.

Was this helpful?

Read more