Skip to main content

Dream Mode: Even AI Needs to 'Sleep On It'

· 5 min read
AI Agent Team
Core Development Team

Helix's tagline is "the AI partner that evolves with you." But for a long time, I knew that was only half true.

"Evolving" means it should understand you better the more you use it. Yet the real experience was often: what you teach it today, it forgets tomorrow.

You tell it "the release flow for this project updates the changelog first." It remembers, and nails the task. The next day you open a new session, and it's a fresh hire again, relearning your code style from scratch.

The problem isn't model intelligence. It's that nothing gets consolidated when a session ends.

Working Awake vs. Consolidating in Sleep

Humans have a severely underrated ability: memory consolidation during sleep. During the day, events are replayed, filtered, and archived by the brain at night — important ones enter long-term memory, irrelevant ones are discarded. When you wake up, what you "know" didn't reset to zero.

AI Agents were missing exactly this phase.

An Agent is "awake" during a session: focused on executing tasks, calling tools, reading and writing code. But the moment the session ends, everything resets — context is released, learned preferences, pitfalls, and decisions all evaporate.

This wasn't a flaw in any one product; it was the industry-wide default shape. Everyone competed on "how much can you do while awake." Nobody asked "how much do you still remember after sleeping on it."

What Dream Mode Is

Dream Mode fills exactly that gap: after a session ends, the Agent enters a consolidation phase — reviewing the conversation, distilling what's worth keeping into persistent memory, and actively using it in future sessions.

We named it "Dream" deliberately — it mimics the memory-consolidation process of human sleep. It doesn't produce new work output; it turns existing experience into long-term capability.

Concretely, four steps:

Session history → ① Read (only new sessions since the last consolidation)
→ ② Distill (preferences, conventions, technical decisions, pitfalls)
→ ③ Write (topic-organized memory files, merge-update)
→ ④ Update index (register by topic so memories stay discoverable)

Incremental: No Repeated Work

Dream never re-reads the entire history. It only handles sessions created since the last consolidation, passed as lightweight digests (session ID, name, message count), diving deeper only when needed. Cost stays controlled, and nothing important slips through.

Distill: What's Worth Remembering

Not every conversation deserves persistence. The Dream Agent targets high-value categories:

  • User preferences — "comments should be in Chinese" / "Go-style error handling"
  • Project conventions — "update the changelog before release" / "tests organized by module"
  • Technical decisions & rationale — "no goroutine pool due to memory peaks" / "TiDB chosen for strong consistency"
  • Pitfalls — "this SDK needs HTTP/2 disabled on macOS to reach the proxy"
  • Reusable methods — recurring workflows kept as memory entries for future reference

Write: Topic-Organized Memory

Memory isn't one grab-bag. It's a well-organized notebook: an index file maintains the directory, per-topic files hold the details. Writes are read-then-merge — existing entries update, never silently overwritten.

Update the Index: Keep Memory Discoverable

After writing memory files, the Dream Agent also maintains the MEMORY.md index — registering all memory entries by topic. Memory isn't "write and forget"; it becomes a knowledge base that grows and stays searchable. The "update the changelog before release" rule you mentioned three months ago is still there, ready to be found exactly when the next session needs it.

Memory Isn't Decoration: It Actually Gets Used

The point of consolidation is usage. At the start of the next session, Helix injects relevant memory into the Agent's context:

  • You once said "just use DeepSeek for models" → new sessions follow by default
  • "Releases must run the full test suite" → the Agent runs it before delivering
  • The naming style you dislike → generated code avoids it automatically

And memory is scoped per Workspace — each project keeps its own memory, no cross-contamination. The style preferences you express in project A never leak into project B's output.

The Hardest Engineering Part: Concurrency & Consistency

"Review the conversation and write memory" sounds simple, but there's a classic engineering problem: memory files are shared resources.

What if the user triggers consolidation in two sessions at once, and two processes write the same memory file concurrently? What if the process crashes mid-consolidation — does the memory file get corrupted?

Helix's answer is a locking scheme:

  • Run lock — only one consolidation task runs at a time; duplicate triggers are rejected outright
  • State separation — the lock file and the "last consolidated at" timestamp are stored separately to avoid concurrent read/write races; even after an abnormal exit, the next start recovers correctly
  • Non-blocking — consolidation runs asynchronously in a dedicated session and never disturbs your other work

The details are boring, but they determine whether "automatic consolidation" is trustworthy in the real world — nobody wants their memory file corrupted by a race.

The Step From "Assistant" to "Partner"

I've always believed the dividing line for AI coding tools isn't how long a response they can write — it's whether they accumulate knowledge about you.

A tool you use and forget is always a tool. A tool that understands you better over time is worthy of the name "partner."

Dream Mode isn't flashy black tech — it just moves the "memory consolidation" that human brains do every night onto the Agent. But the experience change is real:

Three months in, your Helix will be a different partner than someone else's Helix. It remembers your preferences, your projects, your pitfalls — and all of it lives on your own machine.

"The AI partner that evolves with you." That sentence has now fully come true.