返回顶部
c

clawguard利爪守卫配置

Install and configure the ClawGuard security plugin - an LLM-as-a-Judge guardrail that detects and blocks risky tool calls

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.1.5
安全检测
已通过
2,300
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

clawguard

技能名称: clawguard
详细描述:

ClawGuard 插件安装指南

ClawGuard 是一款安全插件,它采用大语言模型作为评判者的方式,在执行工具调用前进行评估,检测并可选地阻止高风险操作。

前置条件

安装 ClawGuard 前,请确保网关的聊天补全端点已启用:

bash
openclaw config set gateway.http.endpoints.chatCompletions.enabled true

安装

通过 npm 安装插件:

bash
openclaw plugins install @capsulesecurity/clawguard

安装完成后,重启网关以加载插件。

Docker 安装

如果在 Docker 中运行 OpenClaw:

bash

安装插件


docker compose run --rm openclaw-cli plugins install @capsulesecurity/clawguard

使用强制重建重启网关以重新加载环境变量

docker compose up -d --force-recreate openclaw-gateway

重要提示: 重启时务必使用 --force-recreate。仅使用 docker compose restart 不会重新加载环境变量。

验证安装

检查网关日志中是否出现初始化消息:

[clawguard] Initialized (logging: true, security: true, block: true, metrics: enabled)

配置

通过 openclaw config set plugins.clawguard.<选项> <值> 配置 ClawGuard:

选项默认值描述
enabledtrue启用/禁用插件
logToolCalls
true | 将工具调用 JSON 记录到网关日志 |
| securityCheckEnabled | true | 运行 LLM 安全评估 |
| blockOnRisk | true | 阻止高/严重风险的工具调用 |
| maxContextWords | 2000 | 用于评估的会话上下文词数限制 |
| timeoutMs | 15000 | 安全检查超时时间(毫秒) |
| gatewayHost | 127.0.0.1 | 用于 LLM 调用的网关主机 |
| gatewayPort | 18789 | 用于 LLM 调用的网关端口 |
| metricsEnabled | true | 启用匿名使用指标 |

配置示例

bash

禁用阻止(仅记录模式)


openclaw config set plugins.clawguard.blockOnRisk false

为较慢的模型增加超时时间

openclaw config set plugins.clawguard.timeoutMs 30000

禁用指标收集

openclaw config set plugins.clawguard.metricsEnabled false

网关认证

ClawGuard 会在内部调用网关的 /v1/chat/completions 端点。如果遇到 401 未授权错误:

  1. 1. 检查环境中的网关令牌是否与配置匹配:
bash # 检查环境变量 printenv OPENCLAWGATEWAYTOKEN

# 检查配置中的令牌
cat ~/.openclaw/openclaw.json | grep -A2 token

  1. 2. 如果令牌不匹配,请更新环境变量并重启网关。

对于 Docker,请确保 .env 文件中包含正确的 OPENCLAWGATEWAYTOKEN,并在重启时使用 --force-recreate。

故障排除

405 方法不允许

聊天补全端点未启用。请运行: bash openclaw config set gateway.http.endpoints.chatCompletions.enabled true

401 未授权

环境变量与配置中的令牌不匹配。请参阅上方网关认证部分。

插件未加载

  1. 1. 检查 openclaw plugins list 是否显示 clawguard
  2. 重启网关
  3. 检查网关日志中的错误信息

工作原理

ClawGuard 注册了一个 beforetoolcall 钩子,该钩子会:

  1. 1. 记录工具调用详情(如果启用了 logToolCalls)
  2. 将工具上下文发送给 LLM 进行安全评估
  3. 返回风险评估结果(无/低/中/高/严重)
  4. 如果风险为高或严重,则阻止执行(如果启用了 blockOnRisk)

安全评估使用您配置的 LLM 提供商,因此它可以与您在 OpenClaw 中设置的任何模型配合使用。

相关链接

  • - GitHub:https://github.com/capsulesecurity/clawguard
  • npm:https://www.npmjs.com/package/@capsulesecurity/clawguard

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 clawguard-1776419972 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 clawguard-1776419972 技能

通过命令行安装

skillhub install clawguard-1776419972

下载

⬇ 下载 clawguard v0.1.5(免费)

文件大小: 2.18 KB | 发布时间: 2026-4-17 19:45

v0.1.5 最新 2026-4-17 19:45
- Added detailed installation and configuration instructions for the ClawGuard plugin, including Docker support.
- Provided troubleshooting guidance for common issues (401/405 errors, plugin loading).
- Documented all available configuration options with descriptions and examples.
- Explained the plugin’s security evaluation workflow and how it integrates with OpenClaw.
- Included links to the ClawGuard GitHub and npm package for further reference.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部