Hook JSON with top-level additionalContext is silently dropped (no warning), context never reaches the model
Environment
- Claude Code 2.1.274, macOS
Bug
A hook that prints {"additionalContext": "..."} at the top level (not inside hookSpecificOutput) exits 0, is logged as success, and its context never reaches the model. No warning appears in the transcript or the debug log.
Repro
UserPromptSubmit hook via --settings:
- A:
echo '{"additionalContext":"The secret codeword is FALCON."}' - B:
echo '{"hookSpecificOutput":{"hookEventName":"UserPromptSubmit","additionalContext":"The secret codeword is OSPREY."}}'
Ask "Is there a secret codeword in your context? Reply with only the word, or NONE."
- A returns
NONE - B returns
OSPREY
Real-world impact
A third-party memory tool emitted the top-level shape for weeks. Every hook run showed as success, so nothing looked wrong, while none of its injected context ever reached the model. It was found only by grepping transcripts for hook_additional_context attachments.
Expected
When hook JSON output contains a recognized field in the wrong place (top-level additionalContext), log a warning such as "additionalContext must be inside hookSpecificOutput; ignored", or accept it.