[BUG] SessionStart hook stdout is silently dropped when source=clear
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
This problem has appeared while trying to create a hook for /clear that will list the latest projects being worked on (just modification timestamp of some folders). The hook works perfectly on new session, can't work on /clear due to TTY limitations: the list of projects is passed to the model as context but can't be written to the terminal. I was trying to work around it by giving the model a prompt to output that project list it already has in the context, but it doesn't work until a first promt is made on the new post-/clear session. Hook debug log attached
- Evidence: Hook fires (confirmed via debug log), produces stdout, but Claude Code shows "(no content)" — the output is neither shown to the user nor added as model context
- Expected: stdout should be added as model context, matching startup and resume behavior
- Workaround: None currently — /dev/tty doesn't work post-TUI, and stdout is dropped
What Should Happen?
Model should follow the prompt
Error Messages/Logs
Steps to Reproduce
Attaching hook invoked by this config
"outputStyle": "Explanatory",
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/scripts/recent-projects.sh"
}
]
}
]
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.41 (Claude Code)
Platform
Google Vertex AI
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