Skip to content

πŸ› memory-core: Dreaming subsystem causes memory bloat (7.8MB β†’ 3.7GB Gateway crash) and session-memory plugin floods memory directory with raw transcriptsΒ #68379

Description

@xiux1909

Problem Summary

The memory-core plugin's dreaming feature and session-memory auto-dump mechanism caused severe memory bloat, leading to a Gateway crash with 3.7GB RSS memory usage.

Root Cause Analysis

Issue 1: Dreaming writes without cleanup

  • The .dreams/ directory accumulated 7.8MB of data (149,224 lines in short-term-recall.json alone)
  • Dream cleanup mechanism fails silently: narrative session cleanup failed for rem/light phase: missing scope: operator.admin
  • This means dream writes data but never cleans it up β€” unbounded growth
  • sqlite-vec unavailable causes vector recall degradation, possibly triggering redundant writes

Issue 2: session-memory plugin dumps raw conversation transcripts

  • Error sessions (429 rate limits, OOM crashes, MCP config sessions) get dumped as raw conversation transcripts into the memory/ directory
  • Filenames like *-provider-finish-reason-error-f.md, *-oom-debug.md, *-figma-mcp-setup.md
  • These contain full user/assistant conversation transcripts with zero summarization
  • Every startup/heartbeat/memory_search scans these files, burning massive tokens
  • No deduplication or cleanup β€” 10+ redundant files accumulated

Issue 3: No user control

  • Dreaming has no config option to disable it until we manually patched plugins.entries.memory-core.config.dreaming.enabled = false
  • The default behavior is write-only with no cleanup, making it a ticking time bomb for all users

Impact

  • Memory: Gateway RSS grew from ~500MB to 3.7GB before crashing
  • Tokens: Every heartbeat/search loaded 7.8MB of junk, burning 100k+ tokens per invocation
  • UX: Agent became slow, unresponsive, and eventually crashed requiring manual restart

Reproduction

  1. Use OpenClaw with memory-core plugin enabled (default)
  2. Let it run for ~1 week with regular heartbeats
  3. Observe .dreams/ directory growth and memory/ directory filling with session dumps

Suggested Fixes

  1. Fix dream cleanup permissions β€” the missing scope: operator.admin error indicates cleanup lacks proper permissions
  2. Add a config toggle for dreaming that is OFF by default (or at least document it)
  3. Cap .dreams file sizes β€” enforce maximum file size with automatic truncation
  4. Session-memory should summarize, not dump β€” raw transcripts in memory directory are useless for recall; only summarized insights should be persisted
  5. Add TTL or rotation for session dump files

Workaround

Users can manually disable dreaming via config:

{
  "plugins": {
    "entries": {
      "memory-core": {
        "config": {
          "dreaming": {
            "enabled": false
          }
        }
      }
    }
  }
}

Environment

  • OpenClaw 2026.4.15
  • macOS 24.5.0 (arm64)
  • Model: Qwen3.6-Plus-DogFooding (via IDEALab)
  • memory-core plugin with sqlite-vec unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions