Claude Code before tools: JSON permission and input rewrites
Inspect PreToolUse decision fields, full-input rewrites and auto-mode boundaries.
Decisions belong in hookSpecificOutput · updatedInput replaces the full input · Auto review and rewrites have separate boundaries
At a glance
This page inspects one event contract from official Claude Code hook documentation. Use a reviewed settings copy, inspect event input and output, then observe loading. This run checked synthetic JSON only and enabled no actual hook.
Runtime and applicability
- Article type
- Spec file
- Verified
- Applies to
- Claude Code Applies to the Claude Code hook event documented here.
- Tools
File locations
| Path | Scope | How it is read |
|---|---|---|
.claude/settings.json | Project hooks settings copy; preserve existing configuration. | Read by Claude Code under settings loading and the event contract; not enabled in this run. |
When to use
- Inspect PreToolUse decision fields, full-input rewrites and auto-mode boundaries.
When not to use
- The event or required fields are unclear, or a local JSON check is expected to replace permission and execution evidence.
Decisions belong in hookSpecificOutput
PreToolUse permissionDecision belongs in hookSpecificOutput with hookEventName=PreToolUse. Inspect allow, deny, ask and defer separately. deny prevents a call, ask requests confirmation, and defer requires -p non-interactive mode and ends the turn for later resumption. allow does not override deny/ask rules and has exceptions for some actions, network paths and SDK always_ask tools.
updatedInput replaces the full input
updatedInput replaces the whole parameter object, including both retained and modified fields; permission rules evaluate the returned input. ask shows the rewritten input, while defer ignores updatedInput. The synthetic object retains description and changes a demo command to npm run lint, without executing or approving it.
Auto review and rewrites have separate boundaries
In auto mode, updatedInput without permissionDecision can cause denial because server review covered the original input. Documentation lists connection and tool exceptions, so not every rewrite is denied. When Claude repeats the changed input exactly, the hook still runs, but corresponding paths can discard another rewrite. Inspect version and tool before adoption.
Inspect fields and precedence first
Decision precedence across hooks is deny > defer > ask > allow. Local checks covered synthetic field locations and retained input, without running an auto classifier or tool call. In a settings copy and disposable task, inspect final inputs and permission outcomes. Stop the new rewrite on expanded scope, rule conflicts or unexplained logs.
Sources
All links are official pages; verification dates are listed per source, and links point to the version checked.