Skip to content

Rewind and Context Inspection

Wrong turn five messages ago? Rewind lets you branch. Combined with context inspection, debug why Claude behaves unexpectedly.

You asked Claude Code to refactor a module. It did. Then it "fixed" a test. Then it "improved" an import. Now three files are broken and you're five messages deep into a mess that started with one bad suggestion.

You could manually undo everything. Or you could rewind.

Your Undo Button for AI Conversations

The /rewind command rolls your session back to any previous prompt. Like git checkouts, but for your conversation.

Two ways to trigger it:

  • Type /rewind and hit Enter
  • Press Esc twice quickly (faster)

Either way, you get a scrollable list of every prompt from your current session. Pick one, and Claude Code gives you four choices:

Restore code and conversation. Full undo. Files on disk revert. Conversation rewinds. That bad turn never happened.

Restore conversation only. Messages rewind, but your files stay as they are. Useful when Claude wrote something good but then talked itself into changing it further.

Restore code only. Files revert, conversation stays intact. You keep all the context from the discussion. Good when the code went sideways but the reasoning was actually sound.

Summarize from here. Different from the other three. Instead of undoing anything, it compresses everything from that point forward into a summary. Files stay the same. Conversation gets shorter. Context window gets breathing room.

After restoring, the original prompt from your selected message gets placed back into the input field. You can edit it, refine it, or send it as-is to try a different path.

Inspecting What Claude Code Actually Sees

Sometimes Claude Code does something weird. Not wrong exactly. Just unexpected. Before you rewind or start debugging, check what's actually in the context window.

/context

Shows a colored grid representing your current context window usage. Each block represents a chunk of the conversation. You can see how much space your CLAUDE.md files take up, how much the conversation history uses, and how much room is left.

First thing to check when you hit the "Claude forgot what I said" problem. Context window 95% full? Mystery solved.

/diff

Opens an interactive diff viewer. Switch between two views with left and right arrow keys:

  • Git diff: all uncommitted changes across your working tree
  • Per-turn diffs: what changed in each individual Claude Code turn

Use up and down arrows to browse between files. Faster than running git diff yourself because it groups changes by the conversation turn that caused them.

/export

Exports your entire conversation as plain text. Handy for documentation, sharing with teammates, or reviewing what happened in a long session.

Try it

Start a Claude Code session and have a short conversation (three or four prompts). Then:

/context

Look at the grid. Note how much space your conversation takes up so far.

/diff

Browse the changes with arrow keys. See which turns modified which files. Finally, press Esc twice to open the rewind menu. Scroll through your prompts. Pick one and select "Summarize from here." Run /context again. The grid should show less usage. You just freed up context window space without losing any file changes.

Rewind vs. Clear vs. Fresh Session

Three different tools for three different situations. Pick the wrong one and you waste time.

Rewind when you want to go back to a specific point but keep everything before it. The early part of your conversation was good. The recent part went off track.

/clear when you are switching tasks entirely. Auth module done, now working on the dashboard. The old context is irrelevant. Clear it out.

Fresh session when you've corrected Claude Code more than twice on the same issue. At that point, the context contains your original request, the wrong attempt, your correction, another wrong attempt, another correction. All that noise actively makes it harder for Claude Code to get it right. A clean start is faster.

Quick decision guide:

Wrong turn 2 messages ago?       → Rewind
Wrong turn 10 messages ago?      → Rewind + summarize the good parts
Context window nearly full?      → Summarize from midpoint
Switching to unrelated task?     → /clear
Claude keeps repeating mistakes? → Fresh session with better prompt

One pattern worth calling out: exploratory branching. You want to compare two implementation approaches. Rewind to the point before the first attempt. Try approach B. Compare using /diff. Pick the winner. Way faster than manually reverting files and re-explaining the task.

The summarize option deserves special attention for long debugging sessions. You might spend 15 messages tracking down a bug. The fix ends up being a one-line change. All those debugging messages are now dead weight. Rewind to the start of the debugging thread and summarize. You keep the fix, reclaim the space, and Claude remembers the conclusion without all the false starts.

Bottom Line

  • Press Esc twice or type /rewind to open the rewind menu. Lists every prompt, lets you restore code, conversation, or both.
  • /context is the first thing to check when Claude seems forgetful. The colored grid tells you why.
  • /diff shows all uncommitted changes organized by conversation turn.
  • Rewind when early context is good. /clear when switching tasks. Fresh session when corrections are piling up.
  • "Summarize from here" compresses verbose stretches without touching files.

Mastering Claude Code

Lesson 18 of 70