Skip to content

[P0] Claude Code 中心化设计导致与其他 AI agent 平台不兼容 #52

@nnn228085-star

Description

@nnn228085-star

问题描述
AgentGuard 当前设计假设"单用户 + 单 Claude Code 实例 + home目录可写",导致在 OpenClaw、Cline、Goose 等其他平台的企业多 agent 部署中无法正常工作。

具体问题

设计选择 在其他平台的问题
${CLAUDE_PLUGIN_ROOT} hook 协议 OpenClaw / Cline / Goose 使用不同的 hook 协议,hooks.json 直接失效
默认 audit log 路径 ~/.agentguard/ 可能不在沙箱白名单内,写日志时触发 EPERM
patrol 依赖 find 二进制 限制了 safeBins 的环境(如事故后加固)无法运行 patrol
trust registry 位于 ~/.agentguard/data/registry.json 隐式跨 agent 共享与 per-agent 隔离要求冲突

建议修复方案

  1. 引入平台适配器抽象层:
    interface AgentGuardAdapter {
      auditLogPath(): string;
      trustRegistryPath(): string;
      hookProtocol(): 'claude-code' | 'openclaw' | 'cline' | 'goose' | 'generic';
      fileSystemSearch(): 'find' | 'mdfind' | 'glob' | 'fd' | 'js-readdir';
    }
  2. 支持环境变量覆盖:AGENTGUARD_AUDIT_LOGAGENTGUARD_TRUST_REGISTRY
  3. 用纯 Node.js 重写 patrol 文件扫描(fs.readdir + 正则),移除对 find/mdfind/grep 等外部二进制的依赖

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions