claw-lark Patches
自动重应用飞书插件自定义补丁,修复更新后功能失效问题。
为 OpenClaw 代理配置 Mem0 长期记忆插件,支持平台或自托管模式。
openclaw skills install @nyrosveil/mem0-config命令、参数、文件名以原文为准
OpenClaw 代理的长期记忆插件,由 [Mem0](https://mem0.ai) 提供支持。可在每个代理回合中自动提取和注入记忆。
openclaw plugins install @mem0/openclaw-mem0此命令会将插件安装到 ~/.openclaw/extensions/openclaw-mem0/ 目录,并添加至 openclaw.json 文件中。
平台模式 —— 无需本地依赖。前往 [app.mem0.ai](https://app.mem0.ai) 获取 API 密钥,然后跳转至 [配置](#configuration) 部分。
开源模式 —— 需要两个本地服务:
# Ollama(嵌入模型 + LLM)
brew install ollama
ollama serve # 或:brew services start ollama
ollama pull bge-m3:latest # 嵌入模型(1024维)
ollama pull llama3.2 # 用于记忆提取的 LLM
# Qdrant(向量存储)
docker run -d -p 6333:6333 qdrant/qdrant
# 或:brew install qdrant && qdrant验证两者是否正常运行:
curl -s http://localhost:11434/ # → "Ollama is running"
curl -s http://localhost:6333/health # → {"status":"ok"}在 plugins.entries 下添加对应配置项(详见下方 [配置](#configuration) 章节)。
openclaw gateway stop && openclaw gateway确认插件已加载:
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 | oss 块(自托管) | Ollama + Qdrant(或其他兼容提供方) |
平台模式:
"openclaw-mem0": {
"enabled": true,
"config": { "mode": "platform", "apiKey": "${MEM0_API_KEY}", "userId": "your-id" }
}开源模式:
"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 上不可写),导致 SQLite 的 SQLITE_CANTOPEN 错误循环崩溃。参见 [troubleshooting.md](references/troubleshooting.md)。
| 配置项 | 默认值 | 说明 |
|---|---|---|
autoRecall | true | 在每个代理回合前自动注入记忆 |
autoCapture | true | 在每个代理回合后自动保存记忆 |
topK | 5 | 每回合最多注入的记忆数量 |
searchThreshold | 0.5 | 最小相似度分数(0–1 之间) |
userId | "default" | 按用户范围隔离记忆 |
openclaw mem0 stats # 显示总记忆数、当前模式、用户信息
openclaw mem0 search "用户姓名" # 语义搜索
openclaw mem0 search "主题" --scope long-term # 可选范围:long-term | session | all该插件为代理注册了 5 个可调用工具:
| 工具 | 描述 |
|---|---|
memory_search | 语义搜索(支持 scope:session/long-term/all) |
memory_list | 列出指定用户的全部记忆 |
memory_store | 显式保存一条事实(默认 longTerm: true) |
memory_get | 根据 ID 获取记忆 |
memory_forget | 根据 ID 或查询条件删除记忆 |
# 检查网关日志中的注入事件
grep "openclaw-mem0: inject" ~/.openclaw/logs/gateway.log | tail -5
# 确认历史数据库已按配置路径创建
ls -la /path/to/history.db
# 检查自上次网关启动以来是否有 SQLITE 错误
grep "SQLITE_CANTOPEN" ~/.openclaw/logs/gateway.err.log | tail -3参见 [references/troubleshooting.md](references/troubleshooting.md) 了解以下问题的解决方案:
allowFrom 配置警告已收录 1 个 Skill