mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-10-15 12:15:32 +00:00
- Migrate to OpenClaw Plugin SDK with definePluginEntry and api.registerTool - Rewrite GraphDatabase with better-sqlite3 for persistent storage - Implement recall depth traversal, timeRange filtering, supersede mode - Add archive and cleanup data management features - Fix SKILL.md frontmatter to OpenClaw single-line format (kebab-case names) - Add ToolLimiter for per-turn rate limiting - Add TypeBox parameter schemas for OpenClaw tool registration - Add 110 tests across 4 test files (GraphDatabase, MemoryService, Tool, Limiter) - Update README for OpenClaw plugin installation and usage
2.9 KiB
2.9 KiB
重构执行进度追踪
最后更新: 2026-04-16 15:00 当前分支: openclaw
Phase 1: 项目结构改造为 OpenClaw Plugin(🔴 P0)
1.1 添加 OpenClaw Plugin SDK 依赖
- 1.1.1
npm install @sinclair/typebox better-sqlite3 - 1.1.2 更新
ts/package.json添加openclaw字段 - 1.1.3 创建
ts/openclaw.plugin.jsonmanifest 文件
1.2 创建 Plugin Entry Point
- 1.2.1 创建
ts/src/plugin-entry.ts - 1.2.2 确保 entry point 导出为 ESM 格式
- 1.2.3 更新
ts/tsconfig.json确保编译输出路径正确
1.3 迁移 Tool Schema 到 TypeBox
- 1.3.1 添加 TypeBox schema 到 plugin-entry.ts
- 1.3.2 更新
graph_memory_tool.ts的inputSchema字段(添加 newRelation, days, dry_run) - 1.3.3 添加
execute(_id, params)方法匹配 OpenClaw 签名 - 1.3.4 返回值格式为
{ content: [{ type: "text", text }] }
1.4 更新 Tool Interface
- 1.4.1 添加
OpenClawToolResult类型到 graph_memory_tool.ts
Phase 2: SKILL.md 格式修复(🔴 P0)
2.1 修复 skills/graph-memory/SKILL.md
- 2.1.1 移除多行嵌套结构
- 2.1.2 name 改为 kebab-case
- 2.1.3 description 改为单行
- 2.1.4 添加 metadata 单行 JSON
2.2 修复 skills/graph-memory/persona/SKILL.md
- 2.2.1 同上
2.3 修复 skills/graph-memory/task/SKILL.md
- 2.3.1 同上
2.4 同步修复 bundled-skills
- 2.4.1 ts/bundled-skills/graph-memory/SKILL.md
- 2.4.2 ts/bundled-skills/graph-memory/persona/SKILL.md
- 2.4.3 ts/bundled-skills/graph-memory/task/SKILL.md
2.5 重命名目录
- 2.5.1 skills/graph_memory/ → skills/graph-memory/
- 2.5.2 ts/bundled-skills/graph_memory/ → ts/bundled-skills/graph-memory/
Phase 3: GraphDatabase 持久化(🔴 P0)
3.1 添加 SQLite 依赖
- 3.1.1 npm install better-sqlite3
- 3.1.2 npm install @types/better-sqlite3
3.2 重写 GraphDatabase
- 3.2.1 修改构造函数接受 dbPath
- 3.2.2 使用 better-sqlite3 创建/连接数据库
- 3.2.3 创建实体表
- 3.2.4 创建关系表
- 3.2.5 创建索引
3.3-3.7 功能补全
- 3.3 depth 多跳遍历 (BFS)
- 3.4 timeRange 过滤
- 3.5 supersede 模式
- 3.6 archive 归档
- 3.7 cleanup 清理
3.8 修复逻辑
- 3.8.1 修复 isEntityDeleted 逻辑 (已移除,用 SQL 替代)
Phase 4: ToolLimiter(🟡 P2)
- 4.1 创建 ToolLimiter
- 4.2 集成到 GraphMemoryTool
Phase 5: 测试重建(🔴 P1)
- 5.1 GraphDatabase 测试 (15+)
- 5.2 MemoryService 测试 (12+)
- 5.3 GraphMemoryTool 测试 (15+)
- 5.4 Plugin Entry 集成测试
Phase 6: 文档更新(🟢 P3)
- 6.1 更新 README.md
- 6.2 更新 README_EN.md
- 6.3 更新迁移设计文档
最终验收
- npm run build 编译通过
- npm test 全部通过
- 推送到远程 openclaw 分支