mrkeyoor.com_
Tue 01 Sept 17:41 UTC
Dev Toolsevaluationupdated 30 Aug 2026

destructive_command_guard review

Destructive Command Guard, or dcg, is a Rust hook that inspects shell commands proposed by coding agents and blocks commands matching destructive rules before execution. It solves a narrow problem: an agent can move quickly enough to erase uncommitted work, cloud resources, or database data before a person catches the command.

+24 / 3dstars / 7d
Verdict

Our dcg run built successfully and passed 5,311 of 5,313 tests, but the 399-second suite still exited with 2 failures, so it is useful insurance rather than a safety boundary. Install it if agents can touch valuable working trees, then enable only the packs you can test against real commands. Keep backups, least-privilege credentials, and the agent's own sandbox because dcg has documented bypasses and current false-positive and false-negative reports.

We ran it

Lab card: what happened when we ran destructive_command_guardScreenshot of destructive_command_guard (github.com/Dicklesworthstone/destructive_command_guard)
Install✓ · 75s361 packages
Build✓ · 363s
Tests✗ · 399s5311 passed · 2 failed of 5313 (cargo test)
Repo603 files~305,091 lines of source · 22.5 MB · 10 CI workflows · tests dir

Answers from our run

Does destructive_command_guard build from source?

Dependencies installed in 75 seconds (361 packages), and the build succeeded in 363 seconds. We cloned commit d1ada2d into a clean Debian container with 3 CPUs and no project-specific setup.

Do destructive_command_guard's tests pass?

Not all of them: 5311 of 5313 passed and 2 failed when we ran the project's own test command (cargo test). Some failures need services or credentials a bare container does not have.

Who should not use destructive_command_guard?

Anyone expecting a sandbox or permission boundary: the README calls dcg a hook, documents DCG_BYPASS=1, and provides permanent allowlists, so a user or process that can alter the environment can disable it.

What are the alternatives to destructive_command_guard?

Shellfirm, Codex, Harden-Runner. Our dcg run built successfully and passed 5,311 of 5,313 tests, but the 399-second suite still exited with 2 failures, so it is useful insurance rather than a safety boundary.

Setup4/575-second install; hook edits and pack tuning still need review
Docs5/5Install, packs, agent protocols, bypasses, and limits are detailed
Community4/55,868 stars and current issue activity after an August push
Maturity4/5Broad agent coverage, but our suite had two failures

Discussed on

  1. hnShow HN: Destructive_command_guard (Dcg)3 points

Who it’s for

Developers using Claude Code, Codex CLI, Gemini CLI, Copilot, Cursor, or another documented hook target on real repositories.
Teams that want destructive Git and filesystem commands blocked by default, with optional packs for databases, containers, clouds, and infrastructure tools.
Security-minded agent users willing to tune allowlists and review denials instead of treating the hook as a guarantee.
CI maintainers who want to scan scripts and changed files for dangerous command patterns.

Who it’s NOT for

Anyone expecting a sandbox or permission boundary: the README calls dcg a hook, documents DCG_BYPASS=1, and provides permanent allowlists, so a user or process that can alter the environment can disable it.
Developers whose normal workflow sends Markdown through quoted heredocs: open issue 357 reports that a line beginning with a backtick is denied even when the quoted delimiter prevents shell expansion.
Teams that require complete detection of destructive Git spellings: issue 361 shows wildcard directory components allowing several git branch -D forms in v0.13.9.
Users who want every advertised pack active immediately: the README says only core filesystem, core Git, and system disk packs are enabled by default on Unix; database, container, and cloud packs require configuration.
Projects that cannot accept a custom license: GitHub reports no standard SPDX license, and the repository links to its own license terms.

Setup reality

Our sandbox install succeeded in 75 seconds and installed 361 packages. The Rust build succeeded in 363 seconds. Tests then failed after 399 seconds: 5,311 passed and 2 failed out of 5,313, with the log ending on a failed rebase_recovery_e2e test.

The quick installer downloads a binary and edits detected agent hook configuration. Building from source needs the Rust toolchain. Basic Git and filesystem protection needs no account or secret, while optional cloud, database, container, and infrastructure packs must be enabled in the TOML config.

Linux, macOS, WSL, and native Windows have documented install paths, but agent support is uneven: Aider is limited to Git hooks and Continue is detection-only. The bypass environment variable, allow-once codes, allowlists, and hook removal are deliberate escape routes, so dcg should sit beside backups and native permission controls.

It blocks agent commands before the shell receives them

dcg connects to the hook systems exposed by Claude Code, Codex CLI, Gemini CLI, Copilot, Cursor, and several other coding tools. When an agent proposes a shell command, the Rust binary classifies it and returns an allow or deny decision. The default Unix rules cover destructive filesystem operations, dangerous Git history changes, and disk commands. That is a useful last check when an agent has write access to a repository and is moving faster than a reviewer can read its transcript.

