Install, configure, diagnose, and operate the openclaw-mem0 long-term memory plugin for OpenClaw agents. Use when the user wants to set up mem0 memory (platform or open-source/self-hosted mode), configure OSS components (embedder, vector store, LLM, historyDbPath), debug memory issues (SQLITE_CANTOPEN crash loops, memories not being stored or recalled, Qdrant/Ollama connectivity), use the `openclaw mem0` CLI (search, stats), or understand how auto-recall and auto-capture work in agent sessions.
为OpenClaw智能体提供长期记忆的插件,基于Mem0构建。在每个智能体回合前后自动提取和注入记忆。
bash
openclaw plugins install @mem0/openclaw-mem0
此命令会将插件安装到 ~/.openclaw/extensions/openclaw-mem0/ 目录,并将其添加到 openclaw.json 配置文件中。
平台模式 — 无需本地依赖。从 app.mem0.ai 获取API密钥,然后直接跳转到配置部分。
开源模式 — 需要两个本地服务:
bash
验证两个服务是否正常运行:
bash
curl -s http://localhost:11434/ # → Ollama is running
curl -s http://localhost:6333/health # → {status:ok}
在 plugins.entries 下添加(详见下面的配置部分)。
bash
openclaw gateway stop && openclaw gateway
确认插件已加载:
bash
grep openclaw-mem0: initialized ~/.openclaw/logs/gateway.log | tail -1
预期输出:openclaw-mem0: initialized (mode: open-source, user: ..., autoRecall: true, autoCapture: true)
| 模式 | 配置 | 要求 |
|---|---|---|
| platform | 来自 app.mem0.ai 的 apiKey | 互联网连接,Mem0 API密钥 |
| open-source |
平台模式:
json5
openclaw-mem0: {
enabled: true,
config: { mode: platform, apiKey: ${MEM0APIKEY}, userId: your-id }
}
开源模式:
json5
openclaw-mem0: {
enabled: true,
config: {
mode: open-source,
userId: your-id,
oss: {
embedder: { provider: ollama, config: { model: bge-m3:latest, baseURL: http://localhost:11434 } },
vectorStore: { provider: qdrant, config: { host: localhost, port: 6333, collection: memories, dimension: 1024 } },
llm: { provider: ollama, config: { model: llama3.2, baseURL: http://localhost:11434 } },
historyDbPath: /absolute/path/to/.openclaw/memory/history.db
}
}
}
始终将 historyDbPath 设置为绝对路径。 当openclaw作为LaunchAgent运行时,process.cwd() 为 /,因此默认的相对路径 memory.db 会解析为 /memory.db(在macOS上不可写),导致SQLITECANTOPEN崩溃循环。详见 troubleshooting.md。
| 键 | 默认值 | 说明 |
|---|---|---|
| autoRecall | true | 在每个智能体回合前注入记忆 |
| autoCapture |
bash
openclaw mem0 stats # 总记忆数、模式、用户
openclaw mem0 search 用户名称 # 语义搜索
openclaw mem0 search 主题 --scope long-term # long-term | session | all
该插件注册了5个供智能体调用的工具:
| 工具 | 描述 |
|---|---|
| memorysearch | 语义搜索(范围:session/long-term/all) |
| memorylist |
bash
详见 references/troubleshooting.md,了解以下问题的处理方法:
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 mem0-config-1776291775 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 mem0-config-1776291775 技能
skillhub install mem0-config-1776291775
文件大小: 4.68 KB | 发布时间: 2026-4-16 18:00