Install
openclaw skills install memory-hubMulti-agent shared memory protocol. Syncs a shared GitHub repo containing USER.md (owner preferences/habits), KNOWLEDGE.md (common knowledge), RULES.md (universal agent rules), and TOOLS.md (shared tools/scripts) across multiple agents. Supports read, write, sync, search, merge operations. Use when reading shared memory, writing new preference/knowledge to shared repo, syncing local cache with shared repo, searching shared memory, or first-time install/setup. Triggers: 读共享记忆, 写入共享记忆, 记录偏好, 同步记忆, 查共享记忆, shared memory, install memory-hub.
openclaw skills install memory-hub多龙虾共享记忆同步协议。所有 agent 通过同一个 GitHub 私有仓库共享对主人的认知,每只 agent 本地维护一份轻量摘要缓存。
运行安装脚本(幂等,重复执行安全):
bash ~/.openclaw/skills/shared-memory/scripts/install.sh
脚本会:
~/.openclaw/shared-memory/~/.openclaw/workspace/SHARED_MEMORY_CACHE.md## Every Session 区块追加读取指令安装完成后告知用户,并说明需要在其他龙虾上重复执行同样步骤。
安装后配置存储在 ~/.openclaw/shared-memory/config.json:
{
"repo_url": "https://github.com/your-username/shared-memory",
"local_path": "~/.openclaw/shared-memory",
"agent_id": "agent-home",
"last_sync": "2026-01-01T00:00:00"
}
shared-memory-repo/
├── USER.md # 主人偏好、习惯、沟通方式
├── KNOWLEDGE.md # 公共知识沉淀:踩坑、工具用法、最佳实践
├── RULES.md # 所有龙虾通用铁律
└── TOOLS.md # 公共工具:脚本、命令、配置
每条记忆格式(严格遵守,不得自由发挥):
## [分类] 标题
内容(1-5行,精炼)
_更新:YYYY-MM-DD by agent_id_
触发词:读共享记忆、同步记忆、load shared memory
步骤:
git -C ~/.openclaw/shared-memory pull --rebase --quiet触发词:写入共享记忆、记录偏好、记住这个
步骤:
git -C ~/.openclaw/shared-memory pull --rebase --quietgit -C ~/.openclaw/shared-memory add -A && git commit -m "🧠 [agent_id] 更新 FILE.md: 一句话描述" && git pushSHARED_MEMORY_CACHE.md 摘要push 失败时:git pull --rebase 后重试一次;仍失败则告知用户,不强制。
触发词:心跳时自动检查、sync shared memory
步骤:
SHARED_MEMORY_CACHE.md触发词:查共享记忆 + 关键词
步骤:
grep -r "关键词" ~/.openclaw/shared-memory/ --include="*.md" -l -n触发词:更新本地缓存、merge shared memory
步骤:
SHARED_MEMORY_CACHE.md| 内容类型 | 写入文件 |
|---|---|
| 主人的偏好、习惯、沟通风格 | USER.md |
| 工具用法、踩坑经验、最佳实践 | KNOWLEDGE.md |
| 所有龙虾必须遵守的行为规范 | RULES.md |
| 可复用脚本、命令、配置片段 | TOOLS.md |
当单文件超过 200 行时,主动提示用户考虑升级。
详见 references/upgrade-guide.md。