@@ -654,6 +654,54 @@ PostToolUse:
654654 reason: "Sensitive file modified - verify .gitignore configuration"
655655` ` `
656656
657+ # ## Notification JSON Output
658+
659+ Notification hooks support JSON output format for Claude Code integration. Actions can return structured output :
660+
661+ **Output Action** (type: `output`):
662+ ` ` ` yaml
663+ Notification:
664+ - actions:
665+ - type: output
666+ message: "Notification message"
667+ continue: true # optional, defaults to true
668+ ` ` `
669+
670+ **Command Action** (type: `command`):
671+ Commands must output JSON with the following structure :
672+ ` ` ` json
673+ {
674+ "continue": true,
675+ "hookSpecificOutput": {
676+ "hookEventName": "Notification",
677+ "additionalContext": "Message to display"
678+ },
679+ "systemMessage": "Optional system message"
680+ }
681+ ` ` `
682+
683+ **Field Merging**:
684+ When multiple actions execute :
685+ - `continue` : Always forced to `true` (Notification cannot block - official spec "Can block? = No")
686+ - `hookEventName` : Set once by first action
687+ - `additionalContext` and `systemMessage` : Concatenated with newline separator
688+
689+ **Exit Code Behavior**:
690+ Notification hooks **always exit with code 0**. The `continue` field is always `true` and cannot be changed :
691+ - Notification hooks cannot block Claude execution
692+ - All errors are logged to stderr as warnings
693+ - Errors are added to `systemMessage` for graceful degradation
694+
695+ **Example**:
696+ ` ` ` yaml
697+ Notification:
698+ - actions:
699+ - type: output
700+ message: "Task completed successfully"
701+ - type: command
702+ command: "get-task-status.sh" # Returns JSON with additionalContext
703+ ` ` `
704+
657705# # Common Workflows
658706
659707# ## Adding a New Hook Type
0 commit comments