ARCANADA
All Posts
Blog April 10, 2026

Claude Code Memory Optimization: Auto Memory, Auto Dream, and the Bugs Documentation Doesn't Mention

Claude Code Memory Optimization: Auto Memory, Auto Dream, and the Bugs Documentation Doesn't Mention

Claude Code has a problem you'll only discover after 20-30 sessions: its memory degrades.

Auto Memory: How It Works

Auto Memory landed in v2.1.59 (March 2026). Claude writes notes about your project: build commands, architecture decisions, preferences, debugging patterns. Everything lives in markdown files at ~/.claude/projects/your-project/memory/. The index file MEMORY.md loads into every new session (first 200 lines or 25KB).

Sounds great. In practice, after 20+ sessions memory turns into chaos: duplicate entries, stale facts ("API uses Express" when you migrated to Fastify weeks ago), relative dates, references to deleted files. Up to 30% of entries become garbage.

Auto Dream: The Fix That Shipped Broken

Auto Dream is what Anthropic quietly shipped in v2.1.81. A background sub-agent that consolidates memory between sessions. Four phases:

  1. Orient — reads current memory directory structure
  2. Gather signal — searches session transcripts for corrections, decisions, patterns
  3. Consolidate — merge data, convert relative dates to absolute, remove contradictions
  4. Index — rebuild MEMORY.md, keep under 200 lines

Trigger: 24 hours + 5 sessions since last consolidation. Takes 8-10 minutes. Writes only to memory files, never touches source code.

The naming references REM sleep on purpose. It's memory consolidation during "downtime."

The Bug

The /memory UI shows: "Auto-dream: on — last ran 13h ago — /dream to run". Type /dream — you get Unknown skill: dream.

This bug (GitHub Issue #38461) has been open since March 24, 2026. Reproducible from v2.1.81 through v2.1.92+. Zero response from Anthropic. The feature isn't documented in official docs at all.

There are also related issues: #38426 and #39135, all reporting the same disconnect between UI and actual functionality.

How to Configure (What Actually Works)

Check your version: claude --version (need 2.1.59+). Open /memory and verify Auto memory is on.

In settings.json:

{
  "autoMemoryEnabled": true,
  "autoDreamEnabled": true
}

Disable via env: CLAUDE_CODE_DISABLE_AUTO_MEMORY=1

Workaround for /dream: just tell Claude in chat: "dream" or "consolidate my memory files". It runs the 4-phase consolidation manually. Tested and confirmed.

Should Other Agent Systems Implement This?

Absolutely. Memory decay isn't a Claude Code problem. It hits any stateful agent. If your agent accumulates context across sessions, after 50 iterations you'll have a pile of contradictions. Memory consolidation isn't a nice-to-have, it's a requirement.

But Anthropic's rollout shows what NOT to do: UI promises a feature that doesn't work; changelog says nothing; docs are silent. If you're building your own, either ship without UI promises, or finish the job.

For your own systems: the 4-phase architecture (orient, gather, consolidate, prune) is a good template. Key rule: the consolidator writes ONLY to memory files, never to project code. Lock files for concurrency. And log what changed — Auto Dream has issues with that too (Issue #38493).

Sources