# CLI reference

> Every bay command, its purpose, and the result it prints.

Source: https://getbay.io/docs/cli (HTML).

bay has a few daily commands for agents and a few setup commands for people. Through a pipe, or with `--json`, each command prints one `bay.result/1` document on stdout. At a terminal without `--json`, a person sees plain text instead. Either way, the command exits 0, 10 or 20. Plain help, `--version` and a usage error print text instead, and a usage error exits 2.

`bay help` shows every command a person or agent runs, with its flags and writes. `bay <command> --help` says more about one command.

## Daily commands

Four commands make the daily loop: `bay start`, `bay merge`, `bay status` and `bay undo`. `bay talk` and `bay status --all` help agents on different machines work together.

| Command | Purpose |
|---|---|
| `bay start <intent> --paths <path>…` | Open a change: a fresh fetch of main, a sparse view of the declared paths, and the change record. `--paths .` or `/` declares the whole tree: the view is a full checkout, and a new file anywhere belongs to the change. The intent says what the work is, in a few words, or gives a card id. Each start also releases clean views of ended changes past the retention window. It lists live changes whose declared paths overlap under `detail.overlaps`, and refuses none. When it re-opens a change, `detail.behind` counts the main commits it missed. After the intent's change merged, it opens the next change, which names the merged one in `detail.supersedes`. |
| `bay start <change>` | Pick up an existing change: checkpoint its draft and bring in newer main. bay reads the argument as a change when it is a change id whose record is here or on the remote. Otherwise, bay reads it as an intent. With `--new`, `--lane` or `--after`, it always opens a new change. With `--from`, it replaces the named change's draft. With `--fixes`, the named change becomes the fix. An ended change whose intent has a newer change is refused with `CHANGE_SUPERSEDED`. bay refuses another actor's change with `VIEW_NOT_YOURS`. Take it over with `--adopt`. |
| `bay start <intent> --input <kind>:<name>` | Name an input this change depends on, as `<kind>:<name>`. Repeat it for each input. |
| `bay start <intent> --new` | Open the intent's next change after its change ended without merging, such as by `bay abandon`, instead of adopting it. After a merge or a `no_effect` end, a plain `bay start` already does this. |
| `bay start <intent> --fixes <change\|check>` | Open a change that fixes a merged change, or a post check of main's policy. Given a live change instead of an intent, that change becomes the fix and keeps its id. Its merge carries a `Fixes:` trailer. A change that never merged is `CHANGE_NOT_MERGED`. Any other name is an error that lists main's post checks. |
| `bay start <intent> --lane <name>` | Open a change in a sandbox lane that `[[lane]]` in `.bay/config.toml` names. Its checks run against main, and it never merges. |
| `bay start <intent> [--paths <path>…] --from <branch>` | Take in a branch made outside bay, by name or full ref. bay reads the remote's branch when the remote has one, even over a local branch of that name. `detail.from.source` says `remote` or `local`. If bay cannot list the remote, the start fails. Its net change on main is the first draft, and it merges as one checked commit that keeps the branch's author and messages. Without `--paths`, bay declares exactly the files the branch changes. With `--paths`, they must cover every one, or bay refuses `PATHS_UNDECLARED`. A local branch with commits the remote's lacks is refused `BRANCH_DIVERGED`, naming both. A conflict with main is `MERGE_CONFLICT`. |
| `bay start <change> --from <ref>` | Replace that change's draft with a branch or commit, such as after a rebase, with no new branch name. |
| `bay start <change> --paths <path>…` | Declare more paths for a change you hold: each one it does not cover yet. Its view holds them too, and the change keeps its place in line. `detail.paths_added` lists them. A change that declares the whole tree adds none, and `--paths .` never widens a narrow change to the whole tree: name the paths instead. |
| `bay start <change> --adopt` | Take the change and its view over from their actor. You become its actor. `detail.adopted_from` and `detail.view_adopted_from` name the one before. An abandoned, superseded or `no_effect` change is yours at once. One its actor still works on is blocked with `CHANGE_SUPERSEDED` until a takeover window passes with no move or heartbeat. One already idle that long is yours at once. A start by intent never takes another actor's change whose operation waits in the queue: only `--adopt` does. Do it only when that actor gave the change up or is gone. |
| `bay start <intent> --paths <path>… --after <change>` | Merge this change only after the named change merged. Repeat it for each change. The named change must exist on the remote, and need not have merged yet. Until each has merged, the operation waits with `DEPENDENCY_PENDING` and holds no queue place. The merge carries one `Bay-After:` trailer per named change. |
| `bay start <intent> --paths <path>… --dry-run` | Say what a change to these paths would meet, and start nothing. `detail.pre_merge` names the pre-merge checks, and `detail.overlaps` the live changes that declare the same paths. It cannot go with `--new`, `--fixes`, `--lane`, `--from`, `--after` or `--adopt`. |
| `bay merge [<change>]` | Freeze the draft, build the candidate, and submit it. Without a change, it takes the change of the view it runs in. Name a change to submit it from elsewhere. It returns at once, and a runner checks and merges it. A revision sent while its batch is checked waits: the checked one merges. Your next `bay merge` sends the newer edits as a new change of the same intent (`detail.follow_up`). It lists open talks about the change, and never waits on them. |
| `bay merge --from <branch>` | Take in a branch made outside bay and merge it in one step: `bay start --from <branch>`, with the branch's name as the intent, then `bay merge`. After its change ended unmerged, it opens a new change from the branch's tip. |
| `bay merge --wait[=<seconds>]` | Return the merge's outcome. The merge runs here when this checkout serves every environment its checks need. Else a live runner that serves them all takes it, and the wait reads its outcome. That wait watches at most `[runner] execution_budget_s` plus `[runner] publish_window_s`, then returns as a timed wait does. It ends at once when the repository is gone. With seconds, it watches that long while the change waits for a runner. It returns the outcome if one comes in time. Else it returns `queued` with `state` `running`, and the run goes on. When no live runner serves every environment its checks need, it returns `CHECK_UNAVAILABLE` instead. Any other result returns at once. |
| `bay merge --expedite <why>` | Ask bay to run the change next, alone, right behind the change that merges now. It needs `[expedite] per_day` in `.bay/config.toml` on main. Only one expedite waits at a time, and at most `per_day` in a UTC day, whoever asks. bay keeps the reason only when it grants the ask at submit: it goes in the signed request, and the runner logs its decision. When no change merges now, or this change is the head already, there is nothing to go before. If bay refuses it at submit, the result is `queued` with `EXPEDITE_REFUSED`, and the change waits its turn. |
| `bay abandon [<change>] [--why <text>]` | Give up a change: without one, the change of the view it runs in. `--why` keeps the reason, such as where the work merged, in the signed request. Another agent can then adopt its intent, or `bay start <intent> --new` opens a fresh change. Your own `bay start <change>` opens it again, with its work. |
| `bay save <intent> [--message <text>]` | Merge the edits in the main checkout as one change, with `bay merge --wait`, then move the checkout to the new main. Never in a view. The intent says what the work is, in a few words. Saving again with the same words goes on with its open change. Run bay without a runner explains it. |
| `bay save <intent> --paths <path>…` | Save only the edits under these paths, named from the repository's root. It runs from any checkout, main or linked, never a view. The change declares the paths, and the checkout's HEAD and files stay as they were. A path with no edit fails the save. |
| `bay waiting` | The changes waiting for an approval that this machine's approver, `bay.approverName`, can give. Each names its candidate, paths and a diff summary. Without an approver set, it lists every one, with who can approve it. It also lists each waivable check that did not pass, with its verdict and the command that waives it. |
| `bay approve <change> [--waive <check>] [--why <text>]` | Sign and push this machine's approval of the exact candidate the change waits on, one record per approval check its approver may answer. `detail.lands_by` names who merges it next: `runner`, `here`, `author`, or `author_repairs` after a no, and `say` follows it. `--why` keeps the reason in the record. `--waive` signs a waiver of one check marked `waivable` instead, never a pass. It needs `--why`. Require a person's approval explains it. |
| `bay reject <change> [--why <text>]` | Say no to a change that waits for an approval: sign and push this machine's no for its exact candidate. The change is blocked with `CHECK_FAILED`, naming you, and `detail.lands_by` is `author_repairs`. `--why` keeps the reason in the record. |
| `bay status [<change>]` | Current state, read from main and refs. With no change named, it lists live changes only, from one fetch. Name a change to read any change, merged ones too. A read of one change, named or a plain read in its view, builds only its row: the fleet's sections, such as `detail.flow` and `detail.targets`, are `null`. For up to two minutes, until a non-presence ref moves, a listing in its checkout reuses its last answer. `detail.saved_s` gives its age in seconds. `detail.guard.hook` says `on` when main's config sets `[agent] product = "claude"`, else `off`. With Codex it says `off`: Codex can run a tool when bay's hook fails, so bay's deny there is advisory. A blocked operation names its next step. It lists red post checks and the open talks you sent or must answer. It also names main commits that did not merge through bay. It lists promotion targets, pending post checks and flaky checks, and warns `no_live_runner` when no runner is fresh, or names a check environment no live runner serves while work waits. A finished operation shows `operation.timing`. A queued change names its place and how many are ahead, under `operation.line`. A change that waits for a worker names its `operation.environments`, and `operation.served_together` says whether one live runner serves them all. Each live change estimates when it reaches main, from its draft on, under `changes[].eta`, and a draft names what its agent did last. A change a runner holds says how long since its claim, under `operation.claimed_s`. A hold on main shows under `detail.hold`, and the flow of work under `detail.flow`. It warns `main_not_linear` for each merge outside bay in the `[red] window` that put bay merges off main's first-parent line. |
| `bay status --deadline <seconds>` | Wait at most this long for the remote, 3 seconds by default. bay does not wait when the last sweep is under `[status] serve_stale_s` old. Then, or past the deadline, bay answers from the local store, says the answer is from the last fetch, and adds `detail.stale_s` and a `stale_read` warning. When no fetch reached the remote, `detail.fetched` is `false`. Then `detail.stale_s` is the age of the last sweep, and `null` when bay recorded none. When the remote has not answered, the warning's `unreached` gives `since` and `why`. `0` answers at once from this machine's last answer, names its age, and refreshes behind. While no ref has moved, that answer is current: `detail.current` is `true`, and bay reads nothing again. |
| `bay status --all` | Every machine and session that the local cache knows, from signed live summaries. It also lists red post checks, and marks each session or change on their paths. It names main commits outside bay, as `bay status` does. It lists the open talks this clone holds, and how many each session owes. It lists each runner's presence, and whether it is stale. When this clone's copy is too old to tell, `stale` is `null` and `stale_why` says why. It shows each machine's last `bay doctor` verdict, and `ready` counts the green and red machines. |
| `bay queue` | The live line, head first, as one `bay.queue/1` document: each place's change, intent, agent, paths, wait, state and runner. `arriving` lists the changes no runner placed yet, and `taken` the changes a runner checks with no place. A `taken` row names the step of a batch search. It writes only fetched copies of the remote's refs. |
| `bay queue --deadline <seconds>` | Wait at most this long for the remote. `0` answers at once from this machine's copy of the line, named by `detail.from_store`. `detail.age_s` says how old that copy is, or `null` when it never fetched. `detail.arrivals_listed` is `false` when no sweep has run here, so `arriving` was not read. Past its window, the read starts a sweep, named in `detail.sweep`. |
| `bay status --branches [--stale-days <days>]` | Every branch on the remote, classed `main`, `target`, `lane`, `merged`, `stale` or `unique`, from one `ls-remote` and one fetch. Under `detail.stranded`, it also names the local branches no remote-tracking ref holds, and worktree records whose folder is gone. It deletes nothing. |
| `bay status --lineage [<range>]` | The `Reverts:`, `Supersedes:` and `Fixes:` pairs on a first-parent range, main by default. It reads local refs only and never fetches. |
| `bay status --green-tip` | The newest commit of main at which every post check is green, in `detail.green_tip`. A red, pending or flaky post check, or a required check with no answer, is never green. It fetches main and the evidence notes first. |
| `bay status --since [<cursor>]` | Merges into main, events and new invalidations after the cursor. Without a cursor, it reads from the start, and each answer names the next cursor in `detail.cursor`. It lists `main_red`, `main_red_cleared`, `outside_merge`, `main_not_linear`, `target_moved`, `target_unpromotable` and talk events, and `--merged` lists none of them. In a view, events are those that touch your change, plus your talks. |
| `bay status --since [<cursor>] --merged` | Only the merges after the cursor, each with its base and committer time. It marks a merge made outside bay, and counts commits off the first-parent line. A bay merge that such a merge put off that line is listed too, with `via` naming the merge. |
| `bay follow [--stop]` | Keep this worktree on main. It moves now, and at each session's start, to the newest main this clone fetched. It moves only when that loses nothing: HEAD detached, no Git operation in progress, tracked files unchanged, main contains HEAD, and no other process in it. Otherwise it stays and says why. It never moves the main worktree or a view. `--stop` ends it, and the worktree stays where it is. |
| `bay look [<commit>] [--paths <path>…] [--end]` | A read-only tree of one commit, with no change and no place in the live-change limit. Without a commit, it reads main's tip, fetched now. It answers the folder, the commit and its Git tree, so a grade names what it read. Everyone on the machine shares one look of a commit. `--paths` writes only those paths, from the repository's root. `--end` ends it now, unless a process outside this session works in it. Else it ends a day after its last look while no process works in it. |
| `bay undo <change>` | A new change that reverses one merge. History before it stays. It returns at once, like `bay merge`, and lists open talks about it. |
| `bay undo <change> --wait[=<seconds>]` | Run the undo here and return its outcome, or watch it for that many seconds, as `bay merge --wait` does. A conflict returns `MERGE_CONFLICT` with the paths. |
| `bay undo <change> --expedite <why>` | Ask bay to run the undo next, alone, as `bay merge --expedite` does, within the same `[expedite] per_day`. |
| `bay talk <agent> <what>` | Ask another agent for one decision, through the shared remote. Its reply is owed in one hour, or `[talk] follow_up_s`. |
| `bay talk <agent> <what> --kind delivery --change <change>\|--artifact <path> [--follow-up <time>]` | Ask another agent for something. The recipient's own key acks it. |
| `bay talk <agent> <what> --kind discovery --decision <decision> [--follow-up <time>]` | Ask for a decision. A `reliability` talk names a `--check` instead. |
| `bay talk <agent> <what> --kind reliability --check <check> [--follow-up <time>]` | Ask for one named check to pass. |
| `bay talk … [--decides <agent>] [--context <text>] [--evidence <ref>] [--supersedes <id>] [--expires <time>] [--target\|--forecast\|--commitment <text>] [--owns\|--promises\|--needs\|--promise-evidence <text>] [--urgent] [--dry-run]` | Optional fields on any talk. The Talk page explains each one. |
| `bay talk --to <agent> --to <agent> <what>` | Ask each agent as one round, one talk each. |
| `bay talk --to-live <what>` | Ask every agent with a live session in this repository, as one round. |
| `bay talk --round <id>` | Show a round: one row per recipient, with its talk, standing and answer. |
| `bay talk --answer <id> <value>\|--value <value>` | Answer a discovery talk with one value. `--supersedes` replaces your earlier answer. |
| `bay talk --backbrief <id> <status> [--outcome <text>] [--first-step <text>] [--unclear <text>] [--evidence <ref>] [--reason <code>]` | Reply to a delivery or reliability talk: `ready`, `blocked`, `validated` or `done`. A `blocked` reply names the code it waits on with `--reason`, and needs a new `--follow-up`. |
| `bay talk --show <id>` | Read one talk and every reply to it, in order. It writes nothing. |
| `bay talk --to-change <change> <what> [--kind <kind>] [--follow-up <time>]` | Send a talk to the agent that merged a change, read from bay's record. Give the action alone, with no agent name. |

