PostToolUse hooks cannot inject context visible to Claude

Resolved 💬 5 comments Opened Jan 15, 2026 by golergka Closed Feb 28, 2026

Problem

PostToolUse hooks can show messages to the user via systemMessage, but there's no way to inject content that Claude (the AI) can see in its context.

Use Case

We have a command_guard.py hook that shows reminders when certain files are edited (e.g., migration files should use a specific workflow). The reminder should be visible to Claude so it can adjust its behavior, not just to the user.

What We Tried

All of these approaches with exit 0 in PostToolUse:

  1. {"decision": "block", "reason": "reminder"} - Shows as "blocking error" to user, not visible to Claude
  2. {"systemMessage": "reminder"} - Shows to user only
  3. {"additionalContext": "reminder"} - No effect
  4. {"hookSpecificOutput": {"additionalContext": "reminder"}} - No effect
  5. {"hookSpecificOutput": {"modifyResult": "original + reminder"}} - No effect
  6. Plain stdout with <system-reminder> tags - No effect
  7. stderr output - No effect

What Works (Workaround for Bash only)

For Bash tools, we can use PreToolUse with updatedInput to append && echo '<system-reminder>...</system-reminder>' to the command. This makes the reminder appear in the command output, which Claude can see.

This workaround doesn't work for Edit/Write tools since we can't append output to those.

Feature Request

Add a way for PostToolUse hooks to inject content into Claude's context. Possible approaches:

  1. Make additionalContext actually work for PostToolUse
  2. Add a modifyResult field that appends to the tool result
  3. Document how to achieve this if it's already possible

Environment

  • Claude Code CLI
  • Hook type: PostToolUse with command type

View original on GitHub ↗

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