⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

hook-guard

@wavmson⭐ 0 stars

钩子守卫。为 Agent 操作添加安全防护层——文件修改前自动备份、危险命令执行前拦截确认、敏感操作自动告警通知用户。触发词:安全检查、hook guard、守卫、备份保护、安全模式、操作审计。也可在 AGENTS.md 中配置为始终生效。

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐ 0 on GitHubGitHub ↗

New / niche

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

🛡️ Hook Guard — 钩子守卫 Skill

给你的 AI Agent 装上安全气囊。危险操作拦截确认,重要文件自动备份,所有行为可审计追溯。


中文说明

这是什么?

AI Agent 拥有强大权限:读写文件、执行命令、发消息、改配置。但能力越强越容易出事:

  • 😱 Agent 误删了重要文件
  • 💥 一个 rm -rf 清空了项目目录
  • 📤 没确认就把消息发到了老板群
  • ⚙️ 改错配置导致服务挂了

Hook Guard 是 Agent 的安全防护层。三级钩子系统覆盖所有操作。

安装

通过 ClawHub 安装(推荐):

clawhub install hook-guard

从 GitHub 克隆:

git clone https://github.com/wavmson/openclaw-skill-hook-guard.git \
  ~/.openclaw/skills/hook-guard

安装后重启 Gateway:

openclaw gateway restart

三级防护体系

级别名称触发场景处理方式
🔴 Red危险拦截删除文件、sudo、发布到公开平台暂停执行,等待用户确认
🟡 Yellow自动备份修改配置、覆盖文件、改 cron备份后执行,通知用户
🟢 Green静默日志读取文件、搜索、查看信息只记录日志,不打扰

Red Hook 示例

Agent 准备执行危险操作时:

🔴 危险操作拦截
━━━━━━━━━━━━

操作:rm -rf /home/wavm/important-project/
影响:将永久删除 342 个文件
风险:不可逆操作

建议:
1. 改用 trash(可恢复)
2. 先备份到 /tmp/

等待确认(回复"继续"执行,"取消"放弃)

Yellow Hook 示例

修改配置文件时自动备份:

🟡 自动备份
文件:openclaw.json
备份:.hook-guard/backups/2026-04-02/openclaw.json.143022.bak
操作:修改 maxTokens 配置

守卫报告

说"守卫报告"或"guard report"查看统计:

🛡️ Hook Guard 报告(最近 24 小时)

🔴 拦截:2 次
🟡 备份:5 次(2.3 MB)
🟢 日志:47 条操作记录

最近拦截:
  - rm -rf /tmp/old-project/ → 改用 trash
  - sudo systemctl restart nginx → 确认后执行

设计原则

原则说明
🔒 不可绕过Red Hook 危险操作必须单次确认,即使用户说过"别问了"
💾 自动备份Yellow 操作自动保存原始状态,7 天自动清理
📝 全程可追溯所有操作记录审计日志,30 天保留
⚡ 不影响性能Green 日志异步写入,零延迟
🎚️ 可调级别用户可以升级或降级某些操作的防护等级

哪些操作会被拦截?

🔴 Red(必须确认):

  • 删除文件(rm、rm -rf)
  • 含 sudo 的命令
  • 停止系统服务
  • 清理 Docker 容器/镜像
  • 发送消息到新聊天
  • 发布到公开平台
  • 修改 DNS/域名
  • 操作生产环境

🟡 Yellow(自动备份):

  • 修改配置文件
  • 覆盖写入工作区文件
  • 修改 cron 定时任务
  • 更新数据库记录

🟢 Green(只记日志):

  • 读取文件
  • 搜索操作
  • 查看日历/任务
  • 网络搜索

与记忆保护链搭配

Skill职责
Smart Compact压缩前抢救信息
Session Resume断线后恢复进度
Memory-Dream定期整合长期记忆
Swarm Coord多 Agent 并行协作
Hook Guard操作安全防护

五个 Skill 形成完整的 Agent 安全运维体系:

  • 记忆不丢(Smart Compact + Memory-Dream)
  • 任务不断(Session Resume)
  • 效率不低(Swarm Coord)
  • 操作不炸(Hook Guard)

常见问题

Q: 会不会每次都弹确认很烦? A: 不会。只有 Red 级操作需要确认,日常读写都是 Green 级静默记录。

Q: 备份会不会占很多空间? A: 只备份被修改的单个文件,7 天自动清理,通常只占几 MB。

Q: 子 Agent 也受保护吗? A: 是的。Swarm Coord 启动的子 Agent 同样遵守 Hook Guard 规则。

Q: 能自定义哪些操作需要确认吗? A: 可以。在 AGENTS.md 中配置自定义规则,升级或降级操作等级。


English

The Problem

AI agents have powerful permissions — file read/write, command execution, message sending, config changes. With great power comes great risk:

  • Accidentally deleting important files
  • Running destructive commands without confirmation
  • Sending messages to wrong recipients
  • Breaking configurations

The Solution

Hook Guard adds a safety layer with three protection levels:

LevelNameTriggerAction
🔴 RedDangerousDelete, sudo, publishPause and ask user
🟡 YellowImportantConfig edits, overwritesAuto-backup, then proceed
🟢 GreenRoutineRead, search, browseSilent audit log

Install

clawhub install hook-guard

Or clone from GitHub:

git clone https://github.com/wavmson/openclaw-skill-hook-guard.git \
  ~/.openclaw/skills/hook-guard

How It Works

Before every operation:

  1. Classify: Red, Yellow, or Green?
  2. Red → Generate interception report → Wait for user confirmation
  3. Yellow → Auto-backup original state → Execute → Notify user
  4. Green → Log silently → Execute normally

Design Principles

PrincipleDescription
🔒 Non-bypassableRed operations always need per-operation confirmation
💾 Auto-backupYellow operations save original state (7-day retention)
📝 Full audit trailAll operations logged (30-day retention)
⚡ Zero overheadGreen logs are async, no performance impact
🎚️ CustomizableUsers can adjust protection levels per operation

The 5-Skill Agent Safety Stack

SkillProtects
Smart CompactConversation details
Session ResumeTask progress
Memory-DreamLong-term memory
Swarm CoordTeam efficiency
Hook GuardOperation safety

FAQ

Q: Will it interrupt me constantly? A: No. Only Red-level operations (deletions, sudo, publishing) need confirmation. Daily work is Green-level (silent).

Q: How much space do backups use? A: Only modified files are backed up. 7-day auto-cleanup keeps it under a few MB.

Q: Does it protect sub-agents too? A: Yes. Agents spawned by Swarm Coord follow the same Hook Guard rules.


Requirements

License

MIT

Author

@wavmson

// HOW IT'S BUILT

KEY FILES

SKILL.mdREADME.md

// REPO STATS

0 stars