Skip to main content

Dreaming (experimental)

Dreaming is the background memory consolidation system in memory-core. It revisits what came up during conversations and decides what is worth keeping as durable context. Dreaming uses three cooperative phases, not competing modes. Each phase has a distinct job, writes to a distinct target, and runs on its own schedule.

The three phases

Light

Light dreaming sorts the recent mess. It scans recent memory traces, dedupes them by Jaccard similarity, clusters related entries, and stages candidate memories into the daily memory note (memory/YYYY-MM-DD.md). Light does not write anything into MEMORY.md. It only organizes and stages. Think: “what from today might matter later?”

Deep

Deep dreaming decides what becomes durable memory. It runs the real promotion logic: weighted scoring across six signals, threshold gates, recall count, unique query diversity, recency decay, and max age filtering. Deep is the only phase allowed to write durable facts into MEMORY.md. It also owns recovery when memory is thin (health drops below a configured threshold). Think: “what is true enough to keep?”

REM

REM dreaming looks for patterns and reflection. It examines recent material, identifies recurring themes through concept tag clustering, and writes higher-order notes and reflections into the daily note. REM writes to the daily note (memory/YYYY-MM-DD.md), not MEMORY.md. Its output is interpretive, not canonical. Think: “what pattern am I noticing?”

Hard boundaries

PhaseJobWrites toDoes NOT write to
LightOrganizeDaily note (YYYY-MM-DD.md)MEMORY.md
DeepPreserveMEMORY.md
REMInterpretDaily note (YYYY-MM-DD.md)MEMORY.md

Quick start

Enable all three phases (recommended):
{
  "plugins": {
    "entries": {
      "memory-core": {
        "config": {
          "dreaming": {
            "enabled": true
          }
        }
      }
    }
  }
}
Enable only deep promotion:
{
  "plugins": {
    "entries": {
      "memory-core": {
        "config": {
          "dreaming": {
            "enabled": true,
            "phases": {
              "light": { "enabled": false },
              "deep": { "enabled": true },
              "rem": { "enabled": false }
            }
          }
        }
      }
    }
  }
}

Configuration

All dreaming settings live under plugins.entries.memory-core.config.dreaming in openclaw.json. See Memory configuration reference for the full key list.

Global settings

KeyTypeDefaultDescription
enabledbooleantrueMaster switch for all phases
timezonestringunsetTimezone for schedule evaluation and daily notes
verboseLoggingbooleanfalseEmit detailed per-run dreaming logs
storage.modestring"inline"inline, separate, or both

Light phase config

KeyTypeDefaultDescription
enabledbooleantrueEnable light phase
cronstring0 */6 * * *Schedule (default: every 6 hours)
lookbackDaysnumber2How many days of traces to scan
limitnumber100Max candidates to stage per run
dedupeSimilaritynumber0.9Jaccard threshold for dedup
sourcesstring[]["daily","sessions","recall"]Data sources to scan

Deep phase config

KeyTypeDefaultDescription
enabledbooleantrueEnable deep phase
cronstring0 3 * * *Schedule (default: daily at 3 AM)
limitnumber10Max candidates to promote per cycle
minScorenumber0.8Minimum weighted score for promotion
minRecallCountnumber3Minimum recall count threshold
minUniqueQueriesnumber3Minimum distinct query count
recencyHalfLifeDaysnumber14Days for recency score to halve
maxAgeDaysnumber30Max daily-note age for promotion
sourcesstring[]["daily","memory","sessions","logs","recall"]Data sources

Deep recovery config

Recovery kicks in when long-term memory health drops below a threshold.
KeyTypeDefaultDescription
recovery.enabledbooleantrueEnable automatic recovery
recovery.triggerBelowHealthnumber0.35Health score threshold to trigger recovery
recovery.lookbackDaysnumber30How far back to look for recovery material
recovery.maxRecoveredCandidatesnumber20Max candidates to recover per run
recovery.minRecoveryConfidencenumber0.9Minimum confidence for recovery candidates
recovery.autoWriteMinConfidencenumber0.97Auto-write threshold (skip manual review)

