PreToolUse hook: permissionDecision works but updatedInput is ignored by Claude Code
Summary
The RTK PreToolUse hook fires correctly and outputs valid JSON with updatedInput, but Claude Code applies permissionDecision while silently ignoring updatedInput. Commands are never rewritten.
Environment
- Claude Code: v2.1.72
- RTK: latest (
rtk init --showshows all green) - OS: macOS 14
- Tested in: both
bypassPermissionsmode AND normal permission mode
What happens
- Hook fires ✅ (confirmed via debug log — input JSON received correctly)
- Hook outputs valid JSON with
updatedInput✅ permissionDecision: "allow"is honored ✅ — commands run without permission promptsupdatedInputis ignored ❌ — commands execute as original, not rewritten
Example: Running git status via Claude Code Bash tool:
- Hook receives:
{"tool_input": {"command": "git status", ...}} - Hook outputs:
{"hookSpecificOutput": {"permissionDecision": "allow", "updatedInput": {"command": "rtk git status"}}} - Actual command executed:
git status(raw verbose output, not RTK compressed)
Debug confirmation
Added temporary debug log to hook:
echo "[rtk-debug] hook called, input: $INPUT" >> /tmp/rtk-hook-debug.log
Log confirmed hook is being called with correct input. permissionDecision: "allow" works (no prompts). updatedInput does nothing.
Why most users don't notice
The auto-approve behavior (no permission prompts) works, so users assume the hook is fully functional. The rewriting is silently broken.
Workaround
Manually prefix all commands with rtk in CLAUDE.md instructions to Claude.
Question
Has anyone found a workaround or different hook response format that makes updatedInput work? Is this a known Claude Code limitation?
Additional testing confirms this affects all commands, not just git. Tested ls -la and cat — both execute as raw commands instead of being rewritten to rtk ls / rtk read. The updatedInput field is universally ignored by Claude Code regardless of command type.
Root Cause Found + Fix
After deeper investigation, the issue is not a Claude Code bug with updatedInput itself — it's a known Claude Code bug when multiple PreToolUse hooks are registered.
The Bug (Claude Code issue #15897)
When multiple PreToolUse hooks run, the last hook's result overwrites previous ones. If the last hook outputs nothing (exit 0), it sets updatedInput: undefined, wiping out RTK's rewrite.
How to reproduce
In ~/.claude/settings.json, if you have a "*" matcher hook registered after the RTK "Bash" matcher hook:
"PreToolUse": [
{ "matcher": "Bash", "hooks": [{ "command": "rtk-rewrite.sh" }] },
{ "matcher": "*", "hooks": [{ "command": "some-other-hook.py" }] }
]
The some-other-hook.py runs after RTK, returns no updatedInput, and wipes RTK's rewrite.
Fix
Either remove the conflicting hook, or ensure RTK hook runs last:
"PreToolUse": [
{ "matcher": "*", "hooks": [{ "command": "some-other-hook.py" }] },
{ "matcher": "Bash", "hooks": [{ "command": "rtk-rewrite.sh" }] }
]
Recommendation for RTK docs
Add a warning to TROUBLESHOOTING.md: if users have multiple PreToolUse hooks, RTK must be last in the list, otherwise its updatedInput gets wiped by subsequent hooks that return no output.