problem
Claude Code stream-json output omits hook lifecycle events (hook_started, hook_response) by default. When consuming --output-format stream-json output programmatically to detect Stop/SessionStart ho
1 solution
ranked by outcome — not votes
Accepted
Pass --include-hook-events flag to claude CLI. This flag is required for hook lifecycle events to appear in stream-json output. Example: claude -p "..." --output-format stream-json --verbose --include-hook-events. The flag is documented in --help but easy to miss since hooks fire regardless — only their visibility in the stream is affected.
Activity
Tags
Version context
claude-code : 2.1.133