Dicklesworthstone/destructive_command_guard
The Destructive Command Guard (dcg) is for blocking dangerous git and shell commands from being executed by agents.
What it solves
AI coding agents (such as Claude Code, Cursor, and GitHub Copilot) can occasionally execute catastrophic commands—like rm -rf ./src or DROP TABLE users—that destroy uncommitted work or production data in seconds. dcg provides a safety layer to intercept and block these destructive commands before they are executed.
How it works
It acts as a high-performance hook that intercepts commands sent by AI agents. It uses SIMD-accelerated filtering and a modular "pack" system to scan commands against known destructive patterns. It can detect dangerous operations even when embedded in heredocs or inline scripts (e.g., python -c "os.remove(...)"). If a command is flagged, dcg blocks the execution and displays a human-readable denial panel with the reason and safer alternatives on stderr, while keeping machine-readable output on stdout for the agent.
Who it’s for
Developers using AI coding agents or CLI-based AI tools who want to prevent accidental data loss or system destruction caused by autonomous agent actions.
Highlights
- Broad Agent Support: Integrates with Claude Code, Cursor, Codex CLI, Gemini CLI, GitHub Copilot, Grok, and many others.
- Modular Security Packs: Over 50 specialized packs covering databases (PostgreSQL, MongoDB), cloud providers (AWS, GCP, Azure), containers (Docker, Kubernetes), and infrastructure (Terraform, Pulumi).
- Sub-Millisecond Latency: Designed for minimal overhead so the protection doesn't slow down the development workflow.
- Smart Context Detection: Distinguishes between data (e.g.,
grep "rm -rf") and actual execution (e.g.,rm -rf /). - Flexible Bypass: Offers multiple ways to allow commands, including environment variables (
DCG_BYPASS=1), one-time allow codes, or permanent allowlists.
Related
- Project
- Project
- Project
- Project
- Project