PermissionRequest Hook - Claude Code
Fires when a permission dialog appears. Auto-approve or auto-deny.
PermissionRequest runs when Claude Code is about to show the user a permission dialog. The hook can intercept - auto-approving or auto-denying based on custom logic.
What it does
The hook sees the tool, arguments, and reason for the prompt. It can allow, deny, or pass through to the user. This is how you implement policy that's smarter than static permission rules - decisions based on the current branch, time of day, remote git state, or anything else you can script.
When to use it
- Conditional auto-approval (only on feature branches, never on main).
- Integrating with an external approval system for sensitive tasks.
- Enforcing team policies that vary by project phase.
- Building smarter "auto mode" behavior than the built-in classifier.
Gotchas
- Automating approvals removes the human safety net. Log every decision.
- Long-running hooks stall the session while the user waits.
- A hook that auto-denies too aggressively will be worse than the default prompts.
Official docs: https://code.claude.com/docs/en/hooks.md#permissionrequest
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
Was this helpful?




