ThePromptBuddy logoThePromptBuddy

Claude Code AutoDream Explained: How It Works

Anthropic's AutoDream cleans Claude Code's memory between sessions. Here's how the three-phase system works and what the March 31 source leak revealed about KAIROS.

Pranav Sunil
April 4, 2026
Anthropic's AutoDream cleans Claude Code's memory between sessions. Here's how the three-phase system works and what the March 31 source leak revealed about KAIROS.

AutoDream is Claude Code's background memory consolidation system — and thanks to an accidental source code leak on March 31, 2026, we now know far more about how it works than Anthropic intended to share.

The feature itself solves a real problem: after dozens of coding sessions, Claude's auto-generated memory files become cluttered with contradictions, stale references, and meaningless relative timestamps. AutoDream runs during idle time to clean all of that up automatically, the same way the human brain consolidates memories during sleep. Anthropic had been quietly testing AutoDream in recent Claude Code builds. The leaked source confirmed it is more sophisticated — and more deeply integrated into an unreleased always-on agent system — than the company had publicly acknowledged.


What You Need to Know

AutoDream is a background sub-agent that prunes, merges, and reorganizes Claude Code's memory files between sessions. It is currently rolling out via a server-side feature flag, meaning not all users have access yet even if they see the toggle in /memory. The feature is part of a larger unreleased system called KAIROS — an always-on autonomous agent mode that the source code leak revealed in detail. AutoDream is available today in limited rollout. KAIROS is not.

  • Enable AutoDream now if you have 20+ Claude Code sessions on a project and your memory files feel like noise.
  • Hold off on KAIROS expectations — it is engineered but not yet publicly shipped.
  • Check for the axios security issue if you updated Claude Code via npm between 00:21 and 03:29 UTC on March 31, 2026 (separate from AutoDream — see the security section below).

What AutoDream Actually Does

The problem AutoDream solves is straightforward. The biggest issue with AI coding assistants that retain context across sessions is not forgetting — it is remembering too much of the wrong things. After 20 sessions, memory files become cluttered with contradictory entries, stale debugging notes referencing deleted files, and relative timestamps like "yesterday" that lose all meaning a week later.

AutoDream is Claude Code's automated memory consolidation system. It runs in the background — typically during idle time, between active sessions, or when explicitly triggered — and performs three core operations: pruning, merging, and refreshing.

Here is what each phase does:

PhaseWhat HappensExample
PruningRemoves outdated, contradicted, or redundant entriesDebugging notes about a deleted file are removed
MergingCombines fragmented notes on the same topicThree notes about the same build quirk become one
Date normalizationConverts relative to absolute dates"Yesterday we chose Redis" → "On 2026-03-15 we chose Redis"
Index optimizationKeeps MEMORY.md under 200 linesMoves detailed notes to topic files; index holds pointers only
Contradiction resolutionRemoves overwritten factsOld "API uses Express" entry deleted after switch to Fastify

One observed case consolidated 913 sessions worth of memory in about 8 to 9 minutes. That is not a trivial performance claim — it suggests AutoDream scales to even the heaviest long-running projects.

The 200-line ceiling on MEMORY.md is a hard architectural constraint, not an aesthetic choice. At the core is MEMORY.md, a lightweight index of pointers — roughly 150 characters per line — that is perpetually loaded into the context. This index does not store data; it stores locations. Actual project knowledge is distributed across topic files fetched on demand. Raw transcripts are never fully re-read; they are searched for specific identifiers only. This keeps startup context lean and prevents the model from drowning in its own history.


The Memory Architecture Behind It

AutoDream did not arrive in a vacuum. It builds on a two-layer memory system Anthropic has been developing since early 2026.

Claude Code has always had a form of persistent memory in the shape of CLAUDE.md — the instruction files users write to carry project rules and preferences across sessions. What Anthropic added in February was "auto memory," which lets Claude save its own notes as it works — from build commands and debugging insights to architecture decisions and code style preferences. Those notes are stored in a separate memory file, typically surfaced as MEMORY.md, which Claude updates over time and reloads at the start of each session.

Thariq Shihipar, a member of technical staff at Anthropic, described this as a split between user-defined instructions and model-generated memory: "You can now think of Claude.md as your instructions to Claude, and Memory.md as Claude's memory scratchpad it updates."

AutoDream is the third layer — the one that maintains the quality of MEMORY.md over time, so the first two layers do not degrade into noise.

One design decision stands out from the leaked source: the write discipline requires writing to a topic file first, then updating the index. Never dumping content directly into the index. If a fact can be re-derived from the codebase, it is not stored at all. Memory is treated as a hint, not as truth. That last point matters. Claude Code is designed to verify its own memories against the actual codebase before acting on them — which prevents confident errors based on stale stored beliefs.


How to Check If You Have It

Run /memory in any Claude Code session. The interface shows whether Auto-dream is on or off. If the option does not appear at all, the feature has not rolled out to your account yet.

References to AutoDream have surfaced in Claude Code versions including v2.1.83, with users pointing to a toggle inside the /memory interface. While the toggle suggests the feature is present in some form, it cannot yet be invoked directly — there is no working /dream command for all users. Reports indicate it runs automatically only when certain conditions are met, such as after a period of activity across multiple sessions.

The feature is controlled by a server-side feature flag, meaning Anthropic manages the rollout. Not every user has access yet even with the setting enabled.

Before enabling AutoDream: back up your ~/.claude/ directory before enabling AutoDream for the first time. The feature prunes aggressively. If it removes something you wanted to keep, having a backup provides a recovery path.


