Claude Code hook
Tool Gate Hook
A PreToolUse hook for Claude Code for more granular permission controls
Install
cargo install --path .Found in the project README. Check it for setup steps after installing.
git clone https://github.com/kornysietsma/tool-gate-hook.gitFrom the README
tool-gate-hook A PreToolUse hook for Claude Code and GitHub Copilot CLI (macOS, local CLI only) that does two jobs: 1. Gate: auto-allow, auto-deny, or force a prompt (ask) for tool calls, using rules you write in a TOML file. Anything no rule matches passes through to the agent's normal permission flow. 2. Observe: record every call to a JSONL audit log with the raw payload, which rules matched, in order, and which one decided. When an agent changes what it sends, the log shows you. Both agents use the same rule engine; only the payload shape and tool names differ. This is a workaround for the limits of the agents' built-in permission rules (for example, Bash permissions that don't hold up against a && b). It is small and rule-driven, and you need Rust to build it. This has changed since I blogged about it. It was claude-code-permissions-hook, a Claude-only hook with [[allow]] / [[deny]] rules; it has since been renamed, given a new config format and taught to work with Copilot CLI. To see the code as it was when the blog post was written, browse the repository at that commit. Install Requires Rust (rustup). This puts tool-gate-hook in ~/.cargo/bin. Agents may run hooks with a PATH that doesn't include ~/.cargo/bin; if the hook doesn't fire, use the absolute path (e.g. /Users/you/.cargo/bin/tool-gate-hook) in the registration commands below. Quick start Copy an example config to the default location for your agent and edit it: --agent is required (there is no auto-detection) and --config PATH overrides the default location. A minimal config: See the Configuration guide for every option. Registering the hook User level (typical) Claude Code, in ~/.claude/settings.json: Copilot CLI, in ~/.copilot/hooks/tool-gate-hook.json: Project level (opt-in) For a…
How hooks work
- Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
- They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
- A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Details
- Repository
- kornysietsma/tool-gate-hook
- Type
- Hooks
- Language
- Rust
- License
- MIT
- Last updated
- 12 October 2026
FAQ
What is Tool Gate Hook?
A PreToolUse hook for Claude Code for more granular permission controls It is a hook for Claude Code, from kornysietsma/tool-gate-hook on GitHub.
How do I install Tool Gate Hook?
Run cargo install --path ., then follow the setup in the README.
Is Tool Gate Hook popular?
kornysietsma/tool-gate-hook has 41 GitHub stars and 6 forks. It was last updated on 12 October 2026.
More hooks
Claude Playbook
44smartwhale8/claude-playbook
Production-ready .claude/ scaffolding for enforcing professional software engineering standards with Claude Code. Rules, skills, agents, and hooks — ready to use as a GitHub template.
Founder OS
24cloudrepo-io/founder-os
Run your company with an AI team. No complex tooling—just markdown files and Claude.
Claude Moodle Dev
42SaadRahman01/claude-moodle-dev
Moodle development toolkit for AI coding assistants. Skills for XMLDB, Hooks API, PHPUnit, Behat, AMD, privacy/GDPR, security, accessibility. Native Claude Code plugin + adapters.
CC Thingz
39alexei-led/cc-thingz
Portable skills, agents, hooks, and Pi extensions for Claude Code, Codex CLI, Copilot, Cursor, Grok, and Pi.
Claude Code Plugins
44FlorianBruniaux/claude-code-plugins
Production-ready Claude Code plugins: skills, hooks, agents, slash commands, and MCP templates.
MadameClaude
25williamkapke/MadameClaude
Madame Claude is a monitoring system for Claude Code hooks that captures and streams tool usage events to a web interface.
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.