Expand description
Live Claude Code peer sessions: registry discovery and inbound policy.
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 (supercode_interchange::catalog) is deliberately about persisted state only, so
nothing there may claim liveness; this module is the separate, explicitly
process-checking half; it feeds session activity and the mail router’s
native door, which reach clients as a discovered descriptor’s activity
and delivery.
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. - Nothing here writes 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. Messages reach a live session through a Claude relay
(
crate::claude_relay), a headless Claude that sends with Claude’s ownSendMessage.
Structs§
- 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. - Claude
Peer Settings - The user-settings portion Supercode can inspect without pretending to know a target process’s complete managed/project/CLI precedence stack.
Enums§
- Claude
Cross Session Inbound - User-level policy Claude Code applies to messages from other sessions.
- Claude
Peer Refusal - Why a message could not be delivered into a live session.
- Claude
Peer Settings Error - Failure to read or safely update Claude Code’s user settings.
- Claude
Peer Status - Activity a live Claude Code session reports for itself.
Functions§
- read_
claude_ peer_ settings - Inspect only the user-level inbound setting. The report deliberately does not claim to be Claude’s effective value because managed, project, and command-line settings can have higher precedence in a particular target.
- read_
registry - Read every LIVE session from a Claude registry directory.
- registry_
dir - Directory holding the live-session registry for the configured Claude home.
- resolve_
live_ session - Resolve
session_idto the live Claude session running it. - update_
claude_ peer_ settings - Set or reset Claude Code’s user-level inbound policy.
expected_revisionprevents an explicit UI action from overwriting settings inspected before another process changed the file. - user_
settings_ path - Claude Code’s user settings file for the configured Claude home.
- write_
claude_ peer_ settings - Explicitly update Claude Code’s user-level inbound policy while preserving every unrelated setting. The write is atomic, refuses symlinks, and aborts when it observes an edit between its initial read and commit.