Claude Code checkpoints vs other AI coding agent checkpoints

Eight coding agents compared on what their checkpoints snapshot, when, and whether a restore also reverses what shell commands did.

Updated October 2026

Claude Code checkpoints, Cursor checkpoints and Gemini CLI checkpointing all restore files the agent edited, but they differ on one question that matters most: what happens to changes a shell command made. Claude Code's /rewind doesn't restore them. Cline, OpenCode and Darce snapshot the working tree, so they can. Codex CLI currently has no file undo at all.

Last checked: October 2026. Agent features change fast; each claim below links to the source we used.

This page compares how undo works in eight coding agents: what each one snapshots, when, what a restore puts back, and what none of them can reverse.

Quick answer: which agents can undo what

AgentUndo commandSnapshot mechanismWhen a snapshot is takenNeeds git
Claude Code/rewind or Esc EscCopies of files Claude's edit tools changeEach prompt you sendNo
CursorRestore CheckpointLocal snapshots, separate from gitBefore the Agent makes "significant changes"No
Codex CLINone todayNone (ghost snapshots removed April 2026)n/an/a
Gemini CLI/restore (off by default)Shadow git repo in ~/.gemini/history/When you approve a file-changing toolUses git
ClineRestore Files / Restore Files & TaskShadow git repoAfter each tool use, commands includedUses git
OpenCode/undo, /redoSeparate git directory snapshotting the work treeEach model stepYes
Aider/undoReal git commits in your repoEach edit Aider makesYes
Darce/undo, /rewind or Esc EscGit commit objects under private refsBefore every step that can change the projectFor shell effects

What each checkpoint actually restores

The part people get wrong is the second column. "Checkpoint" sounds like a full snapshot of your project, but in several agents it only covers files the agent wrote with its own edit tool.

AgentFiles the agent editedShell command effects (rm, mv, generators, installs)Untracked filesGitignored filesConversationSurvives restart
Claude CodeYesNoOnly if Claude's edit tools touched themOnly if Claude's edit tools touched themYesYes, about 30 days
CursorYesNot documentedNot documentedNot documentedNo, files onlyNot documented
Codex CLINoNoNoNoEsc Esc forks the chatn/a
Gemini CLIYesNo checkpoint before shell-only stepsYesNo (copies your .gitignore)YesNot documented
ClineYesYes, per the docsYesNot documentedYesNot documented
OpenCodeYesYes, inside the projectYes, except large filesNoYesNot documented
AiderYesNon/an/aNoYes, commits are permanent
DarceYesYes, in a git repoYesNoYesNo, session only

"Not documented" means the official docs don't say and we didn't want to guess. The details per tool follow.

Claude Code checkpoints and /rewind

Claude Code captures the state of your code before each prompt you send. Run /rewind or press Esc twice on an empty prompt to pick a message, then restore code, conversation, or both. Checkpoints are saved with the session, so rewind works after you resume. Claude Code keeps the 100 most recent checkpoints per session and deletes snapshots about 30 days after the session last saved one (cleanupPeriodDays changes that).

The limit is stated plainly in the docs: "Checkpointing does not track files modified by Bash commands." If Claude ran rm, mv or cp, rewind leaves the result in place. Most subagent edits, symlinked and hard-linked files (including files pnpm hard-links into place), and changes from outside the session are also not restored. We cover the recovery steps in what Claude Code's /rewind can't undo.

Cursor checkpoints and Restore Checkpoint

Cursor's docs say checkpoints "save snapshots of your codebase during an Agent session," created "before making significant changes." You restore from the chat timeline, the Restore Checkpoint button on a previous request, or the + button on hover. Two documented points:

  • Restoring reverts files only. It "does not remove messages from the conversation."
  • Checkpoints are "stored locally and separate from Git" and meant for undoing Agent changes.

The docs don't say whether files changed by terminal commands are covered. On Cursor's forum, users have reported that a restore didn't bring back files deleted from the command line, and Cursor staff have pointed people to VS Code's Local History: Find Entry to Restore as a fallback that works independently of checkpoints. Treat terminal changes as not covered until Cursor documents otherwise.

Does Codex CLI have undo?

Not anymore. Codex CLI used to have an experimental /undo built on "ghost snapshots": unreferenced git commits taken each turn. OpenAI removed ghost snapshots in April 2026, and the change made undo "a no-op that reports the feature is unavailable." The current command reference lists /fork and says Esc twice on an empty composer lets you "edit the previous user message and fork the chat from that point." That forks the conversation; the docs don't say it restores files.

Codex's protection is prevention instead of recovery: an OS-enforced sandbox that by default limits writes to the workspace, keeps .git read-only and turns the network off. That stops a lot, but nothing inside the workspace can be rolled back by Codex itself. More on that trade-off in sandbox vs undo.

Gemini CLI checkpointing and /restore

Gemini CLI checkpointing is disabled by default. Turn it on in settings.json (the --checkpointing flag was removed in 0.11.0):

{
  "general": {
    "checkpointing": {
      "enabled": true
    }
  }
}

When you approve a tool that modifies files, such as write_file or replace, Gemini CLI commits your project to a shadow git repo in your home directory and saves the conversation and the pending tool call. /restore lists checkpoints; /restore <name> puts files and conversation back and re-proposes the tool call.

