Feature Request: Add PermissionRequest Hook for Notifications
Feature Request: Add PermissionRequest Hook for Notifications
Summary
Request to add a new hook event type PermissionRequest that triggers when Claude Code displays a permission dialog to the user.
Use Case
I want to receive desktop notifications with sound when Claude Code displays a permission dialog (the prompt asking "yes/no" for file read/write or command execution). Currently, there's no way to detect when these dialogs appear.
Current Workaround
The Stop hook triggers after the user responds to the permission dialog, but not when the dialog first appears. This means:
- ✅ User gets notified after responding to the dialog
- ❌ User doesn't get notified when the dialog first appears (when they need to take action)
Proposed Solution
Add a new hook event type: PermissionRequest
Example Configuration
{
"hooks": {
"PermissionRequest": [
{
"hooks": [
{
"type": "command",
"command": "/path/to/notify.sh 'Claude Code' 'Permission needed' 'Purr'"
}
]
}
]
}
}
Optional Enhancement: Matcher Support
It would be even better if the hook could include matcher support to filter by permission type:
{
"hooks": {
"PermissionRequest": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "/path/to/notify.sh 'Claude Code' 'Command permission needed' 'Purr'"
}
]
},
{
"matcher": "Read",
"hooks": [
{
"type": "command",
"command": "/path/to/notify.sh 'Claude Code' 'File read permission needed' 'Tink'"
}
]
}
]
}
}
Benefits
- Better UX for background work: Users can work on other tasks and get notified immediately when Claude Code needs their permission
- Consistency with existing hooks: Follows the same pattern as
PreToolUse,PostToolUse, andStop - Accessibility: Helps users who rely on audio cues or work with multiple windows/screens
Current Hook System
For reference, here are the currently available hooks:
PreToolUse- Before tool executionPostToolUse- After tool executionStop- When AI stops (waiting for input, after permission response)SessionEnd- When session endsUserPromptSubmit- When user submits a prompt
The PermissionRequest hook would fill the gap between when a permission dialog appears and when the user responds to it.
Environment
- Claude Code version: [Latest as of January 2025]
- IDE: Cursor (VS Code-based)
- OS: macOS
Thank you for considering this feature request!
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