Build This Now
Build This Now
Keyboard ShortcutsStatus Line Guide
CLAUDE.md, Skills, Subagents, Hooks: When to Use WhichClaude Code Subagents: The 3 to 5 Agent Sweet SpotCLAUDE.md Best Practices: The File That Makes Claude Code ReliableHow to Fix Claude Code Running Out of Context
speedy_devvkoen_salo
Blog/Toolkit/Hooks/Claude Code Permission Hook

Claude Code Permission Hook

Install a three-tier Claude Code permission hook: instant allow for safe calls, instant deny for dangerous ones, LLM check for the gray area. No skip flag.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

See what we build for companies →
speedy_devvWritten by speedy_devvPublished Jan 27, 2026Toolkit hubHooks index

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.

Continue in Hooks

  • Slash Commands Are Now Skills: Migrating Commands to Skills
    Claude Code slash commands and skills now do the same thing. Here is how to migrate .claude/commands to .claude/skills and why it pays off.
  • Claude Code Setup Hooks
    Braid scripts, agents, and docs into Claude Code setup hooks. One command runs a deterministic script, hands output to a diagnosing agent, logs living docs.
  • Context Backup Hooks for Claude Code
    A StatusLine-driven Claude Code context backup hook. Writes structured snapshots every 10K tokens so auto-compaction never eats errors, signatures, decisions.
  • Cross-Platform Hooks for Claude Code
    Cross-platform Claude Code hooks: skip .cmd, .sh, and .ps1 wrappers and invoke node directly so one .mjs file runs on macOS, Linux, and Windows across the team.
  • Hooks Guide
    Claude Code hooks from first principles: exit codes, JSON output, async commands, HTTP endpoints, PreToolUse and PostToolUse matchers, production patterns.
  • MCP Tool Hooks in Claude Code
    How to call MCP server tools directly from Claude Code hooks using type: mcp_tool — schema, substitution syntax, use cases, and production patterns.

More from Toolkit

  • CLAUDE.md, Skills, Subagents, Hooks: When to Use Which
    Claude Code skills vs subagents vs hooks vs CLAUDE.md: a plain mental model for picking the right primitive, with token costs and examples.
  • Claude Code Subagents: The 3 to 5 Agent Sweet Spot
    Claude code subagents work best at 3-5 concurrent agents. Here is why that ceiling exists, how to set them up, and what to use past it.
  • CLAUDE.md Best Practices: The File That Makes Claude Code Reliable
    CLAUDE.md best practices: keep it under 200 lines, write it by hand, and use hooks when you need real enforcement, not advice.
  • How to Fix Claude Code Running Out of Context
    Claude Code running out of context is a session design problem. Fix it with /compact, lean CLAUDE.md, skills, and subagents, not a bigger window.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

See what we build for companies →

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.

See what we build for companies →