Skill: zxz333zxz/jjy-agentguard (version 1.8.2)

--- name: agentguard description: "AgentGuard security engine — intercept dangerous operations, audit all actions, protect sensitive data. All commands/file/network operations go through ag_* tools for rule engine review. AgentGuard 安全引擎 — 拦截危险操作、审计所有行为、保护敏感数据。所有命令/文件/网络操作通过 ag_* 工具经规则引擎审核后执行。" homepage: https://www.agentguard.site user-invocable: true command-dispatch: tool command-tool: ag_status command-arg-mode: raw metadata: { "openclaw": { "emoji": "🛡️", "requires": { "bins": ["agentguard"] }, "env": { "AGENTGUARD_DAEMON_PORT": { "description": "AgentGuard daemon dashboard port", "default": "19821" } }, "os": ["darwin", "linux"] } } --- # AgentGuard Security Engine You now have the **AgentGuard Security Engine** integrated. All Agent operations must pass security review — use `ag_*` tools instead of native operations. > This is a general-purpose AI Agent security engine for intercepting and auditing command execution, file I/O, and network access. It does not handle any form of digital asset management or financial transactions. ## Security Architecture AgentGuard provides **four layers of protection** to ensure agents cannot bypass security controls: 1. **Gateway Tool Blocking (L1)** — During setup, `setup.sh` installs the AgentGuard binary to a system path and starts the daemon. Users must manually add `tools.deny` entries to `openclaw.json` to disable native `exec`/`write`/`edit`/`apply_patch`/`process` tools at the Gateway layer. Agents are **physically unable** to call blocked native tools. **Rollback: manually delete the `tools.deny` entries in `openclaw.json` to restore native tools.** 2. **Rule Engine (L2)** — All `ag_*` tool calls are reviewed against command blacklists/whitelists, file path controls, and domain whitelists. 3. **Redaction Engine (L3)** — Automatically filters API credentials, auth tokens, SSH keys, and 15 categories of sensitive information (bidirectional input+output redaction). 4. **Audit Log (L4)** — All operations are logged to local SQLite, viewable in the Dashboard, tamper-proof. > ⚠️ Native dangerous tools are blocked at the Gateway layer. You can only use the `ag_*` tools listed below to perform operations. ## Security Tools ### Operation Tools (replace native tools) | ag_* Tool | Replaces | Security | |-----------|----------|----------| | `ag_execute_command` | `exec` / `process` | Command blacklist + dangerous command interception + output redaction | | `ag_read_file` | `read` | Sensitive path blocking (.ssh/, system credential store, browser data) + content redaction | | `ag_write_file` | `write` / `edit` / `apply_patch` | Path access control + write content redaction check | | `ag_list_directory` | `read` (directory) | Directory access control | | `ag_http_request` | `browser` / network tools | Domain whitelist + data exfiltration prevention | ### Inspection Tools | ag_* Tool | Purpose | |-----------|---------| | `ag_skill_check` | Check if a skill/plugin is on the security whitelist | | `ag_status` | View engine status: mode / audit stats / Panic state | ### Control Tools | ag_* Tool | Purpose | |-----------|---------| | `ag_panic` | Emergency stop — immediately reject all subsequent operations | | `ag_resume` | Resume normal operation | ## Usage Rules 1. **Must use `ag_*` tools** for all command, file, and network operations. Do not use native `exec`, `read`, `write`, `apply_patch`, `process` to bypass security. 2. When `ag_*` returns `Intercepted`, **do not attempt to bypass** — inform the user the operation was blocked and why. 3. When returning `Awaiting Approval`, tell the user to approve in the Dashboard. 4. If AgentGuard daemon is not running (connection failed), prompt the user: - Install: run `setup.sh` in the skill directory (installs from local binary, no network download) - Start: `agentguard daemon start` 5. Use `ag_status` anytime to check current security state. 6. Use `ag_panic` for emergency stop when suspicious behavior is detected. ## Security Modes - **enforce** — Violations are rejected immediately - **supervised** — Suspicious operations pause for user approval - **permissive** — Audit logging only, no blocking ## Dashboard Audit logs viewable at: **http://127.0.0.1:19821** Features: real-time operation timeline / audit statistics / rule configuration / one-click Panic ## Uninstall & Rollback 1. `agentguard daemon stop` — stop the daemon 2. Delete the `tools.deny` entries in `openclaw.json` 3. `rm /usr/local/bin/agentguard` — remove the binary --- # AgentGuard 安全引擎 你现在集成了 **AgentGuard 安全引擎**。所有 Agent 操作必须经过安全审核，你需要使用 `ag_*` 系列工具替代原生操作。 > 本工具为通用 AI Agent 安全防护引擎，用于拦截和审计 Agent 的命令执行、文件读写及网络访问操作，不涉及任何形式的数字资产管理或金融交易功能。 ## 安全架构 AgentGuard 通过 **四层防护** 确保 Agent 无法绕过安全监管： 1. **Gateway 工具封锁 (L1)** — 安装时 `setup.sh` 将 AgentGuard 二进制文件安装到系统路径并启动守护进程。用户需在 `openclaw.json` 中手动添加 `tools.deny` 条目以在 Gateway 层禁用原生 `exec`/`write`/`edit`/`apply_patch`/`process` 工具。Agent **物理上无法调用**被封锁的原生工具。**回滚方式：手动删除 `openclaw.json` 中的 `tools.deny` 条目即可恢复原生工具。** 2. **规则引擎 (L2)** — 所有 `ag_*` 工具调用经命令黑白名单、文件路径控制、域名白名单审核 3. **脱敏引擎 (L3)** — 自动过滤 API 凭证、认证令牌、SSH 密钥等 15 类敏感信息（输入+输出双向脱敏） 4. **审计日志 (L4)** — 所有操作记录到本地 SQLite，可在 Dashboard 查看，不可篡改 > ⚠️ 原生危险工具已在 Gateway 层被封锁，你只能使用下方 `ag_*` 工具执行操作。 ## 安全工具 ### 操作类 (替代原生工具) | ag_* 工具 | 替代原生工具 | 安全能力 | |-----------|-------------|---------| | `ag_execute_command` | `exec` / `process` | 命令黑白名单 + 危险命令拦截 + 输出脱敏 | | `ag_read_file` | `read` | 敏感路径拦截 (.ssh/, 系统凭证存储, 浏览器数据) + 内容脱敏 | | `ag_write_file` | `write` / `edit` / `apply_patch` | 路径访问控制 + 写入内容脱敏检查 | | `ag_list_directory` | `read` (目录) | 目录访问控制 | | `ag_http_request` | `browser` / 网络工具 | 域名白名单 + 数据外泄防护 | ### 检查类 | ag_* 工具 | 用途 | |-----------|------| | `ag_skill_check` | 检查 Skill/插件是否在安全白名单中 | | `ag_status` | 查看引擎状态：运行模式 / 审计统计 / Panic 状态 | ### 控制类 | ag_* 工具 | 用途 | |-----------|------| | `ag_panic` | 紧急暂停 — 立即拒绝所有后续操作 | | `ag_resume` | 恢复正常运行 | ## 使用规则 1. **必须使用 `ag_*` 工具**执行所有命令、文件和网络操作。不得使用 `exec`、`read`、`write`、`apply_patch`、`process` 等原生工具绕过安全检查。 2. 当 `ag_*` 工具返回 `拦截` 信息时，**不要尝试绕过**，向用户说明操作被安全策略拦截及原因。 3. 当返回 `等待审批` 时，告知用户正在等待审批，请在 Dashboard 中操作。 4. 如果 AgentGuard daemon 未运行（连接失败），提示用户： - 安装: 运行 skill 目录下的 `setup.sh`（从本地 binary 安装，无需网络下载） - 启动: `agentguard daemon start` 5. 可以随时使用 `ag_status` 查看当前安全状态。 6. 发现可疑行为或用户要求时，使用 `ag_panic` 紧急暂停。 ## 安全模式 - **enforce (强制拦截)** — 违反规则的操作直接拒绝 - **supervised (监督审批)** — 可疑操作暂停等待用户审批 - **permissive (宽松放行)** — 仅记录审计日志，不拦截 ## Dashboard 所有操作的审计日志可在本地 Dashboard 查看：**http://127.0.0.1:19821** Dashboard 提供：实时操作时间线 / 审计统计图表 / 规则配置 / 一键 Panic ## 卸载与回滚 1. `agentguard daemon stop` 停止守护进程 2. 删除 `openclaw.json` 中的 `tools.deny` 条目 3. `rm /usr/local/bin/agentguard` 移除 binary

