Expand description
Claude relays: the degraded tier’s door into a Claude Code session that supercode does not control.
A Claude session answers a message by copying its from into
SendMessage. For that answer to come back, the message must come FROM a
live Claude peer. A relay is that peer: a Claude Code runtime that
supercode hosts like any other (runtimes.start in the machine daemon’s
harness serve, registered in the live-runtime registry), named
sc-<name>-on-<machine>, sending on one session’s behalf. Nothing here
runs its own process supervisor or writes Claude’s private socket frame.
Three rules earn their place here:
- No model runs. A relay’s API is supercode’s own deterministic
endpoint (
crate::relay_endpoint), which answers a send turn with aSendMessageof the queued pair. Every send is queued first, and a PreToolUse hook (supercode message gate) still denies any tool call but aSendMessageof exactly that pair. - Receipts come from Claude, through hooks. A PostToolUse hook writes
Claude’s own
SendMessageresult beside the queue; a denied call and a turn that ends without sending write theirs too. The sender waits on that file, not on the model’s words. - Inbound mail never reaches the model. Claude hands every inbound
peer envelope and idle or delivery notice to the relay’s
UserPromptSubmithook byte-exact; the hook files it in the represented session’s mailbox and blocks the prompt, so no model turn runs for it (measured:duration_api_ms: 0).
A relay’s busy/idle is its own; its name carries the sc- prefix and
every turn ends with RELAY_STATUS_LINE.
Structs§
- Native
Envelope - A native peer envelope as Claude delivered it to a relay.
- Queued
Send - The one send a relay is allowed to make next.
- Relay
Paths - Files of one relay, all in its own directory (also its working directory, which holds no project settings).
- Relay
Spec - Everything needed to start one relay.
Enums§
- Relay
Event - One inbound prompt, as Claude handed it to a relay’s hook.
- Relay
Receipt - Outcome of one relayed send, as the sender reads it.
Constants§
- RELAY_
MODEL - Model name a relay’s requests carry. The relay endpoint answers them without any model.
- RELAY_
NAME_ PREFIX - Prefix marking a registry name as a relay rather than a session.
- RELAY_
STATUS_ LINE - Text every relay turn ends with. Claude quotes a session’s last line in its idle notices, so this is where the correction reaches the agent.
- SEND_
TIMEOUT - How long a send waits for Claude’s own receipt.
Functions§
- ensure_
machine_ daemon - Start this OS user’s machine daemon when it is not answering. It hosts
relays (in its
harness serve) and the idle watcher. - file_
inbound_ prompt - File one inbound prompt in
represented’s mailbox.last_sentmaps a Claude session name to the newest message this relay sent it, for - gate_
decision - Decide one PreToolUse hook call.
Noneallows it;Some(reason)denies. - gate_
denial - The hook’s JSON answer for a denial.
- inbound_
block - The UserPromptSubmit answer that keeps a prompt from the model.
- is_
inbound_ prompt - Whether a prompt Claude handed the relay is inbound mail (a peer envelope or a notice) rather than its host’s own send turn.
- machine_
rpc - One
harness.v1call into this machine’s daemon (supercode teams rpc), starting the daemon when it is not running. - parse_
inbound_ text - Recognize an inbound peer envelope or notice in the text Claude handed a relay.
- read_
receipt - Read a receipt the relay’s hooks wrote: Claude’s own
SendMessageresult, a gate denial, or a turn that ended without sending. - relay_
arguments - Arguments of the Claude Code runtime a relay runs as.
- relay_
environment - Environment of a relay: its API is the relay endpoint at
endpoint, and its API key names its directory there. The key also keeps account connectors (MCP servers) out of the relay. - relay_
name - Registry name of the relay that represents
nameonmachine. - relay_
settings - Settings document installing a relay’s hooks.
- resolve_
native_ sender - The live Claude session behind a native
uds:sender address. - send_
through_ relay - Send
messageto the Claude session namedto, fromsenderthrough its relay: start the relay as a hosted runtime when it is not running, queue the send, hand it the send turn through the runtime’s own door, and wait for Claude’s receipt. - send_
turn - The host turn asking a relay to make one send.
- supercode_
program - The
supercodeprogram that the relay hooks and the machine daemon run: this process when it issupercode(the CLI,supercode harness serve),