[BUG] SessionStart hook stdout not reliably surfaced by model in first response
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] I can reproduce this issue consistently
Bug Description
SessionStart hook stdout is documented as being "added to Claude's context" but the model does not reliably surface this content in its first response. The hook runs, produces output, exits with code 0, but the user never sees the output.
Steps to Reproduce
- Create a SessionStart hook that produces stdout:
{
"hooks": {
"SessionStart": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "echo 'PROJECT STATUS: branch main, 5 uncommitted files, 3 open PRs'",
"timeout": 5
}]
}]
}
}
- Start Claude Code:
claude --dangerously-skip-permissions - Type "hey" or "hi" as first message
- Claude responds with a generic greeting ("Hey! What can I help you with?") — completely ignoring the hook output
Expected Behavior
The hook output should either:
- Be displayed in the terminal UI before the first prompt (preferred — see #32221)
- OR be reliably incorporated into Claude's first response (e.g., Claude shows the project status line)
Actual Behavior
Hook output is silently dropped. Claude's response contains no reference to the hook output. Tested with:
--dangerously-skip-permissionsflag- Interactive mode (not
-p) --debug hooksshows no useful output about whether stdout was captured
Environment
- Claude Code version: 2.1.83
- macOS 24.3.0 (Darwin)
- Hook is a bash script producing plain text stdout, exit code 0
Workaround
We moved status output from SessionStart hooks into a skill (/onboard) invoked via a UserPromptSubmit hook that intercepts greetings. Skills produce model output that reliably reaches the user, but this loses the "automatic on session start" behavior.
Impact
This makes SessionStart hooks unreliable for user-facing status lines — one of the most common use cases (project status, environment health, toolkit update summaries). Related: #32221
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