Expand description
Multi-session wire on one machine (v0.5.16).
Problem: multiple Claude Code (or any agent harness) sessions on the
same machine share a single WIRE_HOME, which means they share the
same DID, same relay slot, same inbox JSONL, and same daemon. Peers
have no way to address a specific session, and the operator can’t
tell which session sent what.
Solution: a wire session subcommand that bootstraps isolated
per-session WIRE_HOME trees. Each session gets its own identity,
handle, relay slot, daemon, and inbox/outbox. Sessions pair with each
other through the public relay (wireup.net) like any other peer —
no protocol changes. The bilateral-pair gate from v0.5.14 still
applies in both directions.
Storage layout:
~/.local/state/wire/sessions/
registry.json — cwd → session_name map
<session-name>/ — full WIRE_HOME tree per session
config/wire/...
state/wire/...Naming: derived from basename(cwd) so re-opening the same project
reuses the same session identity. Collisions across two different
paths with the same basename get a 4-char SHA-256 path-hash suffix.
Structs§
- Federation
Only Session View - Sessions with no Local endpoint — shown separately so the operator knows they exist but are federation-only.
- Local
Endpoint View - Stripped view of a Local endpoint for tooling output. Drops
slot_tokenbecause it is a bearer credential — exposing it throughwire session list-local --jsonwould risk accidental leak via logs, screenshots, or piped output. Routing code uses the fullEndpointfromrelay-state.jsondirectly; this type is for human/JSON observation only. - Local
Session Listing - Result shape for
wire session list-local.localis grouped by the local-relay URL so output can render each cluster of mutually- reachable sister sessions together.federation_onlylists the rest. - Local
Session View - One row of
wire session list-localoutput: a session that has a Local-scope endpoint plus metadata to render it. - Session
Info - Summary of one on-disk session for
wire session list. - Session
Registry
Functions§
- derive_
name_ from_ cwd - Derive a stable session name for the given cwd. Resolution order:
- list_
local_ sessions - Build the listing for
wire session list-localfrom current on-disk state. Read-only; no daemon contact, no relay probe. - list_
sessions - Enumerate every on-disk session by reading
sessions_root(). Cross- references the registry so each entry’scwdis filled in when known. - read_
registry - read_
session_ endpoints - Read a session’s
relay-state.jsonand return itsself.endpoints[]array (v0.5.17 dual-slot). Empty Vec on any read/parse error — this is a best-effort discovery helper, not a verification tool. A pre- v0.5.17 session writes only the legacy flat fields;self_endpointspromotes those to a federation-only Endpoint, so the result is still meaningful for legacy sessions. - registry_
path - Registry tracks
cwd → session_nameso repeatedwire session newfrom the same project reuses the same identity instead of creating a fresh one each time. Lives at<sessions_root>/registry.json. - sanitize_
name - Sanitize an arbitrary string to a session-name-safe form: lowercase
ASCII alphanumeric +
-+_, replace other chars with-, dedupe consecutive dashes, trim leading/trailing dashes, max 32 chars. - session_
dir - Full filesystem path for the named session’s WIRE_HOME root.
Inside this dir the standard wire layout applies:
config/wire/...andstate/wire/.... - sessions_
root - Root directory under which all session WIRE_HOMEs live.
- write_
registry