All Agent Engineering

Claude Code permission requests: allow, deny and exit codes

Distinguish PermissionRequest decision objects from exit-two behavior.

AINavWritten / Updated
On this page

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.

File locations

PathScopeHow it is read
.claude/settings.jsonProject 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

  • Distinguish PermissionRequest decision objects from exit-two behavior.

When not to use

  • The event or required fields are unclear, or a local JSON check is expected to replace permission and execution evidence.

Locate the tool permission request

PermissionRequest concerns the permission-request stage. Inspect tool_name, tool_input and rules and configure a synchronous command hook matching the tool, rather than matching prompt text alone. This page explains returns without configuring automatic approval. Existing deny/ask rules still apply.

behavior belongs in the nested decision

The output uses hookSpecificOutput.hookEventName=PermissionRequest and hookSpecificOutput.decision.behavior. allow grants the request and deny rejects it; a deny message tells Claude why and interrupt=true can stop it. These fields differ from UserPromptSubmit top-level block and PreToolUse permissionDecision.

Allow rewrites still undergo rule evaluation

allow can include updatedInput, replacing the full object and re-evaluating deny/ask rules. updatedPermissions is a separate update array omitted here. Exit two without a decision object leaves the permission flow unchanged and discards stderr. A script rejecting another event through its exit code cannot directly implement permission-request rejection.

Inspect a synthetic denial object

Local parsing checked behavior=deny, message=demo and interrupt=false at the correct event path. No permission prompt, setting update or tool approval occurred. Preserve settings and inspect denial reasons and interruption in a disposable session. Repair misplaced fields or unchanged permission flow before expanding allow rules.

Sources

All links are official pages; verification dates are listed per source, and links point to the version checked.

  1. Anthropic · Hooks reference

Found an error? Tell us →