path: bin/checksums.txt
content: bbe7f613b18360b3e2dfb276a97ebc75c38361aa2cbdbc33e25f291a38081040  agentguard-arm64


path: index.js
content: /**
 * AgentGuard Plugin for OpenClaw
 *
 * 将 AgentGuard 安全引擎集成到 OpenClaw，代理所有工具调用：
 * - execute_command → 经 AgentGuard 规则引擎审核后执行
 * - read_file / write_file → 路径黑白名单 + 脱敏过滤
 * - list_directory → 目录访问控制
 * - http_request → 域名白名单过滤
 * - skill_check → Skill 白名单校验
 *
 * 所有操作记录到 AgentGuard 审计日志，Dashboard: http://127.0.0.1:19821
 *
 * Plugin 规范参考: https://docs.openclaw.ai/tools/plugin
 * Agent Tools 参考: https://docs.openclaw.ai/plugins/agent-tools
 */

import http from "http";

// --- 默认配置 (可被 openclaw.plugin.json configSchema 覆盖) ---
const DEFAULT_CONFIG = {
  daemonHost: "127.0.0.1",
  daemonPort: 19821,
  healthCheckInterval: 30,
  autoReconnect: true,
};

// --- 插件状态 ---
let pluginConfig = { ...DEFAULT_CONFIG };
let daemonConnected = false;
let healthCheckTimer = null;

