High latency in hook invocation for Notification events
Status Open
Maintainer reply None cached
Activity 4 comments · opened Jan 21, 2026
Description
There is significant latency (seconds) between when a permission prompt or idle prompt event occurs and when the associated Notification hook is actually invoked.
Reproduction
- Configure a Notification hook in settings.json:
{
"hooks": {
"Notification": [
{
"matcher": "permission_prompt",
"hooks": [
{
"type": "command",
"command": "~/bin-personal/claude-notify.sh"
}
]
}
]
}
}
- Trigger a permission prompt (e.g., run a Bash command)
- Observe multi-second delay before the hook script executes
Debugging performed
We isolated the latency to Claude Code's hook invocation, not the notification delivery chain:
| Component | Latency |
|-----------|---------|
| Hook script execution | ~15-27ms |
| Tmux passthrough | ~1ms |
| Direct OSC 99 notification | Instant |
| Claude Code hook invocation | Seconds |
When sending notifications directly via printf to the TTY, they appear instantly. The same scripts called via Claude Code hooks have multi-second delays.
Expected behavior
Hooks should be invoked with minimal latency (<100ms) after the triggering event occurs.
Environment
- macOS (Darwin 24.6.0)
- Running inside tmux
- Kitty terminal with OSC 99 notifications
4 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I'm seeing this also. I've been using hooks to keep track of my running sessions, but very recently (since around 2.1.7) their reliability took a huge hit.
I got into the same issue. Any notification ~20-45s delay until it fires. I tried to set the hook for permission_prompt or elicitation_dialog, but it doesn't change anything.
Hope to see a fix soon. I am on v2.1.50
*edit: I used the notification hook for a day now and mentioned that on projects where Claude CLI was called from project_root instead of ~ the delay was around ~2-8s. Loving that I can work without waiting much for the hook but it's still a very strange behavior.
Environment:
Additional datapoint: PermissionRequest and Stop hooks fire almost immediately, while Notification does not.
For the same
Writepermission event, with the permission dialog already visible in the TUI:So the delay is not in the shell script or notification daemon. The
PermissionRequesthook fires immediately, but theNotificationhook for the same permission prompt runs several seconds later.My hypothesis is that PreToolUse, PermissionRequest, and Stop are executed synchronously in the agent loop, while Notification is handled through a deferred or queued path.
That would also fit the other observations in this thread, such as the
idle_prompttimer behavior, delays scaling withcwd, and the Windows duplicate-notification issue.