KAIROS: The Bigger Picture AutoDream Is Part Of

Here is what Anthropic did not plan to announce yet.

The leaked source reveals a feature flag called KAIROS — the Ancient Greek concept of "at the right time" — mentioned over 150 times in the source. KAIROS represents a fundamental shift in user experience: an autonomous daemon mode. While current AI tools are largely reactive, KAIROS allows Claude Code to operate as an always-on background agent.

AutoDream is a component of KAIROS, not a standalone feature. KAIROS runs in the background, 24/7, without you asking. Every few seconds it receives a heartbeat prompt: "anything worth doing right now?" It evaluates what is happening and makes a call: act, or stay quiet. If it acts, it can fix errors, respond to messages, update files, run tasks. It has three exclusive tools that regular Claude Code does not have: push notifications so it can reach you on your phone or desktop even when the terminal is closed, file delivery so it can send you things it created without being asked, and PR monitoring.

According to comments inside the leaked source — from unverified internal notes, not from any official Anthropic announcement — a teaser was planned for April 1–7, with a full launch targeted for May 2026. Anthropic hasn't confirmed any of this publicly.

The strategic implication is significant. If shipped together, KAIROS and ULTRAPLAN would position Claude Code as a persistent development environment rather than a session-based assistant. ULTRAPLAN is a separate unreleased feature that offloads complex architectural planning to a cloud-based Opus session running for up to 30 minutes.


How AutoDream Compares to Competing Tools

The memory management gap between Claude Code and its rivals is meaningful.

ToolPersistent MemoryCross-Session LearningAuto-Consolidation
Claude Code (AutoDream)✅ MEMORY.md + topic files✅ Auto Memory✅ AutoDream (rolling out)
Cursor⚠️ Static config files only
GitHub Copilot❌ Minimal
Windsurf⚠️ Project-level rules

Cursor's memory system is essentially static configuration files — you write rules and they persist, but nothing manages them. GitHub Copilot barely has persistent memory at all. Windsurf has project-level rules but no cross-session learning. Claude Code with AutoDream is the only tool that actually gets smarter over time without you manually curating its knowledge base.


The Security Situation You Need to Know About

The AutoDream story is inseparable from the Claude Code source leak that brought it to wide attention.

On March 31, 2026, security researcher Chaofan Shou noticed that Anthropic had shipped a .map file inside version 2.1.88 of the @anthropic-ai/claude-code npm package. That file pointed to a zip archive containing the full, readable source code of Claude Code: 1,906 TypeScript files, roughly 512,000 lines.

Anthropic confirmed the leak in a statement: "No sensitive customer data or credentials were involved or exposed. This was a release packaging issue caused by human error, not a security breach. We're rolling out measures to prevent this from happening again."

Separately — and this is urgent for a specific group — a concurrent supply-chain attack on the axios npm package occurred hours before the leak. If you installed or updated Claude Code via npm on March 31, 2026, between 00:21 and 03:29 UTC, you may have inadvertently pulled in a malicious version of axios (1.14.1 or 0.30.4) that contains a Remote Access Trojan. You should immediately search your project lockfiles (package-lock.json, yarn.lock, or bun.lockb) for these specific versions or the dependency plain-crypto-js.

The axios attack is unrelated to the AutoDream feature and unrelated to Anthropic's packaging error. The timing was coincidental, but the overlap means anyone who updated Claude Code during that window should treat both as separate issues to investigate.


Who Should Care About AutoDream

Enable AutoDream now if:

  • You have been using Claude Code with auto memory for more than 20 sessions on a single project.
  • Your MEMORY.md is growing unwieldy and you are noticing Claude referencing outdated architectural decisions.
  • You want Claude to start each session with clean, current context rather than a backlog of stale notes.

Wait or watch if:

  • You are a new Claude Code user. Auto memory has not had time to accumulate noise for you yet. AutoDream will not do much.
  • You are in an enterprise environment with strict data policies. The autoDream service spawns a background subagent that searches through all JSONL session transcripts to consolidate memories. The agent runs in the same process as Claude — under the same API key, with the same network access — and its scan is local. Security-conscious teams will want to audit this before enabling.

This does not affect you if:

  • You use CLAUDE.md exclusively for hand-written instructions and have auto memory disabled. AutoDream only operates on auto-generated memory files, not your manual configurations.

What to Watch Next

KAIROS is the one to watch. The leaked source describes KAIROS as a persistent assistant that doesn't wait to be asked, with a special Brief output mode designed for a persistent assistant and access to tools regular Claude Code doesn't have. If Anthropic ships KAIROS as described internally, Claude Code becomes a fundamentally different kind of tool — one that maintains your codebase context around the clock without any session management on your part.

Watch for official announcements in April and May 2026. The /dream command for manual memory triggering is also rolling out progressively — users who see it return "Unknown skill" will likely gain access in coming weeks.


Conclusion

AutoDream addresses one of the most underreported problems in AI-assisted development: memory quality degradation over time. The feature itself is solid — a three-phase consolidation system that keeps Claude Code's working context clean and current across long projects. But the bigger story is what the source leak revealed about where Anthropic is taking this: an always-on agent called KAIROS that treats Claude Code as a persistent development collaborator, not a session-by-session assistant.

If you are a heavy Claude Code user, run /memory today and check your AutoDream status. Back up ~/.claude/ first. And if you updated Claude Code during the March 31 window, check your lockfiles for the axios RAT before anything else.

Join other AI professionals

Get the latest AI prompts, tool reviews, and model insights delivered straight to your inbox, completely free.