Progress will not be saved. This browser is blocking storage (often private browsing). You can still learn, but closing the tab loses your progress.
Practice needs JavaScript. The reading works without it.Back to the reading
Claude Code automatically saves the state of your code before each prompt you send. Every prompt that starts a turn is a checkpoint. You don't have to do anything to get them.
A few numbers worth remembering:
- Each session keeps snapshots for the 100 most recent checkpoints.
- Checkpoints are saved with the conversation, so you can still rewind after reopening yesterday's session.
- Snapshots are cleaned up about 30 days after they were last saved. Rewinding to a checkpoint that's been cleaned up reports
No files were restored. To keep them longer, changecleanupPeriodDays.
Checkpoints track the files Claude changes with its file editing tools (Edit, Write). That matters, and section 4 comes back to it.
Two ways:
- Type
/rewind(or its shorter alias,/undo). - Press
Esctwice while the prompt input is empty. If the input has text, doubleEscclears it instead of opening the menu; the text stays in your history, so pressUpto get it back.
The menu lists the prompts you've sent in the session. Pick the point you want to go back to, then choose what to do. Lesson 1.3 mentioned Esc for stopping Claude mid-action: one Esc stops, two Esc on an empty input go back.
At the point you pick, the menu offers:
| Option | Code | Conversation | When to use it |
|---|---|---|---|
| Restore code and conversation | Back to that point | Back to that point | The whole direction was wrong; redo from there |
| Restore conversation | Kept as it is | Back to that point | The code is fine, but the conversation has got muddled |
| Restore code | Back to that point | Kept as it is | Drop the changes, but keep what Claude learned |
The two code options only appear when there are tracked file changes after that point. After "Restore conversation", your original prompt goes back into the input: improve it and send it again, instead of typing another correction on top of the old one.
"Restore code" is often overlooked but very useful. Say Claude renamed the list function to findAll everywhere and you don't like it. Restore code puts the files back, while Claude still remembers what it tried and why you didn't like it, so the next attempt is closer.
The menu also has two summarize options: "Summarize from here" and "Summarize up to here". They compress part of the conversation into a summary to free context, without changing files. Type instructions on the "add context (optional)" row to steer the summary. It's like a targeted /compact; lesson 7.3 says more about context.
This is the most important part of the lesson. Checkpoints can't undo:
- Files that only Bash commands changed. In lesson 6.2, Claude inserted a line with
printf … >> src/app.jsinstead of Edit. If Claude hadn't already editedapp.jswith Edit in that session, that line isn't undone. (If it had, later Bash changes to that file are tracked.) - Subagent changes, in most cases. The debugger in lesson 4.3 worked in a separate worktree; a background subagent edits files your session doesn't record.
- Changes outside Claude Code: your own edits in an editor, another Claude session working on the same repo.
- Symlinked and hard-linked files: skipped, with a
Restored the code, but skipped N fileswarning. - Messages typed while Claude was working can be marked "No code restore"; pick the prompt that started that turn instead.
The docs are blunt: checkpoints are for quick recovery within a session, not a replacement for git.
Three tools, three jobs:
- Rewind: step back once or twice in the session you're in. Fast, no planning needed.
/branch name: copies the conversation so far into a new branch and switches you into it; the original stays intact, and/resumetakes you back. Use it to try another direction while keeping the old conversation. Note that both conversation branches still work on the same code folder. For two truly separate copies of the code, use a git branch or a worktree as in lesson 4.3.- Git: long-term history, sharing with the team, and the safety net for everything rewind can't see.
One simple habit ties them together: commit before a big change. Then rewind handles the small steps within a session, while git diff and git checkout handle everything else, including what Bash or subagents did.
With checkpoints, you can try the bold approach first, because stepping back is cheap. The docs pair that with two habits:
- Watch the first minute and press
Escas soon as Claude drifts. - Two failed corrections, then stop. A third correction just piles onto a conversation that already holds two failed attempts. Rewind to before them (or
/clear) and write one better prompt that folds in what you've learned.
For todo-api, refactoring a module looks like this: commit a clean state, plan in plan mode (lesson 7.1), approve, let Claude work step by step, and when a step goes wrong press Esc Esc, pick the point just before it, choose "Restore code and conversation", fix the prompt and send it again. The lesson's mission does exactly that with the input checks in the routes.
The next lesson, 7.3, covers the rest of long sessions: background work, managing and resuming sessions, and keeping context lean over hours of work.