Install
$ agentstack add skill-momentmaker-kaijutsu-dcg Open-source listing — not yet scanned by AgentStack. Follow the source repository for install instructions.
Security review
⚠ Flagged1 finding(s); flagged for manual review. · v0.1.0 How review works →
- • Prompt-injection patterns
- • Secret / credential exfiltration
- • Dangerous shell & filesystem operations
- • Untrusted network calls
- • Known-malicious package signatures
- high Destructive filesystem operation.
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
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 /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 ":". 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
/.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.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: momentmaker
- Source: momentmaker/kaijutsu
- License: MIT
- Homepage: https://kaijutsu.dev/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.