Skip to content

cn alerts doesn't model new Claude Code hook events (SubagentStop, TeammateIdle, TaskCompleted) — noisy under agent teams #46

@durandom

Description

@durandom

Problem

cn alerts controls only the Notification hook's matcher string (idle_prompt|permission_prompt|auth_success|elicitation_dialog). It does not register or expose the newer hook events Claude Code now emits, which became significant once teammateMode: auto and subagent-heavy workflows landed.

Result: with the default idle_prompt|permission_prompt matcher and teammateMode: auto + CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, users get a notable jump in chimes — each subagent's tool call can surface a permission prompt that fires the Notification hook. The per-subtype rate limit (last_notification_${tool}_${project}_${subtype}) doesn't dampen this because permission prompts share their own bucket and arrive in bursts.

Hook events Claude Code emits that cn doesn't currently model

Per https://code.claude.com/docs/en/hooks:

Event Currently in cn?
Stop (main session only) yes (hardcoded, empty matcher, 10s rate-limit)
Notification subtypes yes via cn alerts
SubagentStop no
SubagentStart no
TeammateIdle (agent teams) no
TaskCreated / TaskCompleted no

CHANGELOG line 83 (Fixed agent-type hooks failing with "Messages are required for agent hooks" when configured for events other than Stop or SubagentStop) confirms Stop and SubagentStop are distinct events that need separate registration.

Proposed asks (in order of value)

  1. Extend cn alerts to opt-in/out of additional eventsSubagentStop, TeammateIdle, TaskCompleted as toggleable, same UX as today's idle_prompt/permission_prompt.
  2. Document agent-teams interaction in README — call out that the default matcher includes permission_prompt and that this gets noisier under teammateMode: auto. Suggest cn alerts remove permission_prompt for users who only want idle-pings.
  3. (optional) Global cross-subtype rate limit via env var (e.g. CODE_NOTIFY_GLOBAL_MIN_INTERVAL_SECONDS) so a permission-prompt burst is dampened even when subtypes differ.

Repro

# In ~/.claude/settings.json:
"teammateMode": "auto",
"env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" }

cn on   # default matcher: idle_prompt|permission_prompt
# Run any task that spawns multiple subagents → multiple permission_prompt chimes per turn

Workaround

cn alerts remove permission_prompt && cn on — leaves only idle_prompt. Works but loses permission visibility entirely; finer-grained per-event controls would be better.

Environment

  • code-notify 1.7.3 (Homebrew)
  • Claude Code 2.1.119
  • macOS (Darwin 25.4.0)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions