Black Friday sale: 30% off Flywrite
The short version

Keep the draft as a Markdown file and run your agent in Flywrite's terminal under the page. Select the passage and press ⌘⇧L. It types a reference such as @issues/2026-11-07-issue-42.md#L12-18 at the agent's prompt, and you add your instruction. Claude Code, and Cursor Agent after its setup, see your selection without it; Codex and other CLI agents need it.

We make Flywrite, the Markdown writing app these steps use. The steps follow each tool's own docs; if one looks different, check that tool's docs under Sources.

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).
  • A CLI agent on its own plan: Claude Code, Codex, Cursor Agent or another, such as Gemini CLI or OpenCode. If it runs in your Mac's terminal, it runs in Flywrite's, and Flywrite adds no AI fee.
  • The passage in a Markdown file inside that project. The agent reads it from the file.

Do it step by step

By the end, you hand any agent one passage with a shortcut and a sentence, and it works on those lines in your file, with no copying and pasting.

  1. Open your writing folder in Flywrite. Choose Open Folder to use a folder already on your Mac, or New Project to start fresh. A project is an ordinary folder of files, such as this example:

    weekend-gardener/
      ideas.md
      issues/
        2026-11-07-issue-42.md
  2. Start your agent in the terminal under the page. Press ⌃2 for Claude Code, ⌃3 for Codex or ⌃4 for Cursor Agent, or open a plain terminal tab with ⌃1 and start any other agent there. 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. These are Flywrite's default shortcuts, and every one is customizable.

    ⌃2   Claude Code
    ⌃3   Codex
    ⌃4   Cursor Agent
  3. Select the passage. Drag across the lines you want the agent to work on, in Rendered or Source view. The agent reads them from the file on disk, and Flywrite autosaves as you write (⌘S saves at once). Source view (⌘E) shows line numbers; these are lines 12 to 18 of the example issue:

    ## Putting the beds to sleep
    
    Cut the spent tomato vines and leave the roots.
    
    Spread two inches of leaves over every bed.
    
    Water once more, then let the garden rest.
  4. Press ⌘⇧L. Send Selection to Terminal types a reference to the file and those lines at the prompt of the active terminal tab, then stops. It doesn't press Enter, so nothing is sent yet. With nothing selected, it types the line your cursor is on, such as #L12. If no terminal tab is open, it types nothing, so start your agent first.

    @issues/2026-11-07-issue-42.md#L12-18

    You should see that reference at the agent's prompt, followed by a space.

  5. Add your instruction and press Enter. Press ⌘J to jump into the terminal; the highlight stays on your passage so you can still see it. Type what you want after the reference. With Codex, typing @ and the file name also points it at the file, and with any agent you can name the lines in words, such as "lines 12 to 18".

    @issues/2026-11-07-issue-42.md#L12-18 Make this warmer, under 40 words.

    You should see the edit land in the draft above as the agent writes it.

  6. With Claude Code, skip the shortcut. Claude Code already sees your selection, the open file and the line you're on, with no setup. Cursor Agent does too, after its one-time setup in Settings → Agents (Writing with Cursor). Select the passage and ask about "the selected paragraph"; press ⌘⇧L when you want the lines named in the prompt as well.

    Tighten the selected paragraph.
  7. Check the edit, and roll back if you need to. The draft updates as the agent edits. To undo, press ⌘⇧V to open Versions, expand the checkpoint from before the run, and restore the project or only this file (Roll back what an agent changed).

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

Facts at a glance

Agent Sees your selection on its own ⌘⇧L Checkpoint at start
Claude Code (⌃2) Yes, with the open file and line Optional Yes
Cursor Agent (⌃4) After its one-time setup Optional After its setup
Codex (⌃3) No Needed, or type @ and the file name No, press ⌘⇧C
Any other CLI agent No Needed; the reference arrives as text No, press ⌘⇧C
Fact Value
What ⌘⇧L types @, the file's path in the project, then #L and the first and last line, at the prompt, without pressing Enter
With nothing selected The cursor's line, such as #L12
What the agent reads The saved file, at those lines
Flywrite's price $99 a year for Mac, with no AI fee

When not to use this

  • You already work in Warp. Select text in Warp's code editor and press ⌘L to attach it to a Claude Code or Codex session running in a Warp tab (Warp: Selection as context).
  • You write in VS Code with Claude Code's extension. It sees your selected text automatically, and Option+K inserts an @-mention with the line numbers, such as @app.ts#5-10 (Use Claude Code in VS Code).
  • You only want the agent, not a writing app. In macOS Terminal, type @ and the file name in Claude Code or Codex, and name the lines in your request (Claude Code interactive mode, Codex CLI commands).
  • The passage isn't in a file. Text in an email or on a web page has no file to point at, so paste it into the prompt, or save it into the project first.
Hand your agent the passage, not the clipboard

Flywrite is $99 a year for Mac, with no AI fee. Read about writing with Codex.

Buy now

Questions

Does Codex see the text I select?

No. Codex doesn't see what you have open or selected in Flywrite on its own. Press ⌘⇧L to type a reference to the file and those lines at its prompt, or type @ and the file name.

Can I paste the text instead?

Yes, any terminal takes pasted text. ⌘⇧L types a short reference instead, so the prompt stays short and the agent works on those lines in the file itself.

Sources
  1. Flywrite docs: Writing with Claude Code. Checked .
  2. Flywrite docs: Writing with Codex. Checked .
  3. Flywrite docs: Writing with Cursor. Checked .
  4. Flywrite docs: The terminal. Checked .
  5. Flywrite docs: The editor. Checked .
  6. Flywrite docs: Keyboard shortcuts. Checked .
  7. Flywrite docs: Checkpoints & versions. Checked .
  8. Flywrite docs: Your first project. Checked .
  9. Flywrite pricing. Checked .
  10. OpenAI Codex docs: Developer commands (CLI). Checked .
  11. Claude Code: Interactive mode. Checked .
  12. Claude Code: Use Claude Code in VS Code. Checked .
  13. Warp docs: Selection as context. Checked .
  14. Gemini CLI docs. Checked .
  15. OpenCode docs. Checked .

Write with your agent in a writing app.

Buy now