概述
内置引擎是默认的记忆后端,将记忆索引存储在每个 Agent 的 SQLite 数据库中,无需额外依赖即可开箱即用。
核心要点
提供的能力:
- 关键词搜索:FTS5 全文索引(BM25 评分)
- 向量搜索:通过任意支持的 Embedding 提供商
- 混合搜索:两者结合,效果最佳
- CJK 支持:三元组分词(中文、日文、韩文)
- sqlite-vec 加速:可选的数据库内向量查询
支持的 Embedding 提供商(自动检测顺序):
| 提供商 | ID | 自动检测 | 备注 |
|---|---|---|---|
| OpenAI | openai | 是 | 默认 text-embedding-3-small |
| Gemini | gemini | 是 | 支持多模态(图片+音频) |
| Voyage | voyage | 是 | |
| Mistral | mistral | 是 | |
| DeepInfra | deepinfra | 是 | 默认 BAAI/bge-m3 |
| Ollama | ollama | 否 | 本地,需显式配置 |
| Local | local | 是(优先) | 需 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相关页面
- memory — 记忆机制概述
- memory-search — 搜索管道与调优
- context — 记忆与上下文的关系