Description
When using hooks to play notification sounds, the Notification hook (with idle_prompt matcher) has a noticeable delay compared to the Stop hook, even though both use the same command.
Steps to Reproduce
- Configure both hooks in
~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "afplay -v 0.5 ~/.claude/bubble.aiff &",
"async": true
}
]
}
],
"Notification": [
{
"matcher": "idle_prompt|permission_prompt",
"hooks": [
{
"type": "command",
"command": "afplay -v 0.5 ~/.claude/bubble.aiff &",
"async": true
}
]
}
]
}
}
- Run Claude Code and perform a task that completes → Sound plays immediately
- Ask Claude something that triggers a question back (e.g., using
AskUserQuestion) → Sound plays with noticeable delay
Expected Behavior
Both hooks should trigger at approximately the same speed since they use the same async command.
Actual Behavior
Stop hook: Sound plays immediately when task completes
Notification hook: Sound plays with a noticeable delay (feels like ~1-2 seconds) when Claude asks a question
Environment
Additional Context
The delay seems to be in when the Notification event is fired internally, not in the sound playback itself (same file, same command, different timing).
Description
When using hooks to play notification sounds, the
Notificationhook (withidle_promptmatcher) has a noticeable delay compared to theStophook, even though both use the same command.Steps to Reproduce
~/.claude/settings.json:{ "hooks": { "Stop": [ { "hooks": [ { "type": "command", "command": "afplay -v 0.5 ~/.claude/bubble.aiff &", "async": true } ] } ], "Notification": [ { "matcher": "idle_prompt|permission_prompt", "hooks": [ { "type": "command", "command": "afplay -v 0.5 ~/.claude/bubble.aiff &", "async": true } ] } ] } }AskUserQuestion) → Sound plays with noticeable delayExpected Behavior
Both hooks should trigger at approximately the same speed since they use the same async command.
Actual Behavior
Stophook: Sound plays immediately when task completesNotificationhook: Sound plays with a noticeable delay (feels like ~1-2 seconds) when Claude asks a questionEnvironment
Additional Context
The delay seems to be in when the
Notificationevent is fired internally, not in the sound playback itself (same file, same command, different timing).