[BUG] PreToolUse hook updatedInput silently ignored in claude -p mode

Resolved 💬 4 comments Opened Mar 9, 2026 by mhcoen Closed Apr 6, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

PreToolUse hooks that return updatedInput to rewrite commands work correctly in interactive mode but are silently ignored in -p (pipe/print) mode. The hook fires, returns a valid response with permissionDecision: "allow" and updatedInput containing a modified command, but the original command executes unchanged. This breaks any tool that relies on command rewriting via hooks, including RTK.

What Should Happen?

Expected behavior: updatedInput from PreToolUse hooks should be applied in -p mode the same way it is in interactive mode.

Observed behavior: permissionDecision (allow/deny) is respected in -p mode. updatedInput is silently dropped. No error or warning is logged.

Error Messages/Logs

Steps to Reproduce

  1. Configure a PreToolUse Bash hook that rewrites commands (e.g., rtk-rewrite.sh from RTK, which prepends rtk proxy to commands for token compression)
  2. Run an interactive claude session. The hook fires and the rewritten command executes. rtk gain shows increasing counts.
  3. Run claude -p "run ruff check .". The hook fires and returns updatedInput with the rewritten command. But the original command executes. rtk gain count does not increase.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.71 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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