dcg
Skill3 starsChanged 6 months agoMITView on GitHub
Destructive Command Guard. Installs a pre-tool-use hook that blocks unrecoverable shell commands (rm -rf /, git reset --hard, git clean -fd, rm of .env / credentials, force-pushing to main, fork bombs, shred / dd, etc.) before the agent executes them. Use when the user says "install dcg", "destructive command guard", "guard rails for destructive commands", or invokes /dcg.
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
2 other projects use a version of this.
Adopted by
Most recently taken up by
- Dicklesworthstone/destructive_command_guardtheir own version, first seen Aug 26, 2026
- Dicklesworthstone/agent_flywheel_clawdbot_skills_and_integrationstheir own version, first seen Jun 19, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Dicklesworthstone/destructive_command_guard★ 6.3ksame name
- Dicklesworthstone/agent_flywheel_clawdbot_skills_and_integrations★ 73same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- code-simplificationSkill
- editorial-reviewSkill
- journalSkill
- readme-updateSkill
- security-and-hardeningSkill
- session-retroSkill
- autopilotSkill
- blunder-huntSkill
- brainstormSkill
- convergence-detectSkill
- deslopSkill
- dispatch-parallelSkill
- doc-reviewSkill
- dreamSkill
- incremental-implementationSkill
- planning-and-task-breakdownSkill
- polishSkill
- pr-reviewSkill
- refactor-planSkill
- scope-checkSkill
- security-auditSkill
- spec-driven-developmentSkill
- unstuckSkill
- verification-before-completionSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 84
After install, in any project where DCG is registered:
- Very specific: line 101
The hook script timeout is 5 seconds: If jq is slow or stdin is malformed, the hook exits and the action proceeds (fail-open).
- Distinctive: line 102
DCG patterns are not exhaustive: Use it alongside, not instead of, repository-level safeguards (commit signing, branch protection, CI …
- Very specific: line 107
No per-project pattern overrides yet.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DCG — Destructive Command Guard
A pre-tool-use hook that intercepts every shell command the agent is about to run. If the command matches a known destructive pattern, the hook returns a non-zero exit and a stopReason payload, blocking execution.
What it blocks
rm -rf /— at rootsudo ... rm -rf /— same with sudogit reset --hard— irreversible discard of local workgit clean -fd— force-delete untracked files (commonly nukes.env, generated configs)git push --forcetomain/master— overwriting upstream history on protected branchesrmof.env/ credentials /.pem/ SSH keysshred/dd— disk destruction:(){ :|:& };:— fork bombchmod 777on$HOME— permission disasterfind $HOME -delete— bulk deletion in home
The full pattern list is in hooks/dcg.sh. New patterns can be added by appending to the patterns array.
What it does NOT block
By design DCG is a floor, not a ceiling:
rm -rf <project>/build— project-local cleanup is allowedgit reset HEAD~1— non---hardresets are recoverablerm .DS_Store— junk-file removal is allowed- Anything outside the agent's shell tool
This is intentional. Over-blocking causes alert fatigue; agents start either circumventing or losing trust. DCG focuses on the truly unrecoverable cases.
How install wires it up
jutsu install dcg registers a pre-tool-use hook with matcher Bash for every active agent:
| Agent | Settings file | Native event |
| Claude Code | ~/.claude/settings.json | PreToolUse |
| OpenAI Codex CLI | ~/.codex/config.toml | PreToolUse |
| Google Antigravity CLI | ~/.antigravity/settings.json | BeforeTool |
Each entry is tagged with _kaijutsu: skill:dcg:hook:block-destructive-shell so jutsu remove dcg can clean up exactly what we added without disturbing user-authored hooks.
The script at hooks/dcg.sh is platform-agnostic POSIX bash — it reads the hook JSON from stdin, extracts the command field via jq (with a regex fallback if jq is absent), and matches against the pattern list.
How agents experience a block
When DCG fires:
{
"continue": false,
"stopReason": "dcg blocked: rm -rf /",
"matched_command": "rm -rf /"
}Plus a non-zero exit. Each agent's hook framework propagates this differently:
- Claude Code: surfaces
stopReasonto the model so the assistant knows why and can react (apologize, propose a safer alternative). - Codex: returns the
"blocked"status to the model. - Antigravity: similar — the
BeforeToolinterception aborts the call.
In every case the destructive shell never runs.
Customization
Edit hooks/dcg.sh to add or remove patterns:
patterns+=(
"rm of database backups:rm.*\\.sql\\.bak"
)The format is "<label>:<regex>". The script grep -Es each regex against the proposed command.
Testing locally
After install, in any project where DCG is registered:
# In any agent session, ask:
> please run `rm -rf /tmp/foo`
# DCG should let it through (limited to /tmp/foo, not /).
> please run `rm -rf /`
# DCG should block. The agent will report "dcg blocked: rm -rf /".Hard rules
- Never bypass DCG by editing settings.json directly while an agent is running. Restart the agent after disabling.
- DCG is not a security boundary against malicious skills. A malicious skill could ship its own hooks that disable DCG. Treat DCG as a guardrail against agent mistakes, not against adversaries with skill-install access.
- The hook script timeout is 5 seconds. If
jqis slow or stdin is malformed, the hook exits and the action proceeds (fail-open). v0.4 may switch to fail-closed. - DCG patterns are not exhaustive. Use it alongside, not instead of, repository-level safeguards (commit signing, branch protection, CI checks).
v0 limitations
- Patterns only match shell strings — agents that use direct file-edit tools (Claude's Edit tool, Codex's apply_patch) bypass DCG. Future v0.4: extend matchers to
Edit/Writetools with sensitive-path patterns (.env,credentials,id_rsa). - No per-project pattern overrides yet. v0.4 will read
<project>/.kaijutsu/dcg-patterns.txtas an addendum. - jq dependency is best-effort. If
jqisn't installed, the script greps over the full JSON payload — works but slightly less precise.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

