概述

内置引擎是默认的记忆后端,将记忆索引存储在每个 Agent 的 SQLite 数据库中,无需额外依赖即可开箱即用。

核心要点

提供的能力:

  • 关键词搜索:FTS5 全文索引(BM25 评分)
  • 向量搜索:通过任意支持的 Embedding 提供商
  • 混合搜索:两者结合,效果最佳
  • CJK 支持:三元组分词(中文、日文、韩文)
  • sqlite-vec 加速:可选的数据库内向量查询

支持的 Embedding 提供商(自动检测顺序):

提供商ID自动检测备注
OpenAIopenai是默认 text-embedding-3-small
Geminigemini是支持多模态(图片+音频)
Voyagevoyage是
Mistralmistral是
DeepInfradeepinfra是默认 BAAI/bge-m3
Ollamaollama否本地,需显式配置
Locallocal是(优先)需 node-llama-cpp

索引机制:

  • 索引 MEMORY.md 和 memory/*.md,分块约 400 tokens(80 token 重叠)
  • 索引位置:~/.openclaw/memory/<agentId>.sqlite
  • 文件变更触发防抖重建索引(1.5s)
  • Embedding 提供商/模型/分块配置变更时自动全量重建

配置/使用

显式设置 Embedding 提供商:

{
  agents: {
    defaults: {
      memorySearch: {
        provider: "openai"
      }
    }
  }
}

本地 Embedding(无 API Key):

{
  agents: {
    defaults: {
      memorySearch: {
        provider: "local",
        fallback: "none",
        local: {
          modelPath: "~/.node-llama-cpp/models/embeddinggemma-300m-qat-Q8_0.gguf"
        }
      }
    }
  }
}

故障排查:

openclaw memory status --deep --agent main
openclaw memory index --force --agent main

相关页面