fix(dreaming): default storage.mode to "separate" so phase blocks stop polluting daily memory files#66412
Conversation
Greptile SummaryFlips
Confidence Score: 5/5
|
…p polluting daily memory files Closes openclaw#66328. Before this change, every dreaming installation that did not explicitly set `plugins.entries.memory-core.config.dreaming.storage.mode` accepted the silent default of `"inline"`, which routes Light Sleep and REM Sleep phase blocks (the structured staged-candidate lists with their `<!-- openclaw:dreaming:{phase}:start -->` markers) into `memory/YYYY-MM-DD.md`. On heavy days the inline blocks dominate the daily memory file - the reporter measured 340 lines for the Light phase alone, and a second cross-host check on a v2026.4.12 install observed 475 inline lines from Light plus 14 from REM in a single sweep, leaving the daily file unusable as a "what happened today" record. The `"separate"` storage mode that was already wired up in `writeDailyDreamingPhaseBlock` writes the same content to `memory/dreaming/{phase}/YYYY-MM-DD.md` instead, leaving the daily file untouched. `stripManagedDailyDreamingLines` was already in place so the daily-ingestion scanner does not re-record dream blocks as recall candidates either way, but flipping the default also avoids the incidental round-trip where the dreaming pipeline writes inline output and then reads its own output back as fresh recall material in the next cycle. Operators who want the previous behavior can still opt in explicitly: plugins.entries.memory-core.config.dreaming.storage.mode: "inline" The host helper `normalizeStorageMode` continues to accept all three documented modes (`inline | separate | both`); only the unset-default fallback changes. Test changes: - src/memory-host-sdk/dreaming.test.ts adds two new assertions: one pinning the new default shape and one confirming explicit `"inline"` still round-trips for opt-in callers. - extensions/memory-core/src/dreaming.test.ts updates four default-output assertions in `resolveShortTermPromotionDreamingConfig` to expect `mode: "separate"`. - extensions/memory-core/src/dreaming-phases.test.ts pins `LIGHT_DREAMING_TEST_CONFIG` and the inline-mode harness in "checkpoints daily ingestion and skips unchanged daily files" to `storage.mode: "inline"` with a comment, since those tests rely on inline-mode side effects on `memory/<day>.md` and now need to opt in explicitly. The schema accept-test in extensions/memory-core/src/config.test.ts and the inline-mode write-path tests in extensions/memory-core/src/dreaming-markdown.test.ts intentionally keep asserting `mode: "inline"` because they cover input handling and the inline write path itself, both of which still need to work.
…w "separate" default Address review feedback on openclaw#66412. `writeDeepDreamingReport` is called with a defensive `params.config.storage ?? { mode: "inline", ... }` fallback for cases where the config object is loosely constructed (tests, migrations). After flipping the unset default to `"separate"` in `src/memory-host-sdk/dreaming.ts`, this hardcoded `"inline"` fallback would silently re-introduce the old behavior for any caller that exercises the fallback branch. Update the fallback to `"separate"` so all default code paths agree. The `MemoryDreamingStorageMode` type continues to accept all three documented modes; this is purely a default-value alignment.
afee0f4 to
4b1c8ac
Compare
|
Merged via squash.
Thanks @mjamiv! |
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…p polluting daily memory files (openclaw#66412) Merged via squash. Prepared head SHA: 4b1c8ac Co-authored-by: mjamiv <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Summary
Closes #66328.
The dreaming pipeline writes Light Sleep and REM Sleep phase blocks to the location selected by
dreaming.storage.mode. The mode was already wired up to support"inline" | "separate" | "both"inwriteDailyDreamingPhaseBlock, but the unset-default fallback insrc/memory-host-sdk/dreaming.tswas hardcoded to"inline". As a result, every installation that didn't explicitly setplugins.entries.memory-core.config.dreaming.storage.modesilently got dream phase blocks injected straight intomemory/YYYY-MM-DD.md.This PR flips the unset-default to
"separate". Phase blocks now land inmemory/dreaming/{phase}/YYYY-MM-DD.mdby default, leaving the daily memory file alone.Why this matters (#66328)
The reporter measured 340 lines of Light Sleep narrative being injected into a single daily file. A second host on a v2026.4.12 install observed 475 inline lines from the Light phase plus 14 from REM in a single sweep, leaving the daily file unusable as a "what happened today" record - the same dreaming output that gets dumped into
DREAMS.md(working correctly) was also being dumped inline.The reporter also surfaced the symptom side: when an agent reads
memory/YYYY-MM-DD.mdto answer "what did I do yesterday?" it ends up reading hundreds of lines of dreaming narrative instead of actual event records.stripManagedDailyDreamingLinesalready protects the daily-ingestion scanner from re-ingesting dream marker blocks as recall candidates, so the recall side is unaffected by either mode. Flipping the default just stops the daily file from being written to in the first place.Backward compatibility
Operators who actually want inline behavior can opt in explicitly:
normalizeStorageModecontinues to accept all three documented modes (inline | separate | both); only the unset-default fallback changes. TheMemoryDreamingStorageModetype is unchanged.Test changes
src/memory-host-sdk/dreaming.test.tsadds two new assertions: one pinning the new default shape, and one confirming explicit"inline"still round-trips for opt-in callers.extensions/memory-core/src/dreaming.test.tsupdates four default-output assertions inresolveShortTermPromotionDreamingConfigfrommode: "inline"tomode: "separate".extensions/memory-core/src/dreaming-phases.test.tspinsLIGHT_DREAMING_TEST_CONFIGand the inline-mode harness in checkpoints daily ingestion and skips unchanged daily files tostorage.mode: "inline"with an inline comment, since those tests rely on inline-mode side effects onmemory/<day>.mdand now need to opt in explicitly. The substantive coverage they provide is unchanged.The schema accept-test in
extensions/memory-core/src/config.test.tsand the inline-mode write-path tests inextensions/memory-core/src/dreaming-markdown.test.tsintentionally keep assertingmode: "inline"because they cover input handling and the inline write path itself, both of which still need to work.Validation
pnpm vitest run extensions/memory-core/src/dreaming-phases.test.ts extensions/memory-core/src/dreaming.test.ts extensions/memory-core/src/dreaming-markdown.test.ts extensions/memory-core/src/dreaming-narrative.test.ts extensions/memory-core/src/dreaming-command.test.ts extensions/memory-core/src/dreaming-repair.test.ts extensions/memory-core/src/memory-events.test.ts extensions/memory-core/src/config.test.ts src/memory-host-sdk/dreaming.test.tspnpm check): madge import cycles, tsgo, oxlint, host-env-policy:swift, webhook auth body order, pairing-store-group, pairing-account-scope - all clean.