Feature Request: Hook event for actual task completion (not every response)
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:
- After "Agents launched, waiting..." (intermediate)
- After "1/3 done, waiting..." (intermediate)
- After "2/3 done, waiting..." (intermediate)
- 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)
- Add
is_final_responseoris_waiting_for_inputboolean to the Stop hook JSON input —truewhen Claude has nothing more to do and is waiting for user input,falsewhen more processing is expected
- Add a new
TaskCompleteevent that fires only once when the entire agentic loop is truly finished (all sub-agents done, final response delivered)
- Add a
pending_subagentscount 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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