agent-bridge

Documentation

The link's design: what it is, and what was weighed against it

agent-bridge links one owner's machines so their agents can run work on each other and talk. The link is SSH. This page explains why, what 0.8 changed, what was considered and turned down (with the reason for each), and what comes next. The aim is that the next change starts from the same reasoning instead of from scratch.

How it is built

What stays, and why

What 0.8 changed

What 0.9 changed (the security release)

What 0.10 changed (safe jobs)

What 0.12 changed (live messaging)

Claude Code's own cross-session messaging (SendMessage, Remote Control) set the bar for how talking to another session feels: answer from where the message landed, hear when the other one is done, and two agents can't loop forever. 0.12 matches that over the LAN, for any agent CLI and any model provider, and goes past it where a link between machines allows.

0.13: the mesh (one long poll per peer, replicated logs, relaying)

Considered, and decided

Idea Decision
Pin the post-quantum key exchange in ~/.ssh/config No. One file is read by every OpenSSH on a machine (Windows can have three), and a name one of them doesn't know breaks them all for that host. Instead the best build is picked by itself, and require_pq adds the setting on the command line. A downgrade isn't the risk: the key exchange's hash covers both sides' lists, signed by the pinned host key.
sshd's ClientAliveInterval to end stray peer processes Not relied on: sshd drops a dead connection but doesn't reliably end what it ran. The hold ends itself instead. The setup scripts still set it, and it applies the next time they run; nothing asks for an extra run.
A forced-command "gate" that logs, then runs whatever was sent Superseded by the safe tier (0.10): only known operations run, through installed code, in a sandbox, and the audit log is written by that code. A full key stays a shell login, by design, for machines trusted that much.
Allowlisted operations alone (build, test, git-sync, logs, status) as the boundary No. Build and test run what the synced repo's config says, and the peer wrote that repo. The boundary is the sandbox; the allowlist makes sure the sandbox can't be skipped. Ad-hoc scripts stay possible on the safe tier, inside the sandbox without network, after the deny rules.
bubblewrap, firejail or a container for Linux jobs No: they need installing. unshare (util-linux) is on every distribution.
An "observe" tier (messages plus status and logs) No. Jobs are scoped to the machine that asks, and an observe-only peer can't start any, so it would see almost nothing beyond what messages-only and ping already give.
Capability tokens (Biscuit, macaroons, UCAN) No. The machine that issues a right and the one that checks it belong to the same owner, so the key's own line and serve give the same guarantee. Narrower, delegated rights come in 1.0 as short-lived SSH certificates, made by OpenSSH's own ssh-keygen.
An A2A (Agent2Agent) server No. A2A is for agents of different organizations over HTTP, and running one would open a port for a problem agent-bridge doesn't have. Task states map onto A2A's (below), and 0.10 writes a static Agent Card file describing the link, with no listener.
An MCP tool server Yes, as a stateless shim in 0.9, with no run-command tool. It runs inside Claude Code, which is already there, and it calls the CLI once per request. 0.12 gives it eight tools and makes it the channel.
Relaying Claude Code's permission prompts to another machine (claude/channel/permission) No. Any agent that can run the CLI could then turn a message into the owner's approval, and Claude Code's own rule is that a message from another session never counts as consent. watch says when a peer's session waits for its owner; answering it from a phone is Remote Control's job, and the two combine.
A phone or web view of the machines No. It needs a listening port or a relay, a third party either way. Remote Control already does it for Claude Code sessions.
A resident daemon on each machine, to deliver while no session is open No. Messages wait in the outbox for as long as it takes, and the next session's monitor takes them in within a second. A process that is always running is more to secure, for a gap the outbox already covers.
Delivering into Claude Code's own per-session inbox socket (CLAUDE_CODE_MESSAGING_SOCKET) Not yet. Only its first, authenticating line is documented, not the message itself, and the channel already starts a turn in an idle session. Taken up if Claude Code documents the format.
Holding a message from a session that runs without permission prompts (Claude Code's default between sessions) No. A hold waits for the owner. The read header says how the sender runs, and the loop guard limits what any sender can start.
UUIDv7 message ids No. Ids are already unique and time-ordered (<time>-<machine>-<random>), and every machine drops a repeat by id. A new format would add churn for nothing.
A 256 KB cap per message No. Attachments are already capped at 256 KB in all; a message (text, data and attachments together) stays capped at 1 MB.
Keys that expire after 90 days and rotate every 30 Folded into 1.0's owner certificate authority. Rotating raw keys means editing authorized_keys on both sides on a schedule, where one failed step locks a machine out, and on Windows an administrator's key file needs elevation. Short-lived certificates renew by themselves and need neither. Expiry without rotation would only lock machines out.
A non-admin bridge user on Windows, now After the first round of real-machine tests. It changes which account runs a peer's builds, and whether that account can use the owner's toolchains (PATH, SDKs) has to be seen on the machine first.
A 2-minute pairing window No. Each code is bound to this attempt's nonces and dies at the first wrong entry, so the window's length doesn't add safety, and on Windows the owner's confirmation can include a UAC prompt.

Task states and A2A

agent-bridge's task states map onto A2A v1.0's, several onto one, and A2A has states with no counterpart here:

agent-bridge A2A v1.0
created, waiting (--after, not sent yet), open (a pool task) SUBMITTED
accepted, assigned (a pool task), started WORKING
blocked INPUT_REQUIRED
done COMPLETED
failed FAILED
cancelled CANCELED
declined REJECTED
(none) AUTH_REQUIRED, UNSPECIFIED

A pool task's claimed changes no state (it stays SUBMITTED until assigned), and reopened takes it back to SUBMITTED. The Agent Card lists what a machine can do as skills; what each machine has (its capabilities: pick --has) and which sessions hold a role (@<role>) change from hour to hour, so they are asked of the peer, not written in the card.

The message, on the wire

A message is one JSON object, "protocol": "agent-bridge/3". One rule (lib/msg/check.jq and its PowerShell twin, held to the same answers by tests/fixtures/messages) checks it before anything reads it.

Field
id <time>-<machine>-<random>: unique, time-ordered; a repeat is dropped by id at every step
from, to <machine>/<session>; from's machine must be the one that delivered it, and the signer
kind note, request, reply, status, done, task, ack, subscribe (data.session: whose idle notice is asked for), log (data.type: decision, finding, warning or note); a newer sender's new kind is still a message
created_at, created_epoch when it was written
seq, thread, reply_to order per peer (gaps show a lost message), the conversation, what it answers
subject, body text, redacted of secrets before it left
priority, due_at, expires_epoch expires_epoch: after it, the message is dropped unread
task, data a task event: data.event (and its other fields)
refs, attachments a job and branch; files (name, size, sha256, base64; 256 KB in all)
artifacts bigger files as git objects: name, size, sha256 and the commit that holds the file (0.13)
sender optional: {agent, mode}, the sending session's agent CLI and permission mode (one word each)

How it travels. An exchange carries each message as a line:

An older machine sends no signature and ignores one.

The signature. ssh-keygen -Y sign -n agent-bridge over the message file's exact bytes. It is made with the key the sending machine uses for the receiving one (~/.ssh/agent_bridge_<peer>_ed25519), and checked with ssh-keygen -Y verify -I <machine> -n agent-bridge against allowed_signers next to peers.json. Pairing writes that file; machines paired before 0.9 take it from authorized_keys. It is kept as sigs/<id>.sig. A verified message gets a verified/<id> marker; one from a machine whose key is on record and that fails goes to quarantine/.

1.0: agent identity (designed; built after the first real-machine tests)

1.0 replaces long-lived keys with certificates from the owner's own certificate authority, made only with OpenSSH's ssh-keygen. It waits for the real-machine tests of 0.8 to 0.10, because its first step adds a way to log in, and that must be proven on the machines before it replaces anything.

The link is LAN-only by design. Reaching a machine that is off the LAN, behind NAT or a VPN, takes something outside the two machines:

That is why off-LAN stays experimental and opt-in. agent-bridge itself adds none of these.

ab-link, in this repository, is a small Rust program built on iroh: QUIC, connections dialled by public key, hole punching, and a relay when that fails. It carries SSH's own, already-encrypted bytes as an SSH ProxyCommand, so SSH stays the trust layer.

What works now, by hand, for machines the owner already paired:

  1. On each machine: agent-bridge link id prints its endpoint id (its key is made in ~/.config/agent-bridge/ab-link.key on first use).
  2. On the machine that starts work, in the other machine's entry: "via": {"ab_link": "<its id>", "relay": "none", "addr": "<its ip>:47100"}, or "relay": "n0" and no addr. Every SSH call to that peer then goes through ab-link dial, and nothing else changes.
  3. On the other machine: the same "via" entry for the first one (that is its allowlist), then agent-bridge link listen (--relay, --port, --to 127.0.0.1:22). sshd sees these logins from 127.0.0.1, so the key's from= there has to allow 127.0.0.1. That is the owner's choice, made by hand, and the reason this stays experimental until it gets an SSH port of its own.

Measured on 2026-12-03 between a Windows PC and a Linux machine on one LAN, with iroh 1.6.0:

It ships only when it passes its gate:

Edit this page on GitHub →