claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Add interrupt/reason context to Notification hook

Open jo47011 opened this issue 1 month ago • 2 comments

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

jo47011 avatar Nov 07 '25 14:11 jo47011

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 10 '25 10:12 github-actions[bot]

Yes, still active until someone of your team takes carte of it. It is a useful feature request for all users I suppose.

Maybe you should adjust your revocation cycles to your feature workflow speed 😉

jo47011 avatar Dec 10 '25 10:12 jo47011