AI Coding Tools

Claude Code Checkpointing: How to Undo Changes with /rewind (2026)

Aug 19, 20269 min read

Press Esc twice when the prompt input is empty, or type /rewind, pick a checkpoint, then choose what to restore: code, conversation, or both. Checkpoints are created automatically after every prompt, keep the 100 most recent per session, and auto-delete after 30 days (configurable). But /rewind can't undo bash commands, doesn't always restore subagent edits, and isn't a replacement for git.

- Cross-checked directly against the official docs at code.claude.com/docs/en/checkpointing, /commands, and /settings at time of writing (Aug 2026); this is a fast-moving feature, so verify the live docs before you depend on it.

What checkpointing actually saves

Claude Code automatically captures the state of your code before every prompt you send. A few facts worth getting right up front, per the official docs:

  • Every user prompt creates a new checkpoint - automatic, nothing to enable.
  • Only Claude's own file-editing-tool changes are tracked - not every change that happens on disk (details in the "can't undo" section below).
  • The 100 most recent checkpoints per session are kept. When an older checkpoint is discarded, snapshot files no remaining checkpoint references get deleted too - except each file's first snapshot, which the VS Code extension keeps as the baseline for its session diffs.
  • Checkpoints save with the conversation, so /rewind still works after you /resume a session.
  • Checkpoints are deleted along with the session after 30 days under the default cleanup rule, adjustable via cleanupPeriodDays in settings.json (default 30, minimum 1 day per current docs - this is a value that can shift release to release, so verify before relying on the exact number).

New to Claude Code and unsure what a session, prompt, or tool-call even means? Start with what Claude Code is before the rest of this guide.

How to open and use /rewind, step by step

Two ways to open the rewind menu:

  1. Type /rewind and press Enter.
  2. Press Esc twice while the prompt input is empty.

Common surprise: if the prompt box has text in it, Esc Esc just clears that draft into your input history instead of opening the rewind menu. The cleared text isn't lost - press Up to recall it after you're done in the menu.

The rewind menu lists every prompt you sent during the session. Pick a point, then choose an action:

ActionWhat it does
Restore code and conversationReverts both code and conversation to the selected point.
Restore conversationRewinds to that message while keeping current code.
Restore codeReverts file changes while keeping the conversation.
Summarize from hereCompresses the conversation from this point forward into a summary, freeing context space.
Summarize up to hereCompresses the conversation before this point, keeping later messages intact.
Never mindExits the menu without changing anything.

The two code-restore options only appear when the selected checkpoint actually has tracked file changes to revert - otherwise the menu offers just Restore conversation, the two Summarize options, and Never mind. With either Summarize option, you can type instructions into the "add context (optional)" field to steer what the summary focuses on; selecting it with the number key instead summarizes immediately with no extra instructions.

What /rewind can't undo

This is the part most other guides skip or oversimplify. Four real limitations, straight from the official docs:

LimitationDetail
Bash-command changes aren't trackedrm file.txt, mv old.txt new.txt, cp source.txt dest.txt run through bash cannot be undone via rewind - only changes made through Claude's file-editing tools are tracked.
Subagent edits are usually NOT restoredThe one exception: a skill running context: fork in the foreground (background: false) edits your working tree during your own turn, so rewind restores those edits as usual. Every other subagent - including a forked skill running in the background (the default) and a background /code-review --fix - is NOT restored by rewind; use git instead.
External changes aren't trackedManual edits made outside Claude Code, or edits from a separate concurrent session, are normally not captured unless they happen to touch the same files as the current session.
Symlinked/hard-linked files are skippedChoosing Restore code or Restore code and conversation, Claude Code skips any tracked path that's a symlink or hard link and shows a Restored the code, but skipped N files warning. To see which paths get skipped before it happens, turn on /debug before restoring - the log lands at ~/.claude/debug/<session-id>.txt.

And one thing that matters more than any single row above: checkpoints are built for fast, session-level recovery, not as a replacement for version control. Permanent history, branching, and collaboration still need git.

/rewind vs git vs /clear - the decision table

The most practical question here: which tool for which situation? The right one saves seconds; the wrong one can cost an afternoon.

ScenarioBest toolWhy
Undo Claude's last few edits mid-task/rewind → Restore codeFast, no leaving Claude Code, keeps the conversation intact if you want it.
Conversation drifted but the code is fine/rewind → Restore conversationRolls back context without touching files that are already correct.
Want to permanently save a working stategit commitCheckpoints auto-delete after ~30 days and aren't real version control; a commit is the durable history.
Claude ran rm/mv/npm install and it needs revertinggit (or manual fix) - not /rewindBash-driven changes aren't tracked by checkpointing, so rewind can't touch them.
Context is huge but you still want to keep working/rewind → Summarize, or /compactCompresses the conversation to free context space without losing the original detail in the transcript.
Want a fresh start but keep the files/clearStarts a new conversation with empty context; files on disk are untouched.