// --- HTTP helper ---
function agRequest(method, path, body, customTimeout) {
  return new Promise((resolve, reject) => {
    const opts = {
      hostname: pluginConfig.daemonHost,
      port: pluginConfig.daemonPort,
      path,
      method,
      timeout: customTimeout || (method === "GET" ? 5000 : 15000),
    };

    if (body) {
      opts.headers = {
        "Content-Type": "application/json",
        "Content-Length": Buffer.byteLength(JSON.stringify(body)),
      };
    }

    const req = http.request(opts, (res) => {
      let chunks = "";
      res.on("data", (c) => (chunks += c));
      res.on("end", () => {
        try {
          const data = JSON.parse(chunks);
          // HTTP 4xx/5xx 视为业务错误
          if (res.statusCode >= 400) {
            resolve({ error: data.error || data.message || `HTTP ${res.statusCode}`, _status: res.statusCode });
          } else {
            resolve(data);
          }
        } catch {
          resolve({ raw: chunks, _status: res.statusCode });
        }
      });
    });
    req.on("error", reject);
    req.on("timeout", () => {
      req.destroy();
      reject(new Error("AgentGuard daemon 连接超时"));
    });
    if (body) req.write(JSON.stringify(body));
    req.end();
  });
}

function agGet(path) {
  return agRequest("GET", path);
}
function agPost(path, body) {
  return agRequest("POST", path, body);
}

// --- AgentGuard tool proxy ---
async function callTool(toolName, params) {
  const res = await agPost("/api/tool/call", { tool: toolName, input: params });

  // If review required, return prompt for Agent to pause and retry
  if (res.review_required && res.audit_id) {
    const aid = res.audit_id;
    const timeout = res.timeout || 60;
    return {
      _needsApproval: true,
      text: [
        `⚠️ APPROVAL REQUIRED — 此操作需用户在 AgentGuard Dashboard 人工审批。`,
        ``,
        `📋 审批流程:`,
        `  1. 用户在 Dashboard 审批队列中 批准/拒绝 此操作`,
        `  2. 审批通过后，请使用完全相同的参数重新调用本工具，并额外添加参数 _audit_id: "${aid}"`,
        `  3. 若 ${timeout}s 内未审批则自动超时拒绝`,
        ``,
        `⏸️ 请暂停当前任务，告知用户需要审批，等用户确认后再重试。`,
        `Dashboard: http://${pluginConfig.daemonHost}:${pluginConfig.daemonPort}`,
      ].join('\n'),
    };
  }

  return res;
}

