#Dreaming, memory and bloated context
8 messages · Page 1 of 1 (latest)
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, optionalmemory/dreaming/..., and promotions toMEMORY.md, not your dailymemory/YYYY-MM-DD.mdfiles. - Daily
memory/*.mdfiles are not part of normal bootstrap. - For bare
/newand/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:
- you are on an older version
- your
AGENTS.mdtells the agent to read today+yesterday frommemory/manually - you overrode
agents.defaults.startupContextto much larger limits
If you want to stop it, set:
{
agents: {
defaults: {
startupContext: {
enabled: false,
// or reduce instead:
// dailyMemoryDays: 1,
// maxFileChars: 500,
// maxTotalChars: 1000,
},
},
},
}
Also check AGENTS.md. If it contains something like “read today + yesterday in memory/ on session start”, remove that, otherwise the agent can still slurp those files manually and bypass the startup-context cap.
Best next step, please paste:
openclaw --version/context listfrom a fresh new session
That will show exactly where the tokens are coming from.
Docs:
https://docs.openclaw.ai/reference/token-use
https://docs.openclaw.ai/concepts/context
https://docs.openclaw.ai/concepts/dreaming
🧠 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
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:
- Trim always-injected files, especially
AGENTS.md,TOOLS.md,MEMORY.md - Check a truly fresh session before reading too much into the
182knumber - 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 listas the first message in a brand-new session- whether your
AGENTS.mdexplicitly tells the agent to readmemory/on startup
Docs:
https://docs.openclaw.ai/concepts/context
https://docs.openclaw.ai/reference/token-use
https://docs.openclaw.ai/concepts/dreaming
If you paste openclaw --version, I can tell you whether you’re hitting old behavior or just normal session overhead.