TellWorldAI World Archive
Ask中文

Home›Practice›Practice

Practice

Claude Code checkpointing: rewinding mistakes

Claude Code checkpoints file edits before each turn. Use /rewind to restore code, conversation or both, summarize long sessions, and see which changes checkpoints cannot undo.

Who this is for

People who have used Claude Code to change code and found that a series of edits broke something. After reading, you can use /rewind to return to an earlier point, tell apart code restores from conversation restores, and know which changes checkpoints cannot undo, so you can fall back on version control for those.

What it is

A checkpoint is a snapshot that Claude Code takes automatically. Each prompt you send that starts a turn creates a checkpoint, which records the state of your code before that prompt. Checkpoints track the file edits made by Claude's file editing tools. They serve quick recovery within a session and do not replace version control.[1]

Setup

  • Work in your project with Claude Code as usual. Checkpointing is automatic and needs no extra switch.[1]
  • A session keeps file snapshots for its 100 most recent checkpoints. By default, snapshots are cleaned up about 30 days after the session last saved one. To keep them longer, set cleanupPeriodDays.[1]
  • Checkpoints are saved with the conversation, so /rewind still works after you resume a session.[1]

Opening the rewind menu

  1. Run /rewind, or press Esc twice when the prompt input is empty. Either way opens the rewind menu.[1]
  2. The menu lists the prompts you sent during the session. Select one, then choose an action.[1]
  3. If the prompt input contains text, double Esc clears it instead of opening the menu. The cleared text is saved to input history, so you can press Up to recall it after you finish in the rewind menu.[1]

What the six actions do

  • Restore code and conversation reverts both the code and the conversation to the selected point.[1]
  • Restore conversation rewinds to that message and keeps the current code.[1]
  • Restore code reverts file changes and keeps the conversation.[1]
  • Summarize from here compresses the conversation from that point forward into a summary, which frees context window space.[1]
  • Summarize up to here compresses the messages before that point into a summary and keeps the later messages intact.[1]
  • Never mind returns to the message list without making changes.[1]

After you restore the conversation or choose Summarize from here, the prompt from the selected message goes back into the input field, so you can re-send or edit it.[1] Summarizing does not change files on disk, and the earlier messages stay in the session transcript, so Claude can still refer to the details.[1]

The two code restore options appear only when the selected checkpoint has tracked file changes to revert. Otherwise the menu offers only Restore conversation, the summarize options and Never mind.[1]

When checkpoints help

Checkpoints are useful for trying a different implementation without losing your starting point, undoing a change that broke functionality, iterating on a feature with variations, and freeing context in a long session while keeping your first instructions.[1]

What checkpoints cannot undo

  • Bash command changes. Once Claude has edited a file with its file editing tools, /rewind undoes the changes that Bash commands make to that file afterward. A file that only Bash commands changed is not tracked and stays as it is. Revert those with version control such as Git.[1]
  • Subagent edits. Claude Code usually does not capture subagent edits in checkpoints. For most subagents, rewinding restores only the files Claude had already edited in your conversation, and the subagent's edits to other files stay.[1]
  • Changes made outside the session. Checkpointing only tracks files edited within the current session. Manual changes made outside Claude Code, and edits from other concurrent sessions, are normally not captured.[1]
  • Messages sent mid-turn. A message you type while Claude is still working can be marked No code restore, because it has no checkpoint of its own. To undo the file edits from the whole turn, select the prompt that started the turn and choose Restore code.[1]
  • Symlinks and hard links. Checkpointing does not rewind these. Restore code skips them and shows a Restored the code, but skipped N files warning.[1]

Common questions

**The restore fails with No files were restored.** The snapshots for that checkpoint have been cleaned up, because the session passed its retention period. Set cleanupPeriodDays to keep them longer.[1]

Rewound messages came back. If you exit before sending your next prompt, the rewound messages can return when you reopen the session. To remove them again, run /rewind in the session, select the same prompt and choose Restore conversation. Send a prompt before you exit, because Claude Code saves the rewound conversation together with that prompt.[1]

**You ran /clear and want the earlier conversation back.** After /clear in the same Claude Code process, the rewind menu shows a /resume <session-id> (previous session) entry at the top. Select it to resume the conversation from before /clear.[1]

You want to know which paths a restore skipped. Turn on debug logging with /debug before restoring. The log at ~/.claude/debug/<session-id>.txt names each skipped path.[1]

Next steps

For the full list of limits and the rewind menu details, use the official checkpointing documentation. For permanent version history and collaboration, keep using Git.[1]

Sources

  1. 1
    CheckpointingAnthropic Claude Code docs

Cite this page: Claude Code checkpointing: rewinding mistakes. TellWorld, https://www.tellworld.net/practice/practice-claude-code-checkpointing. Updated 2026-11-14

Related news

View all