GuidesHosting choices

Claude Code /rewind and checkpoints: what they undo

How Claude Code's /rewind and Esc Esc work: the restore and summarize choices, what checkpoints miss (Bash, subagents), 30-day retention, and -p rewinds.

November 27, 2026The Everpod team
The short answer

Type /rewind (also /undo or /checkpoint), or press Esc twice on an empty prompt. Pick one of your earlier prompts, then choose Restore code and conversation, Restore conversation, Restore code, Summarize from here or Summarize up to here. Claude Code takes a checkpoint before every prompt you send, but it only tracks edits made by its own file tools: a file that only a shell command changed, edits you made in your editor, and most subagent edits are not restored. Snapshots go after about 30 days by default. It is an undo for the session, not a replacement for git.

Open the rewind menu

/rewind          # or /undo, or /checkpoint
Esc Esc          # with the prompt input empty
Copied

If the prompt has text in it, the first double Esc clears it instead, and the cleared text goes to your input history, so Up brings it back after you are done in the menu. In vim mode, press Esc twice from NORMAL mode. The menu lists the prompts you sent in the session; each prompt that started a turn is a checkpoint, because Claude Code captures your files “before each prompt you send that starts a turn”, per Anthropic’s checkpointing page (as of November 2026). It has existed since Claude Code 2.0.0.

In the VS Code extension, hover over any message and a rewind button appears, with three choices: Fork conversation from here, Rewind code to here, and Fork conversation and rewind code. For cloud sessions at claude.ai/code, Anthropic’s docs mention a Rewind to here action only in a troubleshooting entry: on a self-hosted runner with Claude Code before v2.1.246 it fails on any message except the newest.

What each choice does

ChoiceYour filesThe conversation
Restore code and conversation
Back to that pointBack to that point
Restore conversation
Left as they are nowBack to that point
Restore code
Back to that pointKept in full
Summarize from here
UntouchedThat message onward becomes a summary
Summarize up to here
UntouchedEverything before it becomes a summary; later messages stay
Never mind
UntouchedUntouched

The two code options only appear when Claude’s tracked edits after that point have something to revert. If you only see Restore conversation and the summarize options, the checkpoint has no captured file changes.

After Restore conversation or Summarize from here, the prompt you picked is put back in the input box, so you can edit it and send it again. To steer a summary, highlight a Summarize option with the arrow keys and type into the row that reads “add context (optional)”; pressing the option’s number key summarizes straight away. A summary does not touch your files and the original messages stay in the transcript. Claude Code’s /compact covers when a summary is the better tool than a whole-conversation compact.

Two details catch people out. If you rewind the conversation and then exit before sending another prompt, the rewound messages can come back next time; send Claude a prompt before you exit, because the rewind is saved together with it (restored files stay restored either way). And if you ran /clear earlier in the same Claude Code process, the top of the menu has a /resume <session-id> (previous session) entry that takes you back to the conversation before the clear.

What a rewind does not undo

Checkpoints follow Claude’s file editing tools (Write, Edit and NotebookEdit). Everything else depends on whether one of those tools had already touched the file:

When a restore skips files, Claude Code says so:

Restored the code, but skipped 2 files: the tracked path is (or became) a link or other non-regular file, its directory changed since the checkpoint, or its backup could not be safely read. Skipped files were left untouched — run with --debug for the paths.
Copied

The message only gives a count. Run /debug before the restore and the log at ~/.claude/debug/<session-id>.txt names each skipped path; on macOS or Linux find . -type l lists symlinks and find . -type f -links +1 hard-linked files. For a skipped file, ask Claude to reverse its edit or fix it yourself.

How long checkpoints last, and where

Snapshots are stored per session in ~/.claude/file-history/<session>/ as pre-edit copies of the files Claude changed, and checkpoints are saved with the conversation, so /rewind still works after you resume the session. Two limits apply:

The failure looks like this:

Failed to restore the code:
No files were restored: 1 file failed (backup missing, or the file could not be updated)
Copied

Once the backups are gone, trying again fails the same way; restore from git or ask Claude to reverse the edits. The same message appears if Claude Code could not write a file (fix the permissions and run /rewind again), or in a fork made with /branch or --fork-session when copying a backup into the fork failed, for example on a full disk. Before v2.1.260, missing backups were skipped silently and the rewind looked like it had worked, so update if you are on something older. To keep snapshots longer, raise the retention in ~/.claude/settings.json; it also keeps transcripts longer, which matters if they hold secrets:

{
  "cleanupPeriodDays": 90
}
Copied

Clearing these out is optional, and permanent. Deleting ~/.claude/file-history/ yourself loses checkpoint restore for past sessions. claude purge on a project deletes its sessions’ file-history/ entries along with its transcripts and auto memory, after a confirmation that reads “This cannot be undone”; deleting Claude Code sessions and history covers both.

Turn checkpointing off

The setting is fileCheckpointingEnabled, on by default. In /config it is Rewind code (checkpoints), and toggling it there writes the key to your user settings. It can sit in any settings file; the settings.json guide covers which file wins.

{
  "fileCheckpointingEnabled": false
}
Copied

For one session, start with CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING=1 claude. Whichever of the two turns it off, the other cannot turn it back on. With checkpointing off, no file snapshots are taken, so /rewind cannot restore code changes.

Rewind in claude -p and the Agent SDK

A claude -p run has no menu, and file checkpointing is off there unless you ask for it: fileCheckpointingEnabled is ignored in -p and SDK sessions (unless managed settings set it to false, which keeps it off from Claude Code v2.1.331). In the Agent SDK, set enableFileCheckpointing: true (TypeScript) or enable_file_checkpointing=True (Python) and call rewindFiles() or rewind_files() with the UUID of the user message to go back to; the SDK checkpointing page shows the full pattern, including the replay-user-messages option you need for those UUIDs. This restores files only; the conversation is not rewound.

If you captured the session ID and the checkpoint’s message UUID, you can also rewind from a shell. The SDK turns checkpointing on for you, but a direct claude -p needs CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING set on the command, and the original session must have had checkpointing enabled:

CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING=true claude -p --resume <session-id> --rewind-files <checkpoint-uuid>
Copied

--rewind-files does not appear in claude --help, but the CLI accepts it. On success it prints Files rewound to state at message <checkpoint-uuid> and exits without sending a prompt. A bare claude -p with --rewind-files and no variable fails with “File rewinding is not enabled”. On a server where Claude Code runs unattended, that makes checkpoints something you plan for at launch, not something you can reach for afterwards.

Checkpoints and git

Anthropic puts it plainly: checkpoints “are designed for quick, session-level recovery”, and permanent history belongs in version control. Rewind is the fast way back from a turn that went wrong; by default its snapshots go after about 30 days, and it misses files only shell commands changed. For commits, branches and undoing what Claude did in git, see Claude Code and git.

Run Claude Code on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.