# Repository Briefing: Dicklesworthstone/destructive_command_guard
> Source: https://repoforai.com/repo/Dicklesworthstone/destructive_command_guard (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/Dicklesworthstone/destructive_command_guard
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: Rust
- **License**: See repository
- **Engineering Health**: A (77/100 · Maintenance 35/35 · Adoption 16/25 · Releases 20/20 · License 6/20)
- **Latest Release**: v0.17.2 (2026-11-26) — https://github.com/Dicklesworthstone/destructive_command_guard/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: MCP, CLI
- **Momentum**: 6,394 ★ total (+3 24h / +18 7d) · 274 forks
- **Topics**: `ai-agents`, `cli`, `developer-tools`, `git`, `rust`, `safety`
- **When to Use**: Best for: Teams running hook-capable coding agents that want a consistent, explainable check against accidental damage to worktrees, disks, and infrastructure, with CI scanning as a second check. Skip if: You need a standalone MCP server or a hard boundary over all processes, filesystem access, or production credentials. Use isolation and service-side access controls for those requirements.

## Overview
```text
### Architecture & Core Mechanics
Destructive Command Guard (dcg) is a local Rust CLI that sits between an AI coding agent and the shell tool it is about to invoke. A client hook or plugin provides the tool-call context, dcg evaluates the command text against configured rule packs, and the client applies the returned decision. The evaluation pipeline combines SIMD-accelerated filtering, context classification, and a dual regex engine with lazily compiled patterns. The manifest uses Rust edition 2024 and sets a minimum Rust version of 1.95.

Integration is client-specific. Codex CLI 0.125.0+ uses a Bash `PreToolUse` hook; dcg identifies its payload by a nonempty `turn_id` and writes only the supported denial fields to stdout, reserving stderr for human-readable output. OpenCode instead uses a native `tool.execute.before` plugin. The integration surface is hooks, plugins, and a CLI; no MCP server interface is established.

### Key Capabilities & Differentiators
With no configuration, dcg checks for destructive filesystem, Git, and disk operations. The filesystem and Git core packs always participate in evaluation, while `system.disk` can be disabled. `windows.filesystem` and `windows.system` also come on by default on native Windows and can activate on other hosts when the request is recognized as Cmd or PowerShell; a Windows-looking string by itself is not enough. More than 50 packs extend coverage to PostgreSQL and other databases, Kubernetes, Docker, cloud CLIs, Terraform, and more.

Context classification distinguishes command text used as data from operations that would actually run, and evaluation extends to heredocs and inline scripts. `dcg explain` exposes the matched policy and resolved mode, while scan mode brings command checks into pre-commit and CI. Agent profiles can add or remove eligible packs and change allowlist handling. `trust_level` is an audit label, not a control that changes evaluation.

### Trade-offs & Limitations
Compared with Git hooks, dcg can inspect agent-issued shell calls before execution and apply the same policy to filesystem, infrastructure, and database commands. Compared with a sandbox or service-side authorization, its strength is early, explainable feedback, not containment. It depends on the client routing calls through a working hook and honoring the result. Aider is limited to Git hooks, while Continue is detection-only. Keep OS isolation and least-privilege credentials for operations that require a hard boundary.

Broader pack coverage gives teams more control but increases the policy they must tune and test. Pack-wide `warn` or `log` does not relax critical rules: they resolve back to `deny` unless overridden individually. Analysis timeouts can produce explicit review or block outcomes. `Cargo.toml` references a `LICENSE` file without identifying the license by SPDX identifier; inspect the actual terms before approving commercial use or redistribution.

### Hardware & Deployment Guide
Install the local binary and register it with the client's hook or plugin mechanism. The Codex installer detects `codex` on PATH or an existing `~/.codex/` directory, merges into `~/.codex/hooks.json`, preserves other hooks, and refuses to overwrite malformed JSON. OpenCode uses `dcg install --opencode`. Start with the default policy, add workload-specific packs in the dcg TOML configuration, and use `dcg doctor --strict` in the agent's launch environment. Validate both allow and deny behavior end to end before expanding rollout. Source builds require Rust 1.95; the guard itself does not need a model, GPU, or hosted inference service.

The release sequence shows why both test layers matter: v0.17.0 expanded PowerShell truncation coverage and fixed Antigravity hook registration; v0.17.1 introduced a tri-state distinction between action, inert input, and input that cannot be proven safe in the affected guardrail; v0.17.2 added the opt-in `system.processes` pack for shared agent hosts.
```

## Key Capabilities
```text
- Enforcement point: pre-execution hooks and a Rust CLI; an MCP server interface is not established.
- Protocol fidelity: Codex CLI 0.125.0+ receives minimal denial JSON on stdout, with human-readable details on stderr.
- Default policy: filesystem and Git core packs always evaluate; disk protection is enabled by default and can be disabled.
- Context analysis: distinguishes quoted data from executable commands and inspects heredocs and inline scripts.
- Policy tuning: 50+ packs, agent-specific profiles, and per-rule overrides for relaxing critical rules.
- Operational checks: `dcg explain` diagnoses rule decisions, `dcg doctor --strict` surfaces configuration failures, and scan mode supports pre-commit and CI.
```

## Quick Start / Clone
```bash
dcg allowlist add-command "mytool publish --to https://artifacts.corp.internal" \
  -r "First-party internal publisher" --user
```
