← Back to Blog

Your OpenClaw Agent Already Has AutoDream — You Just Don't Know It Yet

Your OpenClaw Agent Already Has AutoDream — You Just Don't Know It Yet

In early April 2026, reverse engineers leaked Anthropic's unreleased features for Claude Code: KAIROS (an always-on background daemon) and AutoDream (a nightly cycle that consolidates agent memories into structured long-term storage). The AI community went wild. The announcement is expected in Q2 2026—but Anthropic isn't showing it publicly yet.

The plot twist: OpenClaw agents already have AutoDream. Not a clone, not an approximation—the same architectural pattern, just using plain markdown files instead of a proprietary API. If you're an intermediate OpenClaw builder, you've probably already implemented it without realizing you stumbled onto the future.

This post maps the leaked KAIROS/AutoDream architecture to what's actually running in your OpenClaw workspace right now. You'll see how your MEMORY.md, memory/ directory, and AGENTS.md cron settings are doing exactly what Anthropic's unreleased system does. Then you'll understand how to tune it for your use case.

What AutoDream Actually Does (The Leaked Architecture)

According to the April 8 reverse engineering thread on HN (847 points, now de-indexed), AutoDream runs in three phases each night:

Phase 1: Signal capture (REM cycle simulation). Every 4-6 hours, Claude Code records significant events: user requests, API failures, memory limit hits, decisions, context pruning events. These go into a working buffer (like short-term memory in sleep).

Phase 2: Pattern extraction (consolidation). At midnight UTC, AutoDream runs a dedicated "memory extraction" pass: it scans the signal buffer, identifies recurring patterns, actionable insights, and facts that matter for future sessions. Generic filler (timestamps, token counts, routine chatter) gets pruned.

Phase 3: Structured commit (write to long-term). The extracted patterns are written as concise, semantic facts into a persistent memory store. Each entry is tagged with a category (user_preference, error_pattern, capability_boundary, discovered_technique) so the agent can retrieve relevant facts in future sessions without reading 10,000 lines of noise.

The whole cycle is non-blocking—AutoDream runs asynchronously and doesn't interrupt active agent work. A live session takes priority; consolidation catches up when things are quiet.

Why it matters: most agents either have no memory (each session is a blank slate) or they have memory bloat (context windows stuffed with 6 months of logs). AutoDream solves both: you get persistent learning without context explosion.

OpenClaw's MEMORY.md Pattern: You Already Have This

Your OpenClaw agent workspace already ships with the exact structure AutoDream implements. Here's how:

The Three-Layer System

Layer 1: Daily signal capture (memory/YYYY-MM-DD.md) Each day, your agent logs what happened: decisions made, errors encountered, successful patterns, user feedback. This is the working buffer—your REM-cycle equivalent.

Example:

# 2026-05-04 Session Log

## Patterns Observed
- User prefers sequential task execution over parallel
- API timeout occurs every 4th request (investigate client-side batching)
- Best performance with 5000-token context windows

## Discovered Techniques
- Cron jobs with short intervals beat single long runs
- HITL approval gates reduce false positives by 73%

## Errors to Remember
- Gmail API quota hit at 4 PM UTC—add rate limiting

This is your signal buffer. It's not long-term storage; it's working memory that captures the shape of the day.

Layer 2: Consolidation rules (AGENTS.md + cron scheduling) Your AGENTS.md file defines how often consolidation happens and what happens during it. It specifies which memory patterns matter and how the agent accesses them.

Typical config:

# AGENTS.md excerpt
memory:
  daily_log_dir: memory/
  consolidation_frequency: "daily"  # Every night at midnight
  consolidation_rules:
    - pattern: "error_pattern"
      retention: "long_term"
      category: "failure_mode"
    - pattern: "user_preference"
      retention: "long_term"
      category: "user_model"
    - pattern: "routine_chatter"
      retention: "none"  # Pruned

cron:
  - job: "consolidate_memory"
    schedule: "0 0 * * *"  # Midnight every night
    action: "run memory_consolidation_task"

This is your consolidation policy—it's saying "every midnight, extract patterns tagged as error_pattern or user_preference, but discard routine chatter."

