Feature Request: Non-blocking PreToolUse hooks that inject context to Claude
Resolved 💬 3 comments Opened Nov 28, 2025 by FabianHertwig Closed Dec 2, 2025
Summary
I would like PreToolUse hooks to have an option to inject a message/context to Claude (the model) while still allowing the tool to execute (non-blocking).
Current Behavior
Based on the documentation and testing:
- Exit code 0: Command executes, but stdout/JSON output is only shown to the user in verbose mode - Claude does not see it
- Exit code 1: Command executes (non-blocking), stderr shown to user in verbose mode - Claude does not see it
- Exit code 2: Command is blocked, stderr is shown to Claude - but this prevents execution
The permissionDecisionReason field with permissionDecision: "allow" is explicitly documented as "shown to the user but not to Claude."
Desired Behavior
A way for PreToolUse hooks to:
- Allow the tool to execute (non-blocking)
- Inject a message/context that Claude sees before or alongside the tool result
Use Case
I want to remind Claude to run quality checks (linting, type checking, tests) before creating PRs or pushing code. The ideal flow would be:
- Claude attempts
git pushorgh pr create - Hook triggers and injects a reminder: "Have you run npm run lint:format and npm run check?"
- Command still executes (or Claude can choose to run checks first based on the reminder)
- Claude sees the reminder and can make an informed decision
Currently, I can only:
- Block the command entirely (exit 2) - but this requires re-running the command after Claude acknowledges
- Show a message to the user only (exit 0/1) - but Claude doesn't see it and can't act on it
Proposed Solution
One of these approaches:
- A new exit code or JSON field that means "allow execution but inject this message to Claude's context"
- Extend
hookSpecificOutputto support aclaudeMessagefield that gets injected to Claude regardless of permission decision - Allow
permissionDecisionReasonto optionally be shown to Claude with a flag likeshowToClaude: true
Environment
- Claude Code CLI
- macOS
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