Relay protocol
This page is imported from the project's own documentation at the pinned commit. Its links to repository files are removed, and one pointer to internal test material is left out. The relay protocol, version 1: the frames, the handshake, the requests and the doors. It is long and is meant for looking things up.
The runnable base profile and its external relay/store adapter instructions are in the conformance kit.
What two stores, a store and a relay, or two relays say to each other, byte for byte, as the crate
crates/il-relay speaks it. Values are wire values (store-format.md §2):
canonical, so equal values have equal bytes. Below, {a, b} is a wire dict, [x, y] a wire
list, bytes32 a 32-byte string, int a non-negative integer.
The handshake field v is the protocol version (1) and a mismatch is refused; error frames carry
{code, message}.
The frame grammar carries packed entries. An entry has either 13 or 14 fields; a 14-field entry signs a body digest and carries its detachable body after the signature. Its id and signature remain valid after that body is removed. A peer that only understands 13-field entries must refuse a 14-field entry. See store-format.md for the exact bytes.
1. Transport and framing
One TCP connection, optionally TLS (§3). Both directions are a sequence of frames:
u32 big-endian length N | N bytes: wire value [op: str, id: int, payload: any]
Nmay not exceedrelay.max_frame_bytes(9 MiB by default). A peer that receives a larger length sendserrwith codeprotocoland closes.- A frame that is not a 3-item list with a string
opand integeridgetserrprotocol. - The same port serves HTTP (§9): a connection whose first four bytes are one of
GET,POST,HEAD,PUT,OPTI,DELEis HTTP. A frame length starting with those bytes would exceed even the maximum permittedrelay.max_frame_bytes, so the test is unambiguous.
Requests, replies, pushes
The client picks id (any int ≥ 1, unique among its open requests). The server answers each
request with exactly one final frame, in the order requests arrived:
| Frame | Meaning |
|---|---|
["ok", id, payload] | success; payload per op (§4) |
["err", id, {code, message}] | failure; common code values in §5 |
A client may pipeline any number of requests without waiting. Pushes reuse the id of the request
that opened them and never end a request: ["ev", sid, …], ["cur", sid, …], ["room", sid, room], ["chunk", id, bytes]. A server may end a subscription by sending ["err", sid, …]
after its ok (for example when read access is lost); the client drops it.
2. Handshake: each side proves its key
C → S ["hello", 0, {"v": 1, "pub": C: bytes32, "nonce": Nc: bytes32}]
S → C ["hello", 0, {"v": 1, "pub": S: bytes32, "nonce": Ns: bytes32, "proof": sig_S}]
C → S ["auth", 0, {"proof": sig_C, "dlg": [delegation, …]}]
S → C ["ok", 0, {"dlg": [delegator: bytes32, …]}] or ["err", 0, …] and close
vis the protocol version. A server that does not speakvanswerserrversion; a client that receives anothervcloses.- A proof is the 64-byte signature of a token entry (
contract.token): anEntrywithroom = 32 zero bytes, seq = 0, prev = 32 zero bytes, lamport = 0, ts = 0, kind = "net.proof",body = wire(ctx),key = "", to = [], refs = [], epoch = 0; the signature is over its id (blake2b-256(signable, person="il.entry")). The verifier rebuilds the token from the expected context and checks the signature with the claimed key. - Contexts:
sig_Sover["il.handshake", "server", Nc, Ns, C, cert];sig_Cover["il.handshake", "client", Ns, Nc, S, cert].certis the SHA-256 of the relay's TLS certificate (DER) as the client saw it, or empty bytes on plain TCP (§3). Each side signs both nonces and the other's key, so a proof cannot be replayed to another peer, connection or channel. - Key pinning: a client that knows the relay's key compares it with
Sand closes on a mismatch. Certificates are never checked against an authority. - The relay checks its connect policy on
hello(errdenied) and the client's proof onauth(errhandshake). Any other frame beforeauthsucceeds getserrhandshakeand close. - A delegation lets the connected key publish entries authored by another key: a packed token
entry of kind
net.delegate, body{"to": holder: bytes32, "expires": ms}, signed by the delegator,ts= issue time in ms. Valid when the signature checks,tois the authenticated key andexpiresis in the future. The relay lists the delegators it accepted.
3. TLS and the channel binding
- A relay serves TLS (1.2 or later) on the whole port, frames and HTTP alike, or plain TCP. Plain
TCP on a non-loopback listener requires the safety-weakening
relay.plain_tcp_off_loopbacksetting and its explicit confirmation; otherwise the relay refuses to start without TLS. Clients default to TLS unless the relay's host is loopback. - The certificate is self-signed; the Rust relay makes it with
rcgenin-process, keeps it in<store>/tls/relay-cert.pemandrelay-key.pem(mode 600), and replaces it when fewer thanrelay.tls_renew_before_daysdays of validity remain (30 by default). - Trust comes from the handshake:
certin both proof contexts issha256(certificate DER). A man in the middle with another certificate cannot produce the relay's proof over its own fingerprint, and the client's proof is useless on any other channel.
4. Requests
After the handshake, C below is the authenticated key. Every room-scoped request is subject to
read access (§6); a room the key may not read answers as if it did not exist.
| op | payload | ok payload |
|---|---|---|
ping | any | {} |
status | any | {v, pub, rooms, entries, conns, subs, directory, uptime, maxrss, cpu, counts, links}; servers may add fields |
whoami | any | {key, binding}: the connected key and its current company binding, if any |
bind | {token: packed id.bind token} | the verified company binding for this connection |
admission.register | any | {}: an admission authority registers to receive admission requests |
admission.exchange | signed request naming authority, relay, requester, nonce | an authority's answer; while pending, the authority receives an admission.request push |
admission.answer | signed authority answer | {} for the authority; completes the matching exchange |
pub | [packed entry, …] | {acc: int, dup: int, rej: [[id, reason], …], miss: [[room, author, seq], …], tails: [[room, offset], …], reach: [[key, "subscribed" or "stored"], …]}, plus retry: float seconds when rate limited (§7). reach covers each accepted entry's recipients (its to, else the room's members, at most 256): subscribed = a connection of that key follows the room or its "mine" feed now; stored = not connected, the entry waits for it (§13) |
pub.part | [packed entry, …] | {held: int} (§8) |
peek | {room, invitation: packed token} | [packed entry, …]: the room's room.* and admission.* entries, for a valid room.invitation token signed by an owner, admin or principal of the room, not expired; err forbidden otherwise. No messages or tasks of the room |
heads | {room} | [[author, seq, id, lamport], …]; [] for an unknown or unreadable room; a deleted room instead returns {deleted: packed marker, attestation: packed entry} |
want | [[room, author, seq, limit], …] | [packed entry, …]: each author's entries with sequence > seq, in order, at most min(limit, relay.want_max_per_author) per item (5000 by default). The reply uses relay.want_budget_bytes (default frame limit minus 64 KiB), allowing one entry beyond the budget. Items for a room's creator are served first. Unreadable rooms contribute nothing |
rooms | {} | [room, …] the key may read |
sub | {room, after, cursors?: bool} | {tail}, then ["ev", sid, [[offset, packed], …]] pushes for every entry after after (after = -1: from now). With cursors: true, also ["cur", sid, [reader, name, offset]] when any cursor of the room moves |
sub | {mine: true, after} | {tail}, then ["ev", sid, [[room, offset, packed], …]] for entries in any room addressed to C (its key in to, or a plaintext room.invite whose who is C). after counts items of this per-key index (relay-local), -1 = from now. The backlog after after comes in one push while it fits half a frame |
sub | {rooms: true} | {rooms: [room, …]}, then ["room", sid, room] when a room appears. Federation peers only (err forbidden) |
unsub | {sid} | {} |
cursor | {room, offset, name} | the cursor's new value: moves C's cursor name (default delivered) forward, never back, never past the tail |
cursors | {room, name} | [[reader, offset], …] |
seen | {room, id} | {offset, delivered: [key, …], read: [key, …], of: int} for an entry at this relay |
wait_cursors | {room, readers: [key, …], offset, name, timeout} | sent once every reader's cursor name has reached offset, or at timeout seconds (≤ 300): {done: bool, offset, cursors: [[reader, offset], …]}. offset = -1 means the relay offset of the last entry this connection published in the room, so pub and wait_cursors can be sent in one write ("confirmed by members" in one reply) |
beat | {room, state: bytes, ttl: float} | {}: C is present for ttl seconds |
present | {room} | [[who, state, age seconds], …] |
blob.put | {size?: int, room?: bytes32} | none yet: the upload is open under this id; a readable room gives that room's readers access after blob.end |
blob.chunk | bytes | no reply (an err ends the upload) |
blob.end | null | {blob: bytes32, size: int}; blob = blake2b-256(data, person="il.blob") |
blob.get | {blob, offset?: int} | ["chunk", id, bytes] pushes then {size} |
blob.has | {blob} | bool (false for a blob the key may not read) |
Offsets are the relay's local arrival positions (from 1); they differ between relays and are used
only for after, cursors and tails. Blob chunks use relay.blob_chunk_bytes (256 KiB by default);
the uploader computes the id
itself and closes the connection if the relay reports another.
5. Errors
["err", id, {"code": str, "message": str}]; message is for people (at most 300 characters).
The relay also uses operation-specific codes for admission, retention, and erasure.
| code | when |
|---|---|
protocol | malformed or oversized frame (connection closes) |
version | unsupported protocol version (connection closes) |
handshake | missing or failed handshake (connection closes) |
denied | the relay's allow/deny list refuses the key (connection closes) |
unknown_op | no such op |
bad_request | the payload does not have the fields the op needs |
not_found | no such room or blob, or one the key may not read (same answer on purpose) |
forbidden | the op is not available to this key (the room feed) |
too_large | blob or held burst over the relay's limit |
rate_limited | admission exchange capacity exceeded; publishes report rate limits in their ok (§7) |
full | the relay's storage is below relay.min_free_bytes (or the disk said so): pub, pub.part and blob.put are refused, reads keep working, the connection stays open; retry later (a client keeps the entries and syncs them then) |
admission | connection admission is invalid or expired when admission authorities are configured |
expired | an expired message body cannot be uploaded again |
replay, authority_offline, timeout | admission exchange nonce reused, authority unavailable, or authority answer timed out |
refused | a room was purged by relay retention |
Rejections of single entries in pub are not errors: they come back in rej with one of these
reasons: malformed entry, bad id or signature, unknown room, fork: a different entry holds this sequence, broken chain, lamport does not increase on the author's chain, unsigned and not covered by a signed later entry in this batch, unsigned tail: the author's last entry in this publish is not signed (decision 14: a relay refuses an author's run that ends unsigned; a client signs its head
before pushing), author is not the authenticated key and gave it no delegation, key may not create rooms on this relay, entry body is over the size limit,
<kind> must be plaintext, author was removed from the room after this sequence,
rate limited. Store reasons may be worded slightly differently by each store; clients compare
by prefix.
6. Who may do what
Publishing. An entry is accepted when its author is C, a key that delegated to C, or C
is a federation peer whose room rule matches the room (§10); and the store's own checks pass.
A room's genesis may be refused by the creators list. Kinds that must stay readable without room
keys are refused when encrypted (epoch > 0): room.*, cap.*, key.epoch, act.approve,
witness, receipt, agent.card, agent.card.endorse. An entry by an author whose membership
was cut (room.remove {who, after_seq} by an owner, admin or principal) with seq > after_seq is
refused until that author is invited again.
Reading (sub, heads, want, rooms, cursor, cursors, beat, present, blobs): a
key may read a room when it is a member, is invited, is one side of a direct room (dm: key), the
room's join is open, it is the relay itself, or it is a federation peer whose rule matches.
Membership is the rooms layer's reducer (rooms.membership, Rust interlinked-rooms) when available;
otherwise the relay's fallback rules, folded in Entry.order, which a test keeps equal to it:
creator = owner; genesis principals; room.invite by owner/admin/principal invites with a role;
room.join by an invitee, anyone in an open room, or either side of a direct room makes a member;
room.leave; room.role; room.remove ends membership and sets the cut. A subscription whose
key loses access is ended with err not_found.
Blobs are readable by the keys that uploaded them and by keys that may read a room with a
plaintext entry whose value has "blob": <id>.
7. Flow control and limits
- Replies and pushes are written in the order produced. The relay writes each read burst's replies with one write and fans out once per burst.
- Back-pressure: when a connection's unsent output passes
relay.high_water_bytes(1 MiB by default) the relay stops reading from it and stops pushing to it. Subscriptions remember their offset and resume belowrelay.low_water_bytes(256 KiB by default); a slow reader's pending output is bounded and its subscription retains the backlog offset. - Rate: a token bucket per key (
rateentries per second,burstcapacity). A publish is charged for all its entries at once and either fully allowed or fully refused, never split: a refused publish getsacc: 0, every entry inrejwith reasonrate limited, andretryseconds. Federation peers are not limited. - Sizes: entry body
relay.max_body_bytes(8 MiB default), blobrelay.max_blob_bytes(1 TiB default), held burstrelay.max_part_bytes(256 MiB default). - Connections: at most
relay.max_conns_per_ipopen connections per address (frames and HTTP together; more are closed at once, counted asrefused_conns), and a connection that has not proved its key withinrelay.handshake_timeout_s(TLS handshake included) is closed (handshake_timeouts). - Storage: below
relay.min_free_bytesfree on the store's filesystem new data is refused withfull(§5); the reading is kept forrelay.free_check_s. - Reconnecting (clients and federation links): the wait doubles from
sync.reconnect_safter each failed attempt up tosync.reconnect_max_s, with up tosync.reconnect_jitterrandom spread, and resets once connected.
8. Bursts larger than a frame
The store accepts an unsigned entry only together with a later signed entry of the same author
(head signing). A sender whose unsigned run does not fit one frame sends the leading frames as
pub.part: the relay holds them for this connection and the next pub on the connection ingests
the held entries and its own as one batch. A sender never cuts a burst after an unsigned entry
except into a pub.part. Held bursts are bounded by max_part; going over ends the burst with
err too_large and discards it.
9. HTTP on the same port
Connection: close after each response; JSON bodies; Access-Control-Allow-Origin: *.
| Method, path | Response |
|---|---|
GET /.well-known/interlinked.json | {interlinked: 2, relay: {key, address, transport}, directory: interlinked address, agentCard, a2a, agent} |
GET /.well-known/agent-card.json | the A2A AgentCard of the relay's primary agent (?agent=<key> for another), or of the relay as a gateway when it has none |
GET /agents/<key>/agent-card.json | the card of any agent in the relay's directory; 404 if none |
GET /directory?q=&skill= | {directory, agents: [summary, …]} |
POST /a2a/<key>, POST /a2a | the A2A door (§11) |
An AgentCard has the A2A 0.3 fields (protocolVersion, name, description, url,
preferredTransport: "JSONRPC", version, capabilities, defaultInputModes,
defaultOutputModes, skills, provider, securitySchemes, security), the A2A 1.0
supportedInterfaces ([{url, protocolBinding: "JSONRPC", protocolVersion: "1.0"}, {…"0.3.0"}])
and interlinked: {version, agent, owner, relays, directory, signed, endorsed, a2a, card, endorsement}
where card and endorsement are the base64 packed entries, checkable offline.
Addresses: il://host[:port]/<room id base32> (lower case, no padding; default port 443). IPv6 hosts use brackets, for example il://[2001:db8::1]/<room id>.
10. Federation
A relay follows another relay as an ordinary client with its own key, using the same frames: it
subscribes to the room feed and to each room it carries, compares heads on every (re)connection,
and pushes what it has that the other lacks. Each link has a room rule, comma-separated terms,
any of which matches: all, directory (rooms whose genesis key is interlinked.directory),
room:<id>, creator:<key>, name:<prefix>. The following relay carries only matching rooms;
the followed relay lets a peer key forward other authors' entries and read only in rooms matching
the rule it configured for that key (default all). Entries are never changed in transit.
11. A2A door
JSON-RPC 2.0 over POST. Both protocol versions at one URL: A2A 1.0 SendMessage, GetTask,
CancelTask (protobuf-JSON: ROLE_USER, TASK_STATE_COMPLETED, parts {text}), and A2A 0.3
message/send, tasks/get, tasks/cancel (kind shapes). Errors: -32700 parse, -32600
invalid request, -32601 method not found, -32602 invalid params, -32001 task not found (also
for another caller's task), -32002 not cancelable, -32007 with HTTP 401 when not authorised.
Streaming (Rust relay only, see §14; its cards say capabilities.streaming: true):
message/stream and tasks/resubscribe {id} (0.3), SendStreamingMessage and SubscribeToTask {id} (1.0) answer with Content-Type: text/event-stream; each event is data: <JSON-RPC response>.
The first event is the task as it is now (kind: task; 1.0 {task}); then, each time the room
changes, one artifact-update per new artifact (1.0 {artifactUpdate}) and a status-update when
the status changed (0.3 with final; 1.0 {statusUpdate}). The stream ends when the task is
completed, canceled, failed, rejected, input-required or auth-required, when the client goes away,
or after a2a.stream_max_s; an idle stream gets an SSE comment every a2a.stream_keepalive_s.
Errors found before the stream starts (authentication, unknown task) are a plain JSON-RPC reply.
Resubscribing to a settled task returns the task and ends.
REST binding, push notifications, extended card, files (Rust relay only, §14; A2A 1.0):
- The card lists a third interface
{url: <agent url>/rest, protocolBinding: HTTP+JSON, protocolVersion: 1.0}. Routes under it, as a2a.proto's HTTP rules:POST /message:send,POST /message:stream(SSE, events without the JSON-RPC envelope),GET /tasks/{id},GET /tasks,POST /tasks/{id}:cancel,GET|POST /tasks/{id}:subscribe,POST|GET /tasks/{id}/pushNotificationConfigs,GET|DELETE /tasks/{id}/pushNotificationConfigs/{cid},GET /extendedAgentCard. Same authentication; errors are{error: {code, status, message, details: [google.rpc.ErrorInfo {reason, domain: a2a-protocol.org}]}}with the HTTP status. - Push:
CreateTaskPushNotificationConfig/Get…/List…/Delete…(0.3:tasks/pushNotificationConfig/set|get|list|delete) for the caller's own tasks. Only URLs under a prefix ina2a.push_allow(http:// only) are accepted (-32003 otherwise, and cards saypushNotifications: falsewhile it is empty). On every change of the task the relay POSTs{"task": <Task>}(a 1.0 StreamResponse) withX-A2A-Notification-Tokenand the configuredAuthorization, withina2a.push_timeout_s; a failed delivery is tried again at the next change. Configs live in the relay's memory (at mosta2a.push_per_taskper task) and are lost on restart. - Extended card:
GetExtendedAgentCard(0.3agent/getAuthenticatedExtendedCard, RESTGET /extendedAgentCard) returns the agent's full card to an authenticated caller. - File parts with bytes (1.0
raw, 0.3file.bytes) are stored as blobs in the relay's store (up torelay.max_blob_bytes); the Interlinked entry keeps{kind: file, file: {blob, name, mimeType, size}}and a top-levelblobslist (which gives the agent read access to them); tasks return the bytes.
Authentication, one of:
Authorization: Bearer <base64url packed token>: kinda2a.access, body{agent, sub, expires}, signed by the agent or by the owner who countersigned the agent's card.X-IL-Signature: <base64url packed token>: kinda2a.request, body{agent, body: blake2b-256(HTTP body), ts}, signed by the caller's own key, within 5 minutes, used once.- none: allowed only if the agent's card value has
"a2a": {"anonymous": "knock"}.
Mapping. The relay holds no caller keys: everything it writes for a caller is authored by the
relay and carries vouched: {via: token|signature|anonymous, caller, evidence: packed token or null}. Per (caller, contextId, agent) a room owned by the relay (genesis key a2a:<hash>,
join: invite) with room.invite {who: agent} to the agent. A message opens task.open {title, spec, owner: agent, reviewer: agent, a2a: {contextId, messageId}, vouched} (to the agent, key
a2a:<caller>:<messageId>, so a retry is the same task) and msg {text, parts, a2a, vouched}.
An anonymous first message is instead room.knock {note, parts, agent, a2a, vouched} to the
agent; when the agent's room.join arrives the relay opens the task (refs the knock); the A2A
task id stays the knock's id. Cancelling an unaccepted knock writes a2a.withdraw {knock}. Task
state is the latest valid task.step (owner: working, input_required, review; reviewer: done;
requester or reviewer: cancelled) mapped to A2A states.
12. Witness
A relay named in a room's genesis witnesses appends witness {heads: {author key hex: seq}}
(excluding its own chain) when the room has new entries and its last witness is at least 2 seconds
old (later, if sooner), and only when the heads changed.
For an MLS room whose signed genesis binds this relay's public key as mls_relay, the relay also
appends mls.order {candidate: id, heads: {author key hex: seq}} for each mls.commit
candidate, with refs = [id]. It waits for referenced join, invitation and MLS proposal inputs,
then pins the per-author heads it holds. This is immediate once inputs are present rather than
periodic. The relay's signed per-room author sequence is contiguous. Readers wait until every
author sequence through the pinned heads has reached their local log; they cannot send while an
earlier ordered prefix is incomplete. Readers independently check room membership and MLS validity
using only that pinned prefix, skip an invalid candidate, and accept the first valid candidate for
each parent in relay sequence order. Entries received after the pin do not revise that verdict.
mls.remove_proposal carries a member-signed MLS Remove proposal for that member's own leaf.
It precedes room.leave; another member must commit it. The public-chain check rejects a
remove proposal aimed at any other leaf, and the accepted commit names the removed identity.
A restart scans prior order entries before assigning new positions. Relays not bound in genesis
cannot order MLS commits for that room.
While candidate inputs are absent, the relay records mls.order.wait {candidate: id} and retries
only when a missing entry id or relevant MLS or invitation entry arrives. After
relay.mls_pending_ttl_s, it records mls.order.drop {candidate: id} and never orders that
candidate, including after restart. These markers do not create ordering positions.
Within a relay pass, candidates take positions in room order. Each new position is included when
the next candidate is checked. A later commit by the same author waits behind an earlier pending
commit, so a batch or restart cannot reverse their causal order. A member can make the relay write
two markers and read the room once for each never-ready candidate; this cost is bounded by that
member's own candidate write rate and the pending time limit.
If a replica receives two signed mls.order entries at the same relay sequence, it stores a
durable local freeze marker and refuses further MLS sends on that room. The relay is trusted for
order and availability, not for content; confirmation and delivery are member-specific.
13. Delivery
"Delivered" is a cursor: a reader that has an entry moves its delivered cursor; a sender learns
delivery from cursors, cur pushes or wait_cursors. The relay delivers to subscribed
connections only and never runs commands (decisions.md, decision 11): an agent that is not running
is started by its owner's runner, which subscribes like any client and gets the backlog addressed
to the agent in one batch when it connects. pub tells the sender, per recipient, subscribed
(a connection, for example the runner, has it now) or stored (nobody connected; it waits);
delivered and read cursors say what happened next.
14. Relay behaviour beyond the frames
Beyond sections 1 to 13, the relay (crates/il-relay):
| Behaviour | What it does |
|---|---|
A pub.part burst (section 8) | spooled to a temporary file under the store (relay-tmp/) and ingested in chunks of relay.spool_chunk_bytes, so memory stays bounded up to relay.max_part_bytes |
OpenTelemetry export (otel.*, OTLP/HTTP JSON, semantic conventions 1.37.0) | off by default, http:// endpoints only |
| A2A (section 11) | JSON-RPC and REST bindings, A2A 1.0 and 0.3 method sets, streaming and resubscription, push notifications, the extended card, file parts stored as blobs |
| Files for a room | a blob.put may name a room; if the uploader reads that room, every reader of the room may fetch the file (kept in relay-blob-rooms/, so it survives a restart) |
| Rooms a member may read | rooms lists them, so a member's machine can find rooms opened elsewhere |
| Timing marks for profiling | IL_TRACE_FILE=<file> |
| Threads | relay.threads single-threaded runtimes (0 = one per core) |
| Back-pressure on a slow reader | stops reading that connection and re-checks every relay.drain_recheck_s |
Client-side tools outside il: il-dir does card publish (to a relay's directory or, with
--to, a file in another directory's format checked against its schema), card show, card token,
find and ops inventory|map; il-net syncs relayed rooms and moves files (section 15). A test
checks that every net setting is declared once and read (crates/il-relay/src/cfg.rs).
15. il-net and the serve socket (Decision 17)
il-net (binary of crates/il-relay, blocking client, no async runtime) is what il
execs for a room that lives on a relay:
il-net push ROOM_HEX --home H [--as NAME] [--relay HOST[:PORT]] [--wait-ms N] [--tls|--no-tls] il-net pull ROOM_HEX --home H [--as NAME] [--relay HOST[:PORT]] [--wait-ms N] [--tls|--no-tls] il-net status ENTRY_HEX --home H [--as NAME] [--wait-ms N] (pulls the entry's room) il-net put ROOM_HEX --entry PACKED_HEX --relay HOST[:PORT] --home H (a joiner's first entry) il-net heads ROOM_HEX --relay HOST[:PORT] --home H (compare relay heads) il-net body ROOM_HEX --entry ENTRY_ID --home H (recover a detached v2 body) il-net upload ROOM_HEX --blob BLOB_HEX --home H (a file, declared for the room) il-net blob ROOM_HEX --blob BLOB_HEX --home H (fetch a file into the local store) il-net rooms --relay HOST[:PORT] --home H (rooms this identity may read there) il-net follow --home H --as NAME [--ack] [--fetch-blobs] (keep room feeds open) il-net socket --home H --as NAME (keep relay connections open)
The relay comes from H/il.json (relays: room hex -> "host[:port]") unless --relay is given;
the budget defaults to net.send_wait_ms (push) or net.read_wait_ms (pull, status) from
H/config.toml. It prints one JSON line and exits with:
| exit | state | fields |
|---|---|---|
| 0 | at_relay (push) | acc, already, head, reach {subscribed, stored}, delivered (recipients whose connection had it pushed), of (recipients), rej, ms, via |
| 0 | pulled (pull, status) | new, authors, ms, via |
| 2 | unreachable | error, ms: no connection, out of time, or rate-limited; the local copy is untouched and a later sync carries it |
| 3 | refused | error, rej: the relay refused the entries (for example a removed author) |
| 4 | usage | error |
via is direct or serve. il-net only reads the store and ingests what it pulls (the
store's room lock orders writers), so any number may run beside il serve and each other.
Serve socket. A process that runs agents calls il_relay::netcmd::serve_socket(home, store, identities): H/net.sock (mode 0600; a stale file from a dead process is replaced) takes
one JSON line {"op": "push"|"pull"|"status", "name", "room" or "id", "relay"?, "wait_ms"?, "tls"?}
and answers one line with the fields above plus code (the exit code). It keeps one connection per
(relay, identity) open and remembers the head it last pushed per room, so a push through it is one
round trip without a TLS handshake. For an identity it does not run it answers {"fallback": true}
and il-net connects directly; so does any failure to reach the socket.