Course Lessons
Welcome & Orientation Starter
Welcome to AI Like a Pro

Quick Reference
⚡ Cheat Sheet 📐 Prompt Formula 📋 CLAUDE.md Guide
← Back to Course Home
Lesson 29 of 37  —  Module 6: Advanced Claude Code 78%
Module 6: Advanced Claude Code  Advanced

Memory 2.0: Teaching Claude to Actually Remember

Discover AutoDream, the background memory consolidation system that keeps Claude Code sessions sharp by automatically pruning and organizing your memory files.

The Problem with AI Memory

Every developer who uses Claude Code long enough hits the same wall: the agent starts to feel cluttered. It repeats questions you have already answered. Context from three sessions ago has been forgotten. Memory files balloon with redundant entries.

This is not a Claude problem -- it is an architecture problem. Without a cleanup mechanism, memory accumulates faster than it gets organized.

AutoDream solves this.


What AutoDream Is

AutoDream is a background sub-agent that runs periodically to consolidate, prune, and improve your Claude Code memory files. Anthropic released it as an experimental feature in early 2025 without major fanfare -- but developers who discovered it immediately recognized its value.

The analogy is apt: AutoDream works the way human sleep works. During sleep, the brain consolidates short-term experiences into long-term memory, discards noise, and strengthens important patterns. AutoDream does the same for your project context files.

When it runs, you will see "dreaming" appear in your status line. The agent reviews recent sessions, identifies what is important, merges duplicate entries, prunes outdated information, and writes clean updated memory files -- all without you touching anything.


The Three-Layer Memory Model

Claude Code actually has three distinct layers of memory working together:

Layer 1: Session Memory
Everything that happens in a single conversation. Coding, debugging, refactoring, tool calls. This layer is ephemeral -- it disappears when the session ends.

Layer 2: Auto-Memory (MEMORY.md)
Persistent context files that Claude Code injects at the start of each session. This is what allows Claude to "remember" your project preferences, key decisions, and architectural context across sessions. Files live in your project memory folder.

Layer 3: AutoDream
The maintenance layer. It runs in the background, reads all your memory files, and keeps them clean. Without AutoDream, Layer 2 files grow bloated over time. With AutoDream, they stay lean and accurate.

All three layers working together create an experience that feels less like a chatbot and more like a collaborator who genuinely understands your project.


How AutoDream Works (Step by Step)

When AutoDream triggers, it follows this process:

  1. Gather session info -- Reviews recent conversation sessions (it can review hundreds at once)
  2. Read existing memory files -- Loads the current state of all your MEMORY.md and related files
  3. Run the dream prompt -- Launches a sub-agent with a consolidation prompt that synthesizes everything into durable, well-organized memories
  4. Consolidate and prune -- Merges duplicates, removes outdated entries, keeps only what future sessions actually need
  5. Store results -- Writes updated memory files back to disk
  6. Repeat -- The cycle runs again on the next trigger

The dream prompt itself instructs the sub-agent to keep MEMORY.md under a line limit, treat it as an index rather than a dump, and link out to detail files with one-line descriptions.


The Benefits You Will Actually Notice

Less repetition -- You stop re-explaining things you already covered in previous sessions. The context is there.

Less bloat -- Memory files stay lean. Fewer tokens consumed at session start means more context available for actual work.

Better recall -- Fewer entries means finding relevant information is faster. Reducing noise makes the signal easier to find.

Fresh sessions -- Each time AutoDream runs, it acts as a checkpoint. Future sessions start from a clean, organized state rather than a cluttered accumulation.


Activating and Using AutoDream

To access the memory interface, type /memory in your Claude Code session. This opens the memory management panel.

In the panel, you will see:
- AutoDream status -- on/off, last run time, or "never ran"
- Auto-memory toggle -- whether persistent memory is active for this project
- Memory files list -- all the MD files AutoDream can touch

To toggle AutoDream on: hover over it and press Enter.

To manually trigger a dream: say "run your AutoDream" in natural language (the /dream command may show as an unknown skill in some versions, but natural language works reliably).

Important: AutoDream is global (applies across all projects) but operates independently per project. Activating it in one project does not affect another.


Trigger Conditions

AutoDream triggers in two ways:

Time-based -- Every N hours (approximately every 12 hours in observed behavior). Useful for projects with frequent daily activity.

Session-based -- After N sessions accumulate (approximately every 300 sessions). Useful for projects with intermittent use over a longer period.

Both triggers can fire. You can also trigger manually at any time.

When running on a large project (285 sessions in one observed test), the consolidation still completes in about 8 minutes. On smaller projects with fewer sessions, it finishes in around 10 minutes.


What AutoDream Touches (and Does Not Touch)

AutoDream only modifies memory context files -- Markdown files in your memory folder. It does not:

  • Modify source code
  • Edit scripts or configuration files
  • Change project structure
  • Delete any non-memory file

After a run, you can review exactly what changed. AutoDream shows you which entries were added and which sections were removed, giving you a clear audit trail.


Practical Recommendations

Enable it on any project you use repeatedly. The value compounds -- the longer you use a project, the more useful consistent memory hygiene becomes.

Do not disable auto-memory. AutoDream works best when the memory files it is cleaning contain real accumulated context. Auto-memory creates that context.

Keep MEMORY.md under 200 lines. Claude Code truncates beyond that limit. AutoDream respects this constraint, but if you manually write to MEMORY.md, stay within bounds.

Review after the first run. For a new project, the first AutoDream run is a good opportunity to verify it captured the right context and pruned the right noise.


Watch the Original

  • Claude Code Just Dropped Memory 2.0 -- youtube.com/watch?v=LrgfmZkl3nc -- 9 min

Next lesson: Claude Code as Your Executive Assistant

HivePowered AI — AI Like a Pro Training