Claude Code PermissionRequest hooks: answer "Allow this?" from your own code A developer documented how to use Claude Code's PermissionRequest hook to answer permission prompts programmatically, publishing a working Node.js example that auto-allows read-only git commands, denies rm -rf, and otherwise stays silent so the normal prompt decides. The guide details the JSON payload Claude Code sends on stdin, the allow/deny/always-allow response format, and how the same hook handles AskUserQuestion multiple-choice prompts. The developer stresses that the hook should print nothing when in doubt, and that read-only git checks must also reject shell metacharacters like ; & | $ and backticks to block injection. Every Claude Code user knows the moment: Claude has done ten minutes of good work, then stops on Allow this? npm test and waits. Most hook guides cover PreToolUse , PostToolUse and Stop . The hook that runs at that exact moment is PermissionRequest , and it can answer the prompt for you, or hand it to anything you like: a script, a chat bot, a window, your phone. This guide covers what Claude Code sends to the hook, what the hook can send back, a small working example, how Claude's multiple-choice questions AskUserQuestion use the same hook, and the mistakes I made building a real tool on it. PermissionRequest fires when Claude Code is about to show a permission prompt. If you already allowed a command in your settings, there is no prompt and no hook. That makes it different from PreToolUse , which runs before every tool call: PermissionRequest only runs when a human would otherwise have to decide. Two things make it useful: timeout in seconds can be long. A hook that waits for a tap on a phone for ten minutes is fine. The hook gets one JSON object on stdin. The fields you will use: { "hook event name": "PermissionRequest", "session id": "4f1c...", "cwd": "/home/me/project", "tool name": "Bash", "tool input": { "command": "npm test", "description": "Run the tests" }, "permission suggestions": { "type": "addRules", "...": "..." } } tool input depends on the tool: command for Bash/PowerShell, file path for Write/Edit, url for WebFetch, query for WebSearch. permission suggestions holds what Claude Code would save if you picked "Always allow". Print one JSON object to stdout: { "hookSpecificOutput": { "hookEventName": "PermissionRequest", "decision": { "behavior": "allow" } } } { "behavior": "allow" } is the same as clicking Allow. { "behavior": "allow", "updatedPermissions":