https://deepwiki.com/search/_102ce0dc-bde6-4596-b145-a914d607d3ec?mode=fast
简要总结
OpenClaw
Markdown
文件为唯一事实来源,配合可选的向量/混合索引实现语义搜索;系统会在会话接近压缩时自动触发“记忆刷新”提醒模型持久化重要信息,并提供
CLI
记忆文件结构(Markdown)
memory/YYYY-MM-DD.md:每日日志(仅追加),会话开始时读取当天与昨天的内容。
MEMORY.md:长期记忆,仅在主/私人会话加载,群组上下文不加载。
- 这些文件位于工作区(
agents.defaults.workspace,默认~/.openclaw/workspace)何时写入记忆
- 决策、偏好、持久事实写入
MEMORY.md;日常笔记写入当日memory/YYYY-MM-DD.md6。
- 若有人说“记住这个”,应立即写入文件而非仅存内存
自动记忆刷新(压缩前触发)
- 当会话接近自动压缩时,系统触发一次静默的智能体回合,提醒模型写入持久记忆
。
- 由
agents.defaults.compaction.memoryFlush控制,支持软阈值、双提示与每周期一次刷新;沙箱只读工作区会跳过向量/混合搜索与索引
- 默认启用对
MEMORY.md与memory/**/*.md的向量索引,支持OpenAI/Gemini/Voyage/本地嵌入;自动选择可用提供商
BM25
SQLite(
~/.openclaw/memory/<agentId>.sqlite),监视文件变更并异步同步;嵌入/模型/分块参数变化会触发全量重建。
- 工具:
memory_search返回带来源的片段;memory_get按路径读取文件CLI
status:查看状态;
--deep探测向量与嵌入可用性;--index在脏时重建索引memory
index:手动重建索引;
--verbose输出详细日志memory
"查询词":执行语义搜索
配置要点
- 记忆搜索配置位于
agents.defaults.memorySearch,可设provider、model、fallback、extraPaths、混合权重、缓存等
。
- 实验性功能:会话记忆搜索(需开启
experimental.sessionMemory与sources:)["memory","sessions"]
。
- 可选后端:QMD(需单独安装)或内置
SQLite
常见问题
- 记忆持久化在磁盘,直到手动删除;会话上下文仍受模型窗口限制,因此需要记忆搜索
。
- 若模型“忘记”,请明确要求其写入
MEMORY.md或当日文件,并确认Gateway
/>
Notes
- 记忆文件是唯一可信源,模型仅“记住”写入磁盘的内容
。
- 可通过
plugins.slots.memory=
。
- 中文用户可参考
docs/zh-CN/concepts/memory.md与docs/zh-CN/cli/memory.md获取本地化说明pages
(openclaw/openclaw)
Citations
File:docs/concepts/memory.md
(L11-27)
OpenClawmemory
contexts).
File:docs/concepts/memory.md
files
(`agents.defaults.workspace`,
default
`~/.openclaw/workspace`).
See
workspace](/concepts/agent-workspace)
for
layout.
File:docs/concepts/memory.md
Decisions,
`memory/YYYY-MM-DD.md`.
File:docs/concepts/memory.md
someone
memory.
File:docs/concepts/memory.md
Automatic
turn.
File:docs/concepts/memory.md
controlled
`agents.defaults.compaction.memoryFlush`:
```json5
}
Details:
- Soft
threshold
:softThresholdTokens.
- Silentby
default:
in
sessions.json). - Workspace
must
"ro"or
"none",the
skipped.
**File:**(L79-96)
`agents.defaults.memorySearch`
(not
`memorySearch.provider`
not
`memorySearch.local.modelPath`
configured
approve-builds`.
File:docs/concepts/memory.md
QMD
[QMD](https://github.com/tobi/qmd):
local-first
https://github.com/tobi/qmd`
grab
macOS).
File:docs/concepts/memory.md
`searchMode`
[`session.sendPolicy`](/gateway/configuration#session).
Default
`channel`/`chatType`
empty
debug.
File:docs/concepts/memory.md
indexing
`agents.defaults.memorySearch.remote.batch.enabled
=
`remote.batch.pollIntervalMs`,
and
`remote.batch.timeoutMinutes`
needed.
`remote.batch.concurrency`
control
[https://platform.openai.com/docs/api-reference/batch](https://platform.openai.com/docs/api-reference/batch)
File:docs/concepts/memory.md
(L347-351)
Tools:returns
path.
File:docs/concepts/memory.md
Set
`agents.defaults.memorySearch.provider
=
`agents.defaults.memorySearch.local.modelPath`
(GGUF
`agents.defaults.memorySearch.fallback
=
returned.
File:docs/concepts/memory.md
What
`~/.openclaw/memory/<agentId>.sqlite`
(configurable
`agents.defaults.memorySearch.store.path`,
supports
store.
File:docs/concepts/memory.md
Hybrid
(`memorySearch.query.hybrid`)
error
queries.
File:docs/cli/memory.md
(L21-28)
```bashopenclaw
checklist"
File:docs/cli/memory.md
`--agent
indexing.
File:docs/help/faq.md
Memory
`memory/YYYY-MM-DD.md`.
This
workspace](/concepts/agent-workspace).
File:docs/help/faq.md
Does
[Context](/concepts/context).
File:docs/zh-CN/concepts/memory.md
OpenClaw
文件**。
这些文件是唯一的事实来源;模型只"记住"写入磁盘的内容。
记忆搜索工具由活动的记忆插件提供(默认:`memory-core`)。
使用
=
`MEMORY.md`(可选)
**仅在主要的私人会话中加载**(绝不在群组上下文中加载)。
这些文件位于工作空间下(`agents.defaults.workspace`,默认
`~/.openclaw/workspace`)。
完整布局参见[智能体工作空间](/concepts/agent-workspace)。
File:docs/zh-CN/cli/memory.md
`openclaw
由活跃的记忆插件提供(默认:`memory-core`;设置
=
记忆概念:[记忆](/concepts/memory)
```bash
--verbose
- 记忆文件是唯一可信源,模型仅“记住”写入磁盘的内容
- 记忆持久化在磁盘,直到手动删除;会话上下文仍受模型窗口限制,因此需要记忆搜索
- 记忆搜索配置位于
- 默认启用对
- 当会话接近自动压缩时,系统触发一次静默的智能体回合,提醒模型写入持久记忆
- 决策、偏好、持久事实写入


