Phase 0-2: Schema cleanup, typed relations, event-driven automation

- Phase 0: AGENTS.md cleanup (dedup quotes, renumber sections, merge qmd)
- Phase 1: typed relations (manage-relations.py, graph-search.py, check-staleness.py, detect-conflicts.py)
- Phase 2: frontmatter validator, weekly lint, knowledge promotion, git hooks
- Fix .gitignore to track tools/ and .githooks/
- Fix git remote URL (remove plaintext token)
- New wiki pages: 504 pages, 34 raw sources
This commit is contained in:
hehaiguang1123
2026-07-01 08:05:43 +08:00
parent e544d6e04a
commit a6f05ab2d5
1067 changed files with 522992 additions and 819 deletions
@@ -0,0 +1,228 @@
# OpenClaw 多 Agent 协作方案:实际配置核实
## 核实结论
原分析报告有若干关键错误,以下基于实际配置数据修正。
---
## 一、实际系统配置
### 1.1 Agent 现状(实际)
| Agent ID | 名称 | 工作区 | 状态 |
|-----------|------|--------|------|
| main | 主代理 | /root/.openclaw/workspace | ✅ 活跃 |
| news | 新闻助手 | /root/.openclaw/workspace-news | ✅ 活跃 |
| assistant | 个人助理 | /root/.openclaw/workspace-assistant | ✅ 活跃 |
| research | 研究助手 | /root/.openclaw/workspace-research | ✅ 活跃 |
| weixin2 | 小新 | /root/.openclaw/agents/weixin2 | ⚠️ 有目录但未入 config |
| zz | - | /root/.openclaw/agents/zz | ❌ 未配置 |
**原分析错误**:报告说"6个Agent",实际活跃的4个。weixin2 和 zz 有目录但不在活跃配置里。
### 1.2 agentToAgent(已确认开启)
```yaml
tools:
agentToAgent:
enabled: true
allow: ["main", "news", "assistant", "research"]
```
**好消息**:多 Agent 通信已经启用,不需要额外配置。
---
## 二、向量检索实际配置
### 2.1 记忆搜索配置
```yaml
memorySearch:
provider: openai # OpenAI 兼容接口
enabled: true
model: embedding-3 # GLM embedding-3 模型
remote:
baseUrl: https://open.bigmodel.cn/api/paas/v4
```
**结论**:向量检索已配置,通过 BigModel CN API 的 embedding-3 实现,不是 SQLite。原分析"70%相似度"修正为 80%。
### 2.2 LanceDB-pro 状态
```
config.yaml 配置了 memory-lancedb-pro 插件
但 /root/.openclaw/memory/lancedb-pro/ 目录是空的
插件已配置但未实际启用本地向量存储
```
---
## 三、知识库实际配置(双 Wiki 架构)
系统存在 **两套 Wiki**,需要区分:
| 位置 | 类型 | 用途 |
|------|------|------|
| /root/.openclaw/wiki/ | OpenClaw memory-wiki | Agent 记忆层,bridge 模式 |
| /home/obsidian/wiki/ | 标准 Obsidian vault | 你的主知识库,Obsidian 桌面端用 |
### 3.1 OpenClaw wikiAgent 用)
```
wiki/
├── concepts/ # 概念页
├── entities/ # 实体页
├── sources/ # 原始资料
├── reports/ # 报告
├── syntheses/ # 综合
├── main/ # 主代理子空间
├── index.md
├── WIKI.md
└── AGENTS.md
```
- vault mode: bridge(连接外部 Obsidian
- render mode: obsidian
- search corpus: all
### 3.2 Obsidian vault(你本地用)
/home/obsidian/wiki/ - 这是你日常在 Obsidian 里用的笔记库。
### 3.3 共享知识库
```
workspace-shared/
├── 01-公共知识/
├── 02-协作记录/
├── 03-资源库/
└── README.md
```
README 明确定义了使用规则:只读优先、分 Agent 写入不同文件、定期清理。
---
## 四、Git 同步现状
### 4.1 PC 端已有同步脚本
`/root/.openclaw/workspace/Obsidian/sync-gitea.ps1` - PowerShell 脚本,功能:
- 检测本地变更 → git add/commit
- git pull 远程
- 检测冲突(发现冲突则退出告警)
- git push
### 4.2 腾讯云端现状
**尚未配置 Git 同步**。云端 VM 的 /home/obsidian/wiki/ 没有初始化 Git,也没有关联 Gitee。
### 4.3 风险重新评估
| 风险 | 原方案 | 实际问题 |
|------|--------|---------|
| 同时写入冲突 | "使用文件锁或分区存储" | sync-gitea.ps1 只检测冲突后退出,没有自动解决 |
| 冲突通知 | 未提及 | 冲突时脚本 exit 2,但谁来处理? |
---
## 五、Coding Subagent 现状
```
/root/.openclaw/subagents/runs.json
→ {"version": 2, "runs": {}}
```
**subagent 机制存在,但目前没有配置任何 subagent。**
原分析推荐用 `openclaw subagent create` 创建 coding subagent,但:
- openclaw 命令本身有权限问题(/root/.local/share/pnpm/openclaw Permission denied
- 没有找到 `subagent create` 的实际命令文档
- subagent 机制和 workspace-agent 是两套系统
**建议**:先用现有的 assistant agent 承担 coding 任务,不一定要单独建 subagent。
---
## 六、关键修正汇总
| 项目 | 原分析结论 | 实际核实结论 |
|------|-----------|------------|
| 活跃 Agent 数量 | 6个 | 4个(main/news/assistant/research |
| agentToAgent | "需要配置" | ✅ 已启用 |
| 向量数据库 | SQLite 70%相似度 | 有 embedding-3 向量搜索,80% |
| Wiki 结构 | 一套 | 两套(OpenClaw wiki + Obsidian vault |
| 共享知识库 | "需要创建" | workspace-shared 已存在 |
| Git 同步 | "需要开发" | PC 端脚本已有,云端未配置 |
| coding subagent | "用命令创建" | subagent 机制空,命令未验证 |
---
## 七、修正后的分阶段方案
### 阶段一:验证多 Agent 协作(1-2天)
**目标**:验证 agentToAgent 委派流程
现有条件已满足,只需写 SOUL.md 协作规则。
```
阶段一可以立即执行,不需要任何配置变更
```
### 阶段二:建立云端 Git 同步(2-3天)
```
1. 腾讯云 VM 上初始化 Git/home/obsidian/wiki/ → git init
2. 关联 Gitee 仓库(和 PC 端同一仓库)
3. 配置 cron 自动同步(每30分钟)
4. 添加冲突检测脚本
```
### 阶段三:完善 Wiki 体系(持续)
```
1. 补全 /home/obsidian/wiki/ 的 LLMWiki 元文件(SCHEMA.md, index.md, log.md
2. 将 wiki-vault-maintainer skill 的规范落地到 Obsidian
3. 统一两套 Wiki 的边界和使用规则
```
### 阶段四:Coding 能力建设(如果需要)
```
方案A:改造 assistant agent,给它写专门的 SOUL.md 增加 coding 职责
方案B:等 subagent 机制验证后再迁过去
```
---
## 八、立即可执行的行动
### 今天可以做
1. **给 main agent 写 SOUL.md**,加入委派规则
2. **验证 agentToAgent** 是否真的工作:向 main 发消息委派给 news,看能否通信
### 本周可以做
1. 初始化云端 wiki 的 Git:进入 /home/obsidian/wiki/ → git init → 关联 Gitee
2. PC 端和云端同时配置 cron 同步
3. 写 workspace-shared/02-协作记录/ 里的协作规则文档
### 需要先确认的
1. Gitee 仓库地址是什么?
2. weixin2 和 zz 这两个 agent 还要不要激活?
---
## 九、风险项重新评估
| 风险 | 可能性 | 影响 | 应对 |
|------|--------|------|------|
| Git 同步冲突 | 高 | 中 | 明确各端写入分区,发生冲突告警人工处理 |
| weixin2/zz agent 冲突 | 中 | 低 | 明确不激活或删除 |
| 两套 Wiki 混乱 | 中 | 高 | 明确边界:OpenClaw wiki 是 Agent 记忆层,Obsidian 是用户交互层 |
| subagent 命令不可用 | 高 | 中 | 先用 assistant agent 试,不等 subagent |