Your AI agent has a memory problem. Not because it's dumb. Because memory is hard.
Every long-running agent hits the same wall. It has great conversations. It learns that you like your calendar color-coded, that your barber's name is Ken, that your business partner hates Slack. Then the context window fills up. The conversation gets compacted. And just like that - gone.
OpenClaw has a memory system that saves daily journal files when conversations overflow. My agent Donna has 210 of them across three months. That's a lot of learned behavior.
But here's the catch: those files are searched, not loaded. The agent has to actively look for them. If it searches with the wrong query, or doesn't think to search at all, those memories might as well not exist. Meanwhile the permanent memory file - the one that loads into every conversation - stays small and manually curated. The agent keeps re-learning things it already knew. Asks the same clarifying questions. Forgets decisions you made together last month.
The AI community calls this catastrophic forgetting. Anyone running a long-lived agent knows exactly what it feels like.
OpenClaw 2026.4.5 shipped something to fix it. They're calling it Dreaming.
What dreaming actually is
It runs at 3 AM on a schedule. While your bot isn't doing anything else, it processes the day's memories and figures out which ones are actually worth keeping forever.
Three phases, modeled loosely on human sleep.
Light sleep scans the last two days of journal files. It deduplicates entries that are too similar (using word-overlap math, not AI). Think of it as sorting the day's mail before anyone's awake.
Deep sleep is where it gets interesting. Every memory snippet gets scored based on how the agent actually used it in real conversations:
- How often was it recalled? (30%) - If the agent looked up the same fact 8 times across different conversations, that's not an accident.
- How relevant was it when recalled? (24%) - High relevance means it was a good match for what the agent actually needed.
- How diverse were the queries that surfaced it? (15%) - Recalled by five different questions beats the same question five times.
- How recent? (15%) - Memories decay with a 14-day half-life.
- How consistently recalled over time? (10%) - Spaced repetition beats cramming.
- How conceptually rich? (6%) - Memories that touch multiple topics carry more weight.
Snippets that score above 0.8, with at least 3 recalls from 3 different queries, get promoted. Copied verbatim into MEMORY.md - the permanent file that loads into every conversation going forward. No AI calls. No token costs. Pure math on patterns from real usage.
REM sleep looks across all recent entries for recurring themes and "candidate truths" - facts that keep showing up with high consistency but haven't been promoted yet. Writes reflections to a DREAMS.md file for you to review.
How the pipeline actually works
During the day, you chat normally. The agent calls memory_search to find relevant context, and every search result is silently logged as a recall signal - which snippet, what triggered it, how relevant it was. When a conversation fills the context window, a background flush runs: the agent extracts what's worth keeping and appends it to today's journal.
At 3 AM:
- Light sleep indexes the last 2 days of journal entries
- Deep sleep scores every snippet's recall signals and promotes the winners to MEMORY.md
- REM sleep identifies patterns and writes reflections to DREAMS.md
The agent wakes up with a slightly better permanent memory. The facts it kept reaching for yesterday are now front and center. The things it never needed quietly age out.
What does it cost?
I ran the numbers using Donna - 210 daily journal files, 3 months of conversation history.
The core dreaming engine costs exactly $0.00. It's local math on local files. No API calls.
There's an optional narrative diary that generates a summary of each phase - think: "Today I noticed Joe keeps asking about his calendar before meetings." That uses 3 LLM calls per night:
| Model | Per night | Per month |
|---|---|---|
| Claude Sonnet 4.6 | $0.04 | ~$1.10 |
| Claude Haiku 4.5 | $0.002 | ~$0.06 |
| Disabled (promotion only) | $0.00 | $0.00 |
The indirect cost worth watching: every promoted entry makes MEMORY.md larger, which adds tokens to every future conversation. If MEMORY.md grows from 12KB to 50KB over six months, that's roughly $15-20/month extra across all conversations. But that's the cost of your agent actually remembering things - and it saves money by cutting down on clarification loops.
Should you turn it on?
The good:
- Solves the number one agent problem - your bot stops forgetting important things between sessions
- Zero-cost core - the promotion engine is pure math, no LLM calls
- Self-improving - the more your agent is used, the better its memory gets
- Fully reviewable - DREAMS.md shows exactly what was promoted and why, with scores and sources
- Non-destructive - only appends to MEMORY.md, never deletes
- Runs while you sleep - zero impact on conversation speed
The less good:
- MEMORY.md grows over time - promoted entries accumulate, increasing token costs. You'll want to prune periodically.
- Verbatim copies, not summaries - what the agent wrote in its journal is what gets promoted, word for word. Poorly written entries get promoted as-is.
- Needs conversation volume - the scoring depends on recall signals. A bot that rarely searches its memory has nothing to score. This works best on active agents.
- No automatic cleanup - dreaming promotes but never demotes. Stale entries stay until you remove them manually.
- Experimental - scoring weights and thresholds may change between versions.
My take:
I'm enabling it on Donna first - promotion only, no diary, default schedule. She has three months of conversation data and a healthy recall pattern. After two weeks I'll review what got promoted and decide whether to roll it out to the rest of the fleet.
The core engine costs nothing to run, which makes this an easy experiment. Worst case: some mediocre snippets land in MEMORY.md and I clean them up. Best case: Donna stops asking me things she already knows.
For any agent that's been running for more than a few weeks with regular conversations, this is worth trying. Your agent already has the data. Dreaming just lets it learn from it.
Dreaming shipped in OpenClaw 2026.4.5. It's disabled by default - enable it with dreaming.enabled: true in your memory-core plugin config.