## Setup commands

A person or a setup script runs these commands. An agent does not run them in the daily loop.

| Command | Purpose |
|---|---|
| `bay install [--main <name>] [--remote <name>]` | Place bay at `~/.local/bin/bay` and copy the skill into every Claude config directory it finds. In a clone, also record main and its remote, and set Git to keep a commit-graph with Bloom filters. When main names an agent product, add bay's hook entries to the project's settings file. You then commit that file and merge it into main once. Until then, its result says the file still has to merge. The Install page lists what each scope writes. |
| `bay install --approver <name>` | In the project's clone, set this person up to approve: make their keys if they have none, start the registry, enrol them, and read it back from the remote. Running it again changes nothing. |
| `bay install --machine` | Only the machine's part: the program and the skill. It never writes hook entries, a repository's agent settings or its Git config. |
| `bay help [<command>…] [--json]` | Show every command, subcommand and flag on one page, grouped for people, agents and admins. With a command, show that command's help. With `--json`: every command, flag, decision and reason code, and the JSON Schema of `bay.result/1`. Each command names what it writes and what it never writes. |
| `bay doctor` | Check this machine: the Git floor and the agent product's floor, the remote, hook entries, the skill in each Claude config directory, key custody, the check sandbox and the directories checks may read. In a repository set up for bay whose remote answers, it pushes its verdict for `bay status --all`. With no agent hook, the `hooks` row reads `off`, and turns red with `HOOKS_MISSING` when main holds merges that went around bay beside bay's own. On an origin, it also names the hosted remote and its mode. |
| `bay enrol <class> <name> <key.pub>` | Add one public key to the key registry: append it to its class file, sign the new version with `bay.registryKey`, and push it. The class is `agent`, `runner`, `producer`, `reviewer`, `approver` or `registry`. The first key creates the registry, and must be the registry key itself. Keys and the registry explains it. |
| `bay enrol --remove <class> <name> --reason rotated\|revoked` | Remove every key of a name from its class, and record each in the registry's `removed` file with the reason. After `rotated`, the key's earlier records still count. After `revoked`, none of them counts. The last `registry` key stays. Keys and the registry explains it. |
| `bay prune [--stale-days <days>]` | Delete the remote's branches merged by `ancestor` or `patch`, each archived on the remote first, with a restore line in `bay/pruned-heads.log`. A branch with commits off main and a tip older than `--stale-days`, 30 by default, is stale and stays. With `[plugin.prune] command` in the config, bay then runs that plugin once per deleted branch, and `detail.pruned` records its outcome. |
| `bay doctor --deadline <seconds>` | Wait at most this long for the remote. `0` answers at once with this machine's last verdict and its age, and probes nothing. |
| `bay doctor --role runner` | Judge this machine as a runner, whatever role doctor infers. It uses the runner's Git floor, and checks the check variables and the runner's `runner` and `producer` keys. It also shows this runner's own presence and its last push. |
| `bay host <path> [--main <name>] [--object-format sha1\|sha256] [--upstream <url>]` | Create a bare repository on reftable whose main is append-only, and set Git's maintenance to keep a commit-graph with Bloom filters. Without `--object-format`, it takes the format of the repository it runs in, else Git's default. With `--upstream <url>`, the host becomes a bay origin of that hosted remote. It takes a push only after the hosted remote takes it. |
| `bay host serve <path> [--once]` | Keep an origin from `bay host --upstream` and its hosted remote current, until you stop it. It brings in what other writers push to the hosted remote. Between passes, it moves to the bay that `bay update` installed. `--once` makes one whole pass and reports it. |
| `bay share <change> [--remote <name>] [--bundle <file>]` | Push a change and its evidence to a remote, all refs or none, or write them to a bundle. |
| `bay runner run [--once] [--interval-s <n>]` | Drive queued operations to an outcome on this machine. Between operations, a looping runner moves to the bay that `bay update` installed. Each pass also moves every `[[target]]` with `advance = true` to its newest promotable commit. |
| `bay runner install [--print] [--force]` | Write a service that keeps `bay runner run` running for this repository: a launchd agent on macOS, a systemd user unit on Linux. It prints the one command that starts it, and starts nothing. `--print` shows the file and writes nothing. `--force` replaces a file already there. |
| `bay runner run --once --check <check> [--tip <rev>]` | Run one post check once, as this runner's producer, outside the election that picks a check's runner. It runs on main's tip, or on the first-parent commit `--tip` names. It writes one record and changes no runner's claims. |
| `bay runner drain [--hold] [--cancel]` | Ask this clone's runner to stop between operations, once the post-check work it started ends. Its service then starts it again with the service's settings. `--hold` keeps it stopped, across restarts too. `--cancel` takes a stop or a hold back. |
| `bay evidence missing --kind <kind> --producer <producer> [--since <rev>]` | Main's first-parent commits that have no record of that kind from that producer. A record counts by commit, or by base tree and tree, never by tree alone. |
| `bay evidence record --kind <kind> --verdict <verdict> --commit <commit>… [--check <check>] [--environment <environment>] [--input <key>=<value>] [--body <file>] [--version <version>] [--why <text>]` | Write one signed record per `--commit` about a merge, as an outside producer or reviewer, or about a candidate commit, as an approver. A `review` is signed by `bay.reviewerKey`, an `approval` or a `waiver` by `bay.approverKey`, any other kind by `bay.producerKey`. The verdict has no default. `--why` keeps the writer's reason in the record. A `waiver` needs one, and its verdict is always `unknown`. Each run also pushes the writer's notes ref, so a record whose push failed goes out next time. `--environment` names the check's environment for a post check's record. Without it, an approval takes the environment of its approval check, and any other record names `any`. A rerun with the same content writes nothing, and a record over 64 KiB is refused. |
| `bay assets held <id>` | Say whether a store may purge the stored bytes of one large file: held when main's `[assets] hold` covers any path main's history ever saved it under. Changes nothing. |
| `bay plugin test check\|wake\|notify\|assets [--timeout-s <n>] [--expected-minimum <n>] [--path <dir>] [--env <name>] [--with <path>] -- <command>…` | Run bay's contract cases against a check command or a plugin, as bay runs it. It changes nothing, and exits 0 only when every case passes. |
| `bay hook <moment>` | The agent hook entry point, which `bay install` writes into the agent product's settings. The product calls it with a moment, such as `tool.before`. No person runs it, so `bay --help` does not list it. `bay hook talk-wait` is the idle wait, for up to an hour. It wakes the session for a new talk, or when a merge it left queued ends. |
| `bay host hook` | The main hook on a bay-hosted main branch. Git calls it, not a person. |
| `bay update [--version <x>] [--check]` | Install a newer bay release, even while a runner runs. `--check` reports what it would do and changes nothing. |

