Expand description
sessionstart subcommand — registered as Claude Code’s SessionStart
hook, once per part (--part 1 … --part 8). Delivers the agent’s memory
(docs/specs/SPEC_GLOBAL_MEMORY_DELIVERY_2026_09_27.md §7 P2).
A SessionStart hook’s additionalContext reaches the model without a
visible turn, but only up to about 10,000 characters per hook command (the
CLI swaps anything longer for a file preview). So the sidecar splits the
memory into labelled parts, and each hook command asks for its own:
- read the hook’s stdin (
session_id,source); POST /api/v1/agent/memory/session-start/partfor part N — the sidecar decides whether this source gets a delivery at all (resumeandforkdon’t) and how many parts there are;- print
{"hookSpecificOutput":{"hookEventName":"SessionStart", "additionalContext":…}}and flush it; POST …/session-start/ack, so the sidecar knows this part reached the CLI. Once every part is acknowledged the pane gets its notice.
Every failure (no env, sidecar down, no part for this number) degrades to exit 0 with nothing printed: a hook must never block or break a session start, and an empty stdout is a hook with nothing to add.
Structs§
- Args
- CLI args for
sessionstart. - Part
Request 🔒 - Session
Start 🔒Input - The fields of the
SessionStartstdin payload this hook uses.
Constants§
- ACK_
PATH 🔒 - ACK_
TIMEOUT 🔒 - PART_
PATH 🔒 - PART_
TIMEOUT 🔒 - The CLI waits for every
SessionStarthook before the session starts, so a slow or wedged sidecar must not hold it up for long. Composing reads a handful of small files on the same host.
Functions§
- hook_
output 🔒 - The hook’s stdout for a part: the shape Claude Code reads a
SessionStarthook’s added context from. - run
- Entry point. Always
Ok(()): see the module doc.