PreToolUse hook `updatedInput` silently ignored for Agent tool

Resolved 💬 6 comments Opened Mar 27, 2026 by KUANKEI21 Closed May 21, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

A PreToolUse command hook that returns updatedInput in hookSpecificOutput works correctly for permissionDecision and additionalContext, but the updatedInput field is silently ignored when tool_name is Agent (the subagent/Task tool).

The hook fires, returns valid JSON with updatedInput containing a modified prompt field, but the subagent receives the original unmodified prompt.

This was tested with:

  • A single command hook (no multi-hook interference per #15897)
  • Single JSON output on stdout
  • permissionDecision: "allow" in the same response (which IS respected)
  • additionalContext in the same response (which IS delivered)

What Should Happen?

updatedInput should modify the Agent tool's input (specifically the prompt field) before the subagent is spawned, consistent with how updatedInput works for other tools.

Actual Behavior

  • permissionDecision — respected (allow/deny works) ✅
  • additionalContext — delivered to Claude as context ✅
  • updatedInputsilently dropped; subagent receives original prompt verbatim ❌

Steps to Reproduce

  1. Create a PreToolUse hook matching the Agent tool:
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Agent",
        "hooks": [
          {
            "type": "command",
            "command": "python3 /path/to/hook.py"
          }
        ]
      }
    ]
  }
}
  1. Hook script returns:
{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "allow",
    "permissionDecisionReason": "Auto-injecting metadata",
    "updatedInput": {
      "prompt": "INJECTED LINE\nOriginal prompt here"
    }
  }
}
  1. Observe that the subagent receives the original prompt, not the modified one.
  2. Note: additionalContext from the same hook response IS delivered correctly.

Claude Code Version

2.1.85+

Platform

macOS (Darwin 25.3.0)

Workaround

Using SubagentStart hook with hookSpecificOutput wrapper to inject additionalContext into the subagent's context. This delivers identity/context information to the subagent, but cannot modify the actual prompt.

{"hookSpecificOutput": {"hookEventName": "SubagentStart", "additionalContext": "..."}}

Note: plain {"additionalContext": "..."} without the hookSpecificOutput wrapper is also silently ignored for SubagentStart hooks.

Related Issues

  • #30770 — updatedInput replace vs merge (different bug, same field)
  • #32348 — updatedInput ignored in -p mode (similar symptom, different context)
  • #15897 — updatedInput doesn't work with multiple PreToolUse hooks (related)
  • #33125 — Agent/prompt hooks don't block PreToolUse (related hooks+agents gap)

View original on GitHub ↗

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