Skip to main content

Module cli_native

Module cli_native 

Source
Expand description

Messages agents send each other through the Claude CLI’s own messaging (its SendMessage tool between sessions), seen from both ends and written to the audit log next to the jekts.

The receiving CLI starts a turn on its own and writes nothing about the message to the stream srv reads, unless it is launched with --replay-user-messages. With it, the message arrives as a user frame carrying origin.kind == "peer", and the same flag replays every user turn srv writes, as isReplay frames the pane already records itself. reader::CliNativeReader therefore takes those two kinds of frame out of the stream the pane sees, and audits the peer ones. The CLI’s own isReplay frames (a local command’s output) are none of those and stay (sent).

Who sent a message is decided here, from the process id the CLI verified for the sender’s connection (sender), never from the name the message gives.

Modules§

frame
The stream-json frames that carry a CLI-native message, read as typed values. The shapes are the pinned CLI’s (providers/claude.rs pinned_version); tests holds frames captured from it.
live
Env for the running srv: the pid table, the process table, the agent registry and the audit log.
pids
The CLI process srv runs for each agent pane, by block: what a sender’s process id is walked up to (super::sender).
reader
One agent pane’s view of CLI-native messages: watches the frames its CLI writes, audits each message from whichever end this pane is, and says which frames the pane’s transcript must not carry.
sender
Who sent a CLI-native message, from the process id the CLI verified for the sender’s connection to the receiving session’s socket (SO_PEERCRED, in the frame’s origin.verifiedPeerPid).
sent
The user turns srv writes to a CLI’s stdin, by uuid.