Build This Now
Build This Now
Keyboard ShortcutsStatus Line Guide
Hooks GuideCross-Platform Hooks for Claude CodeClaude Code Setup HooksStop HooksSelf-Validating Claude Code AgentsClaude Code Session HooksContext Backup Hooks for Claude CodeSkill Activation HookClaude Code Permission Hook
Get Build This Now
speedy_devvkoen_salo
Blog/Toolkit/Hooks/Claude Code Permission Hook

Claude Code Permission Hook

Three-tier permission delegation for Claude Code: instant approve, instant deny, and an LLM check for the gray area.

Problem: A file read needs your approval. Click. A shell command needs your approval. Click. Twenty clicks deep, the feature you started has fallen out of your head.

Quick Win: Run three commands and the Permission Hook takes over:

npm install -g @abdo-el-mobayad/claude-code-fast-permission-hook
cf-approve install
cf-approve config

Three commands. Claude now runs without pausing for approval, and the risky calls get caught before they touch your machine. No --dangerously-skip-permissions needed.

The Two Bad Options

Vanilla Claude Code leaves you with two choices, neither of which is good.

Option 1: Click approve constantly. Safe, and flow-killing. A complex feature can mean 50+ permission prompts. Context goes. Momentum goes. Whatever made AI-assisted coding feel useful goes with them.

Option 2: Use --dangerously-skip-permissions. Fast and terrifying. One hallucinated rm -rf / and the machine is gone. Throwaway projects, fine. Real work, no.

A third option exists with the Permission Hook: intelligent delegation. Claude moves without being interrupted. The truly dangerous commands get caught at the door. Anything in the middle is forwarded to a quick LLM that has the context.

How It Works: Three Tiers

Each request gets evaluated the moment it arrives.

Tier 1 - Fast Approve (No AI Needed)

Safe tools pass straight through:

  • Read, Glob, Grep, WebFetch, WebSearch
  • Write, Edit, MultiEdit, NotebookEdit
  • TodoWrite, Task, all MCP tools

Zero latency. Zero cost. Claude keeps moving.

Tier 2 - Fast Deny (No AI Needed)

Dangerous operations die on the spot:

# These never execute, period
rm -rf /                      # System destruction
git push --force origin main  # Protected branch overwrite
mkfs /dev/sda                 # Disk formatting
:(){ :|:& };:                  # Fork bomb

No LLM call. Hard-coded rules stand between you and the worst-case command.

Tier 3 - LLM Analysis (Cached)

Anything ambiguous routes to a small, cheap model (GPT-4o-mini via OpenRouter) that decides with the surrounding context in mind:

{
  "tool": "Bash",
  "command": "docker system prune -af",
  "working_directory": "/home/user/project",
  "recent_context": "User asked to clean up Docker resources"
}

The model reads what you were trying to do and decides accordingly. Each ruling is cached, so the same command later is instant.

Configuration

Settings live at ~/.claude-code-fast-permission-hook/config.json:

{
  "llm": {
    "provider": "openai",
    "model": "openai/gpt-4o-mini",
    "apiKey": "sk-or-v1-your-key",
    "baseUrl": "https://openrouter.ai/api/v1"
  },
  "cache": {
    "enabled": true,
    "ttlHours": 168
  }
}

OpenRouter wins on latency, so it's the default. Grab a key at openrouter.ai. Rough cost: $1 per 5,000+ LLM decisions. Most calls land in Tier 1 or 2 anyway, so a single dollar tends to last for months.

Where to Install

Device Level (recommended): Drop the config into ~/.claude/settings.json once and every project picks it up.

Project Level: Use .claude/settings.local.json when you want rules scoped to one repo.

The installer writes this into your settings:

{
  "hooks": {
    "PermissionRequest": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "cf-approve permission"
          }
        ]
      }
    ]
  }
}

When Things Break

Error: "Permission denied" on all operations

Your API key is missing or wrong:

cf-approve config

Re-enter the OpenRouter key and you're back.

Error: "Hook not triggering"

Confirm the install is healthy:

cf-approve doctor
cf-approve status

Behavior seems inconsistent

Wipe the decision cache:

cf-approve clear-cache

The Other Half of the Pattern

Two hooks anchor how ClaudeFast thinks about Claude Code. This one handles permissions. The Skill Activation Hook handles the rest, pulling the right skills into context at the moment they matter.

Run them together and the friction drops out of your day. You talk normally. Claude works without pauses. The orchestration runs underneath, out of sight.

You Can Now Code Without Interruption

  • You just installed context-aware permission automation
  • Set up the main Hooks Guide for complete hook coverage
  • Configure the Stop Hook to ensure task completion
  • Try Context Recovery to survive compaction
  • Go deeper: Explore skills for specialized agent workflows

Permission fatigue gone. Skip flags gone. Claude is left to do the part it's good at, which is writing your software while your attention stays on the larger plan.

More in this guide

  • Keyboard Shortcuts
    Configure custom keyboard shortcuts in Claude Code.
  • Status Line Guide
    Set up a custom Claude Code status line showing model name, git branch, cost, and context usage.
  • AI SEO and GEO Optimization
    A rundown of Generative Engine Optimization: how to get content cited inside ChatGPT, Claude, and Perplexity responses instead of just ranked on Google.
  • Claude Code vs Cursor in 2026
    A side-by-side look at Claude Code and Cursor in 2026: agent models, context windows, pricing tiers, and how each tool fits different developer workflows.
  • Claude Code VSCode Extension
    Anthropic's VS Code extension puts Claude Code inside the editor sidebar as a Spark-icon panel, with inline diffs, plan mode, subagents, and MCP support.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now

Skill Activation Hook

A hook on UserPromptSubmit that appends matching skill recommendations to every prompt before Claude reads it.

MCP Basics

Model Context Protocol servers are external processes that expose tools, APIs, and services to Claude Code through a shared wire format.

On this page

The Two Bad Options
How It Works: Three Tiers
Configuration
Where to Install
When Things Break
The Other Half of the Pattern
You Can Now Code Without Interruption

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now