OpenClaw Memory 本地模式配置:Ubuntu+CUDA+llama.cpp 实战
在之前的调试中,我发现执行 openclaw doctor 命令时,Memory 搜索功能一直报错。这是因为默认的长期记忆检索(memory_search)provider 只支持 openai | gemini | local,而前两者都需要 API Key。为了节省 Token 并实现完全本地化,我决定配置使用 local 模式的 Memory。
背景:Memory 不生效的问题
运行诊断命令后,终端提示如下:
◇ Memory search Memory search is enabled but no embedding provider is configured. Semantic recall will not work without an embedding provider. Fix (pick one): - Set OPENAI_API_KEY or GEMINI_API_KEY in your environment - Add credentials: openclaw auth add --provider openai - For local embeddings: configure agents.defaults.memorySearch.provider and local model path - To disable: openclaw config set agents.defaults.memorySearch.enabled false Verify: openclaw memory status --deep
这说明系统检测到了 Memory 功能开启,但缺少 Embedding Provider。网上的资料对此语焉不详,经过反复排查,我总结了一套完整的本地化配置流程。
OpenClaw 的 Memory 配置
核心思路是修改配置文件,将 provider 指向本地模型。编辑 ~/.openclaw/openclaw.json,重点调整 agents.defaults.memorySearch 部分:
"agents": {
"defaults": {
"model": { "primary": "zai/glm-5" },
"models": { "zai/glm-5": { "alias": "GLM" }
...

