# Tool pages

> Register a command-line tool as its own full-page terminal in the sidebar's Tools band, and arrange the band in Settings › Tools.

A tool page gives a command-line program you use all the time (`htop`, `lazygit`, a log viewer, a dev server) its own full-page terminal, one click away in the sidebar's **Tools** band. Tool pages sit outside your sessions and labels, so they stay put whichever session you're in.

## What a tool page is

- Each registered tool has a **name**, a **command**, a **directory** and an optional **icon**.
- Opening its page the first time starts your login shell in the tool's directory and types the command into it. Because the command runs inside a shell, the terminal stays open when the command finishes.
- The tool keeps running while you're on other pages. Coming back shows it where you left it.
- If the shell itself exits, its last screen stays readable. Press ↩, or open the page again, to relaunch the command.
- A command whose first word is `drop` runs the copy of `drop` that ships with Flow, so it works without anything on your `PATH`.
- Tool pages aren't restored after Flow relaunches; each one starts fresh on its first visit.

On a tool page you type straight into its terminal. `⌘C` copies the selection and `⌘V` pastes; other `⌘` shortcuts keep their usual meaning.

## Add a tool

1. Open Settings (`⌘,`) › **Tools**.
2. Under **Add a tool**, fill in:
   - **Name**: the label in the sidebar. Left blank, the command is used.
   - **Command**: what to run (required), for example `htop` or `npm run dev`.
   - **Directory**: where it runs. `~` and `~/…` work; left blank, it is `~`.
3. Press ↩ in any of the fields, or click **Add tool** (the button needs a name as well as a command).

The new tool joins the end of the Tools band. Names don't have to be unique in Settings, but the command line (below) addresses tools by name.

## The Tools band

The Tools band sits at the top of the sidebar, under the header and above your sessions. It lists, in the order you set:

