# Agent panes

> How Flow presents a session running Claude Code or another coding agent, with a centred column, a context card, a Details tab and a Shells tab.

When a coding agent runs in a session's main pane, Flow treats that pane as an agent pane. It centres the agent's text in a readable column, and for Claude Code it adds a context card of the files the session used and made, a Details tab that lists all of them, and a Shells tab that records every shell command the agent runs, with its live output. This page is for anyone who runs Claude Code, Codex or another agent CLI inside Flow sessions. For setting up Claude Code itself, see [Claude Code](https://flow.worldbreakstudios.com/docs/cli/claude-code.md).

## Which panes are agent panes

Every couple of seconds Flow looks at the program running in the foreground of each pane. A pane is an agent pane when that program is one of the **Agent programs** (Settings › General › Agents, `agents.programs`): by default `claude`, `codex`, `pi`, `gemini`, `opencode`, `aider`, `amp` and `cursor-agent`. Names are matched the way tab icons are, so an agent started through `env`, `npx` or `node` still counts. Type the list comma-separated; an empty field restores the default.

- Only a session's main pane gets the agent column and the context card.
- The context card, the Details tab and the Shells tab work with Claude Code only. Other agents get the column.

## The agent column

With **Centre agent panes** on (`agents.column`, on by default), an agent running in a session's main pane has its text in a centred column at most **Agent column width** terminal columns wide (`agents.max_columns`, 120 by default, 60 to 300 in steps of 10). A change applies at once.

- A click in the gutter beside the column focuses the pane, and the wheel there scrolls it.
- A selection dragged into a gutter stops at the column's first or last character.
- The column is not applied on the Dashboard, in the Factory (both size the main pane themselves), in pop-outs, or in a remote host's session.

## The context card

While Claude Code runs in the main pane, a card floats at the pane's top right (in the gutter the column leaves, when there is room) with up to three sections, newest first:

- **Sources**: images and files you attached (an image you pasted or dropped, a file you `@`-mentioned), and images and documents Claude read with its Read tool, such as a screenshot it took while checking its work. Reading code or plain text is not a source.
- **Outputs**: files Claude wrote with its Write tool.
- **Shells**: only while the pane has a running agent shell. Each running shell with its title and how long it has run, newest started first.

Each row shows the kind's glyph (or a small thumbnail for an image), the file name, and the full path as a tooltip. Past six rows, or fewer in a short pane, a section ends in "+N more". Only files that still exist are listed: a file deleted since Claude used it leaves the card and shows under **Not found** in the Details tab, and comes back if the file is restored.

### Open what the card lists

- **A file row** opens the file. One that a Files tab can preview (text, code, Markdown, JSON, images, PDFs, video, web pages) opens there, rooted at the session's checkout, else the file's nearest git repository, else its folder. Scripts open read-only and never run. Documents, media and archives on Flow's allowlist (Word, Excel, PowerPoint, Keynote, Pages, Numbers, audio, `zip` and others) open in their default app. Anything else, such as a folder, an app bundle, a package, a disk image or a binary, is only revealed in Finder. A file that has gone since the last look shows a toast instead.
- **A Shells row** opens that run in the session's Shells tab; the Shells caption opens the tab itself.
- **The ⤢ button** (Open details), a Sources or Outputs caption, a "+N more" row or the card's background opens the Details tab.

> **Note:** The allowlist means one click on the card never runs or installs something an agent wrote.

### Minimize and expand the card

The card's minimize button shrinks it to a chip in the pane's header; a click on the chip expands it again. The **Toggle context card** action (`keyboard.toggle_context_card`, unbound by default) does either. The choice is per session and resets when Flow restarts. In a pane too small for the card, the chip stands in for it, and expanding says in a toast that there is no room.

Turn the card off altogether with **Context card** (Settings › General › Agents, `agents.context_card`, on by default).

### When the card shows

The card shows for the active session's main pane on the Sessions page while all of these hold: `agents.context_card` is on, Claude Code is the pane's program, the session is not on a remote host and is not snoozed, the pane is not collapsed, and Flow has found Claude's transcript. It never shows on the Dashboard, in the Factory or in a pop-out.

Flow reads Claude Code's own local files to fill it: the running session's file under `~/.claude/sessions/` and its transcript under `~/.claude/projects/` (or under `$CLAUDE_CONFIG_DIR` when that is set), every 2 seconds, reading only what was added. It follows the session through `/clear` and a resume, starts over after `/exit` and a new `claude`, and sees through wrappers such as `caffeinate -i claude` or `npx`. No path or transcript text is logged.

### Image previews

> **Note:** Claude image previews are an experiment (BETA). Turn it on in Settings › Experiments (`features.claude_images`).

With it on, the `[Image #N]` placeholders Claude Code prints become links once its transcript names their file: hover one for a floating preview, click it to open the image in a Files tab. Off, they are plain text.

## The Details tab

The Details tab is the context card expanded into a page: every Source and Output of the session's main pane, with no "+N more" cap (up to 200 per section).

- Images show as a grid of large thumbnails; other files as rows with the name, the parent folder and where it came from (attached, read or wrote). A click opens an item as the card does.
- A **Shells** section follows the Outputs while a shell is running, with an **Open in Shells** link and a row per running shell.
- A last **Not found** section lists files the session used that no longer exist on disk. Its rows open nothing.
- With nothing found yet the page reads "No agent context yet".

Open it from the card, or with **Open agent details** (`keyboard.open_agent_details`, unbound by default) from the command palette; on the Dashboard that acts on the focused card's session. Each session has at most one Details tab, and opening it again shows the one there. A new one goes to the session's side panes (the focused tile when it is not the main pane, else the first other tile, else a new tile split to the right), never into the main pane. The tab always shows its own session's main pane, so a Details tab moved to another session shows that session's. It works whether the card is on, minimized or has no room.

## The Shells tab

The Shells tab records the shells Claude Code runs in a pane (its Bash tool calls), each as a run with its command, description, working directory, exit status and full output, and shows them live.

### How capture works

Flow points Claude Code's `CLAUDE_CODE_SHELL_PREFIX` in its panes at a small shim, `~/.flow/flow-shell.sh`, and adds a `PreToolUse` hook for the Bash tool to `~/.claude/settings.json`, through which the command's description and whether it runs in the background arrive. The wrapper records the run, leaves a watcher behind that copies the output into Flow's shell store, and then hands over to the shell Claude would have used. It never sits in the command's output path and can never make a command fail. A `CLAUDE_CODE_SHELL_PREFIX` you had set yourself is kept and run in the chain.

**Shell capture** (Settings › General › Agents, `shells.capture`) chooses what is recorded:

| Value | Label | Records |
|---|---|---|
| `all` (default) | All shells | Every shell the agent runs |
| `background` | Background only | Only commands the agent started in the background |
| `off` | Off | Nothing |

Turning capture on applies to panes opened afterwards. Turning it off, or switching between Background and All, applies from the next shell in the panes already open.

The store lives in `~/.flow/shells/`, readable only by you, since commands and their output can hold secrets. A run's log stops at 16 MiB. At launch and every six hours, Flow deletes sessions idle for 14 days and ended runs older than that, then the oldest ended runs until the store is under 2 GiB. A running run is never touched.

### Open a Shells tab

- **Automatically.** When a captured shell starts in a pane that has had no Shells tab since Flow started, a Shells tab opens in the background in that session, in a side tile and never in the main pane. If the session is just its main pane, a new tile is split off folded, so the main pane keeps its width. Close the tab and Flow does not offer one for that pane again until it restarts.
- **By hand.** **New Shells tab** in the command palette (`keyboard.new_shells_tab`, unbound by default), the right-click menu of a tab strip's "+", or the New tab page's card.
- **From the card.** A Shells row or caption on the context card, or **Open in Shells** in the Details tab.

There is one Shells tab per agent pane. When the agent starts another session in the same pane (`/clear`, `--resume`, a new launch), the tab follows it. The session picker at the tab's top left pins the tab to an older session; **Latest session** unpins it.

### Read a run

- **The rail** at the right lists the runs: a **Filter shells** field (matching a run's description or command), the segments **All**, **Running** and **Failed** with their counts, and the sections **Running** and **Ended**. Each row shows the state, the title (the description, else the command), the duration, the command's first line, and "background" or a failure's "exit N", "signal N" or "lost". A failure is a non-zero exit, a signal, or a run whose wrapper died. In a pane at least 600 px wide the rail docks beside the output; in a narrower one its toggle lays it over the output. Drag its left edge to resize it; double-click the edge for the default width.
- **The viewer** shows the run's title, an exit chip, its times, who ran it ("Claude", "Claude · background", "Run by you" or "Rerun by you"), its directory and the command, with a copy button on hover.
- **The output** is live plain text with line numbers, ending in a marker such as "exit 0 · 2s". The toolbar has a level filter (All, Errors, Warn, Info, Debug, each with a count), **Highlights** (the highlight rules editor, the same rules the Schedules log viewer uses), line wrap, and **Find** (`⌘F`: text with case, whole word and regex options, or fuzzy). The footer counts lines, errors and warnings. Select output or the command with the mouse and copy it with `⌘C`.
- **Keys:** `↑` / `↓` select the previous or next run, Esc closes an overlaid rail, the rules editor or the selection.

### Act on a run

| Button | Shows for | Does |
|---|---|---|
| Interrupt | A running run | Sends SIGINT to the run's process group |
| Kill | A running run | Sends SIGTERM |
| Force kill | A run still going 2 s after Kill | Sends SIGKILL, in Kill's place |
| Rerun | Any run with a command | Runs the command again in the run's own recorded directory, and nowhere else |
| Copy output | Any run with a log | Copies the run's log, cleaned of terminal escapes |

Buttons that don't fit go into the "⋯" menu. A Rerun whose directory is gone is refused with a toast.

### Output levels

The level filter classifies each line by the most severe match (case-sensitive):

| Level | Lines that match |
|---|---|
| Errors | `ERROR`, `FATAL`, `PANIC` or `FAILED` as a whole word; `error:` or `error[E0308]:` at the start; a Rust `thread '…' panicked at` |
| Warn | `WARN` or `WARNING` as a whole word; `warning:` at the start |
| Info | `INFO` as a whole word; lines starting `Compiling`, `Finished` or `Running`; `test result:` |
| Debug | `DEBUG` or `TRACE` as a whole word |

### Shells from the command line

```sh
flow-cli read shells                                   # every collection (one per agent session)
flow-cli read shells --collection NAME                 # its runs, newest first
flow-cli read shells --collection NAME --run RUN_ID    # one run and a chunk of its log
flow-cli shells run --description "Run the tests" -- cargo test
flow-cli shells kill --collection NAME --run RUN_ID --signal INT
flow-cli shells view --segment failed --level errors --wrap on
flow-cli read agent-context                            # the focused session's card as JSON
```

`shells run` starts a run of yours in the named collection (`--collection`), else in the one a Shells tab of the session shows (`--group`, default the active session), else in that session's most recent. It runs in `--cwd`, else in the collection's own directory, and replies with the collection and run ids. `shells kill` takes `INT`, `TERM` (the default) or `KILL`. `shells view` sets the focused Shells tab's `--rail`, `--filter`, `--segment` (`all`, `running`, `failed`), `--wrap`, `--level` (`all`, `errors`, `warn`, `info`, `debug`) and `--highlights`, or another tab's with `--tab`; `--rail`, `--wrap` and `--highlights` take `on` or `off`. See [Flow CLI](https://flow.worldbreakstudios.com/docs/cli/flow-cli.md).

## Settings

| Key | Type | Default | Effect |
|---|---|---|---|
| `agents.column` | bool | `true` | Centre agent panes: the agent's text in a centred column |
| `agents.max_columns` | number | `120` | Agent column width in terminal columns (60 to 300) |
| `agents.programs` | list of names | `claude`, `codex`, `pi`, `gemini`, `opencode`, `aider`, `amp`, `cursor-agent` | Programs that count as coding agents |
| `agents.context_card` | bool | `true` | The context card on a Claude Code main pane |
| `shells.capture` | `all`, `background`, `off` | `all` | Which agent shells are recorded |
| `features.claude_images` | bool | `false` | `[Image #N]` previews (experiment) |
| `keyboard.toggle_context_card` | chord | unbound | Toggle context card |
| `keyboard.open_agent_details` | chord | unbound | Open agent details |
| `keyboard.new_shells_tab` | chord | unbound | New Shells tab |

## Limits

- **Claude Code only.** The card, Details and Shells read Claude Code's files and hooks; other agents get only the column. Outputs list files Claude wrote with its Write tool, not files it edited in place.
- **Remote hosts.** A session on a remote host gets no column and no card, and its shells are not captured.
- **Paired Macs.** In a session mirrored from another of your Macs ([Sync overview](https://flow.worldbreakstudios.com/docs/sync/overview.md)), the card shows what that Mac reports, and the Shells tab reads the shells that Mac captured, read-only: no Interrupt, Kill, Rerun or Copy output, and the card lists no running shells. A run there that has not ended reads "Not ended" rather than "Running".
- **Dashboard, Factory and pop-outs.** No card and no agent column there; a background Shells tab never opens in a pop-out. See [Dashboard](https://flow.worldbreakstudios.com/docs/workspace/dashboard.md) and [Pop-outs and window locks](https://flow.worldbreakstudios.com/docs/workspace/pop-outs-and-window-locks.md).
- **Only new panes are recorded** after you turn capture on.