The repository goes well beyond matching rm -rf. Its pack catalog covers databases, containers, Kubernetes, clouds, storage, and infrastructure tools, but most of those protections are opt-in. More than 50 packs are advertised, while only core filesystem, core Git, and system disk protection start enabled on Unix. dcg init writes a starter config with examples. Buyers should read that distinction carefully because installing the binary does not automatically guard every destructive operation named in the README.

The hook is a guardrail, not an access-control boundary

The escape routes are explicit. DCG_BYPASS=1 skips protection for one invocation, an allow-once code approves one denied command, and permanent allowlists can exempt a rule or command. Removing the hook disables it altogether. These controls make the tool usable when its parser gets in the way, but they also define its security limit. A process that can change its environment or agent configuration is outside the protection model.

That leaves native controls in charge of the hard boundary. Keep Git work recoverable, limit cloud credentials, require database permissions appropriate to the task, and use the agent's sandbox or approval system. dcg can catch a bad string before execution; it cannot restore a deleted resource or stop a caller that deliberately disables the 1 hook responsible for screening commands.

What happened when we ran it

Our sandbox installed commit d1ada2d in 75 seconds, adding 361 packages. The build completed successfully in 363 seconds. This was a sizeable Rust checkout with 603 files, about 305,091 source lines, and 22.5 MB checked out, so compiling it from source is a longer job than the one-line binary installer suggests.

The test command failed with exit code 101 after 399 seconds. Cargo reported 5,311 passed and 2 failed out of 5,313. The tail showed several passing groups, then a group with 9 passes and 1 failure, and ended by naming rebase_recovery_e2e as the test target to rerun. The supplied tail does not name both failed cases or establish a cause, so the defensible result is simple: this commit did not pass its full suite in our fresh Debian container.

The scan also found 10 CI workflow files and a tests directory, but no Dockerfile. Those repository signals show substantial automated testing without providing a ready-made container path. Our run used 3 CPUs, 12 GB of RAM, an unprivileged Rust image, and no secrets. It measured setup and tests, not detection accuracy across a production command history.

Current issues show both unwanted blocks and missed commands

Open issue 357 documents a practical false positive in v0.13.9. A quoted heredoc prevents shell expansion, yet a body line beginning with a backtick can trigger the heredoc.shell:launcher-unverified rule. The reporter hit it while posting Markdown through command-line clients and suggests honoring the quoted delimiter. Until that behavior changes, users who submit fenced Markdown may need to place the body in a file, use an allow-once code, or accept interruptions.

Issue 361 reports the opposite problem. In a 33-case corpus, paths such as /usr/*/git branch -D main escaped the core Git pack even though the basename is literally git. The report says 0 of 4 wildcard-directory bypass shapes were caught in the tested releases. This is an edge spelling rather than the ordinary command most agents emit, but a command guard should be judged on both false denials and false allowances.

Agent coverage differs by client and operating system

The installer auto-detects several clients and merges hook configuration instead of asking users to wire every JSON file by hand. Codex CLI 0.125.0 or newer gets a specific output format because its hook protocol rejects unknown fields. Native Windows has a PowerShell installer and default Windows filesystem and system packs; WSL follows the Unix path. Aider receives only Git-hook coverage, while Continue is listed as detection-only.

Run dcg doctor after installation and test one harmless command plus one known denial in the actual client. An installed binary proves little if the agent is using another shell tool, a malformed hook file was preserved, or the client does not enforce the returned decision. The README's integration notes are detailed enough to make that verification possible, which matters more than the length of the supported-client list.

August maintenance is active, while the license needs reading

GitHub recorded 5,868 stars, 5 combined open issues and pull requests, and a last push on August 28, 2026. Release v0.13.9 was published the same day. The open queue includes recent, specific parser reports and pack expansion requests, which suggests users are exercising the rules rather than only starring the idea. The combined GitHub count should not be read as 5 confirmed bugs.

GitHub labels the license as NOASSERTION, and the README calls it custom. Organizations that require an OSI-approved or standard SPDX license should read the repository's license before distributing the binary. For everyone else, the decision turns on expectations: dcg is a practical extra refusal layer with 5,311 passing tests in our run, but it does not deserve the trust normally assigned to a sandbox or a permission system.

Alternatives

ProjectWhat it isPick it when
ShellfirmA shell safety tool that asks for confirmation before risky commands run.pick this instead when human confirmation in an interactive shell matters more than coding-agent hook formats and rule packs.
Codex gh↗An agent with its own sandbox and approval controls around command execution.pick this instead when you only use Codex and want its native execution policy rather than another command classifier.
Harden-RunnerA GitHub Actions security layer focused on network and process behavior in CI jobs.pick this instead when the threat is untrusted CI activity rather than destructive commands from local coding agents.

What people are saying

  1. [github-trending] Dicklesworthstone/destructive_command_guard

Sources

  1. Destructive Command Guard README
  2. GitHub repository facts
  3. Release v0.13.9
  4. Quoted heredoc false-positive report
  5. Wildcard Git-path false-negative report

More dev tools reviews

workmux · v2rayNG · SecLists · hashcat · eslint · fastfetch · the whole board →