Back to Discover

tool-gates

connector

camjac251

Intelligent tool permission gate & security hooks for AI assistants (Claude Code, Codex, Antigravity; Gemini deprecated). Features AST shell gating, file guards, and safety scanners.

View on GitHub
4 starsSynced Aug 15, 2026

Install to Claude Code

/plugin marketplace add camjac251/tool-gates

README

Tool Gates

Deterministic guardrails for autonomous coding agents

Documentation CI Release MSRV License: MIT

Tool Gates evaluates shell commands, file operations, and tool calls before they run. It combines tree-sitter parsing with a non-configurable safety floor and per-tool policy, then returns the narrowest safe decision for the active client.

Read the documentation →

Why Tool Gates? · Quick start · How it works · Clients · Configuration

[!IMPORTANT]

Claude Code Auto Mode changes the job of a permission hook. New Claude Code sessions on Pro, Max, and Team plans use Auto Mode by default unless a different default is already pinned. Auto Mode does not bypass Tool Gates. Tool Gates still evaluates each supported hook call before Claude's classifier: known-safe calls can run, hard-denied calls remain blocked, and selected irreversible actions can still require a human. See Tool Gates and Auto Mode and Anthropic's rollout announcement.

Why Tool Gates?

Native permission systems have different wire formats, defaults, and ideas of what counts as safe. Tool Gates puts one predictable policy layer in front of them.

Without a shared gateWith Tool Gates
Repeated prompts encourage broad, permanent allow rulesKnown-safe operations can be approved precisely
Text matching misses shell structure inside chains and pipelinesCommands are parsed as syntax with tree-sitter-bash
A probabilistic classifier makes every borderline decisionDeterministic denials and explicit human holds run first
Client behavior drifts across Claude, Codex, and AntigravityOne gate engine renders a client-native result
An approval disappears after the sessionSuccessful human approvals can be reviewed and saved intentionally

Tool Gates is a guardrail layer, not a sandbox or a replacement for code review. Its purpose is to reduce needless friction while keeping deterministic policy in the loop as agents become more autonomous.

Quick start

Install with Homebrew on macOS or Linux:

brew install camjac251/tap/tool-gates

Add the Claude Code hooks and verify the installation:

tool-gates hooks add -s user
tool-gates doctor

For binaries, Cargo installation, and upgrades, see the installation guide.

Codex CLI setup
tool-gates hooks add --codex
tool-gates doctor
Antigravity CLI setup
# User hooks: ~/.gemini/config/hooks.json
tool-gates hooks add --antigravity

# Optional project hooks: .agents/hooks.json
tool-gates hooks add --antigravity -s project

# Add native allow rules for recognized read-only commands
tool-gates agy allowlist --apply

tool-gates doctor
Gemini CLI compatibility setup

Gemini CLI support is deprecated and retained only for existing installations. New Google client integrations should target Antigravity.

tool-gates hooks add --gemini
tool-gates doctor

How it works

Every supported client is normalized into the same gate pipeline. Raw-command checks run before AST parsing, configured rules are merged with the deterministic safety floor, and only then is the result translated into the client's native hook format.

flowchart LR
    CALL[Tool call] --> NORMALIZE[Normalize client input]
    NORMALIZE --> FLOOR[Raw safety floor]
    FLOOR --> PARSE[Parse command or inspect tool input]
    PARSE --> GATES[Apply gates and settings]
    GATES --> DECISION{Decision}

    DECISION -->|allow| RUN[Execute]
    DECISION -->|deny| STOP[Block with reason and recovery]
    DECISION -->|ask or defer| CLIENT{Client permission layer}

    CLIENT -->|Claude Auto| CLASSIFIER[Safety classifier]
    CLIENT -->|Manual or held ask| HUMAN[Human approval]
    CLIENT -->|Codex or Antigravity| NATIVE[Native policy]

    CLASSIFIER --> RUN
    CLASSIFIER --> STOP
    HUMAN --> RUN
    HUMAN --> STOP
    NATIVE --> RUN
    NATIVE --> STOP

    RUN --> POST[Post-tool reminders and approval tracking]
