Skip to content
flow

CLI & automationCustom tools

Custom tools

Add your own tools to Flow's sidebar - CLI tool pages from a command, and flow tools with a manifest and synced data, including the example tools.

View as Markdown
On this page

The sidebar's Tools band lists Flow's built-in pages (the Trash, the Task Manager, Schedules, Reviews, My PRs) and any tools you add. There are two kinds of tool you can add:

  • A CLI tool page is a named command, such as lazygit or k9s, that gets its own full-page terminal in the Tools band. You add one in Settings.
  • A flow tool is a small program in a folder under ~/.flow/tools/, with a manifest and, optionally, data that syncs across your Macs. You build one with the sink command-line tool.

CLI tool pages

Add a CLI tool

  1. Open Settings › Tools › Add a tool.
  2. Enter its name, the command to run and the directory to run it in. Pick an icon, or leave it on Automatic to use the icon of the program it runs.
  3. The tool appears in the sidebar's Tools band. Click it to open its page: a terminal running the command.

From a shell:

sh
flow-cli tool cli add lazygit --command lazygit --cwd ~/src/app
flow-cli tool cli edit lazygit --icon git-branch
flow-cli tool cli edit lazygit --enabled false     # hide it from the Tools band
flow-cli tool cli remove lazygit
flow-cli page lazygit                              # open its page
flow-cli read tools                                # the registry as JSON

tool cli add requires --command; control and formatting characters are refused. A command whose first word is drop always runs the drop bundled with Flow, whether or not it is on your PATH. A tool page's terminal is not saved with your sessions.

Order and visibility

Settings › Tools › Sidebar has a switch for each built-in page (tools.sidebar.trash, tools.sidebar.tasks, tools.sidebar.schedules, tools.sidebar.pr_reviews, tools.sidebar.my_prs) and each CLI tool, and Reorder tools lets you drag them into the order you want. Switching a tool off only takes it out of the band and the ⇧⌘↑ / ⇧⌘↓ walk; its page stays reachable from the command palette and flow-cli page.

The list is stored in two settings, each a JSON array kept as a string:

SettingHolds
tools.cliThe CLI tools: name, command, directory, on/off and icon.
tools.lineupThe Tools band's order and the built-ins' on/off switches.

Both are rewritten by Settings; prefer flow-cli tool cli over editing them.

Share CLI tools across your Macs

With the Puddles experiment on and devices paired, tools.sync (Settings › Tools › Puddle › Sync CLI tools with your devices, on by default) keeps the CLI tool list the same on every Mac that syncs: a tool added, changed or removed on one is added, changed or removed on the others.

  • A tool's directory under your home folder maps to the same place on the other Mac (~/src/app); the command itself, and what it runs, must exist on each Mac.
  • Each Mac keeps its own order.
  • When a change from another Mac changes what runs (a tool added or removed, its command, folder or switch), Flow shows a toast with Revert, and Settings › Tools marks the tool "From DEVICE".
  • When the same name has different values on two Macs the first time they sync, neither is overwritten; Settings › Tools offers "Use DEVICE's".
  • A device's space in the sidebar lists that Mac's tools read-only, with Add to this Mac for one that differs. Taking a tool needs your confirmation of its full command and folder, and only works from a device you allowed to open sessions on this Mac.

Flow tools

A flow tool is a folder, installed at ~/.flow/tools/NAME/, holding:

  • tool.toml, the manifest;
  • one or more *.sink.toml schemas describing its data, all in collections named tool.NAME.*;
  • the program, in any language: a CLI or TUI that runs in a Flow terminal.

Its data lives in Flow's local sync store, so it works on one Mac on its own; with Puddles on, its rows replicate to your other Macs like Flow's own data. Use it for anything that needs a little shared state between machines: a list, a log, a lock, a key-value store.

The manifest

toml
name = "standup"                  # required: [a-z][a-z0-9-]{0,31}, and the folder's name
title = "Standup"
description = "Today's standup across every device."
icon = "list"                     # a Flow tab-icon id
kind = "cli"                      # cli or tui
command = ["python3", "./standup.py"]   # argv; ./x is inside the tool folder
# command = 'exec "$FLOW_TOOL_DIR/run" "$@"'   # or a /bin/sh -c line
schemas = ["standup.sink.toml"]
effects = ["deploy/{target}"]     # lease keys it takes, after tool.NAME:
version = "0.1.0"

[env]                             # extra environment variables

Unknown keys are errors, and no path may leave the tool's folder. In collection names a - in the tool's name is spelled _ (deploy-lock → tool.deploy_lock.*). [env] may not set PATH or any FLOW_*, DYLD_*, LD_* or CLAUDE_CODE_* variable.