- your tool pages;
- the built-in pages: the [Trash](https://flow.worldbreakstudios.com/docs/features/trash.md) (with its worktree count), the [Task Manager](https://flow.worldbreakstudios.com/docs/features/task-manager.md) (with a live CPU and memory readout), [Schedules](https://flow.worldbreakstudios.com/docs/features/schedules.md), the two [pull request](https://flow.worldbreakstudios.com/docs/features/pull-requests.md) pages, Reviews and My PRs, and the [Puddle](https://flow.worldbreakstudios.com/docs/features/puddle.md);
- after those, any flow tools you have installed (see [Custom tools](https://flow.worldbreakstudios.com/docs/cli/custom-tools.md)), in name order.

Click a row to open its page. `⇧⌘↑` / `⇧⌘↓` (**Previous sidebar tab** / **Next sidebar tab**) walk the visible tool rows and your sessions. With every row switched off, the band disappears. Label windows have no Tools band.

Some built-in rows depend on experiments: Schedules shows only while Schedules is on (`features.automations`), Reviews and My PRs only while Pull requests is on (`features.pull_requests`), and the Puddle only while Puddles is on (`features.remote`). Turn them on in Settings › Experiments. A row hidden this way keeps its place and its switch, so it comes back where it was.

The default order, before you change it, is the Trash, your tool pages, the Task Manager, Schedules, Reviews, My PRs and the Puddle, all switched on.

## Arrange the band in Settings › Tools

The **Sidebar** card in Settings › Tools has one row per entry of the band, in sidebar order. Each row shows the tool's icon, its name (built-ins carry a **Built-in** pill) and a description, or for your own tools the `command · directory` line.

- **Reorder**: drag a row by its grip. An accent line shows where it will land.
- **Show or hide**: the switch at the end of a row takes it out of the band and the `⇧⌘↑` / `⇧⌘↓` walk. The tool stays registered and keeps its place.
- **Remove**: the trash icon on one of your own tools unregisters it. Built-ins can only be switched off.
- **Icon**: while tab icons are on, your own tools get an icon picker. **Automatic** (the default) uses the icon of the program the command runs, else a generic command-line icon. See [Tab icons](https://flow.worldbreakstudios.com/docs/features/tab-icons.md).

A switched-off row is dimmed in the card. Settings › Tools also holds settings for some built-in pages (such as the Trash's options) and, with Puddles on, the sync switch described below.

## Go to first tool page

**Go to first tool page** (`keyboard.go_to_tool`, unbound by default) opens your first registered tool page. The palette lists it only while you have at least one tool page. Bind it in Settings › Keyboard (see [Keybindings](https://flow.worldbreakstudios.com/docs/configuration/keybindings.md)).

**Switch session…** in the palette also lists the tools in the band, so you can type a tool's name, or its command, to jump to it.

## Manage tools from the command line

`flow-cli tool cli` adds, edits and removes tool pages by name, the same list as Settings › Tools:

```sh
flow-cli tool cli add htop --command htop
flow-cli tool cli add web --command "npm run dev" --cwd ~/src/app
flow-cli tool cli edit web --enabled false     # hide it from the band
flow-cli tool cli edit web --icon ""           # back to the Automatic icon
flow-cli tool cli remove web
flow-cli read tools                            # the registry as JSON
```

- `add` needs `--command` and refuses a name that's already registered (use `edit`). `--cwd` defaults to `~`.
- `edit` changes only the flags you pass.
- Fields with control or formatting characters are refused.
- `--icon` takes a tab-icon id.

The sidebar follows each change at once. For the rest of the CLI, see [flow-cli](https://flow.worldbreakstudios.com/docs/cli/flow-cli.md).

## Where tools are stored

Tool pages are stored in your settings under `tools.cli`, and the band's order and on/off switches for the built-ins under `tools.lineup`. Both are JSON arrays stored as **strings**, so prefer Settings › Tools or `flow-cli tool cli` over editing them by hand. One tool entry looks like this (`enabled` appears only when `false`, `icon` only when you picked one):

```json
{ "name": "web", "command": "npm run dev", "cwd": "~/src/app", "enabled": false, "icon": "node" }
```

With `tools.cli` unset you have no tool pages. A value that can't be read counts as no tools.

## Sync tools across your Macs

With [Puddles](https://flow.worldbreakstudios.com/docs/features/puddle.md) on, Settings › Tools › **Puddle** has **Sync CLI tools with your devices** (`tools.sync`, boolean, default `true`). A tool added, changed or removed on one of your Macs is added, changed or removed on the others that sync theirs. What carries over is the name, command, on/off switch and icon, plus the directory when it is inside your home folder (it's rewritten for the other Mac's home). What doesn't is a directory outside your home (kept as is), the programs the command needs (install them on each Mac), the band's order, the built-ins' switches and running terminals. A device's space lists its tools, and **Add to this Mac** copies one here. See [Sync overview](https://flow.worldbreakstudios.com/docs/sync/overview.md).

## A flow tool's Data page

Flow tools, the custom tools you build or install under `~/.flow/tools/` (see [Custom tools](https://flow.worldbreakstudios.com/docs/cli/custom-tools.md)), also appear in the Tools band. Hovering a flow tool's row shows a **Data** chip that opens its **Data** page; a tool that can't launch opens its Data page directly, which says what's wrong.

The Data page is a read-only browser over the tool's stored data:

- **Header**: the tool's title and name, its state, and **Open** for a ready tool. A banner lists any problems.
- **Toolbar**: one segment per collection, one per device whose rows the collection holds (**All devices** first), and a text filter over every cell.
- **Table**: columns for the device, the row id and each field, in name order. Click a header to sort by it (ascending, then descending; numbers sort as numbers). Rows not yet confirmed are in italics with a **pending** tag; archived rows are dimmed with an **archived** tag. The table shows at most the first 500 rows and says so.
- **Detail**: select a row to see every field as JSON. The footer counts the rows.

The page updates live as the data changes. Keys: `↑` / `↓` move the selection, `⎋` clears it, and `/` focuses the filter (↩ or `⎋` hand the keyboard back).

`flow-cli tool data NAME` (or `flow-cli tool open NAME --data`) opens a flow tool's Data page from the command line.
