Claude Code snapshots your files before each prompt that starts a turn, and /rewind can restore code, conversation or both. It only tracks edits made through Claude's file editing tools. Changes from shell commands, most subagent edits and anything you change outside the session are not covered, so keep using git.
How it works
Per Anthropic's checkpointing documentation, every prompt you send that starts a turn creates a checkpoint. Claude Code keeps file snapshots for the 100 most recent checkpoints in a session and saves checkpoints with the conversation, so you can rewind after resuming. Snapshots are deleted by the retention sweep, by default about 30 days after the session last saved one. Rewinding past that can fail.
Open the menu with /rewind, or press Escape twice with an empty prompt. Choices include restore code and conversation, restore conversation only, restore code only, and two summarize options that compress part of the conversation to free context. Summarizing does not change files on disk.
What it cannot undo
The documentation lists its limits plainly:
- Bash command changes are not tracked. A delete, move or copy run through the shell cannot be undone with rewind.
- Subagent edits are usually not restored. A foreground forked skill is the exception. For others, only files Claude had already edited in your conversation are restored.
- External changes are not tracked. Manual edits and edits from other concurrent sessions are normally not captured.
- Symlinked and hard-linked paths are skipped on restore, with a warning that names the count.
- A message you type mid-turn may show no code restore of its own, since checkpoints are taken for prompts that start a turn.
The safe habit
Treat checkpoints as session level undo. The page says directly that they are not a replacement for version control.
- Work on a branch.
- Commit before a large agent task, so one command restores a known state.
- Review the diff, not the transcript, before you merge.
- If the agent ran shell commands that changed files, check git status after rewinding.
Rewind versus branch
Summarizing keeps you in the same session. To try a different approach while preserving the original session, the docs point to branching a session or continuing with a fork instead.
Why this matters for risk
An agent that can run shell commands can change things that no checkpoint tracks. That is a reason to run it in a sandbox, keep deny rules for destructive commands, and avoid pointing it at directories that hold the only copy of anything.
Quick check
Will /rewind undo a file Claude deleted with rm?
No. Files changed by Bash commands are not tracked.
Can I rewind after resuming a session?
Yes, checkpoints are saved with the conversation, until the retention sweep deletes the snapshots.
Sources
Last reviewed: 19 October 2026.