Skip to content
BENIBIX Learn

PermissionRequest Hook

AI⌨️ Claude CodeConfiguration

Also known as PermissionRequest

The event just before Claude Code asks you. A hook can answer.

Think of it like

It is like a friend who gets the door for you.

Example

Lucy runs Claude in the background. Her hook approves safe reads in a test folder, so the run does not stall on a prompt.

Why it matters

It lets your own logic stand in for you when you are away from the screen.

Definition

PermissionRequest is the hook event that fires when Claude Code is about to ask you to approve a tool call. A hook here can answer for you, with allow or deny. If no one can see a prompt, such as in a background run, and no hook answers, the call is denied. Exit code 2 does nothing here, so answer with JSON.

Example code

json
{
  "hookSpecificOutput": {
    "hookEventName": "PermissionRequest",
    "decision": { "behavior": "allow" }
  }
}
A hook that says yes for you.

Common mistake

Exiting 2 to deny. That is ignored here. Return a deny decision in JSON.

Key takeaways

  1. 1
    Before a prompt. When one is due.
  2. 2
    Answer for you. Allow or deny.
  3. 3
    No exit 2. Use JSON.

Compare