# Flow agent

> A coding agent in a floating window that drives your Flow workspace through flow-cli, with its own command, system prompt and editable skills.

The Flow agent is a coding-agent CLI (Claude Code, `claude`, by default) running in a floating window of its own, set up to control the Flow window that started it. Ask it in plain language to open sessions, split panes, nudge the agents in your other panes, change settings or take a screenshot, and it does that through `flow-cli`. It is for anyone who would rather say what they want done to the workspace than click through it.

> **Note:** The Flow agent is an experiment (BETA). Turn it on in Settings › Experiments (`features.flow`). While it is off, Toggle Flow agent does nothing, `flow-cli flow-send` is refused, and neither the agent window nor its pill is shown.

## Open and minimize the agent

1. Turn on the experiment in Settings › Experiments.
2. Press `⌃⌘J` (Toggle Flow agent in the command palette). The first press starts an agent if none is running. The chord is also registered system-wide while the experiment is on, so it works from any app.
3. Type your request into the agent's terminal.
4. Press `⌃⌘J` again to minimize the window to the pill. The agents keep running, and the focus goes back to the app you were in before.

A click on the pill opens the window again. Rebind the chord in Settings › Keyboard as `keyboard.toggle_flow`.

## The agent window

The window is a floating panel: it sits above the main window and its web tabs, and it stays up while another app is active and on every Space, full-screen ones included.

- **Tab strip.** The title bar holds one tab per agent, each with the agent command's icon and a ×, then a "+" that starts another agent.
- **Moving and sizing.** Drag the strip's empty area to move the window, double-click it to zoom, and drag the edges to resize. The green traffic light zooms. The red and the yellow lights both minimize to the pill; neither closes the agents.
- **Position.** The window opens out of the pill's corner, and minimizing puts the pill back at that corner of wherever the window is now, so moving either one moves both. Only the window's size is remembered across launches (640 × 440 until you resize it).
- **Selection.** Drag in the agent's text to select it; the wheel scrolls.

### Keys in the agent window

| Key | What it does |
|---|---|
| `⌃⌘J`, `⌘M`, `⌘W`, `⇧⌘W` | Minimize to the pill; the agents keep running |
| `⌘T` | Start another agent in a new tab |
| `⇧⌘[` / `⇧⌘]` | Previous / next agent tab |
| `⌘C` | Copy the text you selected |
| `⌘V` | Paste the clipboard's text; with an image on the clipboard, send `⌃V` so the agent reads the image |
| Any other ⌘ chord | Runs as it does anywhere in Flow (command palette, settings, quit) |
| Every other key, Esc included | Goes to the active agent |

## The pill

While the agent window is minimized, a small pill stands in for it, so the agent never disappears while the experiment is on.

- It shows a card per running agent, the active one in front, each with the agent command's icon and any overlay its tab has (an amber `?` while Claude Code asks a question), then the word "Flow". With no agent running it shows one card.
- The cards show whether or not tab icons are turned on: they are the pill's only mark.
- Drag it anywhere. A click without moving opens the agent window. Showing, pressing or dragging the pill never brings Flow in front of the app you are in; only the click that opens the window does.
- With nothing saved it sits at the bottom right of the main window's display. Its position is kept in `flow.pill` and pulled back onto a visible display when restored.

## Agent tabs and persistence

Every agent tab runs the same command in the same directory, independently of the others.

- The × on a tab ends that agent. `⌘W` only minimizes. When the last tab closes, the window minimizes to the pill and the next `⌃⌘J` starts a fresh agent.
- With Persist sessions on (Settings › General › Sessions, `terminal.persist`, on by default), each agent runs in its own background session. Quitting Flow never ends an agent: at the next launch Flow reattaches every saved agent that is still alive, in its tab order, with the same tab active, and ends the rest. No launch command is typed a second time.
- The Task Manager lists every agent under "Flow agent"; its Reveal selects that agent's tab and opens the window.

## Choose the agent command

Two settings decide what each new agent runs and where. They are not rows in the Settings window; set them with `flow-cli settings set`:

```sh
flow-cli settings set flow.agent_command 'claude --model opus'
flow-cli settings set flow.agent_cwd '~/src'
```

- `flow.agent_command` is the line typed into each new agent's login shell. When its first word is `claude` (bare, or a path ending in `/claude`), Flow appends `--append-system-prompt-file` with the path of `~/.flow/flow-prompt.md`, keeping your own flags. Any other command (`codex`, `claude-dev`, `aider claude`) runs exactly as written and gets no Flow prompt, so it does not know about `flow-cli` unless you tell it.
- `flow.agent_cwd` is the directory every agent starts in; a leading `~` is expanded. It is always the same directory, so `claude`'s `/resume` lists the same history every time.
- Each new tab reads the settings when it starts; agents already running keep what they started with. An agent tab's icon, and the pill's card, are the configured command's tab icon.

## The system prompt

Each time a fresh agent launches, Flow rewrites `~/.flow/flow-prompt.md` from three parts: a short preamble, the full `flow-cli` reference, and the index of your skills. Your edits to this file are overwritten; change the agent's behaviour with skills instead.

The preamble tells the agent that it controls the Flow window that spawned it (`FLOW_SOCKET` in its environment points `flow-cli` at that window), to run `flow-cli state` before acting and to check `state` or a screenshot afterwards, to keep replies to a sentence or two followed by the actions it took, and to act and then report rather than ask for permission, unless a skill tells it to bring a question back to you.

