PostToolUse additionalContext silently dropped for Agent tool calls
Summary
additionalContext in PostToolUse hook JSON output works for native tools (Edit, Write, Read, Glob, Grep) but is silently dropped for Agent tool calls. This prevents hooks from injecting feedback into Claude's context after subagent completion.
Use case
I have a PreToolUse hook on the Agent tool that launches a parallel Codex CLI process (codex exec) with the same prompt whenever Claude spawns a subagent. The goal is to get complementary perspectives from both models.
The PreToolUse hook works perfectly — Codex launches reliably and produces output. The problem is getting Codex's results back into Claude's context after the agent completes.
What I tried
PostToolUse hook on Agent that waits for Codex to finish, then returns:
{
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"additionalContext": "<codex output here>"
}
}
Exit code 0. The hook runs, blocks correctly while waiting, and produces valid JSON on stdout. But Claude never sees the additionalContext — it's silently dropped.
Expected behavior
additionalContext should be injected into Claude's context for all tool types, including Agent, the same way it works for native tools like Edit/Write.
Workaround
Currently relying on a CLAUDE.md instruction telling Claude to manually ls and cat output files from /tmp/codex-{session_id}/. This works when Claude remembers, but is unreliable since it's a soft instruction.
Environment
- Claude Code v2.1.92
- macOS Darwin 24.6.0
Related
Possibly related to #24788 (PostToolUse additionalContext not surfacing for MCP tool calls).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