PostToolUse hook does not fire for Agent tool completions

Resolved 💬 3 comments Opened Jun 3, 2026 by mrlesmithjr Closed Jul 8, 2026

Summary

The PostToolUse hook with matcher * does not fire when the Agent tool completes. Every other tool (Bash, Read, Edit, Grep, etc.) correctly triggers the hook; Agent is the only exception observed.

Environment

  • Claude Code version: current (confirmed via /version)
  • Hook configuration: PostToolUse with matcher: "*", 5s timeout
  • Mode: remote (hook makes HTTP POST to localhost:4000)
  • macOS, launchd-managed MCP/HTTP server

Reproduction

Given this hooks.json:

{
  "PostToolUse": [
    {
      "matcher": "*",
      "hooks": [
        {
          "type": "command",
          "command": "node /path/to/capture-tool.js",
          "timeout": 5
        }
      ]
    }
  ]
}
  1. The hook fires correctly for every tool use (Bash, Read, Edit, Write, Grep, Glob, MCP tools, etc.)
  2. Invoke the Agent tool (with or without subagent_type)
  3. Hook does not fire — no process is spawned, no stdin is provided to the hook command

Evidence

The hook itself is correct. Piping a simulated Agent PostToolUse event manually produces the expected result:

echo '{"session_id":"...","cwd":"/path/to/project","tool_name":"Agent","tool_input":{"prompt":"test","subagent_type":"code-reviewer"},"tool_response":"result"}' \
  | node capture-tool.js
# → {"status":"captured"}

During a live Agent invocation, an HTTP server (localhost:4000) that receives all other PostToolUse events receives zero requests. Server access log and error log are both silent for the duration of the Agent call and afterward.

Spawning multiple Agent invocations (6+ test calls) across two Claude Code sessions produced zero PostToolUse hook events. All other tools in the same sessions produced hook events correctly.

Impact

Any plugin that relies on PostToolUse to observe Agent tool usage cannot do so. Specifically:

  • Agent invocation counts cannot be tracked
  • Skill/agent attribution cannot be captured per-session
  • Agent output cannot be processed post-completion

Expected Behavior

PostToolUse with matcher: "*" should fire after every tool completes, including Agent. The hook should receive a JSON payload on stdin with tool_name: "Agent", tool_input (containing prompt, description, subagent_type), and tool_response (the agent's final text output).

Notes

Historical captures of Agent tool observations exist in our database from April-May 2026, suggesting this may be a regression in a recent Claude Code version, or that PostToolUse for Agent was supported previously and behavior changed. The exact version where this stopped working is unknown.

View original on GitHub ↗

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