From the source, the shadow repo copies your project's .gitignore, so ignored files aren't captured, and each checkpoint stages the whole working tree. Because checkpoints are only taken before file-writing tools, a shell command that runs on its own doesn't get one.

Cline checkpoints

Cline's checkpoints are on by default. Cline "maintains a shadow Git repository separate from your project's actual Git history," and "after each tool use (file edits, commands, etc.)" commits the current state of your files to it. The docs say checkpoints "capture everything, including files not tracked by Git." Restore options are Restore Files, Restore Task Only and Restore Files & Task. The docs warn that very large repositories can make checkpoints slow and storage-hungry.

OpenCode /undo and /redo

OpenCode's /undo "removes the most recent user message, all subsequent responses, and any file changes," and /redo brings them back. The docs say it uses git internally, so "your project needs to be a Git repository." In the source, snapshots live in a separate git directory under OpenCode's data folder, cover the whole work tree at each model step, skip gitignored files and large untracked files, and are pruned after 7 days. Because it snapshots the tree rather than its own edits, files a shell command changed inside the project are covered. Compare: Darce vs OpenCode.

Aider: a git commit per change

Aider takes the simplest approach: every edit is a real commit with a descriptive message, and it commits your pre-existing dirty changes first so they stay separate. /undo will "undo the last git commit if it was done by aider." That history is permanent and easy to inspect with normal git tools. It doesn't cover what a /run command changed, and --no-auto-commits turns the safety net off. Compare: Darce vs Aider.

Darce: snapshots before every step, shell commands included

Darce snapshots your working tree before every step that can change the project, including steps that run shell commands. /undo steps back one change; /rewind or Esc twice opens a tape of every change in the session with a live diff, and Enter puts files and the conversation back.

In a git repository, each snapshot is a commit object under private refs. Darce never touches your branch, index or stash. A swarm merge reverts as one step. The limits, stated honestly:

  • Undo history lasts for the session. Darce removes its refs when you quit. Claude Code and Aider are better here.
  • Gitignored files aren't snapshotted. Undoing an npm install restores package.json and the lockfile, but node_modules keeps the package until you reinstall.
  • Outside a git repo, /undo covers Darce's own edits and new files, not shell effects.

Full details: how undo works.

What no checkpoint can undo

Every tool above restores files on your machine. None of them can reach anything that already left it:

  • a deploy to production
  • a database migration or a destructive SQL statement against a real database
  • git push, especially --force
  • a package published to npm or PyPI
  • an email, Slack message, webhook or paid API call
  • a cloud resource created or deleted

The only defence for these is to stop them before they run. Darce scores every command and, in its default auto mode, makes deploy, migrate, seed and release scripts, database clients and network-reaching commands wait for approval, with a prompt that says /undo can't reverse them. See Safety. Claude Code's auto mode classifier blocks production deploys, migrations and force push by default. Codex's sandbox keeps the network off unless you enable it. If you turn all of that off, read YOLO mode with a safety net first.

How to protect your work with any agent

  1. Commit or stash before you hand over a task. A commit outlives any agent's checkpoints. A clean tree also means git diff shows exactly what the agent did.
  2. Work on a branch. If a session goes badly, git switch - and delete the branch.
  3. Know whether your agent tracks shell commands. If it doesn't (Claude Code, Cursor as documented, Codex, Aider), be stricter about approving rm, mv, generators and formatters.
  4. Turn checkpointing on where it's off. Gemini CLI needs general.checkpointing.enabled: true.
  5. Keep editor local history on. VS Code Timeline and JetBrains Local History have saved files that no agent checkpoint covered.
  6. Gate remote side effects. Deny or ask rules for git push, deploy scripts and database clients matter more than any undo feature. Running the agent in a container helps too; see sandbox vs undo.

Sources

Frequently asked questions

Does Claude Code have checkpoints?

Yes. Claude Code saves a checkpoint before each prompt you send. Run /rewind or press Esc twice to restore code, the conversation, or both. Checkpoints don't cover files changed by Bash commands.

Do Cursor checkpoints undo terminal commands?

Cursor's docs don't say. They describe checkpoints as snapshots for undoing Agent changes, and restoring reverts files only, not chat messages. Users on Cursor's forum have reported that files deleted from the command line weren't brought back.

How do I enable checkpointing in Gemini CLI?

Checkpointing is off by default. Set general.checkpointing.enabled to true in settings.json; the --checkpointing flag was removed in version 0.11.0. Then use /restore to list and restore checkpoints.

Does Codex CLI have an undo command?

Not currently. Codex's experimental /undo, built on ghost snapshots, was removed in April 2026. Esc twice lets you edit an earlier message and fork the chat, but the docs don't say it restores files.

Which AI coding agents can undo shell command changes?

Cline snapshots after each tool use including commands, OpenCode snapshots the whole work tree each step, and Darce snapshots before every step in a git repo. Claude Code, Aider and Codex don't reverse shell effects.

Are checkpoints a replacement for git?

No. Most checkpoints are session-level and some expire or disappear when you quit. Commit before handing an agent a task so you always have a restore point.

Related guides