This project provides a local hook that intercepts and blocks destructive shell and git commands before AI coding agents execute them. It integrates with multiple agent CLIs and IDEs, offering modular security packs and CI/CD scanning capabilities.
Project overview
SIMD-accelerated filtering keeps command interception latency below one millisecond, and the hook catches dangerous inline scripts such as python -c using a three-tier AST pipeline.
Project type
AI Coding
Use cases
Coding & Development
Deployment
Refer to project documentation
License
License pending
Best for
Developers who use AI coding agents via CLI or IDE integrations and need a local tool to prevent accidental data loss from destructive shell commands.
Key capabilities
Intercepts and blocks dangerous git and shell commands from being executed by agents before they run.
Organizes destructive command patterns by category with 50+ security packs (Databases, Kubernetes, Docker, AWS/GCP/Azure, Terraform, etc.) that can be enabled or disabled.
Catches embedded dangerous scripts like python -c "os.remove(...)" using a three-tier AST pipeline.
Provides pre-commit hooks and CI integration to catch dangerous commands in code review.
Limitations and risks
A determined attacker can bypass this hook.
Direct file writes via Python/JavaScript, API calls, etc. are not intercepted.
Getting started
Setup difficulty is rated easy. An install script is available with an --easy-mode flag. The first success path is to run the curl install script with --easy-mode. No coding requirement is documented for setup.
Evidence and sources
README: A high-performance hook for AI coding agents that blocks destructive commands before they execute, protecting your work from accidental deletion across Claude Code, Codex CLI, Gem…
README: AI coding agents (Claude, Codex, Gemini, Copilot, etc.) occasionally run catastrophic commands like `git reset --hard`, `rm -rf ./src`, or `DROP TABLE users`—destroying hours of u…
README: dcg is a high-performance hook that intercepts destructive commands *before* they execute, blocking them with clear explanations and safer alternatives.