Course-correcting early — Esc, rewind, and "undo that"
By the end you can
- Stop a run the moment it goes wrong instead of waiting for it to finish
- Predict what double-Escape does from whether the input box has text in it
- Choose the right entry in the rewind menu for what you want back
- State the four things checkpointing does not restore
- Use the summarize options as a targeted compaction
Watching a run go somewhere wrong and letting it finish is one of the most expensive habits available to you. Everything it produces from the wrong turn onward lands in your window, and you then pay to argue with it. The guidance is blunt about the alternative:
The best results come from tight feedback loops. Though Claude occasionally solves problems perfectly on the first attempt, correcting it quickly generally produces better solutions faster. — Best practices
Four controls, in increasing order of how much they undo.
Esc — stop, keep everything
Press Esc to stop Claude mid-action. Context is preserved, so you can redirect
immediately. This is the one to build a reflex around: the moment you think
"that is not what I meant", the cheapest possible action is available and costs
you nothing but the turn in flight.
Esc Esc — and the thing that surprises everyone
Double-Escape does two completely different things depending on the state of your input box:
| Input box | Double-Esc does |
|---|---|
| Contains text | Clears the draft, saving it to input history — press Up to recall it |
| Empty | Opens the rewind menu |
This catches people constantly. You type half a prompt, decide to rewind
instead, hit Esc Esc, and the menu does not open — you have cleared your draft.
Press Esc Esc again on the now-empty box and you get the menu. Your text is not
lost; Up brings it back.
/rewind opens the same menu regardless of what is in the box, which is why it
is the safer thing to type when you actually want the menu.
The rewind menu
Every prompt you send creates a checkpoint. The menu lists them, and once you select one you choose an action (Checkpointing):
| Option | What it does |
|---|---|
| Restore code and conversation | Revert both to that point |
| Restore conversation | Rewind to that message, keeping current code |
| Restore code | Revert file changes, keeping the conversation |
| Summarize from here | Compress the conversation from this point forward |
| Summarize up to here | Compress the conversation before this point, keeping later messages intact |
| Never mind | Return to the list without changing anything |
The two code-restore options only appear when the selected checkpoint actually has tracked file changes to revert. If nothing was edited after that point you will see only the conversation and summarize options — that is not a bug.
After restoring the conversation, or choosing Summarize from here, the original prompt from that message is put back in your input box, so you can edit and re-send it rather than retyping.
"Undo that"
You can also just say it. "Undo that" asks Claude to revert its changes, in
plain language, without opening a menu. It is the least precise of the four
controls and the fastest to type; for a single edit you have just watched land,
it is usually enough.
What checkpointing does not restore
This is the part that matters more than the menu, because the gap between what people assume and what is tracked is where real work gets lost. Checkpointing tracks files edited through Claude's file-editing tools. Four documented exclusions follow from that:
- Bash commands are not tracked. If Claude ran
rm file.txt,mv old.txt new.txtorcp source.txt dest.txt, those changes cannot be undone through rewind. The file-editing tools are checkpointed; the shell is not. - Subagent edits are usually not restored. A subagent uses the same
file-editing tools, but your session's checkpoints usually do not capture its
edits, so rewind does not take them back and you revert with git. There are
exactly two exceptions, and both edit your working tree during your own turn:
a forked skill — a skill with
context: fork— running in the foreground, and a/code-reviewrunning in the foreground. Rewind restores those as usual. Both of them default to the background now, which the next section takes up. - External changes are not tracked — your own manual edits, and edits from other concurrent sessions.
- Symlinked and hard-linked paths. A code restore skips them: you get a
Restored the code, but skipped N fileswarning, and those files keep their current contents — which is to say Claude's edit to them stands. To take one back, ask Claude to reverse the edit or do it yourself. Config files a dotfile manager symlinks in, and files pnpm hard-links into place, are exactly what this covers. Before v2.1.216 there was no skip and no warning:/rewindwrote and deleted straight through the link, into whatever it pointed at, and did not report the partial restore.
Which subagents rewind actually covers
Rewind reaches two kinds of subagent work and no others: a forked skill running
in the foreground, and a /code-review running in the foreground. Two defaults
moved in v2.1.218: a skill with context: fork now runs in the background
instead of blocking the turn, and /code-review, --fix included, now runs as a
background review instead of inside your conversation. Both used to be foreground
work. By default rewind now takes back neither.
Claude Code still waits for them in a handful of situations, and in those the
edits land in your turn and are checkpointed as usual: a non-interactive -p run
or the Agent SDK, a second invocation started while an earlier run of the same
skill — or the same review — is still going, and
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS set to 1. A forked skill also runs in
the foreground whenever its frontmatter says background: false.
The ordinary subagent Claude spawns with the Agent tool — the research or
parallel-work agent — is outside your checkpoints regardless, and that holds even
when it runs in the foreground: CLAUDE_CODE_DISABLE_BACKGROUND_TASKS puts every
subagent in the foreground, and rewind still does not restore that agent's edits.
Those you revert with git, and they are the reason the rule exists at all.
Lesson 11.4 builds that undo surface in full, channel by channel.
The practical conclusion does not move with the defaults. Some channels sit outside your checkpoints on every version — the shell, the background subagent, your own editor — and the ones inside them expire. Which is why the documentation says this outright, and so does this course:
Checkpoints are designed for quick, session-level recovery. For permanent version history and collaboration, continue using version control, such as Git, for commits, branches, and long-term history. — Checkpointing
Two details worth having
Checkpoints survive resuming. They are saved with the conversation, so you can close your terminal, resume the session tomorrow, and still rewind. Claude Code keeps file snapshots for the 100 most recent checkpoints in a session, and sweeps them on the same retention schedule as the rest of your session data — about 30 days by default.
You can rewind past a /clear. If you cleared earlier in the same Claude
Code process, the rewind menu shows an extra entry at the top labelled
/resume <session-id> (previous session), which takes you back to the
conversation that was active before the clear. It is available until you exit or
resume something else. On versions old enough to predate the entry, /resume
and the picker were the only route back to it.
Where this fits
Level 3 has now given you two different responses to a session going wrong, and they are not interchangeable:
| The problem | The response |
|---|---|
| The last turn went the wrong way | Esc, redirect |
| The last several turns went the wrong way | /rewind, restore to before them |
| The window is full of a verbose detour you still need the start of | /rewind → Summarize from here |
| You have corrected the same issue twice | /clear and a better opening prompt |
| The next task is unrelated | /clear |
Checkpoint
-
Your input box has half a prompt in it and you want the rewind menu. What happens when you press
Esc Esc, and what do you press next?Show answerAnswer
It clears your draft instead of opening the menu. With text in the input box, double-
Escclears the draft and saves it to input history; only on an empty box does it open the rewind menu.So press
Esc Esca second time, on the now-empty box, and you get the menu. Your text is not lost —Uprecalls it. Better still, type/rewind, which opens the same menu regardless of what is in the box, and is the safer thing to type when the menu is what you actually want. -
Claude fixed a bug by editing two files and running
mv config.old config.yml. You rewind to before all of it. What is on disk afterwards?Show answerAnswer
The two edited files are back to their earlier contents; the
mvstill stands. Checkpointing tracks files edited through Claude's file-editing tools, and Bash commands are not tracked —rm,mvandcpcannot be undone through rewind.So afterwards
config.ymlstill holds what used to beconfig.old, andconfig.oldis still gone, while the two source files look as they did before the turn. This is the whole rule in miniature: rewind is not undo, the checkpoint covers the edits, and git covers everything — so commit before the risky thing. -
You have just spent twenty turns on a noisy debugging detour, and the instructions at the very start of the session still matter. Which single menu option gets you the space back without losing them?
Show answerAnswer
Summarize from here, selected at the checkpoint where the detour began. It compresses the conversation from that point forward, which is exactly the mess, while leaving your original instructions intact at the top of the session.
It is a targeted
/compactin which you choose the boundary. Do not reach for Summarize up to here — that compresses everything before the point instead, which is exactly where the instructions you want to keep are living. -
Your project's
.eslintrcis a symlink into a dotfiles repo, and Claude edited it an hour ago. You restore code to before that edit. What is in the dotfiles repo afterwards, what does Claude Code tell you, and how do you get the old contents back?Show answerAnswer
Claude's edit stands — the dotfiles repo still has the new contents. A code restore skips symlinked and hard-linked paths, and those files keep whatever they currently hold.
Claude Code tells you so with a
Restored the code, but skipped N fileswarning. To get the old contents back you ask Claude to reverse the edit, or do it yourself; rewind will not do it for you. Worth knowing which version you are on: before v2.1.216 there was no skip and no warning at all —/rewindwrote and deleted straight through the link into whatever it pointed at, and did not report the partial restore. -
Claude ran
/code-review --fixand it changed three files you did not want changed. Does/rewindget you back, and what decides the answer?Show answerAnswer
By default, no. What decides it is whether that review ran in the foreground: rewind reaches a
/code-reviewonly when it runs in the foreground, and since v2.1.218/code-review—--fixincluded — runs as a background review rather than inside your conversation.Claude Code still waits for it in a handful of situations, and there the edits land in your turn and are checkpointed as usual: a non-interactive
-prun or the Agent SDK, a second invocation started while an earlier run of the same review is still going, andCLAUDE_CODE_DISABLE_BACKGROUND_TASKSset to1. Otherwise you revert with git. And check the answer against the build you are on rather than the one you learned on — this default moved once already, in the same release ascontext: fork.