# Roll back what an AI agent changed in your writing on a Mac

Roll back what Claude Code, Codex or another CLI agent changed in your Markdown drafts on a Mac: the checkpoint for each agent, /rewind, and one-file restores.

**The short version:** Save a checkpoint of the whole project before the agent starts, read its edits in the file as they land, then restore the project or one file if you don't want them. Flywrite saves that checkpoint when Claude Code starts, and when Cursor Agent starts after its one-time setup. Before Codex or any other CLI agent, press ⌘⇧C.

We make Flywrite, the Markdown writing app these steps use.

## What you'll need

- A Mac: Flywrite is a Mac app.
- Flywrite, with your drafts opened as a project, which is an ordinary folder of files ([Your first project](/docs/your-first-project)).
- A CLI agent that already runs in your Mac's terminal: Claude Code, Codex, Cursor Agent or another. If it runs there, it runs in Flywrite's terminal.
- For Cursor Agent, its one-time setup in **Settings → Agents** ([Writing with Cursor](/docs/writing-with-cursor)).

## Do it step by step

By the end, every agent run starts from a checkpoint (saved for you when Claude Code or Cursor Agent starts, one keystroke for the rest), and you can roll back what the agent changed for the whole project or one file.

1. **Check that checkpoints are on.** In **Settings → Writing**, keep **Turn on checkpoints for new projects** on, and leave the automatic checkpoint for agents on there too. One project can override it with **Checkpoints (version history)** in its **Project Settings**, and a folder that already has a Git repository keeps its checkpoints either way.

   ```text
   Settings → Writing
   Project Settings → Checkpoints
   ```

   You should see the **Checkpoint** button in the top bar and the **Versions** panel below the file tree. With checkpoints off, both step aside.

2. **Start the agent from a checkpoint.** Flywrite saves a checkpoint of the whole project when Claude Code starts in its terminal, and when Cursor Agent starts after its one-time setup. Codex and other CLI agents don't trigger it, so press `⌘⇧C` before you start them. For Codex, that's two keystrokes (these are Flywrite's default shortcuts; [every one is customizable](/docs/keyboard-shortcuts)):

   ```text
   ⌘⇧C   Checkpoint Now
   ⌃3    Start Codex
   ```

   You should see the new checkpoint at the top of the Versions panel (`⌘⇧V`), which lists checkpoints newest first.

3. **Read each edit as it lands.** Keep the draft open while the agent works: it edits the file directly and the editor updates live. Current versions of Claude Code start a terminal session in auto mode, which edits without stopping to ask. To approve each edit before it lands, press `Shift+Tab` in Claude Code to switch to Manual mode, or start it in Manual mode from a plain terminal tab (`⌃1`):

   ```terminal
   claude --permission-mode manual
   ```

   You should see Claude Code stop and ask you before it edits a file.

4. **Restore the whole project, or one file.** Open Versions and expand the checkpoint from before the agent ran. Restoring the whole project saves a safety checkpoint of the current state first, so even a restore can be undone.

   ```text
   ⌘⇧V, then expand a checkpoint:
   Restore project to this point
   Restore (on one file)
   ```

   You should see the project, or that one file, back as it was at that checkpoint.

5. **Or rewind inside Claude Code.** Claude Code keeps its own checkpoint for each prompt you send, in Flywrite's terminal as anywhere else. Run [`/rewind`](/glossary/claude-code-rewind), or press `Esc` twice with the prompt empty. It restores files Claude Code's edit tools changed; a file that only shell commands changed isn't tracked, so restore that one from Versions.

   ```prompt
   /rewind
   ```

   You should see Claude Code's rewind menu, with the points you can go back to.

6. **Ask the agent for a line-by-line list (optional).** Flywrite restores from checkpoints; it doesn't show a diff. The Codex CLI docs list no undo command and advise Git checkpoints instead. A Flywrite checkpoint is a Git commit, so Codex's own `/diff` command shows the [Git diff](/glossary/git-diff) since your latest checkpoint, including new files. In a project connected to GitHub, checkpoint names in Versions link to their commits on github.com, where you can select a file to view its diff.

   ```prompt
   /diff
   ```

   You should see the Git diff of the project in the Codex terminal.

## When not to use this

- **You want to keep or undo each agent edit inline.** Flashtype, a free Markdown editor for Claude Code and Codex, shows agent edits inline with keep or undo for each change ([Flashtype](https://flashtype.ai/)). Flywrite rolls back from checkpoints instead.
- **Your drafts live in a cloud document editor.** Use that editor's own version history. Flywrite's checkpoints cover the files in a project folder on your Mac ([Your first project](/docs/your-first-project)).
- **You need a copy off your computer.** Checkpoints stay on your Mac. Connect the project to GitHub for a backup ([Backup & sync with GitHub](/docs/github-backup-and-sync)). Step by step: [Back up Markdown projects to GitHub](/guides/back-up-markdown-to-github).
- **You only run Claude Code, outside Flywrite.** Use [`/rewind`](https://code.claude.com/docs/en/checkpointing) for files its edit tools changed, and commit to Git yourself for the rest.

## Questions

### Does Flywrite save a checkpoint before every agent?

No. It saves one when Claude Code starts in its terminal, and when Cursor Agent starts after its one-time setup. Codex and other CLI agents don't trigger it, so press `⌘⇧C` before you start them.

### Is a checkpoint a backup?

Not on its own. A checkpoint is a Git commit that stays on your computer. For a copy off your computer, connect the project to GitHub and Sync.

### Do I need to know Git?

No. Flywrite saves and restores checkpoints with a button or a shortcut, and you never type a git command. GitHub backup is one Sync action, also with no git commands.

## Sources

1. [Flywrite docs: Checkpoints & versions](/docs/checkpoints-and-versions), checked 2026-11-17
2. [Flywrite docs: Writing with Claude Code](/docs/writing-with-claude-code), checked 2026-11-17
3. [Flywrite docs: Writing with Codex](/docs/writing-with-codex), checked 2026-11-17
4. [Flywrite docs: Writing with Cursor](/docs/writing-with-cursor), checked 2026-11-17
5. [Flywrite docs: The terminal](/docs/the-terminal), checked 2026-11-17
6. [Flywrite docs: Keyboard shortcuts](/docs/keyboard-shortcuts), checked 2026-11-17
7. [Flywrite docs: GitHub backup & sync](/docs/github-backup-and-sync), checked 2026-11-17
8. [Flywrite docs: Your first project](/docs/your-first-project), checked 2026-11-17
9. [Flywrite pricing](/pricing), checked 2026-11-04
10. [Claude Code: Checkpointing](https://code.claude.com/docs/en/checkpointing), checked 2026-11-17
11. [Claude Code: Choose a permission mode](https://code.claude.com/docs/en/permission-modes), checked 2026-11-04
12. [OpenAI Codex docs: Developer commands (CLI)](https://learn.chatgpt.com/docs/developer-commands?surface=cli), checked 2026-11-17
13. [OpenAI Codex docs: Codex CLI](https://learn.chatgpt.com/docs/codex/cli), checked 2026-11-10
14. [GitHub Docs: Commits](https://docs.github.com/en/pull-requests/reference/commits), checked 2026-11-04
15. [Flashtype](https://flashtype.ai/), checked 2026-11-09

---

This is the Markdown copy of https://flywrite.app/guides/review-and-undo-agent-edits.
