
Background
OpenClaw’s Dreaming feature (background memory consolidation) is an experimental capability designed to:
- Light Phase: Scan recent memory files, extract key content into the short-term recall store
- REM Phase: Deduplicate and cluster the recall store
- Deep Phase: For sufficiently rich recall, call the LLM to generate a deep summary, write to
DREAMS.md, and optionally promote it toMEMORY.md
Configured to run automatically at 04:00 daily (customizable). Sounds great.
But in reality: enabling it had zero effect — no output whatsoever.
Symptoms
- Dreaming config shows
enabled: true, cron schedule is correct openclaw memory statusshows recall store always empty: 0 entries · 0 promotedDREAMS.mdnever generatedmemory/.dreams/short-term-recall.jsondoes not exist- Gateway logs show no errors, only silent “No short-term recall candidates.”
Investigation
Layer 1: Suspect Plugin / Config
Checked plugins.entries.memory-core.config.dreaming — config path correct, frequency set to 0 4 * * *. /dreaming on and /dreaming status both respond normally. Config is fine.
Layer 2: Suspect Recall Store Write Permissions
Checked /home/opc/.openclaw/workspace/memory/.dreams/ — directory exists, permissions normal. Not a permission issue.
Layer 3: Suspect Trigger Channel
Manually injected __openclaw_memory_core_short_term_promotion_dream__ event into the main session. The Hook was called (DREAMING_HOOK_FIRED_UNMISTAKABLE appeared in logs), the Pipeline executed but returned executed: false. The trigger channel works — problem is inside the pipeline.
Layer 4: Suspect Recall Store Content
Checked recall store: short-term-recall.json exists but entryCount: 0. Checked memory file list — canonical daily files stopped existing after 2026-04-04:
memory/2026-04-03.md ✅ Last standard file
memory/2026-04-04-x-credentials.md ❌ (not YYYY-MM-DD)
memory/2026-04-07-title-copy.md ❌ (not YYYY-MM-DD)
Checked session hook logs: OpenClaw’s built-in hooks/session-memory writes session fragment files in YYYY-MM-DD-HHMM.md format, not the YYYY-MM-DD.md format Dreaming requires.
Layer 5: Deep Dive into Code
Read the compiled dist files, found the key function isShortTermMemoryPath():
// Original regex (broken)
const RE = /(?:^|\/)memory\/(\d{4})-(\d{2})-(\d{2})\.md$/;
This regex only matches memory/2026-04-03.md — completely fails to match memory/2026-04-07-title-copy.md.
And recordShortTermRecalls() has the write condition:
if (result.source !== "memory") return;
if (!isShortTermMemoryPath(result.path)) return;
// write to recall store ← skipped silently here
Both conditions must pass to write. As long as the filename doesn’t match the regex, writes are silently skipped with no logs.
Root Cause
OpenClaw’s session-memory hook changed the memory file naming convention: from standard YYYY-MM-DD.md to YYYY-MM-DD-HHMM.md (session fragments). But Dreaming’s short-term recall entry regex was still the old one — only matching the standard format.
The resulting chain:
session-memory writes YYYY-MM-DD-HHMM.md → Dreaming regex doesn't match → recall store stays empty → REM phase has no input → Deep phase doesn't trigger → DREAMS.md never generated
This is a classic “interface contract mismatch” bug: both modules work correctly in isolation, but their input/output formats don’t align.
The Fix
Modified the regex in short-term-promotion-G9ML8hkA.js:
// Before
const RE = /(?:^|\/)memory\/(\d{4})-(\d{2})-(\d{2})\.md$/;
// After
const RE = /(?:^|\/)memory\/(\d{4})-(\d{2})-(\d{2})(?:-.*)?\.md$/;
(?:-.*)? matches an optional -suffix part (suffix can be -HHMM or -arbitrary-topic).
Two additional minor improvements were made in dreaming-CnlsXIYM.js (nice-to-have):
- Trigger allowlist broadened: expanded from only accepting
heartbeatto["heartbeat", "system", "cron"] - Telegram reminder text parsing: correctly extracts the raw event name from “A scheduled reminder has been triggered. The reminder content is: xxx”
Validation
After patching, manually injected a cron probe:
Schedule: 2026-04-08T06:50:48.000Z (14:50:48 CST)
Payload: __openclaw_memory_core_short_term_promotion_dream__
Result:
DREAMING_HOOK_FIRED_UNMISTAKABLE >>> trigger=heartbeat bodyLen=...
Executing pipeline... done (executed: false, success: true)
executed: false is expected — the day’s recall store entries were insufficient (threshold ≥ 3), so LLM did not generate a summary. The Pipeline completed fully; it just needs more content accumulated.
Dreaming is now end-to-end functional.
Lessons Learned
When encountering “silent failures”, go read the dist source code first, don’t guess. OpenClaw’s error handling is clean — it won’t volunteer errors, you have to trace the conditional branches yourself.
Interface contract mismatch is a classic distributed systems bug. Both modules work, but formats don’t align. Recommended fix: add broader filename matching in
isShortTermMemoryPath(), or make thesession-memoryhook write standard daily files by default.The
params.triggervalue in a Hook is not necessarily the original event type. When a cron-triggered event reaches thebefore_agent_replyhook, thetriggervalue is"heartbeat"not"cron"— this is OpenClaw’s internal event routing.On next upgrade, only one patch location needs checking:
short-term-promotion-G9ML8hkA.js. The other two changes are nice-to-have and don’t affect core functionality.
「独断万古,恐怖如斯。」 — 如烟大帝, 2026-04-08, from a battle with regular expressions