## What the agent can do

Through `flow-cli` the agent can do everything the command palette can, and read what you see: the window's groups, tiles and tabs as JSON, any pane's screen, settings, toasts and dialogs, and screenshots. The reference it is given asks it to work around you rather than over you:

- **Address, don't focus.** It types into a pane by its session id (`send-text --session`) and reads one (`read pane`) without moving your focus, and focuses a pane only when you asked to see it.
- **Open in the background.** New sessions and tabs it opens use `--background`, so what you are looking at does not change.
- **Read before typing.** It checks that a pane's shell is idle before sending a command.
- **Scratch work in the flyover.** For a shell of its own it opens a tab in the flyover, outside every session group.
- **Destructive commands need your words.** Closing sessions, session groups, tabs or labels, `settings set`, and merging or closing pull requests happen only when you asked for exactly that.

See [Flow CLI](https://flow.worldbreakstudios.com/docs/cli/flow-cli.md) for the commands themselves.

## Skills

A skill is a playbook for a larger job, in `~/.flow/skills/NAME/SKILL.md`: a frontmatter block with `name` and `description`, then Markdown instructions.

```markdown
---
name: standup
description: Summarize what each session did today. Use when the user asks for a standup.
---

# standup

1. Run `flow-cli state` and list the groups.
2. ...
```

- The agent's prompt lists only each skill's name, description and path. When a request matches a description, the agent reads that SKILL.md in full first and follows it. An edit to a skill's instructions therefore applies on the agent's next turn; a new skill, or a changed name or description, reaches agents launched after it.
- A skill whose frontmatter has no `name` is listed under its folder's name.
- Flow seeds its built-in skills into the folder only where a skill's SKILL.md is missing, so your edits are never overwritten, and a built-in you delete comes back at the next seed. The `settings` skill also ships a `MANIFEST.md` that Flow owns and rewrites whenever it differs from the running version.
- Settings › Advanced › Flow agent skills shows the folder (Open folder) and a row per skill with Open for its SKILL.md. The block shows whether or not the experiment is on.

### Built-in skills

| Skill | What it is for |
|---|---|
| `babysit-prs` | Watch the sessions you name and keep each one's coding agent moving toward a mergeable draft PR: check in on a timer, nudge idle agents, bring questions that need you back to the Flow chat |
| `notebooks` | Build interactive notebooks in Notes: runnable Python, JavaScript and shell cells, inputs that re-run them, charts and tables |
| `schedules` | Set up and look after scheduled commands and reminders: the cron, missed runs, approvals, run logs and the Inbox |
| `settings` | Read and change any Flow setting, shortcut, experiment, theme or per-repository override, and explain where a value comes from |
| `snooze` | Snooze a session until something happens (a time, the agent's next message, a PR verdict, CI) and write the watch commands that wake it |
| `sync` | Read and act on the state Flow syncs across your paired devices: which are live, their sessions and tabs, intents sent to another device |
| `tools` | Build a Flow tool end to end: a small CLI or TUI under `~/.flow/tools/` whose data syncs across your devices |
| `trash` | Clean up old git worktrees through the Trash page, deleting only the ones that are safe to delete |

See [Agent skills](https://flow.worldbreakstudios.com/docs/cli/agent-skills.md) for how skills work for agents in your other panes, and [Custom tools](https://flow.worldbreakstudios.com/docs/cli/custom-tools.md) for the tools the `tools` skill builds.

## Send text to the agent from a shell

`flow-cli flow-send` types a message and Enter into the **active** agent tab, opening the agent window first. Several words are joined with spaces; `-` reads the message from stdin.

```sh
flow-cli flow-send open the logs for the api session
git diff --stat | flow-cli flow-send -
```

With no agent running it starts one and passes the message as its first prompt. While the experiment is off the command fails with "Flow is disabled — enable it under Settings > Experiments".

To check the agent from a script, `flow-cli state` has a `flow` block (`enabled`, `mode`: `pill`, `open` or `off`, the active agent's `session`, every tab's `sessions` and the `active` index), and `flow-cli screenshot --window flow` or `--window pill` captures either window.

## Settings and files

| Key or file | Type | Default | Effect |
|---|---|---|---|
| `features.flow` | bool | `false` | Turns the Flow agent on (Settings › Experiments) |
| `keyboard.toggle_flow` | chord | `⌃⌘J` | Opens or minimizes the agent window, in Flow and system-wide |
| `flow.agent_command` | string | `claude` | The command each new agent runs |
| `flow.agent_cwd` | string | `~` | The directory each new agent starts in |
| `terminal.persist` | bool | `true` | Persist sessions: agents survive quitting Flow and are reattached at launch |
| `flow.sessions`, `flow.active` | JSON array, integer | none | The saved agents in tab order and the active tab; written by Flow |
| `flow.window` | object | 640 × 440 | The agent window's frame; only its size is read back. Written by Flow |
| `flow.pill` | object | bottom right | The pill's position; written by Flow when a drag ends |
| `~/.flow/flow-prompt.md` | file | generated | The system prompt a `claude` agent gets; rewritten at every fresh launch |
| `~/.flow/skills/NAME/SKILL.md` | file | built-ins seeded | Your skills; edits are kept |

## Limits

- Only a `claude` command gets the Flow system prompt automatically.
- `flow-send` always goes to the active agent tab.
- File paths in the agent window are not clickable links.
- Only the window's size is remembered; its position follows the pill.