// --- Daemon 健康检查 ---
async function checkDaemonHealth(logger) {
  try {
    const status = await agGet("/api/status");
    if (status.version) {
      if (!daemonConnected) {
        daemonConnected = true;
        if (logger) logger.info(`[AgentGuard] daemon 已连接 v${status.version} mode=${status.mode}`);
      }
      return true;
    }
  } catch {
    if (daemonConnected) {
      daemonConnected = false;
      if (logger) logger.warn("[AgentGuard] daemon 连接断开");
    }
  }
  return false;
}

// --- 统一结果格式化 ---
function formatResult(res) {
  if (res.error) {
    return {
      content: [{ type: "text", text: `\ud83d\udeab AgentGuard \u62e6\u622a: ${res.error}` }],
      isError: true,
    };
  }
  if (res._needsApproval) {
    return { content: [{ type: "text", text: res.text }] };
  }
  const text = res.result || res.output || res.content || JSON.stringify(res, null, 2);
  return { content: [{ type: "text", text }] };
}

function formatError(e) {
  return {
    content: [{
      type: "text",
      text: `⚠️ AgentGuard daemon 未响应: ${e.message}\n` +
            `  启动命令: agentguard daemon start\n` +
            `  安装命令: 运行 skill 目录下的 setup.sh`,
    }],
    isError: true,
  };
}

