/install dcg-guard
DCG Guard
An OpenClaw plugin that hard-blocks dangerous shell commands before they execute. Works on any OpenClaw installation (Windows, macOS, Linux, local, VPS, anywhere). No binary dependencies required.
What It Does
Intercepts every exec/bash tool call via OpenClaw's before_tool_call plugin event. Pipes the command through DCG (Dangerous Command Guard). Safe commands pass silently with zero overhead. Dangerous commands are blocked before execution.
Blocked (Unix): rm -rf ~, git push --force, git reset --hard, git clean -fd, git branch -D
Blocked (Windows): Remove-Item -Recurse -Force, rd /s /q, del /s, Format-Volume, reg delete HKLM
Allowed: ls, cat, echo, git status, npm install, dir, Get-ChildItem
Install
# After clawhub install dcg-guard:
bash install.sh
Or manually:
# 1. Install DCG binary
curl -sSL https://raw.githubusercontent.com/Dicklesworthstone/destructive_command_guard/master/install.sh | bash
# 2. Link plugin into OpenClaw
openclaw plugins install -l /path/to/dcg-guard
openclaw gateway restart
How It Works
- Agent calls
execwith a command - Plugin intercepts via
before_tool_call(runs before execution) - Command is checked against built-in rules (cross-platform, \x3C1ms, no subprocess)
- If no built-in match and DCG binary is installed, command is piped to DCG (~27ms)
- Safe: silent passthrough, agent never knows the plugin exists
- Dangerous:
{ block: true }returned to OpenClaw, command never executes
v1.1.0: Built-in rules work without the DCG binary. DCG binary is optional (adds extra unix rules). Windows fully supported out of the box.
Security
- No shell interpolation. Commands are passed to DCG via stdin using
execFileSync(notexecSync). No injection risk. - Fail-open. If DCG binary is missing or crashes, commands pass through. The plugin never deadlocks your agent.
- Zero dependencies. Only requires the DCG binary (single Go binary, no runtime deps).
Configuration
Optional, in openclaw.json under plugins.entries.dcg-guard.config:
{
"enabled": true,
"dcgBin": "/custom/path/to/dcg"
}
Default DCG path: ~/.local/bin/dcg
Override with env var: DCG_BIN=/path/to/dcg
Agent Instructions (optional)
Add to your workspace AGENTS.md:
When a command is blocked by DCG Guard, do NOT retry it.
Ask the user for explicit permission before attempting any alternative.
The block exists because the command is destructive or irreversible.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install dcg-guard - 安装完成后,直接呼叫该 Skill 的名称或使用
/dcg-guard触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
DCG Guard 是什么?
Hard-blocks dangerous shell commands (rm -rf, git push --force, etc.) before execution via OpenClaw's before_tool_call plugin hook. Zero noise on safe comman... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 768 次。
如何安装 DCG Guard?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install dcg-guard」即可一键安装,无需额外配置。
DCG Guard 是免费的吗?
是的,DCG Guard 完全免费(开源免费),可自由下载、安装和使用。
DCG Guard 支持哪些平台?
DCG Guard 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 DCG Guard?
由 StarenseN(@starensen)开发并维护,当前版本 v1.1.0。