What is Auto Dream in Claude Code?
TL;DR: Auto Dream is a Claude Code sub-agent that automatically consolidates memory files every 24h (after 5+ sessions). It deduplicates entries, removes stale notes, converts relative dates to absolute, and keeps MEMORY.md under 200 lines. Feature rolling out gradually (March 2026).
Auto Dream is an automatic memory consolidation mechanism in Claude Code. It works as a background sub-agent that cleans, organizes, and updates the memory files accumulated by Auto Memory across sessions.
The name draws from neuroscience: during REM sleep, the brain replays the day's events, strengthens useful connections, and discards what doesn't matter. Auto Dream does the same thing with Claude Code's notes.
The problem: memory rot
Auto Memory is a powerful feature. Claude takes its own notes while working: build commands, architecture decisions, style preferences, resolved bugs. These notes live in ~/.claude/projects/ and are reloaded every session.
The problem appears after 20, 50, or 100 sessions. Notes accumulate without maintenance:
- Stale relative dates: "Yesterday we decided to use Redis" loses all meaning three weeks later
- Contradictory entries: one note says "API uses Express," another says "Fastify migration complete"
- Duplicates: three different sessions noted the same build command
- Obsolete notes: debug solutions for files that no longer exist
- Overloaded MEMORY.md: the index exceeds 200 lines, and anything beyond that isn't loaded at startup
The result: Claude starts hallucinating based on outdated information, or loses important instructions buried in noise.
How does Auto Dream work?
Auto Dream runs in four phases, inspired by the brain's sleep memory consolidation process.
Phase 1: Orientation
Claude scans the memory directory and reads MEMORY.md to understand the current state. It builds a map of what exists.
Phase 2: Signal gathering
The sub-agent searches through recent session transcripts (JSONL files) to identify high-value patterns: user corrections, explicit saves, recurring themes, important decisions. It doesn't read everything exhaustively; it searches for specific patterns.
Phase 3: Consolidation
This is the core work:
- Date conversion: "yesterday" becomes "2026-03-24." Absolute dates remain readable over time.
- Contradiction removal: if you migrated from Express to Fastify, the "API uses Express" entry is removed
- Duplicate merging: three notes about the same build command become one clean entry
- Stale note cleanup: debug solutions for deleted files are removed
Phase 4: Pruning and indexing
MEMORY.md is updated: stale pointers removed, new files referenced, contradictions resolved. The index is kept under 200 lines (the startup loading threshold).
Trigger conditions
Auto Dream doesn't run every session. Two conditions must both be met:
| Condition | Threshold | Reason |
|---|---|---|
| Time elapsed | 24 hours minimum since last consolidation | Avoid unnecessary runs |
| Sessions accumulated | 5 sessions minimum since last consolidation | Ensure enough material to consolidate |
This dual gate prevents runs on inactive projects while ensuring regular cleanup on active ones. One observed case consolidated 913 sessions' worth of memory in about 8-9 minutes.
Safety guarantees
Auto Dream operates under strict constraints:
- Read-only on code: the sub-agent can only modify memory files, never source code
- Lock file: prevents concurrent consolidation on the same project
- Background execution: never blocks the active session
Manual triggering
You can force consolidation at any time by asking in conversation:
dream
consolidate my memory files
auto dream
Claude will run the consolidation process immediately, without waiting for the 24h and 5-session thresholds.
Claude Code's four memory systems
Auto Dream fits within an ecosystem of four complementary memory mechanisms:
| System | Role | Trigger | Written by |
|---|---|---|---|
| CLAUDE.md | Persistent project instructions | Manual | You |
| Auto Memory | Session learning capture | Continuous | Claude |
| Session Memory | Conversation continuity across sessions | Automatic | Claude |
| Auto Dream | Consolidation and maintenance | Every 24h + 5 sessions | Claude |
CLAUDE.md sets the rules. Auto Memory takes notes. Session Memory maintains the conversation thread. Auto Dream does the housekeeping.
Concrete impact
Before consolidation: a memory directory with a 280+ line MEMORY.md, contradictory entries, references to deleted files, duplicates spread across multiple files.
After consolidation: MEMORY.md drops to ~142 lines (under the 200-line startup threshold), contradictions resolved, all dates absolute, redundant entries merged into single authoritative files.
The signal-to-noise ratio improves, and Claude works more effectively on long-running projects.
Availability
Auto Dream is rolling out gradually (March 2026). The feature is controlled by a server-side feature flag. It appears in the /memory menu but can't yet be manually enabled by all users.
Configuration parameters reveal the approach:
{
"minHours": 24,
"minSessions": 5,
"enabled": false
}
The enabled parameter is managed server-side. Local settings cannot override it.
Theoretical foundation
Auto Dream's design builds on the research paper "Sleep-time Compute: Beyond Inference Scaling at Test-time" (April 2025). This research demonstrated that preprocessing context during idle periods can reduce inference costs by a factor of 5.
By consolidating memory between sessions rather than during active work, Auto Dream applies this principle: the agent's "sleep" time is useful compute.
Learn more
Memory management is just one aspect of Claude Code. Our one-day Claude Code training covers CLAUDE.md files, Plan Mode, subagents, hooks, and custom skill creation.


