Claude Code checkpoints rewind session management 2026

Claude Code Checkpointing & /rewind: Complete Guide 2026

The Prompt Shelf ·

Claude Code automatically saves a checkpoint before every file edit. When something goes wrong — or when you just want to try a different approach — /rewind lets you restore code, conversation, or both to any prior point in the session. This guide covers how checkpoints work, all the restore and summarize options, what they can’t track, and patterns for getting the most out of them.


How Checkpoints Work

Every user prompt that results in Claude making a file edit creates a new checkpoint. The checkpoint captures file state before the edit, so you always have a rollback point.

Key properties:

  • Automatic — no opt-in required; checkpointing runs continuously
  • Persistent across sessions — checkpoints survive claude --resume
  • 30-day retention — cleaned up automatically after 30 days (configurable)
  • File-edit scoped — only edits made through Claude’s file editing tools are tracked (more on this below)

Opening the Rewind Menu

Two ways:

/rewind

Or press Esc twice when the prompt input is empty.

If the input contains text, double Esc clears it instead of opening the menu. The cleared text is saved to input history — press Up to recall it after you finish with rewind.

The menu lists every prompt you sent during the session. Select a point, then choose what to do.


All Six Options

Restore code and conversation

Full rollback. Both your files and the conversation history return to exactly the state at the selected message. The original prompt is restored to your input field so you can re-send or edit it.

Use this when Claude went in a wrong direction entirely and you want to start fresh from a known good state.

Restore conversation

Rewinds the conversation to that message while leaving your current code intact. Files are unchanged; only the chat history reverts.

Use this when you want to re-approach a problem with different instructions, but the code changes so far are fine to keep.

Restore code

Reverts file changes back to the state at that checkpoint while keeping the full conversation history. The conversation stays, the files revert.

Use this when you want Claude to see the full context of what was discussed but need to undo a bad set of edits.

Fork conversation from here

Starts a new conversation branch from the selected message while keeping all code changes intact. The original session stays untouched.

This is different from restore: you’re branching, not reverting. Use it to explore an alternative approach without losing what you have.

To fork and rewind code simultaneously, combine this with “Rewind code to here” — or use claude --continue --fork-session from the CLI.

Summarize from here

Compresses the conversation from the selected message forward into an AI-generated summary. Messages before the selection stay in full detail; everything from the selection onward (including the selection itself) becomes a summary.

Use this to discard a verbose debugging detour while keeping early context intact. Frees context window space without losing the initial setup.

Summarize up to here

Compresses the conversation before the selected message into a summary. The selected message and everything after stays intact. You remain at the end of the conversation.

Use this to compress early setup discussion while keeping recent work in full detail. Equivalent to /compact but targeted — you choose where to cut.

Both summarize options preserve the original messages in the session transcript. You can pass optional instructions to guide what the summary focuses on.


VS Code Extension: Rewind from the Chat Panel

In the VS Code extension, hover over any message to reveal the rewind button. Three options appear:

  • Fork conversation from here — new branch, code unchanged
  • Rewind code to here — revert files, keep conversation
  • Fork conversation and rewind code — both

The full six-option menu (including summarize) requires running /rewind from the CLI in the integrated terminal.


Critical Limitation: Bash Commands

Checkpointing only tracks files modified through Claude’s file editing tools. Changes made via bash commands are not tracked:

# These are NOT tracked by checkpoints:
rm file.txt
mv old.txt new.txt
cp source.txt dest.txt
echo "data" >> config.json

If Claude runs a bash command that modifies files, those changes cannot be undone through /rewind.

Practical implication: for destructive operations — dropping a database, deleting files, overwriting config — ask Claude to use its file editing tools rather than shell commands if you want checkpointing coverage. Or commit to git first.


Checkpoints vs. Git

Checkpoints and version control serve different purposes:

CheckpointsGit
ScopeCurrent sessionAll history
GranularityPer-promptPer-commit
SpeedInstantRequires staging and committing
Bash changesNot trackedTracked
CollaborationLocal onlyShareable
Retention30 daysPermanent

Think of checkpoints as “local undo within a session” and Git as “permanent version history.” They complement each other — checkpoints let you iterate freely within a session; Git preserves the milestones worth keeping.


Real-World Patterns

Safe exploration

> Refactor the auth module to use the new token format

If the refactor looks wrong, /rewind → Restore code and conversation → try a different approach. No need to manually undo every edit.

Context compression mid-session

After a long debugging session with dozens of messages, the context window fills up. Open /rewind, select the message where debugging started, choose Summarize from here. The verbose back-and-forth becomes a compact summary; your initial instructions and codebase context stay in full.

Branch before a risky edit

Before asking Claude to do something potentially destructive:

  1. Note the current message count
  2. Ask Claude to proceed
  3. If the result looks wrong: /rewindFork conversation and rewind code from the pre-change message

This gives you the original state back plus a new branch to try a different approach.

Parallel approaches (CLI)

Use claude --continue --fork-session from the CLI to create parallel branches of the same session. Compare implementations side by side without losing either.


Configuring Retention

Checkpoints are cleaned up with sessions after 30 days by default. The retention period is configurable in ~/.claude/settings.json:

{
  "checkpointRetentionDays": 60
}

Set to 0 to disable retention limits (checkpoints kept indefinitely until manually cleared).


See Also

Related Articles

Explore the collection

Browse all AI coding rules — CLAUDE.md, .cursorrules, AGENTS.md, and more.

Browse Rules