High latency in hook invocation for Notification events

Open 💬 4 comments Opened Jan 21, 2026 by edvintb

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

  1. Configure a Notification hook in settings.json:
{
  "hooks": {
    "Notification": [
      {
        "matcher": "permission_prompt",
        "hooks": [
          {
            "type": "command",
            "command": "~/bin-personal/claude-notify.sh"
          }
        ]
      }
    ]
  }
}
  1. Trigger a permission prompt (e.g., run a Bash command)
  2. 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

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