agent-bridge

Documentation

Commands

agent-bridge [<peer>] <command> [options]

<peer> is a name from the config; leave it out with a single peer, or set default_peer (or pass --peer <name> after the command). Most commands run inside the project's git repo; the machine-wide ones (pairing, ping, peers, monitor, install-cli...) work anywhere. Both clients, bin/agent-bridge and bin/agent-bridge.ps1, take the same commands and options. agent-bridge help prints this list in the terminal.

Machines and pairing

Command What it does
pair --check What this machine still needs before it can pair, one ok/warn/needs the owner: line each. Read-only. Exit 1 when the owner must act.
pair [<peer>] [--network CIDR] [--no-accept] [--messages-only] [--timeout S] Pair with a machine running pair at the same time (Pairing).
pair --bg [<peer>] [options], pair --status, pair --confirm, pair --cancel The same from an agent session: start it in the background, see where it is, have the owner confirm (a dialog or this terminal asks them for the other machine's code; it takes none), or stop it.
pair --host <ssh target> Pair with a machine mDNS doesn't reach (a VPN, another subnet), over an SSH login you already have there (Pairing by address).
pair <peer> --limit messages|full What a paired machine's key may do here, changed without pairing again: messages makes it a messages-only one, full an ordinary one.
pair --fleet Pair with every fleet member that accepts joins and isn't paired here yet.
unpair <peer> [--yes] Remove what pairing wrote on this machine for <peer>.
fleet init | join | show | status | leave The fleet key: machines that hold it pair without the code.
fleet accept on|off [--network CIDR] Answer fleet members' joins by itself (while advertise runs).
advertise --install | --uninstall | --status Announce this machine on the LAN from now on (opt-in), so paired peers find it at a new address.
discover [--seconds N] [--json] Machines running agent-bridge on the LAN now (pairing or advertising), whether each is paired here, and whether its host key is still the pinned one.
ping [--all] The peer answers: round trip, OS, load, cores, uptime, clock skew.
peers [--json] Every configured peer at once (up, or down and why), and unpaired machines seen on the LAN. Exit 1 when one is down (not with --json).
locate-repo [--save <path>] Find this project's clone on the peer (by its first commit); --save keeps one.
doctor Check everything, both directions, one ok/warn/FAIL line each with the fix. Exit 1 on a FAIL.
check The link works; the peer's hardware, tool versions, repo, your jobs, inboxes.

Jobs

Command What it does
sync <job> [<ref>] [--force] Send <ref> (default HEAD) to the job's worktree on the peer, as a bundle of only what it lacks. Refuses to drop commits there you haven't fetched.
job <job> --agent-cli claude|codex ("<prompt>" | - | --body-file <file>) [--task T] [--timeout S] [--bg] An agent on demand: that machine's own agent CLI, headless, in the job's worktree (never bypassing its permission prompts). Full links only. task new ... --run syncs, makes the task and starts it in one step.
job <job> [--bg] [--fail-fast] [--preset P]… [-c '<cmd>']… | -f <file> [--expect <path>]… [--task T] Run steps in the job's worktree (Jobs).
wait <job> [--timeout S] Wait for it; print each step's result; return its exit code.
logs <job> [-n N] [--follow] [--step NN] The job's log, or one step's.
stop <job> Stop it and everything it started (exit 143).
ls Your jobs on the peer: state, branch, commits ahead, uncommitted changes, steps.
fetch <job> The job's new commits, as branch from-<peer>/<job>.
get <job> <path> [<local>] Copy one file the job made (@build/<path>: from its build folder).
done <job> [--force] Remove the job; refuses while it holds unfetched commits or changes.
clean [--apply] [--force] [--stale-days N] Remove finished jobs with nothing to fetch, and this machine's orphaned or stale build folders there. Dry run unless --apply.
update-checkout [--dry-run] Bring the peer owner's own checkout up to the remote's default branch (fast-forward only, only when clean).
run -c '<cmd>' | -f <file> A one-off read-only command in the peer's repo folder.
guard <key> (--value N | --lcov F) [--job J] [--max-drop P] [--force] Before publishing a report: refuse when job J crashed or lost an expected output, or the value fell more than P points (default 2) below the last accepted one.
pick [--preset P]… [--os O] [--need-ram GB] [--need-disk GB] [--has xcode,gpu,...] [--allow-battery] [--agent] [--json] The best peer right now, with one reason line per peer. Exit 1 when none fits.
auto <command> <job> … Use the peer pick chooses; the job's later commands find it again by name.
status [--json], status --set "<doing>", status --clear The peer's load, your jobs, who works there; or publish what you're doing.
top [--once] [--interval S] Every peer's load at a glance, refreshed.

Messages and tasks

Command What it does
msg <to> [--request] ("<text>" | - | --body-file <file>) A message to session <to> on the peer (or any, or @<role>: every session there started with AGENT_BRIDGE_ROLE=<role>); prints its id. - takes the text from stdin. Options: --kind note|request|reply|status|done, --reply-to <id>, --priority low|normal|high|urgent, --due <ISO>, --data '<JSON>', --attach <file>, --thread <id>, --subject, --job, --branch, --all (every peer). Exit 2 when the peer won't take it (it goes to refused/).
reply <id> ("<text>" | - | --body-file <file>) [--kind status|done] Answer a message.
wait-reply <id> [--timeout S] [--kind done|any] Wait for the answer.
task new "<title>" --pool [--lease 30m|2h|<s>] [--to <session>|@<role>] Offered to every peer: the first claim gets it (the creator's machine decides); an assignee that sends nothing for its lease gives it back to the pool by itself.
task claim <task> Claim a pool task; it is yours once the creator's machine says assigned.
log add [--kind decision|finding|warning|note] ("<text>" | -) An entry in the project log, kept here and sent to every peer: what was decided or found, written once for every agent on the project.
log [ls] [--since 2h|3d|<epoch>] [-n N] [--json] The project log, oldest first; marks it seen for this session.
digest [--json] What needs someone, one line each, newest first: unread and urgent messages, tasks blocked, to accept, waiting on others, overdue or stale, paused threads, held, rejected and refused mail, sessions waiting for their owner. Read-only; works anywhere.
notify-idle <session> [--timeout S] One notice back (a status message) when that session on the peer next goes idle or ends; returns at once. 12 hours at most unless --timeout says otherwise.
inbox [--unread] [--kind K] [--to S] [--thread ID] [--json] [--pull] The local mailbox.
channel Not run by hand: the plugin's MCP server, its tools and its Claude Code channel; the name stays for registrations made before 0.12.
--machine on msg, task new, inbox, watch, exchange, archive The machine's own mailbox, for mail that isn't about a project. Outside a repository these use it by themselves; read, reply, wait-reply and task <verb> find an id in it.
inbox --held, inbox --release <id>... | --release --all Messages your inbox rules hold for you (who and when, never the text), and letting them in.
read <id> [--out <dir>] Show a message, mark it read (a request sends a read receipt); --out saves its attachments. For one you sent: how far it got (queued, delivered, shown to a session, read).
archive [<id>…] [--all], archive --compact, archive --prune <days> File away read messages. --compact (also done by itself once a day): what was filed away or sent more than 30 days ago goes into one file a month (archive/<YYYYMM>.jsonl, sent/<YYYYMM>.jsonl), its exact bytes kept, its read markers dropped; read <id> still finds it. --prune: remove for good what was filed, sent, rejected or refused more than <days> ago (30 or more); tasks keep their logs.
exchange Deliver queued messages both ways now.
watch [--once] [--new] [--interval S] [--timeout S] [--quiet] [--mine|--all] One line per new message, task event or link change (link down: <peer>: <why>, link up: <peer>), per session on another machine that waits for its owner's approval (waiting: ...), and per message rejected here or refused there. --once: stop at the first event. --quiet (the plugin's monitor): silent where there is nothing to watch, and only this session's own mail (as --mine; --all shows everything).
task new "<title>" [--to S] [-d "<details>"] [--parent T] [--after T,...] [--job J] [--branch B] [--priority P] [--due ISO] A task for the peer's agent; prints its id. With --after, it waits here until those tasks are done, then goes by itself (task cancel drops it meanwhile). task show on a parent rolls up its subtasks.
task accept|decline|start|block|done|fail|cancel|note <task> ["<text>"] [--exit N] Move a task along (the assignee's machine), or cancel it (the creator's).
task progress <task> <0-100> ["<text>"], task reassign <task> --to S Report progress; hand it to another session.
task ls [--mine|--theirs] [--state S] [--all] [--json], task show <task>, task wait <task> [--state S] [--timeout S] The board, one task's timeline, or wait for it to end or reach a state (0 done, 1 failed/declined/cancelled, 124 timeout).

Watching and other CLIs

Command What it does
sessions [<peer>] [--all] [--json] The agent sessions that are live on every machine (or one), in this project: <machine>/<name>, id, CLI, state (Sessions).
wait-idle <session> [--timeout S] Wait until that session (a name or an id; on the peer, or here without one) is idle or has ended. 0 then, 1 no such session, 124 timed out.
monitor [<peer>] [--once] [--json] [--events] [--interval S] [--timeout S] Every machine, agent session, connection and job at once (Monitor).
integrate <codex|antigravity|gemini|grok> [--dry-run|--uninstall], integrate --status Set agent-bridge up for another agent CLI (Other agent CLIs).
hook <event> [--agent <cli>] Run by the agent CLIs' hooks: a session's activity into this machine's journal.
install-cli [--dry-run|--uninstall|--status] Put agent-bridge in your terminal (on your shell's PATH), following the plugin across updates; each Claude Code session does it by itself while it's missing, until --uninstall (Install).
link id|listen|status The off-LAN path, experimental and opt-in: this machine's endpoint id; letting in, through ab-link, the peers whose entry has "via"; what's set up (The link's design).
config [--json] The configuration in effect, the files it came from, and the plugin's folder.
is-job <path> Exit 0 when <path> is an agent-bridge job worktree (for other cleanup tools).
version, help

Exit codes

Code Meaning
the job's own for job and wait: the first failing step's
1 a check failed (doctor, peers, ping, pick, pair --check, guard, locate-repo with nothing found), a task ended failed, declined or cancelled (task wait), or a pairing failed
2 usage, or a refusal (one line says why); a message the peer wouldn't take
65 an --expected output is missing (when every step passed; else the first failing step's code)
75 the message is queued (the peer is unreachable, or has no clone of the project yet)
124 timed out
125 the job ended without an exit code
143 stopped
255 the SSH link failed (one line says why)

Slash commands (Claude Code)

Each is a short guide for the agent; the ones that only look pre-approve their own agent-bridge commands (for /agent-bridge:inbox that includes read, which marks a message read and sends its receipt, and exchange).

Command For
/agent-bridge:setup Linking a machine: pairing first, or the steps by hand.
/agent-bridge:pair Pairing with another machine on the LAN.
/agent-bridge:doctor Checking the link, with each problem explained.
/agent-bridge:peers Which peers are up.
/agent-bridge:status A peer's load, your jobs there, who's working there, unread messages.
/agent-bridge:monitor What every machine and agent is doing.
/agent-bridge:offload Running a build or test on another machine.
/agent-bridge:handoff Handing work to the agent on another machine, as a task.
/agent-bridge:inbox Handling what came in.
/agent-bridge:tasks The task board.
/agent-bridge:cleanup The end-of-session round: finished jobs, stale build folders, read messages.

Edit this page on GitHub →