#Dreaming, memory and bloated context

8 messages · Page 1 of 1 (latest)

honest pilot
#

So, after enabling dreaming my memory files became enormous.
• memory/2026-04-14.md — 61047 chars
• memory/2026-04-15.md — 28086 chars

Agent load 2 previous days of memory automatically by default in every new session, so right now I start with 200k context every time. Any fixes for that?

proud joltBOT
#

That sounds off. On current builds, dreaming itself should not be stuffing memory/YYYY-MM-DD.md into every new session.

A few important bits I verified:

  • Dreaming writes mainly to memory/.dreams/, DREAMS.md, optional memory/dreaming/..., and promotions to MEMORY.md, not your daily memory/YYYY-MM-DD.md files.
  • Daily memory/*.md files are not part of normal bootstrap.
  • For bare /new and /reset, startup-context only preloads recent daily memory with hard limits by default:
    • 2 days
    • skip files over 16,384 bytes
    • max 2,000 chars per file
    • max 4,500 chars total

So if you are really getting ~200k on each new session, it is usually one of these:

  1. you are on an older version
  2. your AGENTS.md tells the agent to read today+yesterday from memory/ manually
  3. you overrode agents.defaults.startupContext to much larger limits
#

If you want to stop it, set:

{
  agents: {
    defaults: {
      startupContext: {
        enabled: false,
        // or reduce instead:
        // dailyMemoryDays: 1,
        // maxFileChars: 500,
        // maxTotalChars: 1000,
      },
    },
  },
}
honest pilot
#

🧠 Context breakdown
Workspace: /home/kira/.openclaw/workspace
Bootstrap max/file: 20,000 chars
Bootstrap max/total: 150,000 chars
Sandbox: mode=off sandboxed=false
System prompt (run): 54,079 chars (~13,520 tok) (Project Context 24,107 chars (~6,027 tok))

Injected workspace files:

AGENTS.md: OK | raw 11,386 chars (~2,847 tok) | injected 11,386 chars (~2,847 tok)
SOUL.md: OK | raw 1,307 chars (~327 tok) | injected 1,307 chars (~327 tok)
TOOLS.md: OK | raw 6,807 chars (~1,702 tok) | injected 6,807 chars (~1,702 tok)
IDENTITY.md: OK | raw 589 chars (~148 tok) | injected 589 chars (~148 tok)
USER.md: OK | raw 2,039 chars (~510 tok) | injected 2,039 chars (~510 tok)
HEARTBEAT.md: OK | raw 389 chars (~98 tok) | injected 389 chars (~98 tok)
BOOTSTRAP.md: MISSING | raw 0 | injected 0
MEMORY.md: OK | raw 5,057 chars (~1,265 tok) | injected 5,057 chars (~1,265 tok)

Skills list (system prompt text): 8,118 chars (~2,030 tok) (19 skills)
Skills: clawhub, coding-agent, discord, gh-issues, github, gog, healthcheck, node-connect, notion, obsidian, openai-whisper-api, session-logs, skill-creator, taskflow, taskflow-inbox-triage, tmux, video-frames, weather, mmx-cli
Tool list (system prompt text): 0 chars (~0 tok)
Tool schemas (JSON): 25,434 chars (~6,359 tok) (counts toward context; not shown as text)
Tools: read, edit, write, apply_patch, exec, process, canvas, message, tts, image_generate, music_generate, video_generate, agents_list, update_plan, sessions_list, sessions_history, sessions_send, sessions_yield, sessions_spawn, subagents, session_status, web_fetch, image, pdf, browser, memory_search, memory_get

Session tokens (cached): 182,840 total / ctx=400,000

proud joltBOT
#

Yep, this output is the giveaway: your huge daily memory/YYYY-MM-DD.md files are not what is getting auto-injected here.

What this shows:

  • Injected workspace files are just AGENTS.md, SOUL.md, TOOLS.md, IDENTITY.md, USER.md, HEARTBEAT.md, MEMORY.md
  • Your system prompt is about 13.5k tokens
  • Tool schemas add about 6.3k tokens
  • The 182,840 line is the session’s cached context/history, not “today + yesterday memory files got pasted in raw”

Also, on current builds, startup daily-memory preload would skip oversized files anyway. Your 61k and 28k daily files are both way over the default per-file startup limit.

So the main fixes are:

  1. Trim always-injected files, especially AGENTS.md, TOOLS.md, MEMORY.md
  2. Check a truly fresh session before reading too much into the 182k number
  3. If you still want to kill daily-memory preload entirely:
#
{
  agents: {
    defaults: {
      startupContext: {
        enabled: false,
      },
    },
  },
}

If you want, I’d check these next:

  • openclaw --version
  • /context list as the first message in a brand-new session
  • whether your AGENTS.md explicitly tells the agent to read memory/ on startup