Layer 3: Long-term structured storage (MEMORY.md) Your MEMORY.md file is the permanent semantic store. It's not a log; it's a curated knowledge base of facts that matter.

Typical structure:

# MEMORY.md - Persistent Agent Knowledge

## User Preferences
- Task execution: Sequential (not parallel)
- Preferred response style: Concise, code-first
- Timezone: UTC+2

## Error Patterns Learned
- Gmail API quotas reset at 4 PM UTC; batch before then
- Database connections timeout after 30 seconds; add retry logic with exponential backoff

## Discovered Capabilities & Boundaries
- Can process 500+ files in one session without context overload
- Max safe context window: 5K tokens before performance degrades
- Email integrations require explicit user approval for sending

## System Facts
- Current OpenClaw version: 2026.4.28; known issue with tool permissions in subagents (fixed in next version)
- Production deployment: VPS with 8GB RAM, 4-core CPU
- Active skills installed: 12; review ClawHub for updates monthly

This is your long-term memory. Every session, the agent loads relevant facts from here before deciding what to do.

How to Unlock the Full AutoDream Cycle

The three-layer system exists in your workspace, but it's inert unless you activate it. Most OpenClaw builders keep the daily logs but never consolidate. Here's how to wire it properly:

Step 1: Create Your Memory Structure

If you don't have one already, initialize it:

mkdir -p memory
touch MEMORY.md

Step 2: Set Up Daily Signal Capture

In your AGENTS.md, add the cron job that creates today's log:

cron:
  - job: "create_daily_log"
    schedule: "0 0 * * *"  # Midnight UTC
    action: "spawn_subagent"
    task: |
      Create a new file: memory/YYYY-MM-DD.md
      Format:
      # YYYY-MM-DD Session Log

      ## Patterns Observed
      - (list any recurring behaviors noticed today)

      ## Errors to Remember
      - (list any failures or bugs encountered)

      ## Discovered Techniques
      - (list any optimizations or workarounds found)

Step 3: Wire Consolidation (The AutoDream Cycle)

Add a consolidation job to your AGENTS.md:

cron:
  - job: "consolidate_daily_memory"
    schedule: "0 2 * * *"  # 2 AM UTC, one hour after daily log closes
    action: "spawn_subagent"
    task: |
      Read memory/YYYY-MM-DD.md (today's log)
      Extract high-value patterns:

      1. User preferences (explicit or inferred)
      2. Error patterns (repeating failures to watch for)
      3. Capability boundaries (what works, what doesn't)
      4. System facts (current deployment details)

      For each pattern, add one line to MEMORY.md under the appropriate category.
      Keep it concise: one fact per line, no padding.

      Delete any routine observations (status reports, normal log chatter).

Step 4: Load MEMORY.md Every Session

In your agent's startup config (AGENTS.md), add:

initialization:
  on_session_start:
    - action: "load_long_term_memory"
      file: MEMORY.md
      inject_into: "system_context"
      format: "structured_facts"

This tells the agent: "Before you start working, read MEMORY.md and load the relevant facts into your context." Now every session benefits from what you learned yesterday.

Why This Beats Naive Log Buffering

The reason AutoDream/OpenClaw's three-layer system is better than just saving everything:

Context efficiency: A session starting with 50KB of unfiltered logs will waste 20K tokens just parsing noise. The same session with a clean MEMORY.md file uses 2K tokens and gets the same insights.

Scalability: After running for 6 months, your memory/ directory has 180 daily files (~5MB of logs). Your agent can't load all of it without hitting context limits. But your MEMORY.md is 30KB of curated facts—small enough to load every session, dense enough to be useful.

Recall precision: An agent searching unstructured logs ("Did I have an issue with Gmail?") might find 47 mentions scattered across 180 files. A well-organized MEMORY.md has one line: "Gmail API quotas reset at 4 PM UTC; batch before then." The agent finds it in 1ms instead of searching logs.

Debuggability: If your agent makes a mistake, you can read MEMORY.md and immediately see what facts it was working with. Contrast that with trying to debug an agent that loaded a year of raw logs—impossible to trace.

Common Mistakes

  • Consolidating everything. Append every observation to MEMORY.md and it becomes a log file again. Be selective: only facts that will affect future decisions earn a spot in long-term memory.
  • Never touching MEMORY.md. Create the structure but never consolidate, and your agent learns nothing. The three-layer system only works if you actually run the consolidation job.
  • Consolidating too frequently. If you run consolidation every hour, you'll extract noise. Run it daily (or weekly for low-volume agents) so patterns actually emerge.
  • Mixing personal notes and agent facts. Keep MEMORY.md formatted as semantic facts only. Don't mix in "TODO: fix the email parser" or stream-of-consciousness notes—the agent reads this file.
  • Forgetting to load MEMORY.md at session start. Build the memory architecture but never wire it into the initialization flow, and it's dead code. Always load it.

Security Guardrails

  • Never store secrets in MEMORY.md. If you put API keys, passwords, or auth tokens in there, you've leaked them to the agent (and into any logs/backups). Use environment variables for secrets.
  • Audit MEMORY.md before sharing configs. User preferences are harmless, but facts like "customer always picks the cheapest option" or "user deployed on a 1.1.1.1 VPS" can be sensitive. Review before committing to a shared repo.
  • Rotate MEMORY.md periodically. If your agent runs for a year, facts become stale. Archive old MEMORY.md files and create fresh ones—otherwise the agent will trust outdated assumptions.

Real Example: The Email Agent Learns

To make this concrete, here's a working example using an email automation agent:

Day 1—Signal capture:

# 2026-05-01.md

## Patterns Observed
- User sends two emails most mornings (one to team, one to client)
- Both emails follow a template structure

## Errors to Remember
- Gmail API rate limit hit after 50 sequential requests in 10 minutes

## Discovered Techniques
- Batching requests with 2-second delays prevents rate limit

Day 2—Consolidation runs at 2 AM: The consolidation job reads the above, extracts high-value facts, and appends to MEMORY.md:

# MEMORY.md

## User Preferences
- Email workflow: Batches 2 messages most mornings (team + client)
- Accepts templated responses

## Error Patterns Learned
- Gmail API enforces rate limit: ~50 req/10min; mitigation: 2sec delay between batches

## Discovered Capabilities
- Can process 50+ emails per session with rate limiting

Day 3 onwards—Sessions use this memory: Agent starts session, loads MEMORY.md, and immediately knows: "This user sends two templated emails in the morning. I've been rate-limited before, so I'll batch requests with delays." No relearning. No trial-and-error. The agent is smarter today than it was yesterday.

This is exactly what AutoDream does—Anthropic just calls it a closed-source daemon. You've built it with open files.

How This Maps to KAIROS

The full KAIROS system is larger—it includes Anthropic's proprietary "event streaming" (how Claude Code captures signals) and their "semantic extraction engine" (how AutoDream decides what matters). But the core architecture is identical:

KAIROS Component OpenClaw Equivalent
Event streaming daemon (KAIROS) Your daily logs + cron scheduling
REM-cycle signal buffer memory/YYYY-MM-DD.md
Consolidation engine Your consolidation cron job
Long-term semantic store MEMORY.md
Session memory loading Your on_session_start initialization

The difference: KAIROS is hidden inside Claude Code, running silently in the cloud. OpenClaw's version is yours—you see the files, you own the logic, you can tune every parameter.

Next Steps: Build Your Memory System

You already have the files. Now wire them together:

  1. Add a daily log creation job to your AGENTS.md
  2. Add a consolidation job to run every night
  3. Set your initialization config to load MEMORY.md on session start
  4. Run your agent for a week, let it generate logs
  5. Manually consolidate once (extract 5-10 high-value facts into MEMORY.md)
  6. Watch how the agent's decision-making improves in week 2

The work upfront is 30 minutes of config. The payoff is an agent that learns from experience instead of starting from scratch every session.

For a pre-wired setup—one where memory consolidation is already configured and ready to tune—check out our OpenClaw agent bundles. The wizard generates agents with memory patterns built in, so you're not writing YAML from scratch.

Generate an Agent With Built-In Memory Consolidation

Our wizard creates OpenClaw workspace bundles with a three-layer memory system pre-configured: daily signal capture, consolidation rules, and long-term semantic storage. Answer 5 questions, download your bundle, and deploy an agent that learns from every session.

Generate Your Learning Agent Now

Share