openclaw - 💡(How to fix) Fix Memory flush write paths should be configurable (currently hardcoded to single daily log) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74198Fetched 2026-04-30 06:27:32
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Error Message

Error: 4. Observe error: "Memory flush writes are restricted to memory/2026-04-29.md; use that path only."

Fix Action

Fix / Workaround

Workaround (Current)

Don't write session-summaries during flush. Write them on the next normal turn instead. This delays persistence by 1–2 turns but works.

Code Example

Memory flush writes are restricted to memory/2026-04-29.md; use that path only.

---

{
  "agents": {
    "defaults": {
      "compaction": {
        "memoryFlush": {
          "relativePath": "memory/YYYY-MM-DD.md",
          "allowedWritePaths": [
            "memory/YYYY-MM-DD.md",
            "memory/session-summaries/*.md"
          ]
        }
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

OpenClaw Runtime: Memory Flush Write Paths Should Be Configurable

Problem

The memory flush mechanism (triggered when context window fills) currently restricts write tool calls to a single path: memory/YYYY-MM-DD.md. This is hardcoded in the binary at openclaw-tools-CUmYpN1l.js:775.

The system prompt (AGENTS.md in most workspaces) instructs agents to write two session-state files during flush:

  1. memory/YYYY-MM-DD.md — daily log (works ✓)
  2. memory/session-summaries/{channel}-{threadId}.md — structured session state (fails ✗)

Error:

Memory flush writes are restricted to memory/2026-04-29.md; use that path only.

Impact

  • Agents cannot fully persist session state during flush (STEP 1 of the flush prompt fails).
  • Session-summary writes get deferred to the next normal turn, causing a 1–2 turn delay in persistence.
  • The flush prompt's documented workflow (3-step write) is not executable as written.
  • This creates staleness: a future cold-start session reading today's daily log might miss session-summary context.

Reproduction

  1. Set up a workspace with the standard flush prompt (ask for writes to both memory/YYYY-MM-DD.md and memory/session-summaries/{channel}-{threadId}.md).
  2. Trigger a memory flush (fill context window).
  3. Try to write to memory/session-summaries/telegram-1.md.
  4. Observe error: "Memory flush writes are restricted to memory/2026-04-29.md; use that path only."

Proposed Solution

Add a configurable allowlist of paths for flush writes:

Config Schema

{
  "agents": {
    "defaults": {
      "compaction": {
        "memoryFlush": {
          "relativePath": "memory/YYYY-MM-DD.md",
          "allowedWritePaths": [
            "memory/YYYY-MM-DD.md",
            "memory/session-summaries/*.md"
          ]
        }
      }
    }
  }
}

Implementation

Modify wrapToolMemoryFlushAppendOnlyWrite in openclaw-tools-CUmYpN1l.js (line 761–789) to:

  1. Accept allowedWritePaths: string[] in options.
  2. Check if the requested path matches any pattern in the allowlist (using glob or regex).
  3. Throw only if it matches none.

Default Behavior

If allowedWritePaths is not provided, default to [relativePath] (current behavior — backward compatible).

Workaround (Current)

Don't write session-summaries during flush. Write them on the next normal turn instead. This delays persistence by 1–2 turns but works.

Notes

  • The flush prompt in AGENTS.md assumes both writes succeed. Either the prompt or the runtime needs to change.
  • Suggestion: update the prompt to skip STEP 1's session-summary write during flush, or fix the runtime to allow it.

extent analysis

TL;DR

Modify the wrapToolMemoryFlushAppendOnlyWrite function in openclaw-tools-CUmYpN1l.js to accept a configurable allowlist of paths for flush writes.

Guidance

  • Update the compaction.memoryFlush configuration to include an allowedWritePaths array with the desired paths, such as memory/YYYY-MM-DD.md and memory/session-summaries/*.md.
  • Modify the wrapToolMemoryFlushAppendOnlyWrite function to check if the requested write path matches any pattern in the allowedWritePaths array.
  • If the allowedWritePaths array is not provided, default to the current behavior of only allowing writes to the relativePath.
  • Consider updating the flush prompt in AGENTS.md to skip the session-summary write during flush, or fix the runtime to allow it.

Example

{
  "agents": {
    "defaults": {
      "compaction": {
        "memoryFlush": {
          "relativePath": "memory/YYYY-MM-DD.md",
          "allowedWritePaths": [
            "memory/YYYY-MM-DD.md",
            "memory/session-summaries/*.md"
          ]
        }
      }
    }
  }
}

Notes

The proposed solution requires modifying the openclaw-tools-CUmYpN1l.js file, which may have implications for future updates or maintenance. Additionally, the flush prompt in AGENTS.md may need to be updated to reflect the changes to the runtime.

Recommendation

Apply the proposed solution by modifying the wrapToolMemoryFlushAppendOnlyWrite function and updating the compaction.memoryFlush configuration, as this will allow for more flexibility and customization of the flush write paths.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Memory flush write paths should be configurable (currently hardcoded to single daily log) [1 comments, 2 participants]