GateGuard Pre-Action Gate

•
244k
•

Enforces pre-action investigation gates before code edits, file creations, or destructive commands to prevent hallucinations and boost output quality.

GateGuard is a pre-tool-use hook that intercepts Edit, Write, and Bash operations in Claude Code, requiring concrete factual investigation into dependent modules, data schemas, and user instructions before permitting modifications. Rather than relying on ineffective LLM self-evaluation, GateGuard utilizes a three-stage deny-force-allow pattern to ensure context is actively gathered through tree searches and file inspections. This fact-forcing mechanism eliminates unverified assumptions, guards against destructive CLI operations with rollback mandates, and measurably improves code design depth across complex codebases.

Key Features

01Three-stage deny-force-allow gating pattern for first-touch edits and file creations
02Pre-action fact verification forcing cross-module dependency and schema discovery
03Destructive Bash command protection requiring explicit rollback plans
04Context-saving condensed denials to avoid bloating session context windows
05Flexible configuration via glob exemptions and granular environment toggles
06244,259 GitHub stars

Use Cases

01Refactoring complex, interconnected codebases where edits risk breaking cross-module dependencies
02Preventing accidental destructive terminal actions such as hard resets, force pushes, or recursive file deletions
03Working with strict data structures and date formats where unverified assumptions cause silent bugs