Expand description
Live Claude Code peer sessions: registry discovery and message delivery.
Claude Code is the one supported harness whose running interactive
sessions are addressable. Each live process registers
~/.claude/sessions/<pid>.json and binds the Unix socket named in it. The
catalog (crate::catalog) is deliberately about persisted state only, so
nothing there may claim liveness; this module is the separate, explicitly
process-checking half, and its output reaches clients as the
live_endpoint / live_status enrichment on a discovered descriptor.
Two rules earn their place here:
- A registry file is not a live session. These files survive a crash,
so every read re-checks the recorded pid with
kill(pid, 0)and drops the record when the process is gone. - Delivery goes through the COURIER, never the socket. The socket path
is documented, but its wire frame is not, and a foreign process
authenticating to it is not a supported case. Supercode therefore
delivers by spawning a one-shot headless Claude (
claude -p) restricted to the two documented cross-session tools and telling it to relay the text verbatim. If Anthropic ever documents the frame, writing it directly becomes the obvious faster transport and this module is where that would land.
Structs§
- Claude
Peer Delivery - Successful hand-off of one message to a live session.
- Claude
Peer Endpoint - Opaque addressing string published on a discovered descriptor.
- Claude
Peer Refusal Error - A refusal paired with the detail that names it.
- Claude
Peer Session - One live Claude Code session: a registry record whose pid answered
kill(pid, 0)during the read that produced this value. - Courier
Output - What a courier process produced.
- Courier
Plan - Everything one courier invocation needs.
- Process
Courier Runner - Real courier spawner.
Enums§
- Claude
Peer Endpoint Error - Endpoint parse failure.
- Claude
Peer Refusal - Why a message could not be delivered into a live session.
- Claude
Peer Status - Activity a live Claude Code session reports for itself.
Constants§
- CLAUDE_
PEER_ ENDPOINT_ PREFIX - Scheme prefix of the opaque endpoint published for a live Claude peer.
- COURIER_
MODEL - Model the courier runs on. The courier only reads a listing and relays one string, so it takes the cheapest class available.
- COURIER_
TIMEOUT - Wall-clock ceiling for one courier invocation.
Traits§
- Courier
Runner - Spawner seam for the courier process.
Functions§
- courier_
command - Exact program and arguments spawned for one delivery.
- courier_
prompt - Instruction given to the courier. The text is fenced rather than interpolated into prose so a message that itself looks like an instruction cannot be mistaken for one.
- message_
claude_ peer - Resolve
session_idin the registry and delivertextinto it. - read_
registry - Read every LIVE session from a Claude registry directory.
- registry_
dir - Directory holding the live-session registry for the configured Claude home.