safety-guard

safety-guard is a skill for Claude Code from majiang213/OpenClaw-MAS. It costs 23 tokens per session (443 once invoked), scanned D, original, MIT.

A safety layer for coding agents that warns before destructive commands and can limit edits to a chosen folder.

In plain words
What is it for?
Use it to review risky commands, freeze an agent’s edits to one directory, or combine both protections when working autonomously or handling migrations and deployments.
Why use it?
It reduces the risk of deleting data, discarding work, changing production systems, or modifying unrelated files during automated work.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: reads .claude/ paths; mentions Codex.

Good fit Use it to review risky commands, freeze an agent’s edits to one directory, or combine both protections when working autonomously or handling migrations and deployments.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/majiang213/openclaw-mas/safety-guard
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add majiang213/OpenClaw-MAS --skill safety-guard
Clone the repo
git clone --depth 1 https://github.com/majiang213/OpenClaw-MAS

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for safety-guard

README.md
[![agentmods](https://agentmods.dev/badge/skills/majiang213/openclaw-mas/safety-guard/github.svg)](https://agentmods.dev/skills/majiang213/openclaw-mas/safety-guard)
Your own site
<a href="https://agentmods.dev/skills/majiang213/openclaw-mas/safety-guard"><img src="https://agentmods.dev/badge/skills/majiang213/openclaw-mas/safety-guard/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for safety-guard

Your own site · 80×15
<a href="https://agentmods.dev/skills/majiang213/openclaw-mas/safety-guard"><img src="https://agentmods.dev/badge/skills/majiang213/openclaw-mas/safety-guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 443 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.00443
Opus 5 $0.00012 $0.00221
Sonnet 5 $0.00005 $0.00089
Haiku 4.5 $0.00002 $0.00044

Measured 8d ago against content hash 50328f1aada5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade D, and why

safety-guard scanned grade D with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

- sudo rm

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- rm -rf (especially /, ~, or project root)
ecc-skills/safety-guard/SKILL.md · 76 lines

What it actually says

Safety Guard — Prevent Destructive Operations

When to Use

  • When working on production systems
  • When agents are running autonomously (full-auto mode)
  • When you want to restrict edits to a specific directory
  • During sensitive operations (migrations, deploys, data changes)

How It Works

Three modes of protection:

Mode 1: Careful Mode

Intercepts destructive commands before execution and warns:

Watched patterns:
- rm -rf (especially /, ~, or project root)
- git push --force
- git reset --hard
- git checkout . (discard all changes)
- DROP TABLE / DROP DATABASE
- docker system prune
- kubectl delete
- chmod 777
- sudo rm
- npm publish (accidental publishes)
- Any command with --no-verify

When detected: shows what the command does, asks for confirmation, suggests safer alternative.

Mode 2: Freeze Mode

Locks file edits to a specific directory tree:

/safety-guard freeze src/components/

Any Write/Edit outside src/components/ is blocked with an explanation. Useful when you want an agent to focus on one area without touching unrelated code.

Mode 3: Guard Mode (Careful + Freeze combined)

Both protections active. Maximum safety for autonomous agents.

/safety-guard guard --dir src/api/ --allow-read-all

Agents can read anything but only write to src/api/. Destructive commands are blocked everywhere.

Unlock

/safety-guard off

Implementation

Uses PreToolUse hooks to intercept Bash, Write, Edit, and MultiEdit tool calls. Checks the command/path against the active rules before allowing execution.

Integration

  • Enable by default for codex -a never sessions
  • Pair with observability risk scoring in ECC 2.0
  • Logs all blocked actions to ~/.claude/safety-guard.log
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 76 lines · 23 tokens per session scan D 50328f1aada5

Subscribe to this mod's changes

safety-guard is a skill published in the GitHub repository majiang213/OpenClaw-MAS (5 stars, last pushed 5mo ago), licensed MIT. It adds 23 tokens to every session and 443 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it D with 2 findings (asks for root, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.