## What each command writes

Each command declares what it writes, and what it never writes. `bay help` shows both under each command, and `bay help --json` lists them as `writes` and `never`. This table is bay's own list, in bay's own words.

| Command | Writes | Never writes |
|---|---|---|
| `bay start` | the change's record and claim on the remote; its view: a separate folder outside your checkout, recorded as its actor's; with --adopt: you as the actor of the change and of its view | your checkout's files; main |
| `bay merge` | a request on the change's record; with --wait, the checks' evidence and the merge into main | your checkout's files |
| `bay abandon` | an abandon request on the change's record | the view's files; main |
| `bay save` | a change of the main checkout's edits, merged into main; with --paths, of only the edits under those paths, from any checkout; the main checkout, moved to the new main (never with --paths) | any branch of yours; with --paths, the checkout's HEAD or any of its files |
| `bay waiting` | only fetched copies of the remote's refs | your files; your branches; main |
| `bay approve` | your signed approval, or with --waive a signed waiver, pushed | the change itself; main |
| `bay reject` | your signed no, pushed: the change is blocked | the change itself; main |
| `bay undo` | a new change that reverses one merge, checked and merged like any other | history: nothing is rewritten |
| `bay status` | only fetched copies of the remote's refs, and bay's cache under .git/bay | your files; your branches; main |
| `bay queue` | only fetched copies of the remote's refs | your files; your branches; main; the line |
| `bay prune` | deletes remote branches that already merged, each archived first and logged | a branch that has not merged; main |
| `bay talk` | one talk on the remote | your files; main |
| `bay follow` | a marker in this worktree's own Git folder; --stop removes it; now and at each session's start: this worktree's HEAD and files, moved to main | a branch; a changed file; the main worktree; a bay view |
| `bay look` | a read-only tree of one commit in bay's state folder, shared by every look of it on this machine; with --end, or a day after its last look while no process works in it: that tree removed | your files; a branch; a change; main |
| `bay enrol` | one key in the key registry, signed with this machine's registry key and pushed; with --remove, the name's keys out of its class and into the registry's removed file | main |
| `bay doctor` | bay's cache under .git/bay; this machine's readiness on its presence record on the remote, for bay status --all | your files; your branches; main; settings or hook entries |
| `bay install` | the bay program and its skill in each Claude config directory; in a clone, without --machine: bay's hook entries in the project's agent settings file and this clone's bay.* Git config | main: you commit and merge the settings file; with --machine: hook entries, a project's settings or its Git config |
| `bay host` | a new bare repository whose main only moves forward | an existing repository |
| `bay runner` | run: the merges of queued changes into main, with their evidence and its log; install: a service file that keeps it running; drain: one file in the clone's .git/bay that asks its runner to stop between operations; the runner removes it when it stops, or keeps it while it holds | your checkout's files |
| `bay share` | a change and its evidence pushed to a remote, or written to a bundle file | main |
| `bay evidence` | record: one signed record, pushed; missing writes nothing | main |
| `bay update` | a newer bay program, verified before it replaces this one | anything in a project |
| `bay assets` | nothing: held reads main's policy and history | your files; main; the store |
| `bay plugin` | nothing: it runs a plugin with test inputs | your files; main |
| `bay help` | nothing | anything |

## Global options

| Option | Effect |
|---|---|
| `-C <path>` | Run as if bay started in `<path>`, like `git -C`. |
| `--json` | Print only the `bay.result/1` document, also at a terminal, with no human text on stderr. |
| `--version` | Print the bay version. |

## The result

Through a pipe, or with `--json`, every command that reports state prints one `bay.result/1` JSON document on stdout. Then human text, if any, goes to stderr, and `--json` leaves it out. At a terminal without `--json`, stdout holds the plain sentence and no document. No command asks an interactive question. Unknown is never success, so an unknown check never exits `0`.

| Exit | Meaning |
|---|---|
| `0` | ok, merged, or accepted and queued. Only `merged` says the merge happened. |
| `10` | blocked: a policy or state refusal, with `allowed` and `retry_when`. |
| `20` | failed: an operation fault. A failed `bay merge`, `bay undo` or runner run also writes a receipt. |
| `2` | usage error: the message and usage go to stderr, with no result on stdout. |

> `bay hook <moment>` follows the exit protocol of the agent product instead, and `bay host hook` follows Git's.
> For Claude Code, exit `2` denies the tool call.
