A bouncer for AI agents with a destructive streak
Because AI coding agents occasionally `git reset --hard` your uncommitted work into oblivion.

What it does
dcg intercepts shell commands from AI agents such as Claude Code, Codex CLI, and Cursor before they execute, blocking destructive operations like git reset --hard, rm -rf, and DROP TABLE. It installs as a hook into the agent’s tool-use pipeline and returns a clear denial with context and safer alternatives. The binary runs locally and claims sub-millisecond latency via SIMD-accelerated filtering.
The interesting bit
What began as a Python script grew into a Rust tool with a modular “pack” system spanning 50+ categories—from PostgreSQL and Kubernetes to AWS and rsync—plus heredoc scanning that catches embedded scripts like python -c "os.remove(...)". It also attempts to distinguish data from execution context, so grepping for a dangerous string does not trigger a false block.
Key highlights
- Supports Claude Code, Codex CLI 0.125.0+, Gemini CLI, Copilot, Cursor, Grok, and others with agent-specific profiles
- Fail-open design: timeouts or parse errors never block legitimate workflow
- Native Codex integration that detects
turn_idfields and uses the exact exit-code-2 stderr path Codex expects - Granular bypass options: environment variable overrides, single-use allow-once codes, and permanent allowlists
- Scan mode for CI pipelines and pre-commit hooks to catch dangerous commands in code review
Caveats
- Some integrations are limited: Aider supports only git hooks, Continue offers detection-only, and OpenCode and Pi rely on community plugins
- The
trust_levelfield in agent profiles is purely advisory and does not directly affect rule evaluation
Verdict
Worth installing if you delegate terminal access to any AI agent and have ever lost work to an overzealous git clean or docker system prune. If you only use AI tools for chat or code completion without shell access, you do not need this.
Frequently asked
- What is Dicklesworthstone/destructive_command_guard?
- Because AI coding agents occasionally `git reset --hard` your uncommitted work into oblivion.
- Is destructive_command_guard open source?
- Yes — Dicklesworthstone/destructive_command_guard is an open-source project tracked on heatdrop.
- What language is destructive_command_guard written in?
- Dicklesworthstone/destructive_command_guard is primarily written in Rust.
- How popular is destructive_command_guard?
- Dicklesworthstone/destructive_command_guard has 5.3k stars on GitHub and is currently cooling off.
- Where can I find destructive_command_guard?
- Dicklesworthstone/destructive_command_guard is on GitHub at https://github.com/Dicklesworthstone/destructive_command_guard.