feat(bootstrap): add shared session bootstrap and machine-alias resolver

This commit is contained in:
hotwa
2026-03-10 19:02:26 +08:00
parent 3e5f7fdc2e
commit 5e5344ae31
5 changed files with 341 additions and 3 deletions

View File

@@ -0,0 +1,48 @@
# SESSION BOOTSTRAP (Shared Memory)
## 目标
- 所有客户端OpenClaw / Claude / Codex / Cursor共享同一记忆系统。
- Durable memory authority 是 `collective-memory-repo`
- 群体权威召回只认远程 `memory-gateway`
## 统一架构
- Memory repo: `/Users/lingyuzeng/project/collective-memory-repo`
- Gateway URL: `http://100.64.0.45:8787`
- Gateway MCP URL: `http://100.64.0.45:8787/mcp`
- 记忆层规则:
- 共享长期事实:`shared/long-term/`
- 每日记录:`daily/`
- 任务协作:`tasks/<task-id>/`
- Agent 私域:`agents/<agent-id>/`
## 分支规则
- 长期协作默认:`branch=main`
- 并发任务协作:`branch=task/<task-id>`
- 群体查询必须带:`require_latest=true`
## 读写规则
- Runtime 文件persona/tools/heartbeat留在各自本机 runtime 目录。
- Durable facts 只能写入 `collective-memory-repo` 的对应 lane。
- `vaults/memory/*` 是兼容区,不是长期真相源。
## 会话初始化必填上下文
在新会话第一条消息中提供:
- `machine_hostname`
- `machine_alias`
- `agent_id`
- `memory_branch`(默认 `main`
- `task_id`(如有)
## 示例(首条消息)
```text
@/Users/lingyuzeng/project/collective-memory-repo/policies/SESSION-BOOTSTRAP.md
machine_hostname=mac-5
machine_alias=mac5
agent_id=codex-mac5
memory_branch=main
```
## MCP 接入要求
- 先在客户端注册 MCP serverURL 指向 `...:8787/mcp`)。
- 再通过 `@SESSION-BOOTSTRAP.md` 注入架构与规则。
- 客户端本地检索可保留,但群体结论以 gateway 结果为准。