// ====================================================
// Plugin entry point
// OpenClaw 插件标准接口: export default function(api)
// 参考: https://docs.openclaw.ai/plugins/agent-tools
// ====================================================
export default function (api) {
  // --- 读取插件配置 ---
  if (api.config) {
    pluginConfig = { ...DEFAULT_CONFIG, ...api.config };
  }
  const logger = api.logger || null;

  // --- 注册后台健康检查服务 ---
  // 参考: https://docs.openclaw.ai/tools/plugin#register-background-services
  if (api.registerService) {
    api.registerService({
      id: "agentguard-health",
      start: () => {
        if (logger) logger.info("[AgentGuard] 健康检查服务启动");
        checkDaemonHealth(logger);
        healthCheckTimer = setInterval(
          () => checkDaemonHealth(logger),
          (pluginConfig.healthCheckInterval || 30) * 1000
        );
      },
      stop: () => {
        if (healthCheckTimer) {
          clearInterval(healthCheckTimer);
          healthCheckTimer = null;
        }
        if (logger) logger.info("[AgentGuard] 健康检查服务停止");
      },
    });
  }

  // --- 注册 Gateway RPC 方法 ---
  // 允许其他插件或外部调用查询 AgentGuard 状态
  // 参考: https://docs.openclaw.ai/tools/plugin#register-gateway-rpc-methods
  if (api.registerGatewayMethod) {
    api.registerGatewayMethod("agentguard.status", async ({ respond }) => {
      try {
        const status = await agGet("/api/status");
        respond(true, { connected: true, ...status });
      } catch (e) {
        respond(false, { connected: false, error: e.message });
      }
    });

    api.registerGatewayMethod("agentguard.health", async ({ respond }) => {
      respond(true, { connected: daemonConnected, config: pluginConfig });
    });
  }

  // ============================================
  // 操作类工具 — 替代原生 exec/read/write
  // ============================================

  // Tool: ag_execute_command — 替代 exec / process
  api.registerTool({
    name: "ag_execute_command",
    description:
      "通过 AgentGuard 安全引擎执行 Shell 命令。命令经规则引擎审核，危险命令自动拦截，输出经脱敏引擎过滤敏感信息。替代原生 exec 工具。",
    parameters: {
      type: "object",
      properties: {
        command: { type: "string", description: "要执行的 Shell 命令" },
        cwd: { type: "string", description: "工作目录（可选）" },
        timeout: { type: "integer", description: "超时秒数，默认 30", default: 30 },
      },
      required: ["command"],
    },
    async execute(_id, params) {
      try {
        const res = await callTool("execute_command", {
          command: params.command,
          cwd: params.cwd || "",
          timeout: params.timeout || 30,
        });
        return formatResult(res);
      } catch (e) {
        return formatError(e);
      }
    },
  });

  // Tool: ag_read_file — 替代 read
  api.registerTool({
    name: "ag_read_file",
    description:
      "通过 AgentGuard 安全引擎读取文件。敏感路径 (~/.ssh, /etc/shadow, 浏览器数据等) 自动拦截，文件内容经脱敏引擎过滤 API 凭证/认证令牌/SSH 密钥。替代原生 read 工具。",
    parameters: {
      type: "object",
      properties: {
        path: { type: "string", description: "文件绝对路径或 ~ 开头路径" },
        offset: { type: "integer", description: "起始行号 (1-indexed)" },
        limit: { type: "integer", description: "读取行数" },
      },
      required: ["path"],
    },
    async execute(_id, params) {
      try {
        const input = { path: params.path };
        if (params.offset) input.offset = params.offset;
        if (params.limit) input.limit = params.limit;
        const res = await callTool("read_file", input);
        return formatResult(res);
      } catch (e) {
        return formatError(e);
      }
    },
  });

  // Tool: ag_write_file — 替代 write / edit / apply_patch
  api.registerTool({
    name: "ag_write_file",
    description:
      "通过 AgentGuard 安全引擎写入文件。敏感路径自动拦截，写入内容经脱敏引擎检查防止泄露密钥。替代原生 write / edit / apply_patch 工具。",
    parameters: {
      type: "object",
      properties: {
        path: { type: "string", description: "文件绝对路径" },
        content: { type: "string", description: "文件内容" },
      },
      required: ["path", "content"],
    },
    async execute(_id, params) {
      try {
        const res = await callTool("write_file", {
          path: params.path,
          content: params.content,
        });
        if (!res.error && !res.pending) {
          return { content: [{ type: "text", text: res.result || `✅ 文件已写入: ${params.path}` }] };
        }
        return formatResult(res);
      } catch (e) {
        return formatError(e);
      }
    },
  });

  // Tool: ag_list_directory — 替代 read (目录)
  api.registerTool({
    name: "ag_list_directory",
    description:
      "通过 AgentGuard 安全引擎列出目录内容。受路径访问控制保护，敏感目录自动拦截。",
    parameters: {
      type: "object",
      properties: {
        path: { type: "string", description: "目录路径" },
      },
      required: ["path"],
    },
    async execute(_id, params) {
      try {
        const res = await callTool("list_directory", { path: params.path });
        return formatResult(res);
      } catch (e) {
        return formatError(e);
      }
    },
  });

  // Tool: ag_http_request — 替代 browser / 网络工具
  api.registerTool({
    name: "ag_http_request",
    description:
      "通过 AgentGuard 安全引擎发起 HTTP 请求。仅允许白名单域名，自动拦截未授权的外部请求，防止数据外泄。替代原生网络工具。",
    parameters: {
      type: "object",
      properties: {
        method: { type: "string", enum: ["GET", "POST", "PUT", "DELETE"], description: "HTTP 方法" },
        url: { type: "string", description: "请求 URL" },
        headers: { type: "object", description: "请求头" },
        body: { type: "string", description: "请求体" },
      },
      required: ["method", "url"],
    },
    async execute(_id, params) {
      try {
        const res = await callTool("http_request", {
          method: params.method,
          url: params.url,
          headers: params.headers,
          body: params.body,
        });
        return formatResult(res);
      } catch (e) {
        return formatError(e);
      }
    },
  });

  // ============================================
  // 检查类工具
  // ============================================

  // Tool: ag_skill_check
  api.registerTool({
    name: "ag_skill_check",
    description:
      "检查指定 Skill/插件是否在 AgentGuard 安全白名单中。未通过白名单的 Skill 将被标记为不可信。",
    parameters: {
      type: "object",
      properties: {
        identifier: { type: "string", description: "Skill 标识符，例如 @anthropic/claude-code" },
        name: { type: "string", description: "Skill 名称（可选）" },
      },
      required: ["identifier"],
    },
    async execute(_id, params) {
      try {
        const res = await callTool("skill_check", {
          identifier: params.identifier,
          name: params.name || "",
        });
        if (res.error) {
          return {
            content: [{ type: "text", text: `🚫 Skill 未通过安全检查: ${res.error}` }],
            isError: true,
          };
        }
        return { content: [{ type: "text", text: res.result || `✅ Skill ${params.identifier} 在白名单中` }] };
      } catch (e) {
        return formatError(e);
      }
    },
  });

  // Tool: ag_status
  api.registerTool({
    name: "ag_status",
    description:
      "查看 AgentGuard 安全引擎状态：版本、运行模式、审计统计、Panic 状态。用户可以随时调用查看安全概况。",
    parameters: { type: "object", properties: {} },
    async execute() {
      try {
        const status = await agGet("/api/status");
        const modeLabel = { enforce: "强制拦截", supervised: "监督审批", permissive: "宽松放行" };
        const lines = [
          `🛡️ AgentGuard 安全引擎`,
          ``,
          `  版本:   v${status.version}`,
          `  模式:   ${modeLabel[status.mode] || status.mode}`,
          `  状态:   ${status.panic ? "🔴 已暂停 (Panic)" : "🟢 正常运行"}`,
          `  PID:    ${status.pid || "-"}`,
          ``,
          `  📊 审计统计`,
          `  总操作:  ${status.audit_total || 0}`,
          `  已拦截:  ${status.audit_denied || 0}`,
          ``,
          `  🔗 Dashboard: http://${pluginConfig.daemonHost}:${pluginConfig.daemonPort}`,
        ];
        return { content: [{ type: "text", text: lines.join("\n") }] };
      } catch (e) {
        return {
          content: [{
            type: "text",
            text: `⚠️ AgentGuard daemon 未运行\n\n` +
                  `  启动: agentguard daemon start\n` +
                  `  安装: 运行 skill 目录下的 setup.sh\n` +
                  `  文档: https://www.agentguard.site`,
          }],
          isError: true,
        };
      }
    },
  });

  // ============================================
  // 控制类工具
  // ============================================

  // Tool: ag_panic
  api.registerTool({
    name: "ag_panic",
    description:
      "🚨 紧急暂停 AgentGuard — 立即拒绝所有后续 Agent 操作。当发现异常或可疑行为时使用。",
    parameters: { type: "object", properties: {} },
    async execute() {
      try {
        await agPost("/api/panic", {});
        return {
          content: [{ type: "text", text: "🔴 AgentGuard 已紧急暂停，所有后续操作将被拦截。\n   恢复命令: 调用 ag_resume 或在 Dashboard 中恢复" }],
        };
      } catch (e) {
        return {
          content: [{ type: "text", text: `⚠️ Panic 操作失败: ${e.message}` }],
          isError: true,
        };
      }
    },
  });

  // Tool: ag_resume
  api.registerTool({
    name: "ag_resume",
    description:
      "恢复 AgentGuard 正常运行，解除 Panic 暂停状态。",
    parameters: { type: "object", properties: {} },
    async execute() {
      try {
        await agPost("/api/resume", {});
        const status = await agGet("/api/status");
        const modeLabel = { enforce: "强制拦截", supervised: "监督审批", permissive: "宽松放行" };
        return {
          content: [{
            type: "text",
            text: `🟢 AgentGuard 已恢复正常运行\n   当前模式: ${modeLabel[status.mode] || status.mode}`,
          }],
        };
      } catch (e) {
        return {
          content: [{ type: "text", text: `⚠️ Resume 操作失败: ${e.message}` }],
          isError: true,
        };
      }
    },
  });

  // --- 插件启动日志 ---
  if (logger) {
    logger.info(`[AgentGuard] 插件已加载 — daemon=${pluginConfig.daemonHost}:${pluginConfig.daemonPort}`);
  }
};


