Skip to content

fix(memory-core): default dreaming storage to "separate" to stop polluting daily memory files#66948

Closed
jensenwang560-blip wants to merge 2 commits intoopenclaw:mainfrom
jensenwang560-blip:fix/memory-core-dreaming-default-separate
Closed

fix(memory-core): default dreaming storage to "separate" to stop polluting daily memory files#66948
jensenwang560-blip wants to merge 2 commits intoopenclaw:mainfrom
jensenwang560-blip:fix/memory-core-dreaming-default-separate

Conversation

@jensenwang560-blip
Copy link
Copy Markdown

Summary

  • Change DEFAULT_MEMORY_DREAMING_STORAGE_MODE from "inline" to "separate" in src/memory-host-sdk/dreaming.ts so Light/REM phase blocks are written to memory/dreaming/<phase>/YYYY-MM-DD.md instead of memory/YYYY-MM-DD.md.
  • Update the matching fallback in extensions/memory-core/src/dreaming.ts when params.config.storage is entirely missing.

Fixes #66947.

Why

The current default writes Light/REM dreaming output directly into the agent's daily memory file (memory/YYYY-MM-DD.md). The dreaming sweep runs at 3 AM, so by the time the first real heartbeat fires later that day, the daily file already exists with dreaming content. The LLM-driven heartbeat then judges "file exists, nothing new" and replies HEARTBEAT_OK without logging any actual session activity, producing days with zero agent-curated content despite active conversations.

The "separate" storage mode is already implemented — resolveSeparateReportPath writes Light/REM to memory/dreaming/<phase>/YYYY-MM-DD.md, and the Deep phase already writes only to that separate location. The codebase also already ships stripManagedDailyDreamingLines on the ingest side, which confirms the system already treats dreaming blocks as "not real content". This change simply stops producing that pollution in the first place for new default installs.

Existing workspaces that explicitly set storage.mode in their config are unaffected.

Test plan

  • pnpm test extensions/memory-core
  • Fresh workspace without explicit dreaming.storage.mode — verify Light/REM output lands in memory/dreaming/light/YYYY-MM-DD.md and memory/dreaming/rem/YYYY-MM-DD.md, and that memory/YYYY-MM-DD.md is no longer created by the dreaming sweep alone.
  • Workspace with explicit storage.mode: "inline" — verify inline behavior is preserved for backwards compatibility.
  • Confirm heartbeat agents now see an empty/absent daily file and resume logging real session activity.

Notes

  • Historical polluted files (e.g. memory/2026-04-14.md) still contain inline dreaming blocks after this change and would need a separate migration or manual cleanup.
  • No changelog entry added; this is a default change that could be called out in release notes at maintainer discretion.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 15, 2026

Greptile Summary

This PR changes the default dreaming storage mode from "inline" to "separate" so that Light/REM phase output is written to memory/dreaming/<phase>/YYYY-MM-DD.md instead of polluting the agent's daily memory/YYYY-MM-DD.md file. Both the SDK constant in src/memory-host-sdk/dreaming.ts and the runtime fallback in extensions/memory-core/src/dreaming.ts are updated consistently.

  • Four tests in extensions/memory-core/src/dreaming.test.ts (lines 186–189, 225–229, 261–264, 296–299) still assert storage: { mode: \"inline\", ... } as the default and will fail once this change lands.

Confidence Score: 4/5

Not safe to merge until four stale test assertions are updated to expect "separate" as the default storage mode.

The logic change itself is correct and consistent across both files, but four unit tests still assert the old "inline" default and will fail on pnpm test extensions/memory-core.

extensions/memory-core/src/dreaming.test.ts — lines 186–189, 225–229, 261–264, and 296–299 all need mode: "inline" changed to mode: "separate".

Comments Outside Diff (1)

  1. extensions/memory-core/src/dreaming.test.ts, line 186-189 (link)

    P1 Stale default assertions will break the test suite

    Four tests in this file assert storage: { mode: "inline", ... } as the expected default, but the default was just changed to "separate". These tests call resolveShortTermPromotionDreamingConfig without supplying a storage config, so they'll now resolve to mode: "separate" and fail. The same stale assertion appears at lines 225–229, 261–264, and 296–299.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: extensions/memory-core/src/dreaming.test.ts
    Line: 186-189
    
    Comment:
    **Stale default assertions will break the test suite**
    
    Four tests in this file assert `storage: { mode: "inline", ... }` as the expected default, but the default was just changed to `"separate"`. These tests call `resolveShortTermPromotionDreamingConfig` without supplying a `storage` config, so they'll now resolve to `mode: "separate"` and fail. The same stale assertion appears at lines 225–229, 261–264, and 296–299.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/memory-core/src/dreaming.test.ts
Line: 186-189

Comment:
**Stale default assertions will break the test suite**

Four tests in this file assert `storage: { mode: "inline", ... }` as the expected default, but the default was just changed to `"separate"`. These tests call `resolveShortTermPromotionDreamingConfig` without supplying a `storage` config, so they'll now resolve to `mode: "separate"` and fail. The same stale assertion appears at lines 225–229, 261–264, and 296–299.

```suggestion
        storage: {
          mode: "separate",
          separateReports: false,
        },
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(memory-core): default dreaming stora..." | Re-trigger Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc8d95b6d5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

export const DEFAULT_MEMORY_DREAMING_TIMEZONE = undefined;
export const DEFAULT_MEMORY_DREAMING_VERBOSE_LOGGING = false;
export const DEFAULT_MEMORY_DREAMING_STORAGE_MODE = "inline";
export const DEFAULT_MEMORY_DREAMING_STORAGE_MODE = "separate";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve inline mode for legacy separateReports-only configs

Switching DEFAULT_MEMORY_DREAMING_STORAGE_MODE to "separate" changes behavior for existing configs that still use the legacy shape dreaming.storage.separateReports without dreaming.storage.mode. In resolveMemoryDreamingConfig, normalizeStorageMode(storage?.mode) now falls back to "separate", so a stored config like { separateReports: false } silently flips from inline daily writes to separate-only reports. That is a backward-compatibility regression for previously persisted configs, so this default should be gated to brand-new storage blocks (or legacy-only configs should be explicitly mapped).

Useful? React with 👍 / 👎.

@jalehman
Copy link
Copy Markdown
Contributor

jalehman commented Apr 15, 2026

Closing as superseded by #66412. Thank you!

@jalehman jalehman closed this Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dreaming system pollutes daily memory files, causing heartbeat agents to skip memory logging

2 participants