The exact one-line descriptions from the commands reference: /rewind - "roll code and conversation back to a checkpoint, or summarize part of the conversation"; /clear - "start a new conversation with empty context"; /compact - "free up context by summarizing the conversation so far". If you want to try a different direction without losing the original conversation, there's also /branch - it forks the conversation at the current point.

Rewinding past a /clear (new since v2.1.191)

This is the least-known trick in this guide. If you ran /clear earlier in the same Claude Code process, the rewind menu shows an extra entry at the top of the list: /resume <session-id> (previous session). Select it to jump back to the exact conversation that existed before you ran /clear.

A few things to know before you rely on this:

  • The entry only stays available until you exit Claude Code or resume a different session - it's not permanent.
  • It requires Claude Code v2.1.191 or later. On earlier versions, the entry doesn't appear - use /resume manually and pick the previous session from the list instead.
  • The version gate itself is proof of something worth remembering: checkpointing is still changing release to release, not a fixed API surface.

A safe-experimentation habit I actually use

Here's how I really combine these two tools: commit to git at milestones that already run clean (a feature done, a bug fixed, tests green), then let /rewind absorb the small mistakes that happen between those commits. Rewinding early and often is basically free - a few seconds, nothing lost. Fixing a conversation that's drifted far off course is not cheap at all; you end up re-explaining context and requirements, and Claude can still repeat the same mistake.

This habit lines up directly with the vibe coding mindset: cheap experiments, fast reverts, no fear of breaking a working state. It's also why TDD with AI pairs so well with checkpointing - every red-green-refactor loop is a safe rewind point if Claude heads in the wrong direction.

Where AgentKit fits into this

To be direct about the boundary: /rewind is a native Claude Code feature that works entirely on its own, nothing to install. AgentKit (a paid kit that runs inside Claude Code, different from Codex and from OpenAI AgentKit) doesn't touch or replace this checkpoint system. Where it's useful: AgentKit's brainstorm → plan → cook → ship workflow runs several edit steps in the same session, so when one $ak:cook step goes the wrong way, /rewind lets you undo just that step without losing the rest of the session. Read the full AgentKit review or see AgentKit here.

Frequently asked questions (FAQ)

Does /rewind undo bash/terminal commands?

No. Checkpointing only tracks changes made through Claude's file-editing tools. Commands run through bash, like rm, mv, or cp, are not captured and can't be undone with rewind - use git or a manual fix instead.

How long are checkpoints kept, and can I change that?

By default, checkpoints are deleted with the session after 30 days, with up to 100 most-recent checkpoints kept per session. Change the retention period with cleanupPeriodDays in settings.json (default and location confirmed against the docs at time of writing - re-verify if you're relying on the exact number).

Can I still rewind after resuming an old session?

Yes. Checkpoints save with the conversation, so after you /resume a session, /rewind still works normally against that session's saved checkpoints.

What happens if I /clear and then want an old checkpoint back?

Open /rewind - the top of the list shows /resume <session-id> (previous session); select it to return to the conversation from before /clear. This needs Claude Code v2.1.191 or later and only stays available until you exit the app or resume a different session; earlier versions require using /resume manually.

Is /rewind a replacement for git?

No, and it isn't meant to be. Checkpoints exist for fast, session-scoped recovery, not permanent history or collaboration. For durable saved states, branching, or teamwork, you still need git.

Do subagent edits get restored by rewind?

Usually not. The exception: a skill running context: fork in the foreground (background: false) edits your working tree during your own turn, and those edits are restored normally. Every other subagent - including a forked skill running in the background by default, and a background /code-review --fix - needs git to revert.

Conclusion

/rewind is a fast, session-level undo tool, not a git replacement. Use it for the small mistakes between commits; use git for anything you want to keep permanently, or anything Claude changed through bash. Keep the decision table above handy whenever you're unsure which tool to reach for, and commit at clean milestones before letting Claude try a new direction.

J

Jasmine

Author · Jasmine Daily

The writer behind Jasmine Daily - jotting down thoughts, experiences, and everyday moments. Honest, unhurried, imperfect.

Jasmine Daily

There's more waiting to be read.

If this piece spoke to you, browse a few more pages from the journal.

Read next

Related posts