Claude Code: Memory Consolidation (/dream)
A simple REM-sleep pass for Claude to turn raw session transcripts into durable project memory.

It’s easy to get Claude to follow a set of instructions. It’s much harder to get it to remember the nuance of a 2,000-line codebase across twenty different sessions.
The default behavior of most AI agents is "read the transcript." But transcripts are messy. They contain failed attempts, backtracking, and irrelevant chatter. When a session starts, the agent spends 10 minutes (and 50,000 tokens) just trying to figure what the current state of the world is.
The Solution: Memory Consolidation
Instead of letting transcripts accumulate forever, we use a process called dreaming. At the end of a session, we ask Claude to synthesize the delta — the things that actually matter — into a set of durable memory files.
The next session doesn't read the old transcripts. It reads the Memories.
The Flow
- Work: Do your regular coding session.
- Dream: Run
/dream(the skill below). - Persist: Claude updates
memory/*.mdandmemory/MEMORY.md. - Wake: The next session starts with a compact, accurate index of everything that has happened.
Get the skill
Save the block below as .agents/skills/dream/SKILL.md in your project, then invoke it with /dream at the end of any session.
// Skill not found: undefinedThe verdict
Run /dream at the end of every long session. It takes 30 seconds and it compounds — each session makes the next one faster. Paired with a solid MEMORY.md structure, it's the single highest-leverage habit I've found for working with Claude Code on long-running projects.
More writing from the archive
9 Months of Customizing Claude Code: What I Built and Why
How I turned Claude Code from a default AI assistant into a personalized workflow — 9 skills, 55 plugins, daily routines, and the philosophy behind it all.
The Hidden Emotions Shaping AI Behavior
Why AI models develop 'functional emotions' during training—and why understanding their internal 'desperation' is key to building safer products.
Projects connected to this thinking
Open Brain: Building a Personal Knowledge Backend with AI
Open Brain: Building a Personal Knowledge Backend with AI What if your notes could think? Not in a sci fi way — but in a practical, "I wrote something three months ago th…
Raiffeisen Bank: End-to-End Online Account Opening
Raiffeisen Bank: End to End Online Account Opening When Raiffeisen Bank decided to let customers open a bank account entirely online — no branch visit required — they kne…