# Command Reference (/docs/usage/cli)

> For AI agents, the [documentation index](https://bitrouter-docs-staging.up.railway.app/llms.txt) lists all pages. Append .md to a documentation URL to read its Markdown.

{/\* GENERATED by scripts/generate-cli.mjs from cli-overlays/index.md, cli-overlays/<group>.md, cli-overlays/legacy-workflows.md, and .cli-snapshot.json (bro 1.0.0-alpha.33). Edit the authored inputs and re-run; do not edit this page. \*/}

Use [Getting Started](https://bitrouter-docs-staging.up.railway.app/docs/cli/getting-started), [Run & Inspect](https://bitrouter-docs-staging.up.railway.app/docs/cli/run-inspect), or [Cloud Management](https://bitrouter-docs-staging.up.railway.app/docs/cli/cloud-management) for workflow guidance.

## Command reference \[#command-reference]

BitRouter ships as one **static binary**, `bro`, with no runtime dependencies to install. It runs the local router your applications call, launches supported coding agents, and exposes scriptable commands for routing, evaluation, optimization, and your hosted account.

Start with `bro init` for guided setup, `bro serve` for a foreground router, or `bro cloud login` to manage Cloud.

Commands below are generated from the captured `bro 1.0.0-alpha.33 --help` snapshot. Compare `bro --version` and your installed command's `--help` before using them. The complete captured command set is retained even when a command is outside the first-release workflow guides.

### Conventions \[#conventions]

* **Output is JSON by default** for scriptable commands. The compatibility options `--json`, `--human`, and `--context <NAME>` go before the command when needed.
* **`-c/--config <PATH>`** overrides config discovery for any command that loads a config. Discovery order: `./bitrouter.yaml` → `$BITROUTER_HOME/bitrouter.yaml` → `~/.bitrouter/bitrouter.yaml` → zero-config (in-memory defaults, auto-enabling providers from env keys).
* **Credentials** live under `$XDG_DATA_HOME/bitrouter/account-credentials.json` (mode `0600`), written by `cloud login` or `providers login`.

### Environment variables \[#environment-variables]

| Variable                                                                                              | Effect                                                                                                                                                                              |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `OPENROUTER_API_KEY`, `OPENCODE_ZEN_API_KEY` | Zero-config BYOK — auto-enables the provider. See [BYOK](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/byok-subscriptions#built-in-providers-with-your-own-key) |
| `BITROUTER_API_KEY`                                                                                   | Cloud API key; enables the managed `bitrouter` provider                                                                                                                             |
| `BITROUTER_HOME`                                                                                      | Config discovery override (see above)                                                                                                                                               |
| `BITROUTER_OAUTH_AS`                                                                                  | Override the OAuth authorization server for self-hosted Cloud                                                                                                                       |
| `OTEL_EXPORTER_OTLP_ENDPOINT`                                                                         | Opt in to OTLP export. See [OpenTelemetry](https://bitrouter-docs-staging.up.railway.app/docs/self-hosting#opentelemetry)                                                           |

### Command map \[#command-map]

* **Run it** — [daemon lifecycle](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#daemon-lifecycle): lifecycle, request history, retained operations, and remote contexts
* **Onboard** — [init and config](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#init-and-config): the wizard, config validation
* **Inspect routing** — [routing introspection](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#routing-introspection): decision preview, model catalog, OTel state
* **Providers** — [providers](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#providers): catalog and subscription login
* **Evaluate and improve** — [policy](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#policy): policies, evidence exchange, optimization, and trajectory history
* **Cloud** — [cloud](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#cloud): login, keys, usage, billing, policies, BYOK
* **Agents and protocols** — [agents, ACP, and MCP](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#agents-acp-and-mcp): agent catalog, ACP adapters, and upstream MCP checks
* **Skills** — [skills](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#skills): inspect installed Agent Skills or scaffold one locally
* **Coding agents** — [coding agents](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#coding-agents): native launch, interactive conversation, and headless ACP runs
* **Misc** — [key, workflow-state, and update](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#key-workflow-state-and-update): virtual keys, benchmark tooling, self-update

The deprecated `bitrouter` command may still be installed as a compatibility alias, but documentation uses `bro`. Agents can operate BitRouter through the shipped [Agent Skill](https://bitrouter-docs-staging.up.railway.app/docs/overview/quickstart#onboard-via-the-agent-skill); BitRouter's MCP support is an upstream client and aggregate gateway, not a first-party origin tool server.

### Daemon lifecycle \[#daemon-lifecycle]

The local router listens on `http://127.0.0.1:4356` by default. It serves the supported model protocols and the configured upstream MCP aggregate; ACP agent adapters use their own stdio lifecycle. This section covers the daemon, request history, retained remote operations, and named remote contexts.

#### `bro serve` \[#bro-serve]

Load a config, run migrations, and serve HTTP + control socket **in the foreground**

**Usage:** `bro serve [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. When omitted, the binary resolves in this order: `./bitrouter.yaml` → `$BITROUTER_HOME/bitrouter.yaml` → `~/.bitrouter/bitrouter.yaml` → zero-config in-memory defaults (`bro init` is the explicit way to scaffold a file)

Runs in the foreground — the form you want under a process supervisor or in a container:

```bash
bro serve -c ./bitrouter.yaml
```

#### `bro start` \[#bro-start]

Spawn `bro serve` as a detached background process

**Usage:** `bro start [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (passed through to the child)
* `--log <LOG>` — Path to redirect the daemon's stdout/stderr to. Defaults to `bitrouter.log` inside the config file's directory (e.g. `~/.bitrouter/bitrouter.log`) so it lives alongside the socket and pid file rather than in the launcher's CWD

Daemonizes: writes a pidfile and detaches. `stop`/`restart` target the pidfile; `reload` hot-loads config changes without dropping in-flight connections.

#### `bro stop` \[#bro-stop]

Send a `stop` command to a running daemon

**Usage:** `bro stop [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the control socket). Resolves via the standard chain: `./bitrouter.yaml` → `$BITROUTER_HOME/bitrouter.yaml` → `~/.bitrouter/bitrouter.yaml`
* `--socket <SOCKET>` — Explicit control socket path. Overrides the config-derived path

#### `bro restart` \[#bro-restart]

`stop` then `start` — config path is passed through

**Usage:** `bro restart [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. When omitted, the binary resolves in this order: `./bitrouter.yaml` → `$BITROUTER_HOME/bitrouter.yaml` → `~/.bitrouter/bitrouter.yaml` → zero-config in-memory defaults (`bro init` is the explicit way to scaffold a file)
* `--socket <SOCKET>` — Explicit control socket path. Overrides the config-derived path
* `--log <LOG>` — Path to redirect the new daemon's stdout/stderr to. Defaults to `bitrouter.log` next to the config file

#### `bro reload` \[#bro-reload]

Hot-reload the running daemon's config / routing table

**Usage:** `bro reload [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the control socket)
* `--socket <SOCKET>` — Explicit control socket path. Overrides the config-derived path

#### `bro operations` \[#bro-operations]

Inspect a retained remote administration operation

**Usage:** `bro operations <COMMAND>`

##### `bro operations show` \[#bro-operations-show]

Show one retained reload operation owned by this credential

**Usage:** `bro operations show --instance <INSTANCE> <REQUEST_ID>`

**Arguments**

* `<REQUEST_ID>` — Reload request UUID returned by `bro reload`

**Options**

* `--instance <INSTANCE>` — Daemon boot instance UUID returned with the operation

#### `bro status` \[#bro-status]

Report a running daemon's status (pid, listen address, model count). Prints `running: no` when no daemon is reachable.
With `--requests`, reports what the router has actually done instead: settled requests (time, model, the provider that actually served, tokens, cost, latency, status) plus daemon state and a spend rollup scoped to every caller. Read straight from the metering store, so it works with no daemon running. JSON by default like every other command; `--human` renders the table.

**Usage:** `bro status [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the control socket)
* `--socket <SOCKET>` — Explicit control socket path. Overrides the config-derived path

Prints `running: no` when no daemon is reachable — safe to poll in scripts.

#### `bro requests` \[#bro-requests]

Show recent settled requests and aggregate spend

**Usage:** `bro requests [OPTIONS]`

**Options**

* `--limit <LIMIT>` — Maximum number of recent requests to return \[default: 500]
* `--since <SINCE>` — Inclusive RFC3339 lower bound. Requires `--until`
* `--until <UNTIL>` — Exclusive RFC3339 upper bound. Requires `--since`
* `--model <MODEL>` — Keep only requests resolved to this model id
* `--provider <PROVIDER>` — Keep only requests served by this provider id
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the local control socket)
* `--socket <SOCKET>` — Explicit local control socket path

#### `bro context` \[#bro-context]

Manage named remote-control targets. Contexts store a token environment variable name, never the token value

**Usage:** `bro context <COMMAND>`

##### `bro context add` \[#bro-context-add]

Add a named remote target

**Usage:** `bro context add --endpoint <ENDPOINT> --token-env <NAME> <NAME>`

**Arguments**

* `<NAME>` — Context name used by `--context`

**Options**

* `--endpoint <ENDPOINT>` — HTTPS origin or endpoint ending in `/control/v1`. Plain HTTP is accepted only for loopback/SSH-forwarded endpoints
* `--token-env <NAME>` — Environment variable containing this context's bearer token

##### `bro context list` \[#bro-context-list]

List configured remote targets

**Usage:** `bro context list`

##### `bro context show` \[#bro-context-show]

Show one remote target without reading its token

**Usage:** `bro context show <NAME>`

**Arguments**

* `<NAME>`

##### `bro context remove` \[#bro-context-remove]

Remove one remote target

**Usage:** `bro context remove <NAME>`

**Arguments**

* `<NAME>`

### Init and config \[#init-and-config]

BitRouter discovers its config in this order — first hit wins:

1. `./bitrouter.yaml` in the current directory
2. `$BITROUTER_HOME/bitrouter.yaml` (must exist when the variable is set)
3. `~/.bitrouter/bitrouter.yaml`
4. **Zero-config** — in-memory defaults, auto-enabling any provider whose API key is set in the environment

Any command taking `-c/--config` overrides discovery. The daemon **chdirs into the config's directory** on startup, so relative paths (`database.url`, `policy.path`) resolve there. A JSON Schema for the config lives at `dist/schema/bitrouter.config.schema.json` in the repo for IDE autocomplete.

The full onboarding walkthrough — wizard steps, headless flags, recipes — is the [Quickstart](https://bitrouter-docs-staging.up.railway.app/docs/overview/quickstart).

#### `bro init` \[#bro-init]

Guided onboarding wizard that sequences credential, harness, and finish steps to first value. Interactive by default; `--yes` (or no TTY) runs it headlessly, emitting the JSON result envelope and never blocking on a human. Every prompt has a flag equivalent (below) so an agent can drive the whole thing. Saves the default ACP harness and optional model in the resolved config or BitRouter home; `--force` resets existing settings

**Usage:** `bro init [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Configuration to create/update; defaults to the resolved config or BitRouter home
* `-y, --yes` — Run non-interactively: process the flags below, never block, emit the JSON envelope, and scaffold the starter config
* `--force` — Allow overwriting an existing `bitrouter.yaml` when scaffolding
* `--reset` — Clear stored onboarding credentials (cloud session always; provider credentials after a confirm, or unconditionally under `--yes`) before running
* `--cloud-login` — (Step 1) Sign in to BitRouter Cloud via device-flow OAuth. Skipped and reported under `--yes` (a machine can't complete the device flow)
* `--api-key <BRK_KEY>` — (Step 1) Seed the cloud credential from a `brk_` API key (non-interactive)
* `--provider <ID>` — (Step 1) Log in to an upstream provider by id (repeatable). A paired `--provider-api-key` seeds it non-interactively; otherwise it is reported-and-skipped under `--yes`
* `--provider-api-key <KEY>` — (Step 1) API key for the `--provider` at the same position (repeatable)
* `--use-detected` — (Step 1) Accept the auto-detected credential(s) without prompting
* `--harness <HARNESSES>` — (Step 2) Built-in ACP harness: `claude` or `codex` (first is the default) Possible values:
* ``- claude: Anthropic's Claude Code CLI (`claude`)``
* `- codex:` — OpenAI's Codex CLI (`codex`)
* `--after <AFTER>` — (Step 3) What to do at the end: `launch` | `serve` | `exit` Possible values:
* `- launch: Open BitRouter's TUI using the selected ACP harness`
* `- serve:` — Start the daemon and print a paste-in snippet for an existing tool
* `- exit:` — Do nothing further
* `--model <ID>` — (Step 3) Default daemon-routable model, saved for subsequent TUI sessions

Runs the wizard interactively. With `--yes`, credential prompts are skipped and a JSON result envelope is emitted; choose `--after exit` for a noninteractive setup. Onboarding updates the existing config by default; `--force` starts from the starter template.

```bash
bro init --yes --use-detected --harness claude --after serve
```

#### `bro config` \[#bro-config]

Configuration tooling (validation against the published schema)

**Usage:** `bro config <COMMAND>`

##### `bro config migrate-routers` \[#bro-config-migrate-routers]

Preview a source-preserving migration from presets to named routers

**Usage:** `bro config migrate-routers [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Source bitrouter.yaml; standard local config resolution applies
* `--candidate <CANDIDATE>` — Candidate output path for preview, or reviewed input path for apply
* `--apply` — Apply the reviewed candidate and retain a backup of the source
* `--source-digest <SOURCE_DIGEST>` — Exact source digest returned by the preview; refuses stale edits

##### `bro config validate` \[#bro-config-validate]

Validate a config file: structure, provider `derives` resolution, and upstream-URL (SSRF) safety. Exits non-zero on an invalid config — safe to run in CI. Unset `${VAR}` references are substituted with a placeholder and reported as warnings, so secrets need not be present

**Usage:** `bro config validate [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` / `bitrouter.json`. When omitted, the standard resolution chain applies (`./bitrouter.yaml` → `$BITROUTER_HOME` → `~/.bitrouter`)

The CI-safe check: exits non-zero when the config doesn't match the schema.

```bash
bro config validate -c ./bitrouter.yaml
```

### Routing introspection \[#routing-introspection]

Three read-only views over the same routing state the daemon acts on. Use them to answer *what would BitRouter do?* before sending traffic.

#### `bro route` \[#bro-route]

Resolve a model name through the routing table. Uses the running daemon if reachable, otherwise loads the config — policy table included — and resolves locally. Read-only: nothing is sent upstream

**Usage:** `bro route [OPTIONS] <MODEL>`

**Arguments**

* `<MODEL>` — The model name to resolve

**Options**

* `--prompt <PROMPT>` — Prompt text to resolve *for*. The policy table keys on the agent-loop step a request represents, so the model it selects can differ with the prompt; omit for a bare model resolution
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used as the standalone fallback and to locate the control socket)
* `--socket <SOCKET>` — Explicit control socket path. Overrides the config-derived path

```bash
bro route anthropic/claude-opus-4.8
bro route @coding          # presets resolve through their bound policy
```

Uses the running daemon when reachable, otherwise resolves from the config on disk — so it works in CI too.

#### `bro models` \[#bro-models]

List routable models for a config, optionally filtered by provider

**Usage:** `bro models [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. When omitted, the binary resolves in this order: `./bitrouter.yaml` → `$BITROUTER_HOME/bitrouter.yaml` → `~/.bitrouter/bitrouter.yaml` → zero-config in-memory defaults (`bro init` is the explicit way to scaffold a file)
* `-p, --provider <PROVIDER>` — Show only models declared by this provider

```bash
bro models                 # every model id routable right now
bro models --provider anthropic
```

#### `bro observe` \[#bro-observe]

Observability inspection (OTel exporter state, cardinality usage)

**Usage:** `bro observe <COMMAND>`

##### `bro observe status` \[#bro-observe-status]

Report the OTel exporter's current state (endpoint, sampler, cardinality usage, in-flight spans). Queries the running daemon over the control socket; reports "stopped" + the compile-time `OTEL_ENABLED` flag when no daemon is reachable

**Usage:** `bro observe status [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the control socket)
* `--socket <SOCKET>` — Explicit control socket path. Overrides the config-derived path

Reports the OTel exporter's live state — endpoint, sampler, cardinality usage, in-flight spans. The verification step for [OpenTelemetry](https://bitrouter-docs-staging.up.railway.app/docs/self-hosting#opentelemetry).

### Providers \[#providers]

Two ways a provider becomes available: **BYOK** (its API key in the environment — see [BYOK](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/byok-subscriptions#built-in-providers-with-your-own-key)) and **`providers login`** (OAuth against subscription providers such as Claude or Codex subscriptions — see [Model sources](https://bitrouter-docs-staging.up.railway.app/docs/integration/coding-agents#model-sources)). `providers list` shows the catalog and which providers are active in the current config.

#### `bro providers` \[#bro-providers]

Provider management

**Usage:** `bro providers <COMMAND>`

##### `bro providers list` \[#bro-providers-list]

List every configured provider

**Usage:** `bro providers list [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. When omitted, the binary resolves in this order: `./bitrouter.yaml` → `$BITROUTER_HOME/bitrouter.yaml` → `~/.bitrouter/bitrouter.yaml` → zero-config in-memory defaults (`bro init` is the explicit way to scaffold a file)
* `--socket <SOCKET>` — Explicit local control socket for the daemon's accepted provider catalog

##### `bro providers login` \[#bro-providers-login]

Log in to an upstream provider — interactive credential setup.
Per-provider methods are auto-derived from the catalog: `claude-code` adopts the live Claude Code session; `anthropic` accepts an API-key paste; `openai-codex` runs the ChatGPT PKCE flow; `github-copilot` the GitHub device flow; everything else accepts a pasted API key. Logging in to the built-in `bitrouter` provider runs the same cloud sign-in as `bro cloud login`.

**Usage:** `bro providers login [OPTIONS] <PROVIDER>`

**Arguments**

* `<PROVIDER>` — Provider id (e.g. `claude-code`, `openai-codex`, `bitrouter`)

**Options**

* `-l, --label <LABEL>` — Account label this credential is stored under (default `default`). Ignored for the `bitrouter` provider (it uses the cloud credential) \[default: default]
* `--import-existing` — Import an existing vendor CLI session without prompting for a browser sign-in. Currently supported by openai-codex
* `--no-browser` — Do not run a browser-based provider OAuth flow
* `--api-key <KEY>` — Seed a BYOK provider non-interactively from this API key — skips the method menu and the stdin paste. The provider must accept a pasted key (OAuth-only backends reject it)
* `--key-stdin` — Read the API key from stdin (one line) instead of prompting — for pipelines, e.g. `printf %s "$KEY" \| bro providers login openai --key-stdin`

```bash
bro providers login <provider-id>
```

Opens the provider's OAuth flow and stores the credential in the local credential store — no key to paste. `providers logout` removes it.

##### `bro providers logout` \[#bro-providers-logout]

Log out of an upstream provider — clears every stored credential for it. For the built-in `bitrouter` provider this is `cloud logout`

**Usage:** `bro providers logout <PROVIDER>`

**Arguments**

* `<PROVIDER>` — Provider id whose stored credentials should be removed

### Policy \[#policy]

Local routing policies are the artifact used by the [self-improving loop](https://bitrouter-docs-staging.up.railway.app/docs/overview/what-is-bitrouter): `init` scaffolds `policy-lock.yaml` and binds it to a named router. Operators can compile candidates from evidence and publish them, or authorize an optimizer step that may publish a transition. See [Workload Optimization](https://bitrouter-docs-staging.up.railway.app/docs/routing/workload-optimization#let-evidence-improve-the-policy).

> **info**
>
> `bro policy create` + `bro key sign` are a **different surface** — per-virtual-key access control (allowed models, budgets, rate limits), not routing. See [access-control policies](https://bitrouter-docs-staging.up.railway.app/docs/routing/configuration#validate-the-contract).

#### `bro policy` \[#bro-policy]

Policy management

**Usage:** `bro policy <COMMAND>`

##### `bro policy create` \[#bro-policy-create]

Write a starter access-control policy file to the policy dir

**Usage:** `bro policy create [OPTIONS] <ID>`

**Arguments**

* `<ID>` — Policy id (becomes the file stem and the `id:` field)

**Options**

* `--dir <DIR>` — Policy directory. Default matches the assembly default \[default: ./policies]

##### `bro policy init` \[#bro-policy-init]

Create a routing policy lock and bind it to a router

**Usage:** `bro policy init [OPTIONS] --economy <ECONOMY> <NAME>`

**Arguments**

* `<NAME>` — Policy name written under `policies:`

**Options**

* `--router <ROUTER>` — Router users select as `bitrouter/<id>`. Defaults to `coding` when neither binding flag is supplied
* `--preset <PRESET>` — Legacy preset binding kept for compatibility
* `--strong <STRONG>` — Strong base model. Inferred from an existing router or preset when omitted
* `--strong-effort <STRONG_EFFORT>` — Exact reasoning effort owned by the strong target
* `--economy <ECONOMY>` — Economy model explored as a replacement
* `--economy-effort <ECONOMY_EFFORT>` — Exact reasoning effort owned by the economy target
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`

```bash
bro policy init coding --router coding \
  --strong openai:openai/gpt-5.6-sol \
  --economy moonshotai:moonshotai/kimi-k2.7-code
```

The tiers must be configured, active `provider:model` routes; substitute routes available in your deployment. The command writes `policy-lock.yaml` and edits `bitrouter.yaml` to bind the named router. The router binding preserves the configured policy mode.

##### `bro policy check` \[#bro-policy-check]

Parse and cross-validate `bitrouter.yaml` and its policy lock

**Usage:** `bro policy check [OPTIONS]`

**Options**

* `-c, --config <CONFIG>`

##### `bro policy verify` \[#bro-policy-verify]

Verify the lock's compiled evidence root against the local ledger

**Usage:** `bro policy verify [OPTIONS]`

**Options**

* `--evidence`
* `-c, --config <CONFIG>`

##### `bro policy status` \[#bro-policy-status]

Show policy path, digest, runtime mode, and preset bindings

**Usage:** `bro policy status [OPTIONS]`

**Options**

* `--view <VIEW>` — Read `disk` locally by default; a remote context defaults to `active` \[possible values: active, disk]
* `-c, --config <CONFIG>`
* `--socket <SOCKET>` — Explicit local control socket for an active policy read

##### `bro policy show` \[#bro-policy-show]

Show one named policy after validation

**Usage:** `bro policy show [OPTIONS] <NAME>`

**Arguments**

* `<NAME>`

**Options**

* `--view <VIEW>` — Read `disk` locally by default; a remote context defaults to `active` \[possible values: active, disk]
* `-c, --config <CONFIG>`
* `--socket <SOCKET>` — Explicit local control socket for an active policy read

##### `bro policy reload` \[#bro-policy-reload]

Hot-reload the policy lock through the daemon control socket

**Usage:** `bro policy reload [OPTIONS]`

**Options**

* `-c, --config <CONFIG>`
* `--socket <SOCKET>`

Hot-reloads the daemon's policy snapshot. An invalid lock is rejected and the daemon keeps its last-known-good.

##### `bro policy compile` \[#bro-policy-compile]

Compile a deterministic v3 candidate without changing the active lock

**Usage:** `bro policy compile [OPTIONS] --output <FILE>`

**Options**

* `--output <FILE>` — Candidate output path
* `--snapshot-time <UNIX_MS>` — Frozen evidence snapshot time in Unix milliseconds
* `--eval-snapshot <SHA256>` — Immutable admitted-evidence root from `eval snapshot freeze`
* `-c, --config <CONFIG>`

##### `bro policy diff` \[#bro-policy-diff]

Compare explicit routes in two policy lock artifacts

**Usage:** `bro policy diff <ACTIVE> <CANDIDATE>`

**Arguments**

* `<ACTIVE>`
* `<CANDIDATE>`

##### `bro policy publish` \[#bro-policy-publish]

Publish one already-compiled candidate after lineage validation

**Usage:** `bro policy publish [OPTIONS] <CANDIDATE>`

**Arguments**

* `<CANDIDATE>`

**Options**

* `-c, --config <CONFIG>`
* `--socket <SOCKET>`

##### `bro policy evolve` \[#bro-policy-evolve]

Project qualified database evidence into a deterministic policy lock

**Usage:** `bro policy evolve [OPTIONS]`

**Options**

* `--apply` — Publish the candidate. Without this flag, print a dry-run report
* `--output <FILE>` — Export the candidate without changing the active policy lock
* `-c, --config <CONFIG>`

```bash
bro policy evolve          # dry-run candidate projection
bro policy evolve --apply  # atomically republish policy-lock.yaml in adaptive mode
```

Qualified changes may add or update compiler-owned routes; operator-authored routes are preserved. Publishing requires `policy.mode: adaptive`; frozen mode refuses writes.

##### `bro policy rollback` \[#bro-policy-rollback]

Restore an exact lock snapshot from local promotion history

**Usage:** `bro policy rollback [OPTIONS] <DIGEST>`

**Arguments**

* `<DIGEST>`

**Options**

* `-c, --config <CONFIG>`
* `--socket <SOCKET>`

#### `bro eval` \[#bro-eval]

Evaluator-neutral evidence exchange

**Usage:** `bro eval <COMMAND>`

##### `bro eval subject` \[#bro-eval-subject]

Create, inspect, and list eval subjects

**Usage:** `bro eval subject <COMMAND>`

###### `bro eval subject seal` \[#bro-eval-subject-seal]

Calculate the canonical evidence digest and write a validated JSON subject

**Usage:** `bro eval subject seal --output <FILE> <DRAFT>`

**Arguments**

* `<DRAFT>` — Draft JSON or YAML subject with redacted evidence items

**Options**

* `--output <FILE>` — Destination for the deterministic sealed JSON subject

###### `bro eval subject put` \[#bro-eval-subject-put]

Insert an immutable subject from JSON or YAML

**Usage:** `bro eval subject put [OPTIONS] <FILE>`

**Arguments**

* `<FILE>`

**Options**

* `-c, --config <CONFIG>`

###### `bro eval subject get` \[#bro-eval-subject-get]

Get one subject by eval id

**Usage:** `bro eval subject get [OPTIONS] <EVAL_ID>`

**Arguments**

* `<EVAL_ID>`

**Options**

* `-c, --config <CONFIG>`

###### `bro eval subject list` \[#bro-eval-subject-list]

List subjects

**Usage:** `bro eval subject list [OPTIONS]`

**Options**

* `-c, --config <CONFIG>`

##### `bro eval result` \[#bro-eval-result]

Submit an evaluator result through authority admission

**Usage:** `bro eval result <COMMAND>`

###### `bro eval result submit` \[#bro-eval-result-submit]

Submit an immutable result from JSON or YAML as the local operator

**Usage:** `bro eval result submit [OPTIONS] <FILE>`

**Arguments**

* `<FILE>`

**Options**

* `-c, --config <CONFIG>`

##### `bro eval snapshot` \[#bro-eval-snapshot]

Freeze or inspect an immutable admitted-evidence snapshot

**Usage:** `bro eval snapshot <COMMAND>`

###### `bro eval snapshot freeze` \[#bro-eval-snapshot-freeze]

Freeze all currently admitted results into a content-addressed manifest

**Usage:** `bro eval snapshot freeze [OPTIONS]`

**Options**

* `--at <AT>`
* `-c, --config <CONFIG>`

###### `bro eval snapshot get` \[#bro-eval-snapshot-get]

Get a frozen manifest by evidence root

**Usage:** `bro eval snapshot get [OPTIONS] <EVIDENCE_ROOT>`

**Arguments**

* `<EVIDENCE_ROOT>`

**Options**

* `-c, --config <CONFIG>`

##### `bro eval status` \[#bro-eval-status]

Summarize local exchange state

**Usage:** `bro eval status [OPTIONS]`

**Options**

* `-c, --config <CONFIG>`

#### `bro optimize` \[#bro-optimize]

Advance or inspect history-driven routing optimization

**Usage:** `bro optimize <COMMAND>`

##### `bro optimize run` \[#bro-optimize-run]

Perform one deterministic controller transition from admitted Eval history

**Usage:** `bro optimize run [OPTIONS]`

**Options**

* `--policy <POLICY>` — \[default: auto]
* `--candidate-tier <CANDIDATE_TIER>` — Challenger tier; defaults to the policy's adequacy explore tier
* `--exploration-ppm <EXPLORATION_PPM>` — \[default: 100000]
* `--minimum-tasks <MINIMUM_TASKS>` — \[default: 3]
* `--maximum-tasks <MAXIMUM_TASKS>` — \[default: 20]
* `--minimum-pass-rate-ppm <MINIMUM_PASS_RATE_PPM>` — \[default: 900000]
* `--evaluator-config-digest <EVALUATOR_CONFIG_DIGEST>`
* `-c, --config <CONFIG>` — \[default: bitrouter.yaml]
* `--socket <SOCKET>`

##### `bro optimize status` \[#bro-optimize-status]

Inspect the current controller state without changing files or the database

**Usage:** `bro optimize status [OPTIONS]`

**Options**

* `--policy <POLICY>` — \[default: auto]
* `-c, --config <CONFIG>` — \[default: bitrouter.yaml]

#### `bro trajectory` \[#bro-trajectory]

Inspect, replay, and retain durable trajectory history in the local database

**Usage:** `bro trajectory [OPTIONS] <COMMAND>`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. Uses the standard config resolution chain when omitted

##### `bro trajectory inspect` \[#bro-trajectory-inspect]

Inspect one episode's structural health, route intents, and event digests

**Usage:** `bro trajectory inspect [OPTIONS] <EPISODE_ID>`

**Arguments**

* `<EPISODE_ID>` — Globally unique trajectory episode id

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. Uses the standard config resolution chain when omitted

##### `bro trajectory replay` \[#bro-trajectory-replay]

Verify one episode and compare persisted live checkpoint evidence with replay

**Usage:** `bro trajectory replay [OPTIONS] <EPISODE_ID>`

**Arguments**

* `<EPISODE_ID>` — Globally unique trajectory episode id

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. Uses the standard config resolution chain when omitted

##### `bro trajectory prune` \[#bro-trajectory-prune]

Prune delivered outbox rows and retention-expired terminal episodes

**Usage:** `bro trajectory prune [OPTIONS] --before <BEFORE>`

**Options**

* `--before <BEFORE>` — Exclusive RFC3339 cutoff
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. Uses the standard config resolution chain when omitted
* `--dry-run` — Report exact eligible counts without mutating the database

### Cloud \[#cloud]

`bro cloud login` either runs the RFC 8628 Device Authorization Grant or stores an existing BitRouter API key. Both credential types live under `$XDG_DATA_HOME/bitrouter/account-credentials.json` (mode `0600` on Unix). The API-key form performs no network request, which makes it suitable for CI. Interactive OAuth lets you pick the workspace this session is bound to; tokens refresh automatically within 60 s of expiry.

The default scope set covers `inference:invoke`, `usage:read`, `keys:read`/`keys:write`, `billing:read`, `policy:read`/`policy:write`, `byok:read`/`byok:write`, and `namespace:read`. Sensitive scopes such as `billing:write` are opt-in via `--scope`. After either login form, the `bitrouter` provider auto-enables in zero-config mode — every model your account is entitled to is routable as `bitrouter:<model-id>`.

Every leaf accepts `--json` for raw output; the default is a `systemctl`-style key:value block for single resources and a small table for lists. When the server returns `403 missing required scope: <s>`, OAuth users get a copy-pasteable re-login hint; API-key users are told to mint a key with that scope.

#### `bro cloud` \[#bro-cloud]

Manage your BitRouter Cloud account — sign in/out, namespaces, keys, usage, requests, billing, policies, budgets, presets, and BYOK. Start with `cloud login`

**Usage:** `bro cloud <COMMAND>`

##### `bro cloud whoami` \[#bro-cloud-whoami]

Print the cloud identity stored on this machine alongside the `/v1/*` base URL the CLI will target

**Usage:** `bro cloud whoami`

##### `bro cloud api` \[#bro-cloud-api]

Make an authenticated request to a relative BitRouter Cloud API endpoint

**Usage:** `bro cloud api [OPTIONS] <ENDPOINT>`

**Arguments**

* `<ENDPOINT>` — Relative API endpoint, for example `/v1/models`

**Options**

* `-X, --method <METHOD>` — HTTP method. Defaults to GET, or POST when fields/input are present
* `-H, --header <KEY:VALUE>` — Add an HTTP request header. May be repeated
* `-f, --raw-field <KEY=VALUE>` — Add a string field to the JSON body or query string. May be repeated
* `-F, --field <KEY=VALUE>` — Add a typed field to the JSON body or query string. May be repeated
* `--input <FILE>` — Read the exact request body from a file, or `-` for stdin
* `-i, --include` — Include the response status line and headers in stdout
* `--silent` — Suppress the response body
* `--verbose` — Print redacted request and response details to stderr

Modeled after `gh api`: injects the stored bearer against the logged-in origin and streams the response. Absolute URLs and redirect following are rejected, so the credential never leaves its login origin.

```bash
bro cloud api /v1/models
bro cloud api /v1/chat/completions --input request.json
bro cloud api /v1/responses -f model=openai/gpt-5 -F stream=true
```

##### `bro cloud login` \[#bro-cloud-login]

Sign in to BitRouter Cloud from this terminal.
Prints a verification URL — open it, approve, and this CLI stores an access token it refreshes automatically. This is the same credential the built-in `bitrouter` provider uses for inference, so `providers login bitrouter` is an alias for this command.

**Usage:** `bro cloud login [OPTIONS]`

**Options**

* `--oauth-as <URL>` — Authorization server URL. Defaults to <[https://api.bitrouter.ai](https://api.bitrouter.ai/)>; override only for a self-hosted deployment (env: BITROUTER\_OAUTH\_AS)
* `--client-id <ID>` — OAuth client id. Defaults to `bitrouter-cli`; override only for a self-hosted deployment (env: BITROUTER\_OAUTH\_CLIENT\_ID)
* `--scope <SCOPE>` — Permissions to request, as a space-delimited list. Defaults to a broad "developer" set; pass a narrower or wider list to override (env: BITROUTER\_OAUTH\_SCOPE)
* `--api-key <BRK_API_KEY>` — Authenticate with a BitRouter API key instead of OAuth. Intended for CI and other non-interactive environments

```bash
bro cloud login                              # device flow, pick a workspace
bro cloud login --api-key "$BITROUTER_API_KEY"   # CI: no network, no browser
```

##### `bro cloud logout` \[#bro-cloud-logout]

Sign out: revoke the stored token at the server (best-effort) and delete the local credentials file

**Usage:** `bro cloud logout [OPTIONS]`

**Options**

* `--oauth-as <URL>` — Override the authorization server URL recorded in the credentials file for the revocation call
* `--client-id <ID>` — Override the recorded OAuth client id for the revocation call

##### `bro cloud namespace` \[#bro-cloud-namespace]

Inspect the namespaces you own and the one this CLI is bound to

**Usage:** `bro cloud namespace <COMMAND>`

###### `bro cloud namespace list` \[#bro-cloud-namespace-list]

List the namespaces you own. The one this CLI is signed in to is marked `(active)`. Switching namespaces is a re-login: `bro cloud login` and pick a different namespace in the browser

**Usage:** `bro cloud namespace list [OPTIONS]`

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud namespace current` \[#bro-cloud-namespace-current]

Print the namespace this CLI's credential is bound to. Offline — reads the local credential, no network call

**Usage:** `bro cloud namespace current [OPTIONS]`

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

##### `bro cloud keys` \[#bro-cloud-keys]

Manage `brk_` API keys in your namespace

**Usage:** `bro cloud keys <COMMAND>`

###### `bro cloud keys list` \[#bro-cloud-keys-list]

List API keys on your account

**Usage:** `bro cloud keys list [OPTIONS]`

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud keys mint` \[#bro-cloud-keys-mint]

Mint a new API key. The plaintext is printed once

**Usage:** `bro cloud keys mint [OPTIONS] --name <NAME>`

**Options**

* `--name <NAME>` — Operator-supplied display name
* `--scope <SCOPE>` — Wire-format scope tokens (repeat the flag, or pass a single space-delimited list). Must be a subset of your effective scopes
* `--expires-at <EXPIRES_AT>` — Optional expiry (RFC 3339, e.g. `2026-12-31T00:00:00Z`)
* `--json` — Print the response as raw JSON instead of the human-readable summary

Returns the plaintext `brk_…` token **exactly once** — the server keeps only the SHA-256 hash. Requested scopes must be a subset of your effective scopes.

```bash
bro cloud keys mint --name ci --scope "policy:read usage:read"
```

###### `bro cloud keys revoke` \[#bro-cloud-keys-revoke]

Revoke a key by id

**Usage:** `bro cloud keys revoke [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The key id (e.g. `k_…`)

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

##### `bro cloud usage` \[#bro-cloud-usage]

Read aggregate spend / token counts for your account

**Usage:** `bro cloud usage [OPTIONS]`

**Options**

* `--from <FROM>` — Lower bound (RFC 3339). Defaults to `to - 30 days`
* `--to <TO>` — Upper bound (RFC 3339). Defaults to now
* `--json` — Print the response as raw JSON instead of the human-readable summary

##### `bro cloud requests` \[#bro-cloud-requests]

Page through recent inference requests

**Usage:** `bro cloud requests [OPTIONS]`

**Options**

* `--limit <LIMIT>` — Page size (server clamps to `[1, 100]`)
* `--offset <OFFSET>` — Offset into the result set
* `--json` — Print the response as raw JSON instead of the human-readable summary

##### `bro cloud billing` \[#bro-cloud-billing]

Credit balance and Stripe checkout

**Usage:** `bro cloud billing <COMMAND>`

###### `bro cloud billing balance` \[#bro-cloud-billing-balance]

Show the account's credit balance

**Usage:** `bro cloud billing balance [OPTIONS]`

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud billing checkout` \[#bro-cloud-billing-checkout]

Start a Stripe checkout session for a credit top-up. Requires the `billing:write` scope

**Usage:** `bro cloud billing checkout [OPTIONS] --amount-cents <AMOUNT_CENTS>`

**Options**

* `--amount-cents <AMOUNT_CENTS>` — Amount in USD cents
* `--json` — Print the response as raw JSON instead of the human-readable summary

##### `bro cloud policy` \[#bro-cloud-policy]

Generic CRUD over the typed policy registry

**Usage:** `bro cloud policy <COMMAND>`

`--spec` reads a JSON file (or `-` for stdin) holding the flat inner spec body — e.g. `{"window": "day", "limit_micro_usd": 5000000}` for a budget. `effective` and `for-principal` answer "what would happen to a request from this principal" without making an inference call. `budget` and `preset` are typed sugar over the same rows.

###### `bro cloud policy list` \[#bro-cloud-policy-list]

List policies on your account

**Usage:** `bro cloud policy list [OPTIONS]`

**Options**

* `--kind <KIND>` — Narrow the list to one kind \[possible values: budget, rate-limit, guardrail, preset]
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy get` \[#bro-cloud-policy-get]

Fetch one policy

**Usage:** `bro cloud policy get [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy create` \[#bro-cloud-policy-create]

Create a policy. Spec body is read from `--spec <file\|->`

**Usage:** `bro cloud policy create [OPTIONS] --name <NAME> --kind <KIND> --spec <SPEC>`

**Options**

* `--name <NAME>` — Operator-supplied display name
* `--kind <KIND>` — Kind discriminator — selects which shape `--spec` must take \[possible values: budget, rate-limit, guardrail, preset]
* `--spec <SPEC>` — Path to a JSON file containing the flat inner spec body, or `-` to read from stdin
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy update` \[#bro-cloud-policy-update]

Update a policy's name and / or spec

**Usage:** `bro cloud policy update [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The policy id

**Options**

* `--name <NAME>` — New name. Omit to leave unchanged
* `--spec <SPEC>` — New spec. Path to a JSON file or `-` for stdin. Omit to leave unchanged
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy delete` \[#bro-cloud-policy-delete]

Delete a policy

**Usage:** `bro cloud policy delete [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy bind` \[#bro-cloud-policy-bind]

Attach a policy to a principal

**Usage:** `bro cloud policy bind [OPTIONS] --principal-type <PRINCIPAL_TYPE> --principal-id <PRINCIPAL_ID> <ID>`

**Arguments**

* `<ID>` — The policy id

**Options**

* `--principal-type <PRINCIPAL_TYPE>` — Principal kind (`namespace`, `api_key`, `oauth_token`, `oauth_client`)
* `--principal-id <PRINCIPAL_ID>` — Principal id — interpretation depends on `--principal-type`
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy unbind` \[#bro-cloud-policy-unbind]

Detach one binding from a policy

**Usage:** `bro cloud policy unbind [OPTIONS] <ID> <BINDING_ID>`

**Arguments**

* `<ID>` — The policy id
* `<BINDING_ID>` — The binding id (from `cloud policy bindings <id>`)

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy disable` \[#bro-cloud-policy-disable]

Park a policy — the engine skips it at request time

**Usage:** `bro cloud policy disable [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy enable` \[#bro-cloud-policy-enable]

Re-enable a previously disabled policy

**Usage:** `bro cloud policy enable [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy bindings` \[#bro-cloud-policy-bindings]

List the bindings of one policy

**Usage:** `bro cloud policy bindings [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy effective` \[#bro-cloud-policy-effective]

Preview the effective policy for a principal

**Usage:** `bro cloud policy effective [OPTIONS] --principal-type <PRINCIPAL_TYPE> --principal-id <PRINCIPAL_ID>`

**Options**

* `--principal-type <PRINCIPAL_TYPE>` — Principal kind (`namespace`, `api_key`, `oauth_token`, `oauth_client`)
* `--principal-id <PRINCIPAL_ID>` — Principal id
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud policy for-principal` \[#bro-cloud-policy-for-principal]

List every policy bound to a principal

**Usage:** `bro cloud policy for-principal [OPTIONS] <PRINCIPAL_TYPE> <PRINCIPAL_ID>`

**Arguments**

* `<PRINCIPAL_TYPE>` — Principal kind
* `<PRINCIPAL_ID>` — Principal id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

##### `bro cloud budget` \[#bro-cloud-budget]

Typed wrapper over budget-kind policies

**Usage:** `bro cloud budget <COMMAND>`

###### `bro cloud budget list` \[#bro-cloud-budget-list]

List every budget on the account

**Usage:** `bro cloud budget list [OPTIONS]`

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud budget get` \[#bro-cloud-budget-get]

Fetch one budget

**Usage:** `bro cloud budget get [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud budget create` \[#bro-cloud-budget-create]

Create a budget

**Usage:** `bro cloud budget create [OPTIONS] --name <NAME> --window <WINDOW> --limit-micro-usd <LIMIT_MICRO_USD>`

**Options**

* `--name <NAME>` — Display name
* `--window <WINDOW>` — Rolling-spend window \[possible values: day, month, total]
* `--limit-micro-usd <LIMIT_MICRO_USD>` — Spend cap in micro-USD (must be strictly positive)
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud budget update` \[#bro-cloud-budget-update]

Patch a budget's fields

**Usage:** `bro cloud budget update [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The budget id

**Options**

* `--name <NAME>` — New name
* `--window <WINDOW>` — New window \[possible values: day, month, total]
* `--limit-micro-usd <LIMIT_MICRO_USD>` — New cap (must be strictly positive when supplied)
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud budget delete` \[#bro-cloud-budget-delete]

Remove a budget

**Usage:** `bro cloud budget delete [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

##### `bro cloud preset` \[#bro-cloud-preset]

Typed wrapper over preset-kind policies

**Usage:** `bro cloud preset <COMMAND>`

###### `bro cloud preset list` \[#bro-cloud-preset-list]

List every preset on the account

**Usage:** `bro cloud preset list [OPTIONS]`

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud preset get` \[#bro-cloud-preset-get]

Fetch one preset

**Usage:** `bro cloud preset get [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud preset create` \[#bro-cloud-preset-create]

Create a preset. Each clause is supplied as a JSON file (or `-` for stdin)

**Usage:** `bro cloud preset create [OPTIONS] --name <NAME>`

**Options**

* `--name <NAME>` — Display name
* `--guardrail <GUARDRAIL>` — Optional guardrail clause (JSON file or `-`)
* `--budget <BUDGET>` — Optional budget clause
* `--rate-limit <RATE_LIMIT>` — Optional rate-limit clause
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud preset update` \[#bro-cloud-preset-update]

Patch a preset's clauses. Use `--clear-*` to drop a clause

**Usage:** `bro cloud preset update [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The preset id

**Options**

* `--name <NAME>` — New name
* `--guardrail <GUARDRAIL>` — Replace the guardrail clause (JSON file or `-`)
* `--budget <BUDGET>` — Replace the budget clause
* `--rate-limit <RATE_LIMIT>` — Replace the rate-limit clause
* `--clear-guardrail` — Drop the guardrail clause
* `--clear-budget` — Drop the budget clause
* `--clear-rate-limit` — Drop the rate-limit clause
* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud preset delete` \[#bro-cloud-preset-delete]

Remove a preset

**Usage:** `bro cloud preset delete [OPTIONS] <ID>`

**Arguments**

* `<ID>` — The resource id

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

##### `bro cloud byok` \[#bro-cloud-byok]

Bring-your-own-key provider keys

**Usage:** `bro cloud byok <COMMAND>`

###### `bro cloud byok list` \[#bro-cloud-byok-list]

List every BYOK row on the account

**Usage:** `bro cloud byok list [OPTIONS]`

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

###### `bro cloud byok set` \[#bro-cloud-byok-set]

Upsert a BYOK row. Ciphertext must be sealed by the caller against the cloud's current X25519 public key

**Usage:** `bro cloud byok set [OPTIONS] --provider <PROVIDER> --ciphertext-b64 <CIPHERTEXT_B64> --kek-id <KEK_ID> --key-prefix <KEY_PREFIX>`

**Options**

* `--provider <PROVIDER>` — Upstream provider id (e.g. `anthropic`)
* `--ciphertext-b64 <CIPHERTEXT_B64>` — Base64-encoded sealed-box ciphertext
* `--kek-id <KEK_ID>` — KEK id used to seal `--ciphertext-b64`. Must match the cloud's current `primary_kek_id`
* `--key-prefix <KEY_PREFIX>` — Operator-visible prefix of the underlying plaintext
* `--api-base <API_BASE>` — Override API base for the provider
* `--json` — Print the response as raw JSON instead of the human-readable summary

Ciphertext must be sealed against the cloud's current X25519 public key **before** submission — the server only stores already-encrypted bytes. Fetch the current key from `GET /v1/byok/encryption-pubkey` first.

###### `bro cloud byok delete` \[#bro-cloud-byok-delete]

Remove a BYOK row by provider id

**Usage:** `bro cloud byok delete [OPTIONS] <PROVIDER>`

**Arguments**

* `<PROVIDER>` — Provider id (the row's `provider_name`)

**Options**

* `--json` — Print the response as raw JSON instead of the human-readable summary

### Agents, ACP, and MCP \[#agents-acp-and-mcp]

`agents` inspects ACP adapters, `acp serve` exposes one adapter over protocol-pure stdio, and `mcp check` verifies the upstream MCP servers declared in `bitrouter.yaml`. These are distinct directions: ACP connects a client to an agent; MCP connects BitRouter to upstream tools.

#### `bro agents` \[#bro-agents]

Inspect ACP agent adapters, advertised capabilities, and configuration stubs

**Usage:** `bro agents [COMMAND]`

##### `bro agents sessions` \[#bro-agents-sessions]

List BitRouter-supervised agent runs from the local daemon

**Usage:** `bro agents sessions [OPTIONS]`

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the local control socket)
* `--socket <SOCKET>` — Explicit local control socket path

##### `bro agents attach` \[#bro-agents-attach]

Attach to one supervised run in the alternate-screen inspector

**Usage:** `bro agents attach [OPTIONS] <AGENT_RUN_ID>`

**Arguments**

* `<AGENT_RUN_ID>` — BitRouter agent run id

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the local control socket)
* `--socket <SOCKET>` — Explicit local control socket path

##### `bro agents stop` \[#bro-agents-stop]

Stop one supervised run without deleting its native harness session

**Usage:** `bro agents stop [OPTIONS] <AGENT_RUN_ID>`

**Arguments**

* `<AGENT_RUN_ID>` — BitRouter agent run id

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the local control socket)
* `--socket <SOCKET>` — Explicit local control socket path

##### `bro agents remove` \[#bro-agents-remove]

Remove settled BitRouter run metadata and ephemeral retained events

**Usage:** `bro agents remove [OPTIONS] <AGENT_RUN_ID>`

**Arguments**

* `<AGENT_RUN_ID>` — BitRouter agent run id

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` (used to locate the local control socket)
* `--socket <SOCKET>` — Explicit local control socket path

##### `bro agents list` \[#bro-agents-list]

Show the bundled catalog of well-known agents and which of them are present under `agents:` in the loaded config. With `--remote`, also fetch and list the official ACP agent registry

**Usage:** `bro agents list [OPTIONS]`

**Options**

* `--remote` — Also fetch the ACP agent registry (cdn.agentclientprotocol.com) and list its agents
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. When omitted, the binary resolves in this order: `./bitrouter.yaml` → `$BITROUTER_HOME/bitrouter.yaml` → `~/.bitrouter/bitrouter.yaml` → zero-config in-memory defaults (`bro init` is the explicit way to scaffold a file)
* `--socket <SOCKET>` — Explicit local control socket for the daemon's accepted catalog

##### `bro agents inspect` \[#bro-agents-inspect]

Inspect commands advertised by a fresh ACP session

**Usage:** `bro agents inspect [OPTIONS] <AGENT>`

**Arguments**

* `<AGENT>` — ACP agent id or friendly alias

**Options**

* `--direct` — Do NOT route this session's LLM traffic through the daemon — let the harness use its own provider auth. Routing is attempted by default when the harness supports headless redirection
* `--base-url <BASE_URL>` — Override the gateway base URL (else derived from `server.listen`)
* `--model <MODEL>` — Pin the harness's model (via its model env var / `-c model=`)
* `--no-start` — Never auto-start a local daemon when none is running — fail fast
* `--wait-ms <MS>` — How long to wait for the advertised command list \[default: 2000]
* `--source <SOURCE>` — Show only commands answered by one source Possible values:
* `- bitrouter: BitRouter's own commands`
* `- config:` — Prompt-expansion commands from the config
* `- agent:` — Commands the agent advertises
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`

##### `bro agents check` \[#bro-agents-check]

Spawn one agent, or every configured agent, and verify initialization

**Usage:** `bro agents check [OPTIONS] [AGENT]`

**Arguments**

* `[AGENT]` — ACP agent id or friendly alias; omit to check configured agents

**Options**

* `--direct` — Do NOT route this session's LLM traffic through the daemon — let the harness use its own provider auth. Routing is attempted by default when the harness supports headless redirection
* `--base-url <BASE_URL>` — Override the gateway base URL (else derived from `server.listen`)
* `--model <MODEL>` — Pin the harness's model (via its model env var / `-c model=`)
* `--no-start` — Never auto-start a local daemon when none is running — fail fast
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. When omitted, the binary resolves in this order: `./bitrouter.yaml` → `$BITROUTER_HOME/bitrouter.yaml` → `~/.bitrouter/bitrouter.yaml` → zero-config in-memory defaults (`bro init` is the explicit way to scaffold a file)

```bash
bro agents check codex-acp
```

Spawns the adapter, performs ACP initialization, and reports whether the configured route is usable.

##### `bro agents conformance` \[#bro-agents-conformance]

Run the ACP-compatibility suite against a catalog agent and print the `conformance:` block to record in its runtime entry.
Needs no provider credentials: the agent is launched with its own routing pointed at an ephemeral loopback gateway that records what reached it. It does spawn the agent, so its package or binary must be installed.

**Usage:** `bro agents conformance <ID>`

**Arguments**

* `<ID>` — Agent id, either `<runtime>/<harness>` or a bare harness id (`local/` is the default runtime and may be elided)

##### `bro agents scaffold` \[#bro-agents-scaffold]

Print a YAML stub for an agent (paste under `agents:` in `bitrouter.yaml`). Resolves from the bundled catalog first, then the ACP registry (`npx`/`uvx` distributions only)

**Usage:** `bro agents scaffold <ID>`

**Arguments**

* `<ID>` — Agent id (see `bro agents list` / `list --remote`)

#### `bro mcp` \[#bro-mcp]

Check configured upstream MCP servers

**Usage:** `bro mcp <COMMAND>`

##### `bro mcp check` \[#bro-mcp-check]

Connect, negotiate MCP capabilities, and list advertised tools

**Usage:** `bro mcp check [OPTIONS] [SERVER]`

**Arguments**

* `[SERVER]` — Check only this configured server; omit to check all of them

**Options**

* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`

```bash
bro mcp check
bro mcp check docs
```

Connects to one or every configured upstream, negotiates MCP capabilities, and lists the tools each server advertises.

#### `bro acp` \[#bro-acp]

ACP client integration over stdio, plus compatibility commands.
`serve` exposes an ACP-compatible adapter process over protocol-pure stdio.

**Usage:** `bro acp <COMMAND>`

##### `bro acp evolution` \[#bro-acp-evolution]

Control checkpoint feedback and policy-block evolution on the local daemon

**Usage:** `bro acp evolution [OPTIONS] <COMMAND>`

**Options**

* `-c, --config <CONFIG>`

###### `bro acp evolution status` \[#bro-acp-evolution-status]

Inspect modes, blocks, scheduled checkpoints and judge task status

**Usage:** `bro acp evolution status`

###### `bro acp evolution mode` \[#bro-acp-evolution-mode]

Select feedback mode; automatic requires a configured judge model

**Usage:** `bro acp evolution mode [OPTIONS] <MODE>`

**Arguments**

* `<MODE>` — \[possible values: off, manual, automatic]

**Options**

* `--judge-model <JUDGE_MODEL>`

###### `bro acp evolution register` \[#bro-acp-evolution-register]

Register a complete policy-block experiment from a JSON definition

**Usage:** `bro acp evolution register <FILE>`

**Arguments**

* `<FILE>`

###### `bro acp evolution revise` \[#bro-acp-evolution-revise]

Start the next experiment for the same block; retain the previous evidence

**Usage:** `bro acp evolution revise --expected-experiment <EXPECTED_EXPERIMENT> <FILE>`

**Arguments**

* `<FILE>`

**Options**

* `--expected-experiment <EXPECTED_EXPERIMENT>`

###### `bro acp evolution restore` \[#bro-acp-evolution-restore]

Withdraw the current candidate and return to its supported baseline

**Usage:** `bro acp evolution restore --expected-experiment <EXPECTED_EXPERIMENT> --expected-revision <EXPECTED_REVISION> --reason <REASON> <BLOCK>`

**Arguments**

* `<BLOCK>`

**Options**

* `--expected-experiment <EXPECTED_EXPERIMENT>`
* `--expected-revision <EXPECTED_REVISION>`
* `--reason <REASON>`

###### `bro acp evolution learning` \[#bro-acp-evolution-learning]

Inspect the current evidence and proposed allocation without publishing

**Usage:** `bro acp evolution learning [OPTIONS] <BLOCK>`

**Arguments**

* `<BLOCK>`

**Options**

* `--experiment <EXPERIMENT>`

###### `bro acp evolution improve` \[#bro-acp-evolution-improve]

Reconcile current evidence against live routes and publish an eligible change

**Usage:** `bro acp evolution improve [OPTIONS] <BLOCK>`

**Arguments**

* `<BLOCK>`

**Options**

* `--experiment <EXPERIMENT>`

##### `bro acp checkpoints` \[#bro-acp-checkpoints]

Freeze and evaluate already recorded native-session prefixes locally

**Usage:** `bro acp checkpoints [OPTIONS] --agent <AGENT> <SESSION> <COMMAND>`

**Arguments**

* `<SESSION>`

**Options**

* `--agent <AGENT>`
* `-c, --config <CONFIG>`

###### `bro acp checkpoints judge` \[#bro-acp-checkpoints-judge]

Judge an existing checkpoint with an explicitly selected configured model

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> judge --model <MODEL> <CHECKPOINT>`

**Arguments**

* `<CHECKPOINT>`

**Options**

* `--model <MODEL>`

###### `bro acp checkpoints judge-job` \[#bro-acp-checkpoints-judge-job]

Inspect a durable judge job, or resume it with its recorded input and model

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> judge-job [OPTIONS] <JOB_ID>`

**Arguments**

* `<JOB_ID>`

**Options**

* `--resume`

###### `bro acp checkpoints rubric` \[#bro-acp-checkpoints-rubric]

Prepare or submit evidence-grounded rubric scores from recorded content

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> rubric <COMMAND>`

###### `bro acp checkpoints rubric prepare` \[#bro-acp-checkpoints-rubric-prepare]

Export the fixed rubric library and cited evidence for a frozen checkpoint

**Usage:** `bro acp checkpoints rubric prepare <CHECKPOINT>`

**Arguments**

* `<CHECKPOINT>`

###### `bro acp checkpoints rubric submit` \[#bro-acp-checkpoints-rubric-submit]

Validate and store a structured rubric revision without invoking a model

**Usage:** `bro acp checkpoints rubric submit <FILE>`

**Arguments**

* `<FILE>`

###### `bro acp checkpoints create` \[#bro-acp-checkpoints-create]

Freeze exactly the currently observed prefix; rejects a stale watermark

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> create --watermark <WATERMARK>`

**Options**

* `--watermark <WATERMARK>`

###### `bro acp checkpoints list` \[#bro-acp-checkpoints-list]

List immutable prefixes for this native session

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> list`

###### `bro acp checkpoints show` \[#bro-acp-checkpoints-show]

Read the original content versions referenced by a checkpoint

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> show <CHECKPOINT>`

**Arguments**

* `<CHECKPOINT>`

###### `bro acp checkpoints resources` \[#bro-acp-checkpoints-resources]

Inspect resource snapshots, or refresh them from existing local records

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> resources [OPTIONS] <CHECKPOINT>`

**Arguments**

* `<CHECKPOINT>`

**Options**

* `--refresh`

###### `bro acp checkpoints submit` \[#bro-acp-checkpoints-submit]

Import an idempotent assessment revision or explicit retraction from JSON

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> submit <FILE>`

**Arguments**

* `<FILE>`

###### `bro acp checkpoints history` \[#bro-acp-checkpoints-history]

Read immutable assessment revisions and their selection decisions

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> history`

###### `bro acp checkpoints effective` \[#bro-acp-checkpoints-effective]

Inspect the selected assessment, including unassessed appends

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> effective`

###### `bro acp checkpoints family` \[#bro-acp-checkpoints-family]

Inspect related native forks with a union of observed request costs

**Usage:** `bro acp checkpoints --agent <AGENT> <SESSION> family`

##### `bro acp recordings` \[#bro-acp-recordings]

Inspect or delete locally recorded ACP conversation content

**Usage:** `bro acp recordings [OPTIONS] <COMMAND>`

**Options**

* `-c, --config <CONFIG>` — Config selecting the local content database

###### `bro acp recordings list` \[#bro-acp-recordings-list]

List recorded native sessions under a configured agent source

**Usage:** `bro acp recordings list --agent <AGENT>`

**Options**

* `--agent <AGENT>`

###### `bro acp recordings show` \[#bro-acp-recordings-show]

Export canonical events, replay audit, gaps, and observed request links

**Usage:** `bro acp recordings show --agent <AGENT> <SESSION>`

**Arguments**

* `<SESSION>`

**Options**

* `--agent <AGENT>`

###### `bro acp recordings delete` \[#bro-acp-recordings-delete]

Delete this session's locally captured content

**Usage:** `bro acp recordings delete --agent <AGENT> <SESSION>`

**Arguments**

* `<SESSION>`

**Options**

* `--agent <AGENT>`

##### `bro acp serve` \[#bro-acp-serve]

Expose an ACP-compatible agent adapter over stdio for an ACP client

**Usage:** `bro acp serve <AGENT> [OPTIONS]`

**Arguments**

* `[AGENT]` — Agent id — a bundled-catalog id (`claude-acp`, `codex-acp`, `gemini-cli`, `opencode`, `pi-acp`, `hermes-acp`, `openclaw`) or an entry under `agents:` in the config. A catalog id needs no config entry; `bro agents check <agent>` previews whether it will route or run direct

**Options**

* `--turn-timeout <SECS>` — Per-turn deadline in seconds. On elapse the agent is asked to cancel cooperatively; a turn that still doesn't finish errors
* `--direct` — Do NOT route this session's LLM traffic through the daemon — let the harness use its own provider auth. Routing is attempted by default when the harness supports headless redirection
* `--base-url <BASE_URL>` — Override the gateway base URL (else derived from `server.listen`)
* `--model <MODEL>` — Pin the harness's model (via its model env var / `-c model=`)
* `--no-start` — Never auto-start a local daemon when none is running — fail fast
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`. Resolves via the standard chain when omitted: `./bitrouter.yaml` → `$BITROUTER_HOME` → `~/.bitrouter/bitrouter.yaml` → zero-config defaults

```bash
bro acp serve codex-acp
```

Exposes the selected adapter over stdio for an ACP client. It preserves the selected harness's session semantics; it does not create a durable BitRouter workflow.

### Skills \[#skills]

`bro skills` inspects installed [Agent Skills](https://agentskills.io/) and scaffolds a local `SKILL.md`. Installing a published skill remains the responsibility of the agent runtime or its skill installer; BitRouter no longer exposes an origin MCP server that installs skills for a client.

#### `bro skills` \[#bro-skills]

Inspect installed Agent Skills and scaffold a local `SKILL.md`

**Usage:** `bro skills <COMMAND>`

##### `bro skills list` \[#bro-skills-list]

List installed skills

**Usage:** `bro skills list [OPTIONS]`

**Options**

* `-g, --global` — Operate on the global skills directory (`~/.claude/skills/`)

```bash
bro skills list
bro skills list --global
```

##### `bro skills init` \[#bro-skills-init]

Scaffold a new `SKILL.md` in the current directory

**Usage:** `bro skills init [OPTIONS] <NAME>`

**Arguments**

* `<NAME>` — Skill name written into the generated frontmatter

**Options**

* `-o, --output <OUTPUT>` — Output path for the SKILL.md (default: `<NAME>/SKILL.md`)

```bash
bro skills init my-skill
```

This creates `my-skill/SKILL.md` in the current directory unless `--output` names another path.

### Coding agents \[#coding-agents]

Choose the interaction model that matches the task:

* `bro launch`, `bro claude`, and `bro codex` preserve the harness's native interface.
* `bro code` opens BitRouter's coding conversation and connects to an ACP agent.
* `bro run` sends one ACP prompt headlessly and returns NDJSON, text, or only the final answer.

These commands do not imply the durable multi-attempt workflow described in BitRouter's architecture proposals. They run or connect to the selected harness using the released ACP and launch surfaces.

#### `bro launch` \[#bro-launch]

Launch a coding-agent harness as an interactive native-TUI child. Routed harnesses are pointed at the local BitRouter daemon; own-auth harnesses launch directly and are not redirected. The human drives the harness's own TUI directly (use `bro run` for a headless ACP prompt). Follows `cargo run`'s separator convention: bitrouter options come before `--`, everything after `--` is forwarded to the agent verbatim, e.g. `bro launch codex -- --search`.
Harnesses that route by env/args (claude, codex) are launched without touching any config file. Those that route by synthesized config (opencode, pi, hermes, openclaw) get it under `.bitrouter/launch/` — your own agent config is still never modified.
The agent authenticates to BitRouter with `BITROUTER_API_KEY` when it is set; otherwise a local placeholder is used (fine under the `skip_auth` default written by `bro init`). A missing `claude` / `codex` binary is offered for install via its official native installer; other harnesses report their own install command instead.

**Usage:** `bro launch <AGENT> [OPTIONS] [-- <AGENT_ARGS>...]`

**Arguments**

* `[AGENT]` — Which agent harness to launch: any catalog harness with an interactive binary (`claude`, `codex`, `opencode`, `pi`, `hermes`, `openclaw`, `grok`, or `agy`; catalog ids such as `claude-acp`, `codex-acp`, `pi-acp`, and `hermes-acp` also resolve). Own-auth harnesses such as `grok` and `agy` launch direct and are not redirected
* `[AGENT_ARGS]...` — Arguments forwarded verbatim to the native harness

**Options**

* `--model <ID>` — Pin the harness's model to a daemon-routable id
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`
* `--base-url <BASE_URL>` — Override the BitRouter inference base URL
* `--no-install` — Fail instead of offering to install a missing supported harness
* `--no-start` — Do not auto-start a missing local daemon
* `--check` — Verify the executable, endpoint, and route without launching

```bash
bro launch claude
```

Routed harnesses point their model traffic at the local daemon. Own-auth harnesses launch directly. Use `--check` to verify the executable, endpoint, and route without starting the harness.

#### `bro claude` \[#bro-claude]

Launch Claude Code's native interface through BitRouter

**Usage:** `bro claude [OPTIONS] [-- <AGENT_ARGS>...]`

**Arguments**

* `[AGENT_ARGS]...` — Arguments forwarded verbatim to the native harness

**Options**

* `--model <ID>` — Pin the harness's model to a daemon-routable id
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`
* `--base-url <BASE_URL>` — Override the BitRouter inference base URL
* `--no-install` — Fail instead of offering to install a missing supported harness
* `--no-start` — Do not auto-start a missing local daemon
* `--check` — Verify the executable, endpoint, and route without launching

#### `bro claude-code` \[#bro-claude-code]

Alias for `bro claude`

**Usage:** `bro claude-code [OPTIONS] [-- <AGENT_ARGS>...]`

**Arguments**

* `[AGENT_ARGS]...` — Arguments forwarded verbatim to the native harness

**Options**

* `--model <ID>` — Pin the harness's model to a daemon-routable id
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`
* `--base-url <BASE_URL>` — Override the BitRouter inference base URL
* `--no-install` — Fail instead of offering to install a missing supported harness
* `--no-start` — Do not auto-start a missing local daemon
* `--check` — Verify the executable, endpoint, and route without launching

#### `bro codex` \[#bro-codex]

Launch Codex's native interface through BitRouter

**Usage:** `bro codex [OPTIONS] [-- <AGENT_ARGS>...]`

**Arguments**

* `[AGENT_ARGS]...` — Arguments forwarded verbatim to the native harness

**Options**

* `--model <ID>` — Pin the harness's model to a daemon-routable id
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`
* `--base-url <BASE_URL>` — Override the BitRouter inference base URL
* `--no-install` — Fail instead of offering to install a missing supported harness
* `--no-start` — Do not auto-start a missing local daemon
* `--check` — Verify the executable, endpoint, and route without launching

#### `bro run` \[#bro-run]

Run one ACP agent prompt headlessly. Streams NDJSON by default, or text / quiet output when selected explicitly

**Usage:** `bro run [OPTIONS] <AGENT> [PROMPT]`

**Arguments**

* `<AGENT>` — ACP agent id from the bundled catalog or `agents:` config
* `[PROMPT]` — Prompt to send. Use `-` to read stdin

**Options**

* `--prompt-file <PATH>` — Read the prompt from a file
* `--load <NATIVE_SESSION_ID>` — Load a harness-native session and replay its history
* `--resume <NATIVE_SESSION_ID>` — Resume a harness-native session without replaying history
* `--cwd <PATH>` — Working directory supplied to the agent session
* `--direct` — Do NOT route this session's LLM traffic through the daemon — let the harness use its own provider auth. Routing is attempted by default when the harness supports headless redirection
* `--base-url <BASE_URL>` — Override the gateway base URL (else derived from `server.listen`)
* `--model <MODEL>` — Pin the harness's model (via its model env var / `-c model=`)
* `--no-start` — Never auto-start a local daemon when none is running — fail fast
* `--turn-timeout <SECS>` — Per-turn deadline in seconds
* `--background` — Submit the turn to the resident supervisor and return an attachable agent run id after it has accepted ownership
* `--allow-shared-directory` — Allow another potentially writable run to use the same canonical Git worktree or non-Git directory. This is unsafe and emits a warning before submission
* `--result-schema <JSON|@PATH>` — JSON Schema — inline JSON or `@path` — required of the final reply
* `--approve-all` — Approve every permission request the harness makes
* `--approve-reads` — Approve tool calls the harness labels `read` or `search` (the ACP tool kind); deny everything else, including unlabelled calls
* `--deny-all` — Deny every permission request. This is the default
* `--permission-policy <JSON|@PATH>` — Per-tool policy, inline JSON or `@path`: `{"autoApprove":[…],"autoDeny":[…],"defaultAction":"approve"\|"deny"}`. Entries match the ACP tool kind (`read`, `edit`, `execute`, …), the tool-call title, or its first word. `autoDeny` wins over `autoApprove`; an unmatched request uses `defaultAction`, else the mode flag
* `--format <FORMAT>` — Output: `ndjson` (the default), `text` (the transcript as `code <agent>` prints it to a pipe), or `quiet` (assistant text only) Possible values:
* `- ndjson: One self-describing JSON object per line`
* `- text:` — The transcript as the piped `bro chat <agent>` compatibility path prints it
* `- quiet:` — The assistant's text and nothing else \[default: ndjson]
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml`

```bash
bro run codex-acp "Review the current diff" --format quiet
```

The default permission policy denies requests. Choose an explicit approval mode or pass a per-tool policy when the task needs tools.

#### `bro code` \[#bro-code]

Open BitRouter's coding conversation, or connect directly when an agent id is supplied

**Usage:** `bro code [OPTIONS] [AGENT]`

**Arguments**

* `[AGENT]` — ACP agent id. Omit to choose an agent in the conversation

**Options**

* `--load <NATIVE_SESSION_ID>` — Load a harness-native session and replay its history
* `--resume <NATIVE_SESSION_ID>` — Resume a harness-native session without replaying history
* `--turn-timeout <SECS>` — Per-turn deadline in seconds for an agent session
* `--direct` — Do NOT route this session's LLM traffic through the daemon — let the harness use its own provider auth. Routing is attempted by default when the harness supports headless redirection
* `--base-url <BASE_URL>` — Override the gateway base URL (else derived from `server.listen`)
* `--model <MODEL>` — Pin the harness's model (via its model env var / `-c model=`)
* `--no-start` — Never auto-start a local daemon when none is running — fail fast
* `-c, --config <CONFIG>` — Path to `bitrouter.yaml` for a local Code session
* `--socket <SOCKET>` — Explicit local control socket for read-only operations

```bash
bro code
bro code codex-acp --model openai/gpt-5
```

Omit the agent id to choose inside the conversation, or pass an ACP agent id directly. `--load` replays a native session; `--resume` resumes it without replaying history.

### Key, workflow-state, and update \[#key-workflow-state-and-update]

#### `bro key` \[#bro-key]

Virtual-key management

**Usage:** `bro key <COMMAND>`

##### `bro key sign` \[#bro-key-sign]

Mint a new `brvk_` virtual key for a user. v1 does not sign a JWT — it creates a DB-backed virtual key and prints the plaintext once

**Usage:** `bro key sign [OPTIONS] --user <USER>`

**Options**

* `-u, --user <USER>` — The owning user id
* `-d, --db <DB>` — Database URL — any backend sea-orm supports (`sqlite://…`, `postgres://…`, `mysql://…`) \[default: sqlite://./bitrouter.db]
* `--policy <POLICY>` — Optional policy id to bind to the key (the `policy_id` column)

Mints a **virtual key** bound to an access-control policy — the per-key guardrails surface (allowed models, budgets, rate limits), distinct from routing policies. See [access-control policies](https://bitrouter-docs-staging.up.railway.app/docs/routing/configuration#validate-the-contract).

```bash
bro key sign --user ci --policy nightly-cap
```

#### `bro workflow-state` \[#bro-workflow-state]

Workflow-state trace/replay utilities

**Usage:** `bro workflow-state <COMMAND>`

> **warn**
>
> Internal benchmark tooling — the plumbing behind the published Terminal-Bench reports (trace capture, outcome bundling, reward feedback), not a production user surface. It's documented here only for completeness; you almost certainly don't need it.

##### `bro workflow-state classifier-bakeoff` \[#bro-workflow-state-classifier-bakeoff]

Evaluate a shadow task/role/progress/risk classifier without routing

**Usage:** `bro workflow-state classifier-bakeoff [OPTIONS] --fixtures <FIXTURES> --output <OUTPUT>`

**Options**

* `--fixtures <FIXTURES>` — Directory tree containing frozen workflow-state fixture JSON files
* `--submission <SUBMISSION>` — Optional candidate submission JSON. Omit to evaluate the compiled deterministic scorecard as an uncalibrated baseline
* `--output <OUTPUT>` — Output path for the deterministic manifest and evaluation report

##### `bro workflow-state bundle` \[#bro-workflow-state-bundle]

Build a deterministic benchmark trace bundle

**Usage:** `bro workflow-state bundle [OPTIONS] --run-label <RUN_LABEL> --traces <TRACES> --cloud-usage <CLOUD_USAGE> --output-dir <OUTPUT_DIR>`

**Options**

* `--run-label <RUN_LABEL>` — Run label stored in `run-artifact.json`
* `--traces <TRACES>` — Daemon workflow trace JSONL
* `--cloud-usage <CLOUD_USAGE>` — BitRouter Cloud usage snapshot JSONL
* `--outcomes <OUTCOMES>` — Optional request-scoped benchmark outcome JSONL. Omit when task or episode outcomes will be submitted through the Eval Exchange
* `--policy-decisions <POLICY_DECISIONS>` — Optional policy routing decision JSONL from BITROUTER\_POLICY\_DECISION\_JSONL
* `--output-dir <OUTPUT_DIR>` — Output directory for traces/cloud usage/outcomes/artifacts

##### `bro workflow-state metering-usage` \[#bro-workflow-state-metering-usage]

Export daemon metering rows as usage JSONL for benchmark bundles

**Usage:** `bro workflow-state metering-usage [OPTIONS] --database-url <DATABASE_URL> --output <OUTPUT>`

**Options**

* `--database-url <DATABASE_URL>` — Database URL for the daemon metering DB, for example sqlite:///path/bitrouter.db
* `--output <OUTPUT>` — Output usage JSONL path
* `--impute-price <IMPUTE_PRICES>` — Impute charges as provider:model=uncached,cache\_read,cache\_write,output. Legacy input,output is accepted only for records with no cache usage
* `--since <SINCE>` — Inclusive RFC3339 lower bound. Defaults to the current UTC month
* `--until <UNTIL>` — Exclusive RFC3339 upper bound. Only used with --since; defaults to now

##### `bro workflow-state reliability-report` \[#bro-workflow-state-reliability-report]

Replay persisted provider reliability state into a deterministic JSON report

**Usage:** `bro workflow-state reliability-report --database-url <DATABASE_URL> --config <CONFIG> --output <OUTPUT>`

**Options**

* `--database-url <DATABASE_URL>` — Database URL for the daemon policy DB
* `--config <CONFIG>` — Frozen BitRouter config that defines the reliability thresholds
* `--output <OUTPUT>` — Output JSON report path

##### `bro workflow-state policy-oracle` \[#bro-workflow-state-policy-oracle]

Estimate policy cost coverage and savings without changing live routing

**Usage:** `bro workflow-state policy-oracle --traces <TRACES> --cloud-usage <CLOUD_USAGE> --policy-lock <POLICY_LOCK> --policy <POLICY> --effective-cost-factor <EFFECTIVE_COST_FACTOR_PPM> --target-savings <TARGET_SAVINGS_PPM> --output <OUTPUT>`

**Options**

* `--traces <TRACES>` — Protocol-native daemon workflow trace JSONL from the baseline run
* `--cloud-usage <CLOUD_USAGE>` — Request-settled usage JSONL for the same baseline run
* `--policy-lock <POLICY_LOCK>` — Policy lock containing the candidate routes to replay
* `--policy <POLICY>` — Named policy within the lock
* `--effective-cost-factor <EFFECTIVE_COST_FACTOR_PPM>` — Candidate effective cost divided by baseline cost, including any expected token, retry, or turn inflation (for example 0.24)
* `--target-savings <TARGET_SAVINGS_PPM>` — Desired end-to-end savings fraction. Repeat for multiple targets
* `--output <OUTPUT>` — Output JSON report path

##### `bro workflow-state reconcile-metering` \[#bro-workflow-state-reconcile-metering]

Reconcile selected metering rows against request-scoped receipts

**Usage:** `bro workflow-state reconcile-metering [OPTIONS] --database-url <DATABASE_URL> --request-id <REQUEST_IDS>`

**Options**

* `--database-url <DATABASE_URL>` — Database URL for the daemon metering DB
* `--api-base <API_BASE>` — Inference API root ending in `/v1` \[default: <https://api.bitrouter.ai/v1>]
* `--api-key-env <API_KEY_ENV>` — Environment variable containing the inference key \[default: BITROUTER\_API\_KEY]
* `--credentials-file <CREDENTIALS_FILE>` — Protected BitRouter Cloud credential file containing a static API key. OAuth credentials are never refreshed for settlement
* `--request-id <REQUEST_IDS>` — Exact request id to reconcile. Repeat for every selected row
* `--price <PRICES>` — Frozen price as provider:model=uncached,cache\_read,cache\_write,output. Repeat a provider/model pair for alternative schedules; settlement accepts only one distinct candidate that reconstructs the receipt
* `--max-attempts <MAX_ATTEMPTS>` — Maximum durable receipt fetches per request \[default: 12]
* `--poll-interval-ms <POLL_INTERVAL_MS>` — Delay between pending-receipt polls \[default: 1000]

##### `bro workflow-state apply-reward-feedback` \[#bro-workflow-state-apply-reward-feedback]

Apply task rewards to cheap replacement transitions before the next round

**Usage:** `bro workflow-state apply-reward-feedback --database-url <DATABASE_URL> --traces <TRACES> --cloud-usage <CLOUD_USAGE> --outcomes <OUTCOMES> --policy-decisions <POLICY_DECISIONS>`

**Options**

* `--database-url <DATABASE_URL>` — Database URL for the policy daemon DB, for example sqlite:///path/bitrouter.db
* `--traces <TRACES>` — Daemon workflow trace JSONL for the just-finished benchmark group
* `--cloud-usage <CLOUD_USAGE>` — Exact, reconciled usage JSONL for the same benchmark group
* `--outcomes <OUTCOMES>` — Benchmark outcome JSONL for the just-finished benchmark group
* `--policy-decisions <POLICY_DECISIONS>` — Policy routing decision JSONL from BITROUTER\_POLICY\_DECISION\_JSONL

#### `bro update` \[#bro-update]

Update the installed `bitrouter` binary in place to the latest release. Follows prereleases by default while pre-1.0. For Homebrew / `cargo install` installs it prints the right upgrade command instead

**Usage:** `bro update [OPTIONS]`

**Options**

* `--check` — Report whether a newer version exists, then exit without changing anything
* `--tag <TAG>` — Update (or downgrade) to a specific release tag, e.g. `1.0.0-alpha.18`. Named `--tag` to avoid clashing with the global `--version` flag
* `--stable` — Only consider stable (non-prerelease) releases
* `--restart` — After a successful update, restart a running daemon so it serves the new binary
* `-y, --yes` — Skip the confirmation prompt

```bash
bro update
```

Updates the installed binary in place to the latest release — follows prereleases by default while pre-1.0. Homebrew and `cargo install` builds update through their own package manager instead.

<a id="workflow-guide-links" />
<a id="self-driving-workflows" />
<a id="delegate-a-goal" />
<a id="coordinate-the-work" />
<a id="steer-a-running-goal" />
<a id="deliver-verified-results" />
<a id="pause-recover-and-continue" />
<a id="inspect-execution-and-resource-choices" />
<a id="choose-your-entry-point" />
<a id="interactive-tui" />
<a id="released-acp-conversation-controls" />
<a id="open-goals" />
<a id="find-and-manage-your-goals" />
<a id="work-in-the-current-goal" />
<a id="submit-input-while-work-runs" />
<a id="inspect-the-workflow" />
<a id="handle-necessary-decisions" />
<a id="pause-and-resume" />
<a id="review-the-result" />
<a id="operations-only-targets" />
<a id="headless--scripting" />
<a id="choose-the-native-execution-mode" />
<a id="run-a-native-task" />
<a id="continue-a-managed-session" />
<a id="consume-structured-output" />
<a id="gate-a-script-on-verified-completion" />
<a id="permissions" />
<a id="handle-interruption-and-recovery" />
<a id="automate-a-persistent-goal" />

## Previous workflow links \[#previous-workflow-links]

Earlier agent-workflow previews are outside the first-release documentation. For current CLI tasks, use [Getting Started](https://bitrouter-docs-staging.up.railway.app/docs/cli/getting-started), [Run & Inspect](https://bitrouter-docs-staging.up.railway.app/docs/cli/run-inspect), and [Cloud Management](https://bitrouter-docs-staging.up.railway.app/docs/cli/cloud-management). Captured release commands remain in [Command Reference](https://bitrouter-docs-staging.up.railway.app/docs/usage/cli#command-reference).