Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

tool-gates is a single Rust binary. Install it, then point your assistant's settings at it. The same binary serves Claude Code, Codex CLI, Antigravity CLI, and the deprecated Gemini CLI. Claude Code and Gemini CLI are auto-detected from the hook payload; Codex and Antigravity are selected by the --client codex / --client antigravity flag the installer bakes into the hook command.

Step 1 · Install the binary

Recommended on macOS and Linux. Bottles are built for arm64 and x86_64; the formula updates automatically on every release. Homebrew installation is supported for v1.5.6 and newer.

$ brew install camjac251/tap/tool-gates

Upgrade later with brew upgrade tool-gates.

Step 2 · Wire it into your assistant

Each client uses a different hook protocol. The hooks add subcommand writes the right settings file in the right format. Multiple clients can run side by side. Settings files don't overlap.

Claude Code

4 hooks

Compatible with the latest versions of Claude Code, with built-in fallbacks for legacy hook contracts.

Personal use (recommended):

$ tool-gates hooks add -s user

Shared with team:

$ tool-gates hooks add -s project
  • PreToolUse: main gate
  • PermissionRequest: subagent gate
  • PermissionDenied: auto-mode retry hint
  • PostToolUse: approval learning + Tier 2 nudges

~/.claude/settings.json

Gemini CLI

1 hook

Deprecated compatibility: Google's consumer Gemini CLI sunset date was 2026-06-18. Existing tool-gates integrations remain available, but new setups should use Antigravity. Requires Gemini CLI v0.36.0+ for ask-decision support on BeforeTool hooks.

$ tool-gates hooks add --gemini
  • BeforeTool: gates every tool call

~/.gemini/settings.json

Codex CLI

3 hooks

The installer bakes --client codex into every hook command so the wire format routes correctly.

$ tool-gates hooks add --codex
  • PreToolUse: Bash + apply_patch + MCP
  • PermissionRequest: flat allow/deny
  • PostToolUse: Tier 3 warnings ride here

~/.codex/hooks.json

Antigravity CLI

1 hook

Google's successor to the Gemini CLI (agy). The installer bakes --client antigravity into the hook command so the wire format routes correctly. The hook gates commands (deny/ask); to also stop prompts for read-only commands, generate agy's native allowlist with tool-gates agy allowlist --apply (see Antigravity).

$ tool-gates hooks add --antigravity
  • PreToolUse: command safety, file guards, secret scanning

~/.gemini/config/hooks.json

Preview what would change with --dry-run:

Claude Code:

$ tool-gates hooks add -s user --dry-run

Gemini CLI:

$ tool-gates hooks add --gemini --dry-run

Codex CLI:

$ tool-gates hooks add --codex --dry-run

Antigravity CLI:

$ tool-gates hooks add --antigravity --dry-run

Step 3 · Verify

Confirm every hook is wired across every client:

$ tool-gates hooks status

Or pipe a tool-call payload directly into the binary and watch the decision come back:

Test a safe command (allowed):

$ echo '{"tool_name":"Bash","tool_input":{"command":"git status"}}' | tool-gates
→ {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow","permissionDecisionReason":"Read-only operation"}}

Test a dangerous command (blocked):

$ echo '{"tool_name":"Bash","tool_input":{"command":"rm -rf /"}}' | tool-gates
→ {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"rm: `rm -rf /` blocked: would recursively delete the entire root filesystem."}}

For a full health check on config, hooks, cache files, and legacy bash-gates remnants: tool-gates doctor.

Step 4 · Optional Claude Code plugin

tool-gates also ships as a Claude Code plugin with two slash commands: /tool-gates:review opens the approval TUI, /tool-gates:test-gate runs a command against the gate engine without executing it. The plugin provides skills only; the hook installation above is the prerequisite.

Add the marketplace:

/plugin marketplace add camjac251/tool-gates

Install the plugin:

/plugin install tool-gates@camjac251-tool-gates

Or from a local clone:

$ claude --plugin-dir /path/to/tool-gates/claude-plugin

After install, the two slash commands are available inside any Claude Code session:

Open the approval TUI:

/tool-gates:review

Preview how the engine would decide a command:

/tool-gates:test-gate

tool-gates · permission gate hook for Claude Code, Codex CLI, and Antigravity CLI, with deprecated Gemini CLI support. github.com/camjac251/tool-gates

13 gates · 400+ commands · built from rules/*.toml