PreToolUse hook `updatedInput` silently ignored for Agent tool
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)additionalContextin 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 ✅updatedInput— silently dropped; subagent receives original prompt verbatim ❌
Steps to Reproduce
- Create a PreToolUse hook matching the Agent tool:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Agent",
"hooks": [
{
"type": "command",
"command": "python3 /path/to/hook.py"
}
]
}
]
}
}
- Hook script returns:
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "allow",
"permissionDecisionReason": "Auto-injecting metadata",
"updatedInput": {
"prompt": "INJECTED LINE\nOriginal prompt here"
}
}
}
- Observe that the subagent receives the original prompt, not the modified one.
- Note:
additionalContextfrom 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 —
updatedInputreplace vs merge (different bug, same field) - #32348 —
updatedInputignored in-pmode (similar symptom, different context) - #15897 —
updatedInputdoesn't work with multiple PreToolUse hooks (related) - #33125 — Agent/prompt hooks don't block PreToolUse (related hooks+agents gap)
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