Skip to content

本页介绍 openclaw memory 的所有子命令:status(检查索引状态)、index(重建索引)、search(语义搜索)、promote(短期记忆升级为长期)、promote-explain(解释评分)和 rem-harness(预览 REM 阶段)。同时说明后台 Dreaming 巩固机制的配置方式和定时调度。

openclaw memory

管理语义记忆的索引与搜索。由当前激活的记忆插件提供(默认为 memory-core;设置 plugins.slots.memory = "none" 可禁用)。

相关文档:

快速示例

bash
openclaw memory status
openclaw memory status --deep
openclaw memory status --fix
openclaw memory index --force
openclaw memory search "会议笔记"
openclaw memory search --query "部署" --max-results 20
openclaw memory promote --limit 10 --min-score 0.75
openclaw memory promote --apply
openclaw memory promote-explain "路由器 vlan"
openclaw memory rem-harness
openclaw memory status --agent main
openclaw memory index --agent main --verbose

参数说明

memory statusmemory index

  • --agent <id>:限定单个 agent 范围。不传时对所有配置的 agent 逐一运行;若未配置 agent 列表则退回默认 agent
  • --verbose:探针和索引期间输出详细日志

memory status

  • --deep:探测向量与 embedding 可用性
  • --index:若存储有脏数据则执行重索引(隐含 --deep
  • --fix:修复过期的 recall 锁,规范化晋升元数据
  • --json:输出 JSON

memory index

  • --force:强制全量重建索引
  • Query 输入:传位置参数 [query]--query <text>,两者同时传时 --query 优先
  • 两者均不传时命令报错退出
  • --agent <id>:限定单个 agent(默认:默认 agent)
  • --max-results <n>:限制返回数量
  • --min-score <n>:过滤低分结果
  • --json:输出 JSON

memory promote

预览并应用短期记忆晋升。

bash
openclaw memory promote [--apply] [--limit <n>] [--include-promoted]
  • --apply:将晋升内容写入 MEMORY.md(默认仅预览)
  • --limit <n>:限制候选数量
  • --include-promoted:包含已在上一轮晋升过的条目

完整参数:

  • 使用加权晋升信号从 memory/YYYY-MM-DD.md 对短期候选排名(频率、相关性、查询多样性、时效性、巩固度、概念丰富度)
  • 同时使用 short-term 信号和 light/REM 阶段的强化信号
  • Dreaming 启用时,memory-core 自动管理一个 cron job 在后台运行完整 sweep(无需手动 openclaw cron add
  • --agent <id>
  • --limit <n>
  • --min-score <n>
  • --min-recall-count <n>:候选所需最小 recall 次数
  • --min-unique-queries <n>:候选所需最小不同查询次数
  • --apply
  • --include-promoted
  • --json

memory promote-explain

解释特定晋升候选的评分明细。

bash
openclaw memory promote-explain <selector> [--agent <id>] [--include-promoted] [--json]
  • <selector>:候选 key、路径片段或内容片段(用于定位候选)
  • --agent <id>
  • --include-promoted
  • --json

memory rem-harness

预览 REM 阶段的反思、候选真相和深度晋升结果,不实际写入任何内容。

bash
openclaw memory rem-harness [--agent <id>] [--include-promoted] [--json]
  • --agent <id>
  • --include-promoted
  • --json

Dreaming(实验性)

Dreaming 是后台记忆巩固系统,包含三个协作阶段:Light(轻眠,整理短期素材)、Deep(深眠,将持久内容写入 MEMORY.md)、REM(REM,提炼主题模式)。

启用方式:

json
{
  "plugins": {
    "entries": {
      "memory-core": {
        "config": {
          "dreaming": {
            "enabled": true
          }
        }
      }
    }
  }
}
阶段作用写入持久存储
Light整理/暂存短期素材
Deep晋升高质量候选是(写入 MEMORY.md
REM提炼主题和反思信号

调度默认值:

配置项默认值
dreaming.frequency0 3 * * *(每天凌晨 3 点)
enabledfalse(默认关闭)

阶段策略(阈值等)为内部实现细节,不对外暴露配置项。需要手动覆盖时,通过 memory promote CLI 参数调整。

自定义 sweep 时间:

json
{
  "plugins": {
    "entries": {
      "memory-core": {
        "config": {
          "dreaming": {
            "enabled": true,
            "timezone": "Asia/Shanghai",
            "frequency": "0 */6 * * *"
          }
        }
      }
    }
  }
}

Chat 内开关:

/dreaming on
/dreaming off
/dreaming status

详细配置参考:DreamingMemory 配置参考

常见问题

Q: openclaw memory status 显示 0 files / 0 chunks,记忆搜索没有数据?

A: 先检查 MEMORY.mdmemory/*.md 文件是否存在内容。如果有内容但仍显示 0,运行 openclaw memory index --force 强制重建。还可以用 --deep 参数检查向量服务是否可用。

Q: Dreaming 启用后运行中的龙虾会占用很多资源吗?

A: Dreaming 是轻量级后台 cron,默认每天凌晨 3 点运行一次,不影响正常使用。只有 Deep 阶段会调用 embedding 接口(约等于处理一批 memory 文件)。

Q: 我修改了 MEMORY.md,记忆搜索多久后生效?

A: 文件保存后约 1.5 秒触发自动重索引,无需手动操作。如未生效,运行 openclaw memory index 手动触发。