Skip to content

Repository files navigation

myagents-components

License: AGPL-3.0 Node Tests

5 件套增强组件,给 MyAgents + OpenClaw 装上后立刻获得:全链路追踪 / 统一权限决策 / 项目级共享记忆 / 交付审计 / 知识库自动召回。

这是什么

myagents-components 是一组 AGPL-3.0 许可的独立包,每个都能独立用,但打包成 cc-plugin 后可以一次性装上 5 件套。

组件 解决 MyAgents issue 装上后能看到什么
trace-context 全链路追踪缺失 myagents-trace query <id> 命令,每个工具调用都有 span
permission-policy-engine #460/#295/#362/#93 权限绕过 rm -rf / 自动拦截,plan 模式强制禁止写操作
project-container #433/#351/#92 项目记忆缺失 cd deal-2026 自动加载项目记忆到 LLM context
delivery-receipt 调度成功 vs 实际交付不一致 myagents-delivery last/failed/cleanup CLI
auto-memory-recall LLM 不知道本机有什么知识 myagents-recall search "汇率"

特点:0 source patch MyAgents。 完全靠 cc-plugin 加载机制挂载,MyAgents 升级不影响本插件。

5 分钟上手

装 MyAgents(前置)

brew install hAcKlyc/myagents/myagents
myagents init

装本插件

# 等本仓库发布后
myagents plugin install myagents-components

# 或从源码
git clone https://github.com/YOURNAME/myagents-components.git
cd myagents-components
npm install

跑 demo

node --experimental-strip-types e2e/cron-to-im-demo.ts

会看到:

🚀 e2e: cron→IM→bridge 全链路 demo
🔄 trace_id: 9b16b351d382e703ad1320028d087268

📂 Step 2: 识别 project → deal-2026
🧠 Step 3: 召回 1 条记忆([3.00] 汇率)
⚙️ Step 4: WebFetch 允许 + rm -rf 拦截 ✓
📦 Step 5: receipt 写入(含 trace_id)
📝 Step 6: project memory 累积

📊 收尾:5 traces / 1 receipt / 1 project / 2 recall docs
🎉 e2e 完成!

跑测试

npm test

应该看到:

tests 101
pass 101
fail 0

包结构

myagents-components/
├── packages/
│   ├── trace-context/                      # 全链路追踪(15 tests)
│   ├── permission-policy-engine/           # 权限决策(28 tests)
│   ├── project-container/                  # 项目记忆(19 tests)
│   ├── cc-plugin/                          # 一键打包(10 tests)
│   └── openclaw-plugins/
│       ├── openclaw-plugin-delivery-receipt/    # 9 tests
│       ├── openclaw-plugin-auto-memory-recall/  # 11 tests
│       └── openclaw-plugin-trace-context/       # 4 tests
├── tests/
│   └── integration.test.ts                 # 跨包集成(5 tests)
└── e2e/
    ├── cron-to-im-demo.ts                  # 真实场景演示
    └── README.md

抗"全丢"设计

不是装饰,是踩坑经验沉淀。每条背后都有真实事故。

设计点 抗风险方式
零外部依赖(核心包) 只用 Node 内置 API,npm 包升级不破
adapter 装饰器不 patch 内核 加 Runtime 不用改 MyAgents 源码
数据带 version: "1.0" schema 升级走 migration,不爆炸
损坏行静默跳过 一行坏掉不 throw,reader 继续
fail-closed 默认 deny policy 缺规则默认 ask,安全优先
审计独立 .audit.ndjson 在项目根,目录损坏也能查
embeddingProvider=none 默认 recall 不依赖外部 API,离线可用
CLI 命令独立注册 MyAgents 升级不影响

详见各包 README 的「抗全丢特性」章节。

测试矩阵

测试 通过
trace-context 15 ✅ 15/15
permission-policy-engine 28 ✅ 28/28
project-container 19 ✅ 19/19
openclaw-plugin-delivery-receipt 9 ✅ 9/9
openclaw-plugin-auto-memory-recall 11 ✅ 11/11
openclaw-plugin-trace-context 4 ✅ 4/4
integration 5 ✅ 5/5
cc-plugin 10 ✅ 10/10
e2e demo ✅ 跑通
合计 101 101/101 ✅

文档

文档 用途
e2e/README.md 真实场景演示的逐步说明
CONTRIBUTING.md 怎么加新组件 / 改老组件
CHANGELOG.md 版本变化记录
LICENSE AGPL-3.0 全文

各包独立 README 在 packages/*/README.md

路线图

Phase 内容 状态
Phase 0 5 件套组件 + cc-plugin + e2e demo ✅ 完成
Phase 1 HookBus(OpenClaw EventBus 出现后实现) ⏸️
Phase 1 ACP Gateway(依赖 MyAgents 上游抽象) ⏸️
Phase 2 分布式 trace(跨机器 trace_id 串联) 📋

贡献

PR 流程见 CONTRIBUTING.md。提 PR 前请跑 npm test 确保 101 测试通过。

协议

GNU Affero General Public License v3.0 — 与 MyAgents 上游协议一致。

如果你修改了本仓库并通过网络提供服务,按 AGPL 第 13 条你需要把修改后的源码公开。这是保护开源社区的方式。

联系

  • GitHub Issues:本仓库
  • 邮件:见 package.json#author

设计思想:把 5 件套做成可以独立使用的小包,但通过 npm workspaces + cc-plugin 打包成「一键安装」。使用者只看到一个 cc-plugin,开发者看到的是 5 个干净的小包。

About

myagents-components — 给 MyAgents / OpenClaw 的 5 件套增强组件:全链路追踪、统一权限决策、项目级共享记忆、交付审计、知识库自动召回(AGPL-3.0)。

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages