Claude Code

March 24, 2026 · View on GitHub

Claude Code includes a hidden autoDreamEnabled preference that activates background memory consolidation. When enabled, Claude Code periodically spawns a subagent to review and clean up your memory files — automatically.

Enabling Auto-Dream

Add the following to your Claude Code settings:

# User-level (applies to all projects)
~/.claude/settings.json

# Project-level (applies to one project)
.claude/settings.json
{
  "preferences": {
    "autoDreamEnabled": true
  }
}

See settings.example.json for a complete example.

What Happens When It Runs

When auto-dream is active, Claude Code will:

  1. Detect memory staleness — After enough sessions have passed, the system identifies that consolidation is needed
  2. Spawn a background subagent — A lightweight agent runs outside your main conversation context
  3. Review memory files — The subagent reads your MEMORY.md index and all referenced memory files
  4. Consolidate — Duplicates are merged, stale entries pruned, and related items grouped
  5. Update MEMORY.md — The index is rewritten with consolidated pointers

You will not see the dream agent running. It operates silently in the background.

What It Consolidates

ActionExamples
MergeFive "project status" entries → one current entry
PruneCompleted one-time tasks, superseded decisions
RewriteVague descriptions → specific, actionable entries
PreserveUser preferences, feedback, active project context

Verifying It Works

After enabling, check your memory directory after several sessions:

# Check memory file modification times
ls -lt ~/.claude/projects/*/memory/

# Look at MEMORY.md for consolidation evidence
cat ~/.claude/projects/*/memory/MEMORY.md

Signs auto-dream has run:

  • Memory files have been modified outside your session times
  • MEMORY.md is more concise than expected
  • Duplicate entries have been merged

Troubleshooting

Auto-dream doesn't seem to run:

  • Verify the setting is in the correct settings.json (user vs project level)
  • The feature requires a sufficient number of memory files to trigger
  • It runs on Claude's schedule, not on every session

Memories were incorrectly pruned:

  • Auto-dream is conservative by default, but it can make mistakes
  • Re-add important context in your next session — the system will learn
  • Consider the OpenClaw version if you need full control over consolidation rules

Setting not recognized:

  • Ensure you're on a recent version of Claude Code
  • The setting key is autoDreamEnabled (camelCase, under preferences)

Limitations

  • No control over consolidation rules (black box)
  • No log of what was changed
  • Cannot customize the schedule
  • Cannot target specific memory files

If you need more control, see the OpenClaw version which provides full customization via DREAM.md.

Technical Details

See how-it-works.md for a technical deep-dive into how auto-dream was discovered and how it operates.