The daemon protocol is defined in packages/coding-agent/src/modes/daemon/daemon-protocol.ts and uses JSONL transport over a local socket — it is the transport used by DaemonAgentConnection today, explicitly described as not the final remote gateway protocol.[1] The protocol name is "prime-agent.daemon" (constant DAEMON_PROTOCOL_NAME) and the current protocol version is 7 (constant DAEMON_PROTOCOL_VERSION).[1] Schema revision 16 — identified as "protocol-7-schema-16-1bcb9e7f1a49" and exported as DAEMON_SCHEMA_REVISION / DAEMON_SCHEMA_ID — adds the "stopping" workerState and stops reporting disconnected workers as "ready".[1] The minimum protocol version for the command envelope format is 7, exported as DAEMON_COMMAND_ENVELOPE_MIN_PROTOCOL_VERSION.[1] The RLM ledger loader in rlm-ledger.ts and daemon-mode.ts uses a unified parser that handles both legacy and current registry formats consistently, replacing two previously divergent parsing branches. Engineers extending the RLM ledger schema in rlm-ledger.ts or daemon-mode.ts must update the unified parser; adding a parallel parsing branch re-introduces divergence between legacy and current format handling.
DAEMON_SUPPORTED_CLIENT_CAPABILITIES lists all capabilities a client may declare: "attach_snapshot", "event_sequence", "extension_ui", "slim_attach", "chunked_snapshot", and "client_owned_sessions".[1] DAEMON_DEFAULT_CLIENT_CAPABILITIES includes only "attach_snapshot" and "event_sequence"; extended capabilities such as "slim_attach" and "chunked_snapshot" must be explicitly declared by the client.[1] DAEMON_DEFAULT_SERVER_CAPABILITIES includes all supported client capabilities plus "delete_rlm_subagent", "heartbeat_catalog", "heartbeat_management", "model_catalog", "side_question_transcript", "transient_bash", "session_input_admission", "prompt_admission_cancellation", and "queue_message_mutation".[1] Clients must verify the "transient_bash" server capability before sending execute_bash commands with the transient or runId fields; bash_start/bash_end events carry these markers so clients can correlate runs by identity.[1] The "side_question_transcript" server capability signals that the daemon honors previousTurns on start_side_question for multi-turn side conversations; clients must check for this capability before sending follow-up transcripts.[1]
Clients using the "slim_attach" capability receive a DaemonAttachResult where the top-level state and messages fields are omitted; they must read from snapshot.summary and snapshot.messages instead.[1] DaemonAttachClientMetadata supports a telemetryDisabled opt-out flag; per the opt-out-only policy, a telemetry-enabled worker must reject an attach that carries this flag.[1] DaemonSessionLifecycle is either "resident" (daemon-owned) or "client_owned", distinguishing who controls the session lifetime.[1]
Client env vars are forwarded to the daemon on create only — not on attach — because attaching must not rebind a session's identity, since watchers such as the agents view and subagent viewers may also attach. This is enforced by the DaemonClientEnv contract.[1] The allowlisted client env vars that may be forwarded over the daemon socket are HERDR_ENV, HERDR_PANE_ID, HERDR_SOCKET_PATH, HERDR_TAB_ID, and HERDR_WORKSPACE_ID, defined as DAEMON_CLIENT_ENV_KEYS; both client and server filter against this list.[1] collectDaemonClientEnv reads from process.env by default and returns undefined — not an empty object — when none of the allowlisted keys are present.[1] collectDaemonLaunchEnv forwards the entire process.env except keys prefixed with "PRIME_AGENT_INTERNAL_".[1]
The DaemonUpdateRestartManifest format version is 1 (exported as DAEMON_UPDATE_RESTART_FORMAT_VERSION); the manifest carries per-session state for graceful update-restart, including queued actions, streaming state, compaction state, and bash state.[1] DaemonUpdateRestartSession captures per-session restart state via the flags wasStreaming, wasCompacting, wasBashRunning, and hadRunningRlmChildren, so the new daemon process can accurately resume interrupted work.[1]
The schema revision changelog tracks: revision 9 publishes persisted RLM spawn depth on passive session rows; revision 10 extends this to all session catalog rows; revision 11 adds immediate get/set commands for active-session RLM max depth; revision 12 adds idle-residency metadata on session summary rows; revision 13 narrows agent-origin reach and roster wire shapes to the nuclear family; revision 14 carries the client's monotonic telemetry opt-out on attach and reattach; revision 15 adds mutate_queued_message and the queue_message_mutation capability.[1]
Sources