Agent Safety
Automated safety tools for autonomous AI agents. The principle: don't rely on prompts for safety — automate enforcement.
All scripts are in this skill's scripts/ directory. When OpenClaw loads this skill, resolve paths relative to this file's location.
Pre-Publish Security Scan
Scans files for secrets, PII, and internal paths before publishing.
CODEBLOCK0
Detects:
- - API keys (AWS, GitHub, Anthropic, OpenAI, generic patterns)
- Private keys (PEM blocks), Bearer tokens, hardcoded passwords
- Email addresses, phone numbers, SSNs, credit card patterns
- Physical addresses, name fields
- Home directory paths, internal config paths
Exit 0 = clean. Exit 1 = blocking issues found, do not publish.
Git Pre-Commit Hook
Install once per repo. Automatically scans staged files on every commit:
CODEBLOCK1
- - Scans staged content (what's being committed, not working tree)
- Blocks commit if secrets or SSNs found
- Flags PII for review
- Only bypassed with explicit INLINECODE1
Install this on every repo you work with. It's the real guardrail.
Health Check
System monitoring for disk, workspace, security, and updates:
CODEBLOCK2
Checks: Disk usage, workspace size, memory file growth, OpenClaw version, macOS updates, firewall status, SIP status.
Run periodically (every few heartbeats). Watch for warnings.
Rules
- 1. Run pre-publish scan before ANY external publish action
- Install pre-commit hook on EVERY repo you work with
- Blocking issues (secrets, SSNs) must be fixed — no override
- Review items (emails, paths) need human judgment
- If a secret was ever committed, it's compromised — rotate immediately
技能名称: agent-safety
智能体安全
面向自主AI智能体的自动化安全工具。原则:不要依赖提示词保障安全——而是自动执行强制措施。
所有脚本均位于本技能的 scripts/ 目录下。当OpenClaw加载此技能时,请根据本文件所在位置解析相关路径。
发布前安全扫描
在发布前扫描文件中的密钥、个人身份信息(PII)及内部路径。
bash
bash scripts/pre-publish-scan.sh <文件或目录>
检测内容:
- - API密钥(AWS、GitHub、Anthropic、OpenAI及通用模式)
- 私钥(PEM块)、Bearer令牌、硬编码密码
- 电子邮件地址、电话号码、社会安全号码(SSN)、信用卡模式
- 物理地址、姓名字段
- 主目录路径、内部配置路径
退出码0 = 安全。退出码1 = 发现阻塞性问题,请勿发布。
Git预提交钩子
每个仓库安装一次。每次提交时自动扫描暂存文件:
bash
bash scripts/install-hook.sh <仓库路径>
- - 扫描暂存内容(即正在提交的内容,而非工作目录)
- 若发现密钥或SSN则阻止提交
- 标记PII以供审查
- 仅可通过显式 git commit --no-verify 绕过
在你使用的每个仓库上安装此钩子。 这是真正的安全护栏。
健康检查
针对磁盘、工作区、安全性和更新的系统监控:
bash
bash scripts/health-check.sh
检查项: 磁盘使用率、工作区大小、内存文件增长、OpenClaw版本、macOS更新、防火墙状态、系统完整性保护(SIP)状态。
定期运行(每隔几次心跳)。留意警告信息。
规则
- 1. 在任何外部发布操作前,必须运行发布前扫描
- 在你使用的每个仓库上安装预提交钩子
- 阻塞性问题(密钥、SSN)必须修复——不可覆盖
- 审查项(电子邮件、路径)需要人工判断
- 若密钥曾被提交过,则视为已泄露——立即轮换