REM phase config

KeyTypeDefaultDescription
enabledbooleantrueEnable REM phase
cronstring0 5 * * 0Schedule (default: weekly, Sunday 5 AM)
lookbackDaysnumber7How many days of material to reflect on
limitnumber10Max patterns or themes to write
minPatternStrengthnumber0.75Minimum tag co-occurrence strength
sourcesstring[]["memory","daily","deep"]Data sources for reflection

Execution overrides

Each phase accepts an execution block to override global defaults:
KeyTypeDefaultDescription
speedstring"balanced"fast, balanced, or slow
thinkingstring"medium"low, medium, or high
budgetstring"medium"cheap, medium, expensive
modelstringunsetOverride model for this phase
maxOutputTokensnumberunsetCap output tokens
temperaturenumberunsetSampling temperature (0-2)
timeoutMsnumberunsetPhase timeout in milliseconds

Promotion signals (deep phase)

Deep dreaming combines six weighted signals. Promotion requires all configured threshold gates to pass simultaneously.
SignalWeightDescription
Frequency0.24How often the same entry was recalled
Relevance0.30Average recall scores when retrieved
Query diversity0.15Count of distinct query intents that surfaced it
Recency0.15Temporal decay (recencyHalfLifeDays, default 14)
Consolidation0.10Reward recalls repeated across multiple days
Conceptual richness0.06Reward entries with richer derived concept tags

Chat commands

/dreaming status                 # Show phase config and cadence
/dreaming on                     # Enable all phases
/dreaming off                    # Disable all phases
/dreaming enable light|deep|rem  # Enable a specific phase
/dreaming disable light|deep|rem # Disable a specific phase
/dreaming help                   # Show usage guide

CLI commands

Preview and apply deep promotions from the command line:
# Preview promotion candidates
openclaw memory promote

# Apply promotions to MEMORY.md
openclaw memory promote --apply

# Limit preview count
openclaw memory promote --limit 5

# Include already-promoted entries
openclaw memory promote --include-promoted

# Check dreaming status
openclaw memory status --deep
See memory CLI for the full flag reference.

How it works

Light phase pipeline

  1. Read short-term recall entries from memory/.dreams/short-term-recall.json.
  2. Filter entries within lookbackDays of the current time.
  3. Deduplicate by Jaccard similarity (configurable threshold).
  4. Sort by average recall score, take up to limit entries.
  5. Write staged candidates into the daily note under a ## Light Sleep block.

Deep phase pipeline

  1. Read and rank short-term recall candidates using weighted signals.
  2. Apply threshold gates: minScore, minRecallCount, minUniqueQueries.
  3. Filter by maxAgeDays and apply recency decay.
  4. Fan out across configured memory workspaces.
  5. Re-read the live daily note before writing (skip stale or deleted snippets).
  6. Append qualifying entries to MEMORY.md with promoted timestamps.
  7. Mark promoted entries to exclude them from future cycles.
  8. If health is below recovery.triggerBelowHealth, run the recovery pass.

REM phase pipeline

  1. Read recent memory traces within lookbackDays.
  2. Cluster concept tags by co-occurrence.
  3. Filter patterns by minPatternStrength.
  4. Write themes and reflections into the daily note under a ## REM Sleep block.

Scheduling

Each phase manages its own cron job automatically. When dreaming is enabled, memory-core reconciles managed cron jobs on gateway startup. You do not need to manually create cron entries.
PhaseDefault scheduleDescription
Light0 */6 * * *Every 6 hours
Deep0 3 * * *Daily at 3 AM
REM0 5 * * 0Weekly, Sunday 5 AM
Override any schedule with the phase cron key. All schedules honor the global timezone setting.

Dreams UI

When dreaming is enabled, the Gateway sidebar shows a Dreams tab with memory stats (short-term count, long-term count, promoted count) and the next scheduled cycle time. Daily counters honor dreaming.timezone when set and otherwise fall back to the configured user timezone. Manual openclaw memory promote runs use the same deep phase thresholds by default, so scheduled and on-demand promotion stay aligned unless you pass CLI overrides.