Feature Request: Hook event for actual task completion (not every response)

Resolved 💬 3 comments Opened Apr 4, 2026 by kevinzhenyuhu Closed Apr 8, 2026

Problem

The Stop hook fires after every Claude response, not just when the overall task is complete. This makes it impossible to implement reliable "task completion" notifications for multi-agent workflows.

Current behavior

When running a multi-agent task (e.g., 3 parallel sub-agents via the Agent tool), the Stop hook fires:

  1. After "Agents launched, waiting..." (intermediate)
  2. After "1/3 done, waiting..." (intermediate)
  3. After "2/3 done, waiting..." (intermediate)
  4. After the final summary (actual completion)

All 4 fires look identical — there is no field in the Stop hook JSON input that distinguishes "task complete, waiting for user input" from "intermediate response, more work coming."

What I tried

| Approach | Result |
|----------|--------|
| SubagentStart/SubagentStop counter | Works for the agent-running phase, but post-completion intermediate responses still trigger false notifications |
| Debounce (8s / 25s / 45s delay) | Either too short (misses edge cases) or too long (unacceptable delay). No single value works for all agent durations |
| Notification event | Fires unreliably — sometimes not at all |
| stop_hook_active field | Only prevents infinite loops in blocking Stop hooks, not relevant to this use case |
| Manual marker file via CLAUDE.md instruction | Works in the current session but unreliable across new sessions |

Expected behavior

A way to distinguish the final response (Claude is done and waiting for user input) from intermediate responses (Claude responded but will continue after receiving more agent results).

Proposed solutions (any of these would work)

  1. Add is_final_response or is_waiting_for_input boolean to the Stop hook JSON input — true when Claude has nothing more to do and is waiting for user input, false when more processing is expected
  1. Add a new TaskComplete event that fires only once when the entire agentic loop is truly finished (all sub-agents done, final response delivered)
  1. Add a pending_subagents count to the Stop hook JSON input so hook scripts can check if agents are still running

Environment

  • Claude Code version: latest (2.1.92)
  • OS: Windows 11
  • Model: Claude Opus 4.6

Use case

Desktop/sound notifications when long-running tasks complete. Users walk away during multi-agent tasks and want exactly one notification when everything is done — not one per intermediate response.

This is a common need based on GitHub discussions (#18544, #29928) and community blog posts about Claude Code notifications.

View original on GitHub ↗

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