By Priya Raman, NBT

Every AI coding agent will eventually make a change you don't want. It refactors the wrong module, "fixes" a test by deleting it, or takes a direction that looked fine three prompts ago and doesn't now. Both Claude Code and Cursor (now Grok Build after xAI's rename) have a built-in undo for this: checkpoints.

They look alike from a distance. Up close they differ in what they restore, what they miss, and how you get to them. Those differences decide whether "just roll it back" works or quietly leaves half the change in place. This comparison uses Anthropic's checkpointing page and the agent overview in the Grok Build docs (where Cursor's docs now redirect), both read on 6 December 2026. For the bigger picture, see our full Claude Code vs Cursor comparison.

Side by side

Claude Code Cursor / Grok Build agent
When a checkpoint is made Every prompt you send that starts a turn Automatically, before the agent makes significant changes
How to open them /rewind (alias /undo), or Esc twice on an empty prompt Click a checkpoint in the chat timeline, the Restore Checkpoint button on a past request, or the + button when hovering over a message
Restore files Yes ("Restore code") Yes, "revert all files to that state"
Restore the conversation Yes, separately or together with code No: "Restoring a checkpoint reverts files only; it does not remove messages from the conversation"
Preview before restoring The rewind menu lists your prompts and which ones have file changes Click a checkpoint to preview your files at that point
Where they live Saved with the conversation, so they survive resuming a session Stored locally, separate from Git
Extra Summarize from or up to a point to free context n/a

Both vendors say the same thing about scope. Anthropic: checkpoints are "designed for quick, session-level recovery", not a replacement for version control. The Grok Build docs: use them "for undoing Agent changes; use Git for permanent version control."

Claude Code: three kinds of rewind

Claude Code's rewind menu lists the prompts you sent in the session. Pick one, then choose:

  • Restore code and conversation: both go back to that point.
  • Restore conversation: rewinds the chat but keeps the current files. Use it when the code is fine but the conversation went down a confusing path.
  • Restore code: reverts files but keeps the conversation. Use it when you want Claude to remember what it tried and why it failed, then take another approach.

That last option is the one Cursor doesn't have an equivalent for in the same step, and it's useful. "Restore code, then: that approach broke the migrations, try it without changing the schema" gives the agent the lesson without the damage.

There are also two Summarize options, which compress part of the conversation to free context without touching files.

Cursor: restore files, keep talking

In the Grok Build agent, checkpoints appear in the chat timeline. You click one to preview your files at that point and restore if it's what you want. The conversation stays as it was, so the agent still sees everything it did. If you want a truly fresh start, you open a new chat after restoring.

That's a reasonable default: you don't lose your explanation of the task. Just tell the agent what you restored and why, so its next step doesn't build on files that are no longer there.

What neither of them catches

The trouble spots are where the tools agree, and they're worth knowing before you rely on either.

Changes made by shell commands. Claude Code's docs are explicit. It tracks edits made by its file editing tools. A file that only shell commands changed isn't tracked and "stays as it is". Think of a formatter run, a code generator, npm install rewriting a lockfile, or a migration that changed your local database. The Grok Build docs describe checkpoints as capturing the state of all modified files before the agent's significant changes. Either way, don't expect a checkpoint to undo rm, a database change, or anything outside your project folder.

Edits made in parallel. In Claude Code, edits by most subagents aren't captured in your session's checkpoints. Rewinding restores only files Claude itself had already edited, and the subagent's other changes stay. (A forked skill running in the foreground is the exception.)

Your own edits in between. Claude Code warns that restoring code can throw away changes you or another session made to a file after the checkpoint, if Claude had edited that file. Commit or copy your own work first.

Time. Claude Code keeps snapshots for the 100 most recent checkpoints in a session, and deletes a session's snapshot files about 30 days after the session last saved one (adjustable with cleanupPeriodDays). Older restores can fail with "No files were restored".

A routine that works in both

Checkpoints are the fast undo. Git is the safety net underneath. A simple routine covers the gaps either way:

  1. Start each task on a clean tree. git status should show nothing before you ask for a significant change. Then "undo everything" is always git restore . plus deleting new files (git clean -n to preview, -f to do it).
  2. Commit at each good state. When a step works, commit it, even with a message like "wip: parser passes tests". Checkpoints are per session. Commits survive everything.
  3. Use checkpoints for the last few minutes. Wrong approach just now? Rewind or restore. That's what they're best at.
  4. Use Git for anything older, or anything a shell command touched. git diff shows what really changed, including files the checkpoint didn't track.
  5. Check after restoring. Run git status and your tests after any checkpoint restore. If files you expected to revert are still modified, a shell command or subagent probably made them.

Which is better?

For undo alone, Claude Code gives you more control: separate code and conversation restores, and the option to keep the lesson while dropping the change. The Grok Build agent's in-timeline preview is quicker to scan when you're not sure which point you want. Neither replaces committing often, and both teams say so in their own docs.

If you switch between the two, the habit that transfers is the Git one. Clean tree before, commits at good states, git diff after. The checkpoints then become a convenience rather than something you have to trust.