# Let an AI agent work on your writing folder and still edit the files by hand

Run Claude Code, Codex or another CLI agent on a folder of Markdown drafts on a Mac, and keep editing the same files yourself without losing anyone's words.

**The short version:** Open your folder of Markdown drafts in Flywrite and run Claude Code, Codex or another CLI agent in the terminal under the page. Save a checkpoint first. When the agent changes the file you have open, the page updates and you keep your place. If you have unsaved edits, nothing is overwritten: you choose which version to keep.

We make Flywrite, the Markdown writing app these steps use. The steps follow Flywrite's app and each agent's own docs, listed under Sources.

## What you'll need

- A Mac with Flywrite, and your drafts as Markdown files in one folder.
- A CLI agent on your own plan, such as [Claude Code](/glossary/claude-code) or [Codex](/glossary/codex-cli). If it runs in your Mac's terminal, it runs in Flywrite's, with no Flywrite AI fee ([which plan you need](/guides/use-your-own-claude-code-or-codex-plan)).

## Do it step by step

1. **Open the folder in Flywrite.** Click **+** in the projects rail and choose **Open Folder**. Your drafts stay plain Markdown files, so you and the agent work on the same files ([Open or create a project](/docs/your-first-project)).

2. **Save a checkpoint before the agent starts.** 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. The checkpoint keeps every file as last saved, your own edits included.

3. **Give the agent one file or one section.** Press `⌃2` for Claude Code or `⌃3` for Codex, then say where it works and what to leave alone:

   ```prompt
   Tighten the intro of issue-43.md. Leave the rest alone.
   ```

4. **Keep writing.** Work in another file, or another part of the same one. When the agent changes the file you have open, the page updates in place, and your cursor, selection and scroll stay where they were.

5. **Let your edits save.** Flywrite saves 2 seconds after you stop typing, and `⌘S` saves at once. If the agent changed the file since Flywrite loaded it, Flywrite asks you instead of saving over it.

6. **If the banner appears, choose a version.** When the agent changes a file while you have unsaved edits in it, Flywrite shows "This file changed on disk while you have unsaved edits." Click **Reload (discard my edits)** to take the agent's version, or **Keep mine (overwrite)** to write yours over it. To keep some of both, copy your new sentences, reload, then paste them back.

7. **Tell the agent what you changed.** Claude Code edits against the file as it is now, and reads it again before edits that depend on text you changed. With Codex, say what you edited and ask it to read the file again:

   ```prompt
   I edited paragraph 2 of issue-43.md. Read it again first.
   ```

8. **Roll back from the checkpoint if you need to.** Open **Versions** (`⌘⇧V`), expand the checkpoint from before the agent started, and restore the project or one file. Flywrite saves a checkpoint before it restores, so you can undo the restore too. Claude Code's own rewind normally leaves out changes you typed yourself, so use Flywrite's checkpoint when you both edited a file. More in [Roll back what an AI agent changed](/guides/review-and-undo-agent-edits).

## Facts at a glance

| Fact | Detail |
| --- | --- |
| Where your drafts live | Plain Markdown files in a folder on your Mac |
| The agent edits your open file | The page updates in place and keeps your cursor and scroll |
| When Flywrite saves | 2 seconds after you stop typing, or at once with `⌘S` |
| What a save never does | Write over a file that changed on disk since Flywrite last loaded it |
| The agent edits a file you haven't saved | A banner: **Reload (discard my edits)** or **Keep mine (overwrite)** |
| Checkpoint when the agent starts | Claude Code: yes. Cursor Agent: after its setup. Codex and other agents: press `⌘⇧C` |
| Claude Code's rewind | Normally leaves out changes you typed yourself |
| Price | $99 a year, with no AI fee |

## When not to use this

- **Someone else edits the drafts on another Mac.** Back the project up to GitHub and Sync, and Flywrite shows both versions when edits clash ([Sync a writing project between two Macs](/guides/sync-writing-between-two-macs)).
- **You want the agent on its own copy of the files.** Codex's best practices list running a task on the same files without a Git worktree, a second working copy of the project, as a common mistake. Ask your agent to set one up, and to merge back what you keep.
- **Your drafts live in a cloud document editor.** CLI agents work on files on your computer. Copy the draft into a Markdown file first, or keep it where it is and use that editor's version history.

## Sources

1. [Flywrite docs: Write and format in the editor](/docs/the-editor), checked 2026-11-25
2. [Flywrite release notes](/release-notes), checked 2026-11-25
3. [Flywrite docs: Open or create a project](/docs/your-first-project), checked 2026-11-25
4. [Flywrite docs: Undo changes with checkpoints](/docs/checkpoints-and-versions), checked 2026-11-25
5. [Flywrite docs: Write with Claude Code](/docs/writing-with-claude-code), checked 2026-11-25
6. [Flywrite docs: Write with Codex](/docs/writing-with-codex), checked 2026-11-25
7. [Flywrite docs: Use the terminal under the page](/docs/the-terminal), checked 2026-11-25
8. [Flywrite docs: Keyboard shortcuts](/docs/keyboard-shortcuts), checked 2026-11-25
9. [Flywrite pricing](/pricing), checked 2026-11-04
10. [Claude Code: Tools reference](https://code.claude.com/docs/en/tools-reference), checked 2026-11-25
11. [Claude Code: Checkpointing](https://code.claude.com/docs/en/checkpointing), checked 2026-11-25
12. [OpenAI Codex docs: Codex CLI](https://learn.chatgpt.com/docs/codex/cli), checked 2026-11-25
13. [OpenAI Codex docs: Best practices](https://learn.chatgpt.com/codex/learn/best-practices), checked 2026-11-25

---

This is the Markdown copy of https://flywrite.app/guides/edit-by-hand-while-an-agent-works.