What a tool's program gets

Flow runs the manifest's command in the tool's folder with:

VariableValue
FLOW_TOOLthe tool's name
FLOW_TOOL_DIRthe tool's folder, absolute
FLOW_SINK_DBthe sync store file
FLOW_DEVICEthis Mac's device id, the owner of rows it writes
FLOW_SOCKETthe app's command bus (unset when no app runs)

PATH starts with Flow's bundled binaries (sink, flow-cli). The program reads and writes its data with flow-cli sync query / mutate / intent … --json while the app runs, and falls back to the same call on the store file, sink CMD "$FLOW_SINK_DB" …, when it doesn't.

Build one

The sink CLI (installed with the other command-line tools) scaffolds, checks, simulates and runs tools:

sh
sink tool new standup --lang python       # or sh, ts; creates ./standup/
sink tool check .                         # manifest, paths, schemas, stale generated files
sink tool codegen . --ts sink.ts          # typed TypeScript client from the schemas
sink sim . --script sim.toml              # a scripted multi-device scenario
sink sim . --random 300 --devices 3 --seed 7   # random writes and faults, then convergence
sink tool run . -- add --done shipped it  # run it offline on a scratch store

The scaffold is a working shared list with a passing sim.toml: rework it into your tool. sink COMMAND --help documents every command. To have a coding agent build one with you, use the tools skill.

Install a tool

sh
ln -s "$PWD" ~/.flow/tools/standup      # or copy the folder; its name must be the manifest's name
flow-cli tool check standup             # ready, invalid or refused, with every problem
flow-cli tool open standup              # its page: the terminal
flow-cli tool data standup              # its Data page: its rows, by device
flow-cli tool list                      # every tool Flow found

Flow picks a new or changed tool up within a couple of seconds and gives it a row in the Tools band, after the lineup's rows. A ready tool's row opens its terminal; a tool with problems shows an orange count and opens its Data page, which says what is wrong. A tool whose name is already a Flow page's or a CLI tool page's is refused: rename it. The tool's terminal starts the first time you open its page and is not saved with your sessions; when the program exits, its last screen stays and ⏎ relaunches it.

Share a tool with your other Macs

While sync is on, Flow offers each ready tool to your other Macs as a bundle: every regular file in its folder except dotfiles (a .gitignore is kept), dot-folders, node_modules and symlinks. On another Mac the tool appears in the Tools band as "TITLE · from DEVICE" until you click Install; nothing installs from the bus. Before anything is written, Flow shows the files it will install, executables first. Offers only come from devices you allowed to open sessions on that Mac.

An update replaces the installed copy only after your confirmation, and a copy you edited locally needs a second confirmation. The replaced copy is never deleted: it moves to ~/.flow/tools/.replaced/, and what a bundle never carries (.git, .env, node_modules, symlinks) stays in place.

Example tools

Flow's source includes three worked examples under examples/tools/, each with a README, a manifest, a schema and a sim.toml:

ToolLanguageShows
standupPythonOne standup list across your devices. A shared collection that any device writes, merged field by field; each item records the device that added it. Commands: standup, standup add … (--blocked, --done), standup rm N, standup list --day DATE.
snippets-syncTypeScriptNamed text snippets, the same on every device: snippets-sync set KEY TEXT, get KEY, rm KEY. Uses the generated typed client and upserts with the key as the row id, so two Macs setting one key land on one row. Runs with Bun, or Node with type stripping.
deploy-lockshOne host's deploy lock: deploy-lock run prod -- ./deploy.sh takes a lease on deploy/prod, runs the command, and records the run with a fenced write, so a caller that stalled past its lease can't finish a stale deploy. Also deploy-lock status prod and deploy-lock demo.

Limits

  • Flow tools can't define custom mutations yet: writes are the generated insert, update, upsert, delete and archive operations.
  • A tool's schemas can only grow once registered: add optional fields and collections, never remove, rename or retype.
  • Rows replicate to every paired device, so keep secrets out of them.
  • A CLI tool's command and the programs it runs must exist on each Mac it syncs to.
Sources

Written from these files in the Flow app repo

  • src/cli_tools.rs
  • src/sink_tools.rs
  • src/sink_tools_ui.rs
  • src/flow_tools.rs
  • src/flow_tools_ui.rs
  • src/bin/flow-cli.rs
  • src/bus.rs
  • agent-skills/tools/SKILL.md
  • agent-skills/settings/MANIFEST.md
  • examples/tools/deploy-lock/README.md
  • examples/tools/deploy-lock/tool.toml
  • examples/tools/snippets-sync/README.md
  • examples/tools/snippets-sync/tool.toml
  • examples/tools/standup/README.md
  • examples/tools/standup/tool.toml