Engine outcomeMeaningWhat happens next
AllowThe operation matches known-safe policyIt runs immediately where the client honors hook allows
Ask / deferThe operation is mutating, unknown, or needs another decisionThe user, Claude's Auto classifier, or the client's native policy decides
DenyThe safety floor or an explicit block rule rejected the operationExecution stops with a specific reason and, when available, a safer recovery action

Read the architecture and hook model for the full precedence and serialization contracts.

Tool Gates and Auto Mode

Auto Mode replaces many human approval prompts with a separate safety classifier. It does not make deterministic hooks redundant; it changes which layer resolves an undecided call.

Tool Gates result in Claude Auto ModeResult
Known-safe allowRuns without classifier review
Ordinary gate askBecomes a defer so the classifier can allow or deny it
Explicit auto = "prompt" ruleRemains a human approval; non-interactive sessions fail closed
Hard denyRemains denied; the classifier does not get a vote
Classifier denial of a gate-safe commandCan produce a retry hint with a narrower, safer alternative

Tool Gates also promotes high-risk shell asks such as pipe-to-shell and eval to denials in Auto Mode, and it does not record silent classifier approvals as prior human consent. See the complete Auto Mode guide, including rollout, opt-out, classifyAllShell, and settings-precedence details.

Features

CapabilityWhat it provides
Shell-aware gatesCorrect handling of pipelines, substitutions, wrappers, and &&, ||, ; command chains
Security floorNon-configurable blocks and asks for command injection, pipe-to-shell, eval, unsafe output caps, and other high-impact forms
File guardsSymlink and sensitive-path protection for agent instruction and configuration files
Security remindersWrite/Edit scans for 28 security anti-patterns across three severity tiers
Design and comment lintOpt-in reminders for templated UI patterns, missing interaction basics, and low-value code comments
Approval learningA review queue that turns successful human approvals into deliberate reusable rules
CLI guidanceContextual recovery actions and modern command alternatives such as bat, rg, and fd
Mode awarenessSeparate behavior for manual/default, acceptEdits, Auto, plan, and bypass modes

Explore the gate reference, security floor, security reminders, and design lint.

Client support

ClientIntegration behaviorSetup
Claude CodeFull mode-aware hook lifecycle, including Auto classifier routing, permission-denial recovery, and approval trackingtool-gates hooks add -s user
Codex CLIPre-execution output is deny-only; non-denies stay silent so Codex can apply its own approval_policytool-gates hooks add --codex
Antigravity CLIHook decisions only tighten native policy; use the generated native allowlist for prompt-free recognized readstool-gates hooks add --antigravity
Gemini CLIDeprecated compatibility for existing setupstool-gates hooks add --gemini

Client behavior is intentionally not flattened into a false common denominator. The shared engine keeps one policy, while each serializer emits only decisions that its client can honor safely.

Configuration

User configuration lives at ~/.config/tool-gates/config.toml. Project and client settings participate in a documented precedence model, while the hard safety floor remains non-configurable.

Common configuration areas include:

  • enabling or disabling individual gates, hints, and optional content scans;
  • adding explicit allow, ask, deny, or Auto-specific prompt rules;
  • resolving Git aliases before gate evaluation;
  • blocking selected tools or restricting their domains;
  • auto-approving trusted skills under scoped paths and project conditions; and
  • allowing Codex patch applications inside the project directory.

Start with the configuration reference, then review permission modes and settings precedence.

Approval learning and diagnostics

Tool Gates records successful prompt-backed decisions for later review. Nothing is learned permanently until you select and save it.

# Review pending human approvals in the TUI
tool-gates review

# Inspect stored rules
tool-gates rules list

# Check binaries, hooks, and configuration health
tool-gates doctor

See the CLI reference and approval learning guide.

Acknowledgements

Security reminder patterns were built on and informed by:

Project links

Rendered live from camjac251/tool-gates's GitHub README — not stored, always reflects the source repo.

1 Plugin

NameDescriptionCategorySource
tool-gatesIntelligent permission gate for shell, file, search, Skill, and MCP tool surfaces. AST-parses Bash commands, guards file reads/writes, and blocks configured tool invocations. Tracks manually approved commands for permanent rules.security./claude-plugin

0 Comments

Login required
Log in to post a comment or update on this repo.

No comments yet — be the first to share an update.