ワンクリックで
safety-guardrails
Flags risky shell commands and unsafe tree ops.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Flags risky shell commands and unsafe tree ops.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Detects high-confidence security risks in code.
Surfaces the dojo's non-negotiable prime directives.
Activates the dojo framework at the start of a session.
Plans multi-step work before writing code.
Captures lessons and promotes recurring patterns.
Derives measurable NFRs from a parent business driver.
| name | safety-guardrails |
| description | Flags risky shell commands and unsafe tree ops. |
| tier | core |
| category | discipline |
| created_by | human |
| platforms | ["windows","macos","linux"] |
| tags | ["safety","guardrails","governance"] |
| author | Andreas Wasita (@andreaswasita) |
Gives the agent two invokable preflight checks before a dangerous action: a command guard that flags obviously-destructive commands (rm -rf /, force-push, reset --hard, dd, mkfs), and a tree guard that flags an unsafe working-tree state (mass deletions, or a dirty tree when a clean one is required). This is a heuristic speed bump, not a sandbox — it cannot parse shell grammar or stop execution, so it complements, never replaces, human confirmation.
git operation (force-push, hard reset, history rewrite).powershell Copilot tool to run the guard scripts.PATH (the guards share one stdlib core; the .sh/.ps1 are thin wrappers).git available for the tree guard (it degrades to a skip outside a repo).Use the powershell tool to invoke the guard before the risky action:
# Command guard — exit 1 means STOP and confirm
bash skills/safety-guardrails/scripts/safety-guard.sh command "rm -rf /"
# Tree guard — flag mass deletions or (optionally) any dirty tree
bash skills/safety-guardrails/scripts/safety-guard.sh tree --require-clean
On Windows, call the parity wrapper safety-guard.ps1 with the same verbs. Exit codes: 0 no concern, 1 flagged (stop and confirm), 2 usage error.
| Guard | Flags | Example trigger |
|---|---|---|
command | recursive force-delete of a root/home/system path | rm -rf /, rm -rf ~ |
command | force-push / history rewrite | git push --force, git filter-branch |
command | irreversible reset / clean | git reset --hard, git clean -fdx |
command | disk/device destruction | dd of=/dev/sda, mkfs, > /dev/sdb |
command | over-permissive mode | chmod -R 777 . |
tree | mass staged/pending deletions (≥ threshold) | a refactor that removed many files |
tree | dirty tree when --require-clean | uncommitted edits before a hard reset |
Pass the exact command string to the command guard with the powershell tool. If it exits 1, treat the listed reasons as a hard stop: confirm intent with the user and prefer a reversible alternative (a feature branch over a force-push, git revert over git reset --hard, a preview flag over a destructive one).
Before a bulk or destructive operation, run the tree guard. It reads git status and flags when the number of pending deletions meets the threshold (default 3, tune with --max-deletions). Add --require-clean when the next step assumes a pristine tree (for example, before a hard reset or a checkout that discards changes).
A flag is a checkpoint, not a veto. If the destructive action is genuinely intended and understood, state that explicitly and proceed; otherwise abort and choose the reversible path. Record the decision in tasks/todo.md when it affects the plan.
The detection rules live in skills/safety-guardrails/scripts/safety_guard.py as a single shared core. Add a new rule there (with a test in tests/test_safety_guard.py) so the .sh and .ps1 wrappers stay in parity automatically.
/bin/rm. A pass is the absence of an obvious flag, not a proof of safety.rm trips them — false positives train the agent to ignore the guard..sh/.ps1 are thin and must stay that way.1 (flagged) result was either resolved with a reversible alternative or explicitly confirmed.tests/test_safety_guard.py.