`SessionStart` hook fires but its stdout never reaches the model context (2.3.2)
Summary
The hooks docs say for exit code 0: "stdout content (if any) may be appended to context". This works for UserPromptSubmit but not for SessionStart: the hook fires (observable side effects), yet its stdout is invisible to the model — at least in print mode (kimi -p). If SessionStart output is intentionally discarded (the event table lists it as observation-only, without the "appended to context" note that UserPromptSubmit carries), the docs should say so explicitly; as written they suggest it works.
Environment
- kimi 2.3.2 (
/opt/homebrew/bin/kimi, macOS, Apple Silicon)
Repro
~/.kimi-code/config.toml:
[[hooks]]
event = "SessionStart"
command = "sh -c 'echo \"SESSION-INJECT-TOKEN: FALCON-7392-QX\"; date +%s >> /tmp/sessionstart-fired.log'"
timeout = 5
- Run a print session asking for a secret token that appears ONLY in the hook's stdout:
kimi -p "This session's context may contain a line of the form 'SESSION-INJECT-TOKEN: <code>'. If it is present, reply with exactly the code and nothing else. If there is no such line, reply with exactly NO."
Expected (if stdout is appended): the model answers FALCON-7392-QX.
Actual: the model answers NO. /tmp/sessionstart-fired.log contains a fresh timestamp — the hook ran.
Control (UserPromptSubmit works as documented)
The same stdout-injection pattern on UserPromptSubmit DOES reach the model: our session-context injector (an 11-line block with staleness warnings) is visible to the model on the first prompt — verified by the model quoting content that exists only in the hook's stdout and nowhere in the prompt.
So: stdout → context works for UserPromptSubmit, not for SessionStart.
Expected
One of:
SessionStartstdout is appended to context, likeUserPromptSubmit(preferred — enables session-start injection: environment status, staleness warnings, project memory), or- a structured channel (e.g.
hookSpecificOutput.additionalContext) documented for SessionStart, or - explicit docs: "SessionStart output is discarded; use UserPromptSubmit for context injection".
Impact
Session-start context injection — the pattern the exit-code table suggests — silently no-ops. Real-world workaround we shipped: move the injection to UserPromptSubmit with a first-prompt guard file keyed by session_id. Note this loses re-injection on session resume (same session_id), which SessionStart's resume matcher would have covered.
Source: Context OS v6.1 verification, 2026-10-26 (probe sessions 2a89b3aa (false-positive control), 3dc0cae9 (secret-token probe)).