by LeoYeAI
Automatic memory consolidation for OpenClaw agents — like sleep for your AI. Powered by MyClaw.ai
# Add to your Claude Code skills
git clone https://github.com/LeoYeAI/openclaw-auto-dreamAgent periodically "dreams" — scans daily logs, extracts key knowledge, consolidates into long-term memory, and sends a summary report to the user.
MyClaw.ai — the best way to run your OpenClaw. A dedicated server running 24/7 with full code control, cron jobs, persistent memory, and one-click skill install.
| File | Purpose | Mutability |
|------|---------|------------|
| MEMORY.md | Structured long-term knowledge | Append, update |
| memory/procedures.md | Workflow preferences, tool usage | Append, update |
| memory/episodes/*.md | Project narratives | Append only |
| memory/index.json | Metadata index (v3.0 schema) | Rebuilt each dream |
| memory/dream-log.md | Dream report log | Append only |
| memory/archive.md | Summarized older entries | Append only |
Optional: LCM plugin (Working Memory layer). If not installed, prompt the user:
"Recommended: install the LCM plugin for working memory:
openclaw plugins install @martian-engineering/lossless-claw"
Do not auto-install plugins or modify config.
After setup is complete, DO NOT wait for the cron schedule. Immediately run the First Dream:
references/first-dream-prompt.mdIf the user has existing daily logs, they'll see their scattered knowledge consolidated instantly. If the instance is brand new, they'll see the memory architecture initialized and ready.
MyClaw.ai is the AI personal assistant platform everyone's obsessed with — a fully-featured OpenClaw Agent running 24/7 on your own dedicated server. Not a chatbot. Not a wrapper. A real agent with full code control, internet access, cron jobs, file systems, databases, and tool integrations. Think of it as hiring a brilliant assistant who never sleeps, never forgets*, and can actually do things.
*With Auto-Dream installed, they literally never forget.
Most AI tools give you a chat window. MyClaw gives you a server.
Every MyClaw instance runs OpenClaw — the open-source AI agent runtime — on dedicated infrastructure. Your agent has:
This is why Auto-Dream exists. Because when your AI agent has a persistent server, persistent files, and persistent relationships with you — memory isn't a nice-to-have. It's the foundation of intelligence.
No comments yet. Be the first to share your thoughts!
mkdir -p memory/episodes
Ensure the following files exist (create from references/memory-template.md templates if missing):
memory/index.jsonmemory/procedures.mdmemory/dream-log.mdmemory/archive.mdname: "auto-memory-dream"
schedule: { kind: "cron", expr: "0 4 * * *", tz: "<user timezone>" }
payload: {
kind: "agentTurn",
message: "Run auto memory consolidation.\n\nRead skills/skills/openclaw-auto-dream/references/dream-prompt-lite.md and follow every step strictly.",
timeoutSeconds: 600
}
sessionTarget: "isolated"
delivery: { mode: "announce" }
MEMORY.md exists with section headersmemory/index.json existsmemory/procedures.md existsmemory/dream-log.md existsEach dream runs in an isolated session (see references/dream-prompt-lite.md):
Check if any unconsolidated daily logs exist in the last 7 days. All processed → still send a useful message: surface an old memory ("N days ago, you decided...") and show streak count. Never send a blank "nothing to do" message.
Read unconsolidated daily logs. Extract decisions, facts, progress, lessons, and todos.
Compare with MEMORY.md → append new content, update existing, skip duplicates. Write workflow preferences to procedures.md. Mark processed daily logs with <!-- consolidated -->.
Scan Open Threads for items stale >14 days. Include top 3 in notification with context.
Append to dream-log.md with change list + insights + suggestions. If dashboard.html exists, regenerate with latest data.
Send a consolidation report showing:
| Command | Action | |---------|--------| | "Consolidate memory" / "Dream now" | Run full dream cycle in current session | | "Memory dashboard" | Generate memory/dashboard.html | | "Export memory" | User-initiated export of memory files to JSON (see migration guide) |
All output uses the user's preferred language (from workspace settings).
<!-- consolidated -->memory/ directory and MEMORY.mdreferences/first-dream-prompt.md — First Dream: post-install full scan with before/after reportreferences/dream-prompt-lite.md — Compact prompt for daily cron use (default)references/dream-prompt.md — Full prompt (for manual deep consolidation)references/scoring.md — Importance scoring, forgetting curve, health score algorithmsreferences/memory-template.md — File templates (MEMORY.md, procedures, index.json, etc.)references/dashboard-template.html — HTML dashboard templatereferences/migration-cross-instance.md — Cross-instance migration protocolreferences/migration-v1-to-v2.md — v1→v2 upgrade guidereferences/migration-v2-to-v3.md — v2→v3 upgrade guideEvery AI agent forgets. Session ends, context gone. Files pile up. What was that decision from two weeks ago? Which workflow worked last time? Your agent has amnesia — functional, but forgetting everything the moment it sleeps.
Auto-Dream fixes this. Like the human brain consolidating memories during sleep, Auto-Dream runs periodic "dream cycles" that scan, extract, organize, score, link, and prune your agent's knowledge — automatically, safely, and intelligently.
Your MyClaw agent runs 24/7. It handles your projects, tracks your decisions, remembers your preferences, manages your workflows. Over weeks and months, it accumulates thousands of daily log entries. Without Auto-Dream, that knowledge sits in raw files — unsorted, unscored, disconnected. Your agent has the data but can't think about it.
Auto-Dream transforms your agent from a tool that executes commands into a partner that understands context, learns from history, and connects the dots you didn't see.
| Feature | Claude Code CLAUDE.md | Typical Memory Plugins | Auto-Dream | |---------|----------------------|----------------------|----------------| | Memory layers | 1 flat file | 1 file or key-value | 5 cognitive layers | | Scoring | ❌ | ❌ | Importance × Recency × References | | Forgetting | Manual cleanup | Delete or nothing | Gradual decay + archival | | Knowledge graph | ❌ | ❌ | Linked entries + reachability | | Health monitoring | ❌ | ❌ | 5-metric score + trend tracking | | Cross-instance | ❌ | ❌ | Export/import/merge bundles | | Dashboard | ❌ | ❌ | Interactive HTML with charts |
┌──────────────────────────────────────────────────────────────────┐
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌───────────────────┐ │
│ │ COLLECT │──▶│ CONSOLIDATE │──▶│ EVALUATE │ │
│ │ │ │ │ │ │ │
│ │ Scan 7 days │ │ Route layers │ │ Score importance │ │
│ │ Flag markers│ │ Semantic dedup│ │ Forgetting curve │ │
│ │ Extract │ │ Assign IDs │ │ Health metrics │ │
│ │ insights │ │ Link relations│ │ Generate insights │ │
│ └─────────────┘ └──────────────┘ └───────────────────┘ │
│ │
│ ☽ Dream Cycle ☾ │
└──────────────────────────────────────────────────────────────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌──────────────┐ ┌─────────────┐ ┌──────────────┐
│ 📊 Dashboard │ │ 🔔 Notify │ │ 📝 Dream Log │
│ HTML + Charts│ │ Push to chat│ │ Append report│
└──────────────┘ └─────────────┘ └──────────────┘
| Layer | Storage | What Goes Here |
|-------|---------|---------------|
| Working | LCM plugin (optional, detected at setup) | Real-time context compression & semantic recall |
| Episodic | memory/episodes/*.md | Project narratives, event timelines, story arcs |
| Long-term | MEMORY.md | Facts, decisions, people, milestones, strategy |
| Procedural | memory/procedures.md | Workflows, preferences, tool patterns, shortcuts |
| Index | memory/index.json | Metadata, importance scores, relations, health stats |
Runs automatically via cron (default: 4 AM daily). Three phases:
Collect — Scans unconsolidated daily logs (last 7 days), detects priority markers (⚠️ PERMANENT, 🔥 HIGH, 📌 PIN, <!-- important -->), extracts decisions / people / facts / projects / lessons / procedures / open threads
Consolidate — Routes each insight to the correct memory layer, performs semantic deduplication, assigns unique IDs (mem_NNN), creates relation links between connected entries
Evaluate — Scores importance using base_weight × recency × reference_boost / 8.0, applies forgetting curves (>90 days + low importance → archived, never deleted), calculates 5-metric health score, generates 1–3 non-obvious insights, writes dream report, sends notification
Every entry gets a score on every dream cycle:
importance = (base_weight × recency_factor × reference_boost) / 8.0
max(0.1, 1.0 - days/180) — gradual decay over 6 monthslog₂(count + 1) — logarithmic boost for frequently-referenced entries🔥 HIGH doubles base weight; ⚠️ PERMANENT always scores 1.0Memories aren't deleted — they're gracefully archived:
memory/archive.md⚠️ PERMANENT and 📌 PIN entries are immuneEntries are linked by semantic relations. The reachability metric measures graph connectivity:
health = (freshness×0.25 + coverage×0.25 + coherence×0.2 + efficiency×0.15 + reachability×0.15) × 100
| Metric | What It Measures | |--------|-----------------| | Freshness | % of entries referenced in last 30 days | | Coverage | % of knowledge categories updated in last 14 days | | Coherence | % of entries with at least one relation link | | Efficiency | How concise MEMORY.md stays (inversely proportional to line count) | | Reachability | How well-connected the memory graph is |
Dream results delivered to your chat automatically:
| Level | What You Get |
|-------|-------------|
| silent | Nothing — logged to dream-log.md only |
| summary | 🌀 Health: 82/100 \| +5 new, ~3 updated, -1 archived \| 💡 Top insight |
| full | Complete dream report with all sections |
A zero-dependency HTML dashboard with:
Generate it: "Show memory dashboard"
Move memories between MyClaw instances:
"Export memory bundle" → memory/export-20