[FEATURE] Add interrupt/reason context to Notification hook
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
The Notification hook currently fires whenever Claude waits for user input, but doesn't distinguish between:
- Natural pauses (Claude asks a question/needs clarification)
- User interrupts (ESC/Ctrl+C pressed)
- Permission requests
- Normal waiting for next command
This makes it impossible to filter notifications appropriately. Users want to be notified when Claude needs input for a question, but not when they manually interrupted Claude.
Proposed Solution
Add a reason or trigger field to the Notification hook input JSON:
{
"hook_event_name": "Notification",
"reason": "question" | "interrupted" | "permission" | "waiting",
...
}
Values:
"question"- Claude asking for clarification/choice"interrupted"- User pressed ESC/Ctrl+C to interrupt"permission"- Claude waiting for permission approval"waiting"- Normal wait for next user command
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
Users running Claude in containers want audio/desktop notifications when Claude pauses with a question, but NOT when they manually interrupt execution (since they're already at the terminal).
Current workaround: None - users must accept notifications on ALL waits or disable notifications entirely.
Example Hook Configuration
{
"hooks": {
"Notification": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "bash -c 'if [ \"$NOTIFICATION_REASON\" = \"question\" ]; then notify \"needs input\"; fi'"
}
]
}
]
}
}
Additional Context
- Claude Code version: 2.0.28+
- This affects all notification hook use cases where interrupt vs natural pause distinction matters
- Related to existing hook events: Stop, Notification, UserPromptSubmit
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