path: openclaw.plugin.json
content: {
  "id": "agentguard",
  "configSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "daemonHost": {
        "type": "string",
        "default": "127.0.0.1",
        "description": "AgentGuard daemon host"
      },
      "daemonPort": {
        "type": "integer",
        "default": 19821,
        "description": "AgentGuard daemon dashboard port"
      },
      "healthCheckInterval": {
        "type": "integer",
        "default": 30,
        "description": "Health check interval in seconds"
      },
      "autoReconnect": {
        "type": "boolean",
        "default": true,
        "description": "Auto reconnect to daemon on failure"
      }
    }
  },
  "uiHints": {
    "daemonHost": { "label": "Daemon 地址", "placeholder": "127.0.0.1" },
    "daemonPort": { "label": "Dashboard 端口", "placeholder": "19821" },
    "healthCheckInterval": { "label": "健康检查间隔 (秒)", "placeholder": "30" },
    "autoReconnect": { "label": "自动重连" }
  }
}


path: package.json
content: {
  "name": "agentguard",
  "version": "1.8.2",
  "description": "AgentGuard security engine for OpenClaw — intercept dangerous operations, audit all actions, protect sensitive data. AgentGuard 安全引擎 — 拦截危险操作、审计所有行为、保护敏感数据",
  "main": "index.js",
  "keywords": ["openclaw", "openclaw-plugin", "security", "agentguard", "audit", "mcp", "agent-safety"],
  "license": "MIT",
  "homepage": "https://www.agentguard.site",
  "repository": {
    "type": "git",
    "url": "https://www.agentguard.site"
  },
  "engines": {
    "node": ">=18.0.0"
  },
  "openclaw": {
    "plugin": true,
    "manifest": "openclaw.plugin.json",
    "extensions": ["./index.js"]
  },
  "files": [
    "index.js",
    "SKILL.md",
    "openclaw.plugin.json",
    "setup.sh",
    "bin/"
  ]
}


