Safe command execution for OpenClaw Agents with automatic danger pattern detection, risk assessment, user approval workflow, and audit logging. Use when agen...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install safe-exec或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install safe-exec⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/safe-exec/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: safe-exec description: Safe command execution for OpenClaw Agents with automatic danger pattern detection, risk assessment, user approval workflow, and audit logging. Use when agents need to execute shell commands that may be dangerous (rm -rf, dd, fork bombs, system directory modifications) or require human oversight. Provides multi-level risk assessment (CRITICAL/HIGH/MEDIUM/LOW), in-session notifications, pending request management, and non-interactive environment support for agent automation. metadata: { "openclaw": { "env": ["SAFE_EXEC_DISABLE", "OPENCLAW_AGENT_CALL", "SAFE_EXEC_AUTO_CONFIRM"], "writes": ["~/.openclaw/safe-exec/", "~/.openclaw/safe-exec-audit.log"], "network": false, "monitoring": false, "credentials": [] }, "requires": { "bins": ["jq"] }, "install": [ { "id": "git", "kind": "git", "url": "https://github.com/OTTTTTO/safe-exec.git", "label": "Clone from GitHub", }, ], } ---
Provides secure command execution capabilities for OpenClaw Agents with automatic interception of dangerous operations and approval workflow.
When called by OpenClaw agents in non-interactive environments:
Environment variables:
OPENCLAW_AGENT_CALL - Set by OpenClaw when agent executes commandsSAFE_EXEC_AUTO_CONFIRM - Manual override to auto-approve LOW/MEDIUM risk commandsSecurity Note: Agent mode does not disable safety checks. CRITICAL and HIGH risk commands are still intercepted, logged, and can be reviewed in audit trail.
The easiest way to install SafeExec:
Just say in your OpenClaw chat:
Help me install SafeExec skill from ClawdHub
OpenClaw will automatically download, install, and configure SafeExec for you!
If you prefer manual installation:
# Clone from GitHub
git clone https://github.com/OTTTTTO/safe-exec.git ~/.openclaw/skills/safe-exec
# Make scripts executable
chmod +x ~/.openclaw/skills/safe-exec/safe-exec*.sh
# Create symlinks to PATH (optional)
ln -s ~/.openclaw/skills/safe-exec/safe-exec.sh ~/.local/bin/safe-exec
ln -s ~/.openclaw/skills/safe-exec/safe-exec-*.sh ~/.local/bin/
After installation, simply say:
Enable SafeExec
SafeExec will start monitoring all shell commands automatically!
Once enabled, SafeExec automatically monitors all shell command executions. When a potentially dangerous command is detected, it intercepts the execution and requests your approval through in-session terminal notifications.
Architecture:
~/.openclaw/safe-exec/pending/~/.openclaw/safe-exec-audit.log~/.openclaw/safe-exec-rules.jsonEnable SafeExec:
Enable SafeExec
Turn on SafeExec
Start SafeExec
Once enabled, SafeExec runs transparently in the background. Agents can execute commands normally, and SafeExec will automatically intercept dangerous operations:
Delete all files in /tmp/test
Format the USB drive
SafeExec detects the risk level and displays an in-session prompt for approval.
CRITICAL: System-destructive commands (rm -rf /, dd, mkfs, fork bombs) HIGH: User data deletion or significant system changes (chmod 777, curl | bash) MEDIUM: Service operations or configuration changes (sudo, firewall modifications) LOW: Read operations and safe file manipulations
- Terminal: safe-exec-approve - List pending: safe-exec-list - Reject: safe-exec-reject
Example notification:
🚨 **Dangerous Operation Detected - Command Intercepted**
**Risk Level:** CRITICAL
**Command:** `rm -rf /tmp/test`
**Reason:** Recursive deletion with force flag
**Request ID:** `req_1769938492_9730`
ℹ️ This command requires user approval to execute.
**Approval Methods:**
1. In terminal: `safe-exec-approve req_1769938492_9730`
2. Or: `safe-exec-list` to view all pending requests
**Rejection Method:**
`safe-exec-reject req_1769938492_9730`
Environment variables for customization:
SAFE_EXEC_DISABLE - Set to '1' to globally disable safe-execOPENCLAW_AGENT_CALL - Automatically enabled in agent mode (non-interactive)SAFE_EXEC_AUTO_CONFIRM - Auto-approve LOW/MEDIUM risk commandsEnable SafeExec:
Enable SafeExec
After enabling, agents work normally:
Delete old log files from /var/log
SafeExec automatically detects this is HIGH risk (deletion) and displays an in-session approval prompt.
Safe operations pass through without interruption:
List files in /home/user/documents
This is LOW risk and executes without approval.
Check status:
safe-exec-list
View audit log:
cat ~/.openclaw/safe-exec-audit.log
Disable SafeExec globally:
Disable SafeExec
Or set environment variable:
export SAFE_EXEC_DISABLE=1
Found a bug? Have a feature request?
Please report issues at: 🔗 https://github.com/OTTTTTO/safe-exec/issues
We welcome community feedback, bug reports, and feature suggestions!
When reporting issues, please include:
grep "VERSION" ~/.openclaw/skills/safe-exec/safe-exec.sh)~/.openclaw/safe-exec-audit.logAll command executions are logged with:
Log location: ~/.openclaw/safe-exec-audit.log
What SafeExec does:
What SafeExec does NOT do:
...
安装 Safe Exec 后,可以对 AI 说这些话来触发它
Help me get started with Safe Exec
Explains what Safe Exec does, walks through the setup, and runs a quick demo based on your current project
Use Safe Exec to safe command execution for OpenClaw Agents with automatic danger pa...
Invokes Safe Exec with the right parameters and returns the result directly in the conversation
What can I do with Safe Exec in my ai agent & automation workflow?
Lists the top use cases for Safe Exec, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/safe-exec/ 目录(个人级,所有项目可用),或 .claude/skills/safe-exec/(项目级)。重启 AI 客户端后,用 /safe-exec 主动调用,或让 AI 根据上下文自动发现并使用。
Safe Exec 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Safe Exec 可免费安装使用。请查阅仓库了解许可证信息。
Safe command execution for OpenClaw Agents with automatic danger pattern detection, risk assessment, user approval workflow, and audit logging. Use when agen...
Safe Exec 属于「AI Agent & Automation」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my ai agent & automation tasks using Safe Exec
Identifies repetitive steps in your workflow and sets up Safe Exec to handle them automatically