Memory Lancedb Dreaming
Dreaming plugin for memory-lancedb — Light/REM/Deep phases, DREAMS.md, daily report with optional channel push (Feishu/WeCom/etc.).
Install
openclaw plugins install clawhub:memory-lancedb-dreamingmemory-lancedb-dreaming
Light/REM/Deep memory consolidation for OpenClaw agents using LanceDB / memory-lancedb-pro.
OpenClaw currently has one active memory slot. The built-in dreaming pipeline is tied to memory-core, so agents that use LanceDB for vector memory can lose meaningful Light → REM → Deep consolidation. This plugin keeps LanceDB as the storage backend and runs dreaming as an external OpenClaw plugin.
v0.2.8 stops daily reports from recycling the same old material — text-level REM truth dedupe, exclude promoted memories, narrative freshness on zero-promotion days, idle novelty mode after Deep stalls, and dreaming_doctor install self-check.
v0.2.6 fixes duplicate daily report pushes, adds pushOn: "changed" delivery dedupe, auto-staggers colliding report cron schedules, and rotates REM Lasting Truths / cluster exemplars across days.
v0.2.4+ reads LanceDB dbPath / embedding from plugins.slots.memory (including memory-lancedb-pro).
What You Get
With dailyReport.delivery configured, the agent can push a zero-LLM daily digest to Feishu, WeCom, or another OpenClaw channel:
| When | Output |
|---|---|
| Daily dreaming cron | Light / REM / Deep consolidation, DREAMS.md, and report snapshot |
| Daily report cron | One IM digest from the latest snapshot (auto-staggered if it collides with dreaming) |
Manual dreaming_trigger phase=all | Writes files only; IM delivery is owned by the report cron |
Local files are still written for audit and retrieval:
DREAMS.md— bilingual dream diary at the workspace rootmemory/YYYY-MM-DD.md— daily memory journal with## 梦境日报memory/dreaming/daily/YYYY-MM-DD.md— report archivememory/dreaming/light|rem|deep/YYYY-MM-DD.md— phase reportsmemory/.dreams/— snapshots, delivery state, run metadata, REM diversity history
v0.2.6+: delivery.pushOn: "changed" by default; colliding dailyReport.cron auto-staggers 30 minutes; rem.lastingTruthCooldownDays (7) and rem.clusterSpotlightCooldownDays (5).
v0.2.8 anti-repeat (for long-running installs where the same themes reword daily):
- Text-level dedupe: compares truth text over
rem.truthDedupeWindowDays(default 30); skip if similarity ≥rem.truthSimilarityThreshold(default 0.42, CJK-friendly). - Exclude promoted: memories already in
MEMORY.mdskipped by default (rem.excludePromoted). - Narrative freshness: on Deep
promoted=0days, diary uses today's Light snapshot or skips — no stale ranked candidates. - Idle novelty mode: after
deep.idleNoveltyAfterDays(default 7) zero-promotion days, REM tightens dedupe automatically. - Self-check: run
dreaming_doctororbash scripts/doctor.shbefore opening an issue. - Restore old behavior:
rem.truthSimilarityThreshold: 1,rem.excludePromoted: false,deep.idleNoveltyAfterDays: 0.
Why This Plugin
The plugin resolves a practical OpenClaw trade-off:
| Area | Native dreaming (memory-core) | This plugin (LanceDB slot) |
|---|---|---|
| Uses the active LanceDB memory slot | No | Yes |
| Full Light / REM / Deep on LanceDB vectors | No | Yes |
| LLM-named REM themes | Limited | Yes |
| Bilingual narrative diary | No | Yes |
| Daily report + channel push | No | Yes |
| Duplicate push prevention | No | Yes (v0.2.6+) |
| REM truth / exemplar rotation | No | Yes (v0.2.6+) |
| REM text anti-repeat / narrative freshness | No | Yes (v0.2.8+) |
Install self-check (dreaming_doctor) | No | Yes (v0.2.8+) |
You do not have to switch back to memory-core just to keep dreaming.
Compatibility
| Item | Notes |
|---|---|
| Verified OpenClaw | 2026.5.20, 2026.5.27, 2026.6.5 (VPS, LanceDB slot) |
| Known regression | 2026.5.22 event loop (#86201/#86194) — avoid for production |
| Third-party slot sidecar | Before 6.5/6.6, managed cron could show ok with no artifacts (#92536); fixed in #93678. Fallback: add memory-core to plugins.allow with enabled: false |
| Install | Prefer ClawHub: openclaw plugins install clawhub:memory-lancedb-dreaming; offline: scripts/install.sh |
| Troubleshooting | Run dreaming_doctor / scripts/doctor.sh first |
中文说明
让 LanceDB 的记忆真正会做梦。这个插件为使用 LanceDB / memory-lancedb-pro 的 OpenClaw 智能体恢复 Light → REM → Deep 梦境巩固能力:REM 主题命名、Deep 记忆提升、中英双语 DREAMS.md,以及可选飞书 / 企微日报推送。
v0.2.8 解决长期运行后日报「换措辞但素材重复」:REM 文本级去重、排除已提炼记忆、叙事新鲜度、Deep 空转 novelty 模式、dreaming_doctor 自检。
v0.2.6 已修复日报双推、IM 相似内容重复推送,并增加 REM Lasting Truths 与聚类 exemplar 的跨天轮换。
每天你会看到什么
配置 dailyReport.delivery 后,无需打开文件即可在 IM 里收到当日摘要(零 LLM,插件拼接)。本地仍会写入 DREAMS.md、memory/YYYY-MM-DD.md、memory/dreaming/daily/ 与各阶段报告,便于归档与检索。
| 时机 | 你会收到 |
|---|---|
| 每天 3:00 梦境 cron | 跑 Light/REM/Deep + 写快照/文件(不直接推 IM,v0.2.6+) |
| 每天 4:00 日报 cron | 从快照刷新日报并 负责 IM 推送(与主 cron 冲突时自动错开 30 分钟) |
手动 dreaming_trigger phase=all | 仅写文件;推送由日报 cron 负责 |
不想推送、只要文件:保持 dailyReport.enabled: true,省略 delivery 即可。完全关闭日报:dailyReport.enabled: false。
v0.2.8 反重复(针对长期运行后日报「素材重复」):
- 文本级去重: 与最近
rem.truthDedupeWindowDays(默认 30)天 truth 文本 比对,≥rem.truthSimilarityThreshold(默认 0.42)即跳过。 - 排除已提炼: 已在
MEMORY.md的记忆默认不再进入 lasting truths(rem.excludePromoted)。 - 叙事新鲜度: Deep
promoted=0当天不复用旧候选,改用当天 Light 或跳过。 - 空转 novelty: 连续
deep.idleNoveltyAfterDays(默认 7)天无晋升后 REM 自动收紧。 - 自检:
dreaming_doctor或bash scripts/doctor.sh。 - 保留旧行为:
rem.truthSimilarityThreshold: 1+rem.excludePromoted: false+deep.idleNoveltyAfterDays: 0。
兼容性
| 项 | 说明 |
|---|---|
| 已验证 OpenClaw | 2026.5.20、2026.5.27、2026.6.5(腾讯云 VPS,LanceDB 插槽) |
| 已知回归 | 2026.5.22 event loop(#86201/#86194),3–8s 延迟,避免使用 |
| 第三方插槽 dreaming sidecar | 6.5/6.6 之前 managed cron 可能显示 ok 但无产物(#92536);已由 #93678 修复 |
| 安装方式 | 优先 ClawHub:openclaw plugins install clawhub:memory-lancedb-dreaming;离线 scripts/install.sh |
| 排障第一步 | 先跑 dreaming_doctor / scripts/doctor.sh,再开 issue |
为什么需要这个插件
OpenClaw 同一时间只启用一个 memory 插槽。内置 dreaming 挂在 memory-core 下,读写的是 core 记忆,不是 LanceDB 向量表。插槽换成 LanceDB 后,原生管线无法对向量库跑完整 Light / REM / Deep。
memory-lancedb-dreaming = 继续用 LanceDB + 补回整套 dreaming + 可选每日 IM 日报。
能力对比
| 能力 | 原生 dreaming(memory-core) | memory-lancedb-dreaming |
|---|---|---|
| 与 LanceDB 插槽一致 | 仅 memory-core 插槽 | ✅ |
| LanceDB 向量完整管线 | ❌ | ✅ |
| 语义化 REM 主题 | 有限 | ✅ |
中英叙事 DREAMS.md | ❌ | ✅ |
| 梦境日报 + IM 推送 | ❌ | ✅ |
| 日报双推修复 / IM 去重 | ❌ | ✅ v0.2.6+ |
| REM 反重复 / 叙事新鲜度 | ❌ | ✅ v0.2.8+ |
dreaming_doctor 自检 | ❌ | ✅ v0.2.8+ |
安装
OpenClaw 2026.5.20:
openclaw plugin install仍不可用(Unknown command: openclaw plugin)。新版优先 ClawHub;离线用手动安装。推荐生产版本:OpenClaw 2026.5.20(避开 2026.5.22 回归)。
方式 A:ClawHub(推荐)
openclaw plugins install clawhub:memory-lancedb-dreaming
方式 B:安装脚本
bash scripts/install.sh memory-lancedb-dreaming-0.2.9.tgz
方式 C:手动解压
mkdir -p ~/.openclaw/plugins/memory-lancedb-dreaming
tar -xzf memory-lancedb-dreaming-0.2.9.tgz -C /tmp
cp -r /tmp/package/* ~/.openclaw/plugins/memory-lancedb-dreaming/
cd ~/.openclaw/plugins/memory-lancedb-dreaming && npm install --omit=dev
禁止 安装到
~/.openclaw/workspace/。该路径会导致plugins.load.paths校验失败、gateway 无法启动。
在 openclaw.json 中配置。必须同时配置以下两项 entry 级字段(不是 config 内字段):
| 字段 | 何时必须 | 缺少时的后果 |
|---|---|---|
hooks.allowConversationAccess: true | 始终(启用 dreaming 时) | cron 不执行 pipeline,agent 空转 ~120s |
subagent.allowModelOverride: true | 配置了 rem.model 或 narrative.model 时 | LLM 模型覆盖被拦截,REM 退化为 category 标签 |
{
"plugins": {
"load": {
"paths": [
"/root/.openclaw/plugins/memory-lancedb-dreaming"
]
},
"allow": ["memory-lancedb-dreaming"],
"entries": {
"memory-lancedb-dreaming": {
"enabled": true,
"hooks": {
"allowConversationAccess": true
},
"subagent": {
"allowModelOverride": true
},
"config": {
"enabled": true,
"cron": "0 3 * * *",
"timezone": "Asia/Shanghai",
"autoManageCron": true,
"light": { "enabled": true, "lookbackDays": 2, "limit": 100 },
"rem": {
"enabled": true,
"lookbackDays": 7,
"limit": 10,
"minPatternStrength": 0.45,
"model": "your-model-id"
},
"deep": {
"enabled": true,
"maxPromotions": 5,
"minScore": 0.7,
"minRecallCount": 3,
"maxAgeDays": 30
},
"narrative": {
"enabled": true,
"languages": ["zh", "en"]
},
"dailyReport": {
"enabled": true,
"cron": "0 4 * * *",
"languages": ["zh"],
"delivery": {
"channel": "feishu",
"to": "your-open-id",
"mode": "announce"
}
}
}
}
}
}
}
修改 hooks、subagent 或 load.paths 后必须 完整重启 gateway。
⚠️ 禁止依赖 config hot reload:热加载后日志可能仍显示
cronHook=ready,但 hook 不会重新注册。请执行openclaw gateway stop→openclaw gateway run。
若曾安装到 workspace 路径,需同时清理三处残留:
grep -r "workspace/memory-lancedb-dreaming" ~/.openclaw --include="*.json"
# 清理 openclaw.json、openclaw.json.last-good、plugins/installs.json 中的 stale 路径/记录
启动后日志应出现 cronHook=ready 和 modelOverride=ready(若配置了 rem.model)。若为 blocked 或 CONFIG BLOCKED ERROR,说明对应 entry 字段未生效。
插件启用时会自动清理遗留冲突 cron(如
dreaming-plugin-healthcheck),避免与自管理 dreaming cron 冲突。
rem.model或rem.execution.model:配置后 REM 阶段会按 category 分组 调用 LLM 生成中英文主题名;必须配合subagent.allowModelOverride: true,否则回退到 category 标签。
narrative.model未配置时会自动回退到rem.model。叙事语言由narrative.languages控制(如["zh","en"])。
每次 dreaming 运行时会从 runtime / 磁盘重新读取配置;
dreaming_status的effectiveConfig、hooks.llmModelOverrideReady、lastRun.lastRunAt、dailyReport可核对实际生效值。
LanceDB 配置来源(v0.2.4+)
Dreaming 从 当前 memory 插槽 读取 LanceDB 的 dbPath / embedding:
plugins.slots.memory指向的 entry(例如memory-lancedb-pro)- 若 slot 未设或该 entry 无 config,再回退
memory-lancedb-pro→memory-lancedb→lancedb-pro
启动日志应出现:cached LanceDB config (plugin=memory-lancedb-pro, dbPath=...)。
dreaming_status 会返回 lancedbPluginId 与 lancedb;若 pipeline 失败而日报仍在发,先查这两项。
梦境日报(v0.2.3+)
dailyReport 默认开启(enabled: true)。目标:每天自动看到昨晚梦境做了什么——文件 + 可选 IM 推送。
做了什么
每次 dreaming(phase=all)或日报 cron 触发后,插件会:
- 写入结构化快照
memory/.dreams/lancedb-dreaming-daily-snapshot.json - 汇总 Light / REM / Deep +
DREAMS.md叙事,写入memory/YYYY-MM-DD.md(## 梦境日报) - 归档
memory/dreaming/daily/YYYY-MM-DD.md - 若配置了
dailyReport.delivery→ 用sendDurableMessageBatch推到channel+to(零 LLM)
两条托管 cron(autoManageCron: true)
| Cron | 默认时间 | 作用 |
|---|---|---|
| LanceDB Memory Dreaming | 0 3 * * * | 跑 Light/REM/Deep + 写快照/文件;不直接推送 IM(v0.2.6+) |
| Dreaming Daily Report | 0 4 * * * | 刷新日报文件 + 负责唯一 IM 推送;与主 cron 冲突时自动错开 30 分钟 |
两条均为 main + systemEvent(零 LLM 触发)。OpenClaw 不允许 在 main cron 上挂 delivery,因此推送在插件 before_agent_reply 内完成,不依赖 cron.delivery。
推送配置示例(飞书)
"dailyReport": {
"enabled": true,
"cron": "0 4 * * *",
"languages": ["zh"],
"delivery": {
"channel": "feishu",
"to": "ou_xxxxxxxx",
"mode": "announce"
}
}
channel/to:与你在 OpenClaw 里用的通道一致(飞书填open_id)。- 成功时 gateway 日志:
daily report delivered via feishu to ... - v0.2.2 及以前可能静默失败,请升级到 0.2.3+。
关闭方式
"dailyReport": { "enabled": false }
仅写文件、不推送:不要写 delivery(保留 enabled: true 即可)。
输出文件
DREAMS.md— 梦境叙事日记(叙事散文 + 结构化反思概览)memory/dreaming/light/YYYY-MM-DD.md— Light 阶段原始观测memory/dreaming/rem/YYYY-MM-DD.md— REM 阶段主题模式memory/dreaming/deep/YYYY-MM-DD.md— Deep 阶段提升记录memory/YYYY-MM-DD.md— 当日 memory 日记(含 梦境日报 区块)memory/dreaming/daily/YYYY-MM-DD.md— 日报归档副本memory/.dreams/lancedb-dreaming-daily-snapshot.json— 结构化快照(供日报/cron 读取)
OpenClaw 测试流程
在 Ubuntu / OpenClaw 2026.5.20 上按顺序执行:
0. 前置检查
openclaw --version
node --version
ls ~/.openclaw/plugins/memory-lancedb-dreaming/dist/index.js
grep -r "workspace/memory-lancedb-dreaming" ~/.openclaw --include="*.json" || echo "no stale workspace path"
1. 安装 v0.2.9 并重启 gateway
openclaw plugins install clawhub:memory-lancedb-dreaming
# 或: bash scripts/install.sh memory-lancedb-dreaming-0.2.9.tgz
openclaw gateway stop 2>/dev/null || true
openclaw gateway run
确认日志:
grep "memory-lancedb-dreaming" ~/.openclaw/logs/* 2>/dev/null | tail -5
# 期望: registered ... cronHook=ready ... modelOverride=ready
2. dreaming_status / dreaming_doctor 自检
| 字段 / 工具 | 期望 |
|---|---|
hooks.cronTriggerReady | true |
hooks.llmModelOverrideReady | true(若配置了 rem.model) |
dreaming_doctor | hooks、LanceDB 插槽、cron、无路径错误 |
memoryCount | > 0 |
3. 手动 trigger
调用 dreaming_trigger,phase=all。期望产出 light/rem/deep 文件及 DREAMS.md 更新。
4. cron 触发
openclaw cron list
openclaw cron run <dreaming-job-id>
期望数秒内完成,日志含 dreaming trigger received 与 dreaming phases completed。
5. 验收清单
| # | 测试项 | 通过标准 |
|---|---|---|
| 1 | 插件注册 | cronHook=ready, modelOverride=ready |
| 2 | dreaming_status | hooks.cronTriggerReady=true |
| 3 | dreaming_trigger | 产出 light/rem/deep 文件 |
| 4 | REM 语义主题 | rem 文件含 LLM 主题名 |
| 5 | 中文叙事 | DREAMS.md 含 zh + en |
| 6 | cron 触发 | trigger received + phases completed |
| 7 | 冲突 cron 清理 | 无 dreaming-plugin-healthcheck |
| 8 | dreaming_doctor | 无 blocking 项 |
| 9 | 梦境日报文件 | memory/YYYY-MM-DD.md 含 ## 梦境日报 |
| 10 | 日报 cron | openclaw cron list 含 Dreaming Daily Report |
| 11 | 通道推送 | 日志 daily report delivered via ... + IM 收到正文 |
自定义
"deep": { "maxPromotions": 3, "minScore": 0.8 },
"narrative": { "languages": ["zh"] }
开发
npm run build
npm test
npm pack
Credits
- Project Owner & Tester: airbing11
- Developer: Cursor IDE (AI-assisted development)
- QA & Documentation: 小泡 (AI assistant)
许可证
MIT © 2026 airbing11
版本与变更
- 当前推荐版本:0.2.9(0.2.8 反重复 +
dreaming_doctor的 ClawHub 打包热修;保留 0.2.6 日报去重与 0.2.4 插槽兼容) - 页面版式基线:0.2.7(README 英文在前 +
## 中文说明) - 变更记录:CHANGELOG.md
- 验收报告:docs/v0.2.8-OPENCLAW-TEST-STEPS.md
发布渠道
- ClawHub
- GitHub Releases
- LanceDB Discussions