path: setup.sh
content: #!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
INSTALL_DIR="/usr/local/bin"

# Detect architecture
ARCH=$(uname -m)
case "$ARCH" in
    arm64) ;;
    *)
        echo "Unsupported architecture: $ARCH"
        echo "AgentGuard currently supports arm64 only. x86_64 support is coming soon."
        echo "Request support at: https://www.agentguard.site"
        exit 1
        ;;
esac

BINARY="$SCRIPT_DIR/bin/agentguard-$ARCH"

if [ ! -f "$BINARY" ]; then
    echo "Error: binary not found for $ARCH at $BINARY"
    echo "This platform is not yet supported. Please request support at https://www.agentguard.site"
    exit 1
fi

# Verify checksum
echo "Verifying checksum..."
cd "$SCRIPT_DIR/bin"
EXPECTED=$(grep "agentguard-$ARCH" checksums.txt | awk '{print $1}')
ACTUAL=$(shasum -a 256 "agentguard-$ARCH" | awk '{print $1}')
cd - > /dev/null

if [ "$EXPECTED" != "$ACTUAL" ]; then
    echo "Error: checksum verification failed!"
    echo "Expected: $EXPECTED"
    echo "Actual:   $ACTUAL"
    exit 1
fi
echo "Checksum OK"

# Install binary
echo "Installing agentguard to $INSTALL_DIR..."
cp "$BINARY" "$INSTALL_DIR/agentguard"
chmod +x "$INSTALL_DIR/agentguard"

# Verify installation
if command -v agentguard &> /dev/null; then
    echo "AgentGuard installed successfully (v$(agentguard --version 2>/dev/null || echo 'unknown'))"
else
    echo "Error: installation verification failed"
    exit 1
fi

# Start daemon
echo "Starting AgentGuard daemon..."
agentguard daemon start

echo ""
echo "Installation complete. Dashboard: http://127.0.0.1:19821"


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)