What are checkpoints? Claude Code, Codex, Cursor and Grok
By Flavio
Checkpoints let you undo a coding agent's edits inside a session. How rewind works in Claude Code, Cursor and Grok Build, and what Codex documents instead.
Checkpoints are snapshots of your files taken while a coding agent works, so you can undo a bad turn without digging through Git. Rewind is the command that sends the files, and sometimes the conversation, back to one of those snapshots.
How checkpoints work
You send a prompt. The tool records the state of the files it is about to change. The agent edits. If the result is wrong, you pick that point and restore.
This is session recovery, not version control. A checkpoint lives with the session. Git is still where you keep history you want tomorrow, on another machine, or shared with someone else.
Checkpoints in each tool
| Claude Code | Codex | Cursor | Grok Build | |
|---|---|---|---|---|
| Open it | /rewind, or Esc twice on an empty prompt |
Not documented | A checkpoint in the chat timeline | /rewind, or Esc Esc while idle |
| What a restore puts back | Code, conversation, or either one | Not documented | Files only. Messages stay | Files and the conversation, together |
| What it tracks | Edits from Claude’s file tools | Not documented | Modified files, before significant changes | A point per prompt |
| After a resume | /rewind still works. Snapshots follow the session |
Not documented | Not documented | File snapshots are part of the saved session |
Claude Code
Claude Code tracks file edits automatically. Every prompt that starts a turn creates a checkpoint. It keeps file snapshots for the 100 most recent checkpoints in a session. Checkpoints are saved with the conversation, so /rewind still works after you resume.
/rewind, or Esc twice when the prompt is empty, opens a menu of the prompts you sent. You then pick an action. Restore code and conversation, restore the conversation only, or restore the code only. You can also summarize from the selected point forward, or summarize everything before it. Summarize compresses context and does not change files. If the prompt box has text in it, double Esc clears that text instead of opening the menu.
The two code restores show up only when that checkpoint has tracked file changes. A message you sent while Claude was still working can be marked with no code restore of its own. Select the prompt that started the turn to undo the whole turn’s file edits.
Bash-only changes are the gap. Once Claude has edited a file with its file tools, /rewind can undo later Bash changes to that same file. A file that only Bash touched is not tracked. Subagent edits are often outside the session’s checkpoints too, with a documented exception for a forked skill that runs in the foreground. Symlinks and hard links are skipped on restore, and Claude Code warns that it skipped them.
Snapshots are deleted in the retention sweep, by default about 30 days after the session last saved one. Restoring a checkpoint whose snapshots are gone can fail with No files were restored. cleanupPeriodDays keeps them longer.
See Claude Code checkpointing.
OpenAI Codex
The Codex CLI command reference doesn’t document a checkpoint or a rewind that restores files. What it does document is conversation branching. With an empty composer, Esc twice lets you edit the previous user message and fork the chat from that point. /fork and codex fork copy a session so the original transcript stays.
/diff shows the Git diff, including files Git isn’t tracking yet, which is how you review edits before you commit. Undoing the files is Git’s job until a file-level rewind shows up in the docs.
See the Codex slash commands.
Cursor
Cursor’s agent overview says checkpoints save snapshots during an Agent session. The agent creates them before significant changes and captures the state of all modified files.
Click a checkpoint in the chat timeline to preview the files at that point, then restore. You can also use Restore Checkpoint on a previous request, or the + button when you hover a message. Restoring reverts files only. It does not remove messages from the conversation.
Checkpoints are stored locally and are separate from Git. The page says to use them for undoing agent changes, and to use Git for permanent history.
See Cursor Agent.
Grok Build
/rewind, or Esc Esc while idle, lists a rewind point per prompt. Selecting one restores all files to their state at that point and truncates the conversation to match. The sessions page says rewind modifies files on disk, and reverted changes are lost unless you committed them to Git.
Those file snapshots are part of the saved session under ~/.grok/sessions/, so they come back when you resume. See Grok Build sessions.
Details checked against each vendor’s documentation in October 2026.
A real example
You asked Claude Code to add a “Last updated” line to the post layout, and it also rewrote the RSS feed, which you wanted left alone. Press Esc twice on an empty prompt, or run:
/rewind
Select the prompt where you asked for the date. Choose restore code and conversation if you want both the files and the chat to go back. Choose restore code if the conversation is still useful and only the files are wrong.
Then commit the good version. The checkpoint is gone when the session’s snapshots age out. The commit is not.
In Cursor, use the checkpoint on that request and restore the files. The messages stay in the chat, so you can tell the agent what to leave alone and run the turn again. In Grok Build, /rewind puts the files back and cuts the conversation at that prompt, so commit first if there is anything in the working tree you still want.
When to rewind
Rewind when a turn went the wrong way and you have not committed the result. Exploring two layouts, backing out of an edit that broke the build, and dropping a verbose debugging stretch from the context are the cases Claude Code’s docs name.
Skip it for anything you already committed, and for files the agent changed only through the shell. Those need Git. Skip it when you wanted a second attempt while keeping the first conversation. Fork the session instead. Claude Code’s summarize options are the ones that free context without moving files.
Pitfalls
Claude Code does not track every write. A file only a Bash command created stays as it is. Subagent edits to files the main conversation never touched stay too, except a forked skill running in the foreground. External edits from you, or from another session, are captured only when they happen to touch files this session already edited.
If you restore a Claude Code conversation and quit before the next prompt, the rewound messages can come back. Send a prompt before you exit. The docs say the rewound conversation is saved together with that prompt. Restored files stay as the rewind left them.
Grok’s rewind is not a preview. It writes the old file contents and truncates the chat. Anything you didn’t commit is gone. Cursor’s restore leaves the messages in place, so the agent still “remembers” the turn you undid on disk. Say what to do differently, or the next turn can repeat it.
None of the three replace Git. Claude Code says checkpoints are for quick, session-level recovery. Cursor says the same, in different words. A checkpoint also won’t help on a machine that doesn’t have the session.
Related on flaviocopes.com
- How to use Grok Build explains
/rewind, including the warning that reverted files are lost unless they were committed. - A deep dive into T3 Code shows a different product’s workspace checkpoints, stored as Git objects, and why a checkpoint is a local undo rather than a backup.
- How to use the Codex CLI is where Codex review shows up as a diff you accept or reject, since the CLI docs don’t describe a file rewind.
- AI coding agent context: how to document project decisions keeps the decisions in files, so a rewind of the conversation doesn’t take the only copy with it.
Related glossary entries
- Sessions: A session is a saved coding-agent conversation you can resume later. How Claude Code, Codex, the Cursor CLI and Grok Build store, name, resume and fork one.
- Permission modes: Permission modes decide what a coding agent can do without asking. The modes in Claude Code, Codex, Cursor and Grok Build, and what YOLO mode really skips.
Want me to talk about your product? You can sponsor this site.