From Neuroscience to AI: The "Dreaming" Memory Method Behind Claude Code and OpenClaw
Claude Code and OpenClaw are doing the same thing: letting AI "dream". The name isn't arbitrary — behind it is a memory-consolidation mechanism that neuroscience has validated over hundreds of millions of years. From synaptic pruning to memory replay, AI is learning to tidy its own memory in the background, the way people do.

After Claude Code's source code leaked, everyone's attention went to that "virtual pet" Buddy system. But I noticed another interesting feature — autoDream, a memory-consolidation program that runs in the background. Its name literally means "dreaming".
Right after that, OpenClaw published a similar feature called Dreaming in its own official docs — also background memory consolidation, also using the word "dreaming".
Tracing it back, both designs point to the same neuroscience mechanism — memory consolidation during sleep.
Neuroscience: the brain sorts memories while you sleep

Neuroscientists have long known that people sort memories during sleep. Three mechanisms are central:
1. Synaptic homeostasis hypothesis (SHY) While awake, the brain keeps taking in new information and neuronal synapses are continuously strengthened. During sleep, all synapses shrink globally and proportionally — the rarely used ones get relatively weaker, the frequently reused ones stay relatively stronger.
The result is a higher signal-to-noise ratio and a brain that has regained its capacity to learn new things. It isn't selective deletion; it's a global recalibration.
2. Active systems consolidation Consolidation isn't a simple "move"; it's a re-encoding in the neocortex — the hippocampus pulls out detailed memories and merges them with existing knowledge structures in the cortex, forming more abstract, more stable representations.
3. Memory replay During sharp-wave ripple (SWR) events in sleep, place cells in the hippocampus fire again in temporal order, with time compressed (roughly 20x), replaying the day's experiences in sequence.
Together, these three mechanisms are the "memory maintenance" the brain performs in the background: calibrate the noise globally, consolidate the fragments, and make the important things permanent.
Claude Code's AutoDream
Judging from analysis of the leaked source, AutoDream's official description is:
autoDream — a background "dreaming" process that consolidates memory while you're idle. Merges observations, removes contradictions, turns vague notes into verified facts.
Three operations in practice:
| Operation | What it does |
|---|---|
| Consolidation | Merges related memory files, reducing fragmentation |
| Pruning | Identifies and deletes redundant data, minimizing clutter |
| Reorganization | Restructures the information, improving retrieval efficiency |
Claude Code's approach: the LLM decides for itself what is worth remembering. While idle it runs a background sub-Agent that merges observations, deletes contradictory notes, and upgrades vague notes into verified facts.
You can trigger it manually (/dream), or set it to fully automatic.
OpenClaw's Dreaming
It's the open-source AI assistant that a lot of people use — the one everyone calls "the lobster". Its Dreaming feature is documented in detail in the official docs:
Dreaming is the background memory consolidation pass...It is called "dreaming" because the system revisits what came up during the day and decides what is worth keeping as durable context.
It works by algorithmic scoring rather than LLM judgment, combining four signals into one score:
| Signal | Weight | Meaning |
|---|---|---|
| Frequency | 0.35 | How many times the same content has been recalled |
| Relevance | 0.35 | How high the quality score was when it was recalled |
| Diversity | 0.15 | How many different query intents have reached it |
| Recency | 0.15 | Time decay, with a 14-day half-life |
An item is promoted to long-term memory only when all thresholds pass at once.
Four modes are supported:
| Mode | Trigger frequency | Minimum score | Minimum recalls | Minimum distinct queries |
|---|---|---|---|---|
off |
Off | - | - | - |
core |
3 a.m. daily | 0.75 | 3 | 2 |
rem |
Every 6 hours | 0.85 | 4 | 3 |
deep |
Every 12 hours | 0.80 | 3 | 3 |
The core difference between the two
Same idea, different implementation philosophy:
| Claude Code AutoDream | OpenClaw Dreaming | |
|---|---|---|
| How it decides | The LLM decides for itself | Precise algorithmic thresholds |
| What triggers it | Runs automatically when idle | Timed triggers (core/rem/deep) |
| Control granularity | Opaque, hard to intervene | Explicit thresholds, manual promotion possible |
| Maturity | Relatively mature | Experimental feature (off by default) |
Claude Code: you don't need to understand it; it decides for itself. Suits users who "don't want to configure anything, just want to use it".
OpenClaw: every step is traceable. Suits users who "want to understand the logic of every decision".
The shared instinct behind one name
Claude Code named its background memory-consolidation program "dreaming" first, and OpenClaw followed with the same naming.
What's precise about it: it runs in the background while you're idle, requires no user involvement, and keeps the good while discarding the rest — which maps exactly onto the essence of human sleep.
Cleverer still, the metaphor costs engineers and users nothing to grasp: while you dream, your body rests and your brain sorts through the day. AI "dreaming" works the same way — you're writing code, and it's tidying its memory in the background.
And behind this concept sits exactly that memory-consolidation mechanism from neuroscience, validated by hundreds of millions of years of evolution.
Paradigm shift: AI starts organizing its own memory
The memory capability of AI Agent tools is evolving from "storage" to "management".

Early on, memory meant stuffing context in. AutoMemory let AI record things on its own. Now AutoDream and Dreaming let AI organize things on its own.
With those two steps done, memory for long-term projects actually becomes usable — not a pile of bloated context, but a knowledge base that keeps improving.
If you're a Claude Code or OpenClaw user, I'd suggest turning Dreaming on (for OpenClaw, /dreaming core; Claude Code already has Auto Memory by default). For long-term projects, this is a feature where you can genuinely feel the difference.
If you're an AI system designer, the trend behind this deserves more attention: the word "dreaming" hints at more than a feature — it hints at a paradigm: letting AI maintain its own memory in the background instead of depending on humans to sort it by hand.
The idea underneath — letting AI maintain its memory autonomously — is a design direction worth watching.
Related posts
One week with opencode, and I threw Claude Code away (with an opencode install guide)
A guide to Claude Code alternatives in China: hooking up GLM and MiniMax with ease