[BUG]
[BUG] Hooks cannot both ask user for permission AND modify tool input
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When using hooks, it's impossible to both:
- Show the user a permission prompt (with custom reason message)
- Modify the command via
updatedInputwhen the user approves
The updatedInput field is ignored when permissionDecision is set to "ask". It only works when auto-allowing.
What Should Happen?
Hooks should support modifying tool input while still asking the user for permission. The updatedInput should be applied after the user manually approves the permission dialog.
Error Messages/Logs
No error - the updatedInput is silently ignored when combined with "permissionDecision": "ask".
Steps to Reproduce
- Create a PreToolUse hook that outputs:
``python``
output = {
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "ask",
"permissionDecisionReason": "Custom permission message",
"updatedInput": {"command": "modified-command arg1 arg2"},
}
}
print(json.dumps(output))
- Trigger the hook by running a matching Bash command
- User sees permission dialog with custom reason (good)
- User approves
- Bug: Original command runs, NOT the modified command from
updatedInput
Alternative attempt using both hooks:
- PreToolUse hook returns
"permissionDecision": "ask" - PermissionRequest hook returns
"behavior": "allow"withupdatedInput - Bug: PermissionRequest fires immediately after PreToolUse, auto-approving before user sees dialog
Evidence from debug logs:
PreToolUse: 06:23:57.605541
PermissionRequest: 06:23:57.635483
PermissionRequest fires 30ms after PreToolUse - not after user approval. Additionally, PermissionRequest receives the original command, not the updatedInput from PreToolUse.
Claude Model
N/A
Is this a regression?
Probably not
Claude Code Version
2.0.76
Platform
Claude Code
Operating System
Ubuntu/Debian Linux 24.04
Terminal/Shell
VS Code integrated terminal
Additional Information
Use Case
I want a hook that:
- Intercepts
rename-claude-session "name"commands - Shows user a prompt: "Rename session to 'name'?"
- If approved, injects environment variables into the command so renaming can actually be done.
Why? I want Claude to be able to decide when to rename the session autonomously. I want Claude to be able to choose a session name when I run /name manually. (a custom slash command or skill, I am not sure what the difference is, and neither does Claude know. This is a consequence of severe neglect of the documentation)
Current Workarounds
Must choose one:
Option A: Auto-allow with modification (no user prompt)
output = {
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "allow",
"updatedInput": {"command": new_command},
}
}
Option B: Ask user, but can't modify command
output = {
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "ask",
"permissionDecisionReason": "Rename session",
}
}
Suggested Fix
Either:
- Allow
updatedInputto work with"permissionDecision": "ask"- apply modification after user approves - Add a
PostPermissionApprovalhook that runs after user manually approves, whereupdatedInputcan be applied - Prevent PermissionRequest hook from firing immediately when PreToolUse returns
"ask"
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