You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PostToolUse: updatedToolOutput under hookSpecificOutput is ignored #447
A PostToolUse hook that returns updatedToolOutput under hookSpecificOutput has no effect: the model still gets the original tool output. The same field at the top level works, and tests/hooks-more.test.ts covers that form ("replaces the tool output the model sees via a schema-valid updatedToolOutput").
The nested form is the one in the example of Claude Code's hooks reference, under PostToolUse decision control:
To reproduce (pi-code 1.7.0 from npm, hooks extension loaded with -e extensions/hooks/index.ts, Pi 1.5.2, Linux):
In the user settings.json (I pointed CLAUDE_CONFIG_DIR at an empty directory holding only this file), add a PostToolUse hook on Bash whose command prints the JSON above.
Run pi -p "Run exactly one bash call: echo hello".
Read the tool result in the session file.
Hook output
Tool result the model gets
updatedToolOutput under hookSpecificOutput
hello
updatedToolOutput at the top level
[redacted]
Cause, as far as I can tell:updatedToolOutput() in extensions/hooks/index.ts reads parsed?.updatedToolOutput and parsed?.updatedMCPToolOutput only, and the type tryParseJson() returns in decisions.ts declares both at the top level, not under hookSpecificOutput.
Where it bites: a redaction hook written for Claude Code that masks credential-shaped output runs, its reason is appended to the tool result, and the secret still reaches the model and the session file.
Reading hookSpecificOutput.updatedToolOutput first and falling back to the top-level field would accept both forms.
Activity
Read updatedToolOutput from hookSpecificOutput, as Claude Code does (i…