Bug
The pre-compaction memory flush prompt explicitly instructs the agent to update SESSION_HANDOFF.md:
ALSO: Update SESSION_HANDOFF.md with current session state (what was being worked on, background processes, pending tasks, key decisions, file paths). This is critical for session continuity — the next session reads this first. Overwrite the entire file with fresh content.
However, the runtime tool sandbox during flush turns restricts writes to only memory/YYYY-MM-DD.md, blocking the SESSION_HANDOFF.md write with an error like:
Memory flush writes are restricted to memory/YYYY-MM-DD.md; use that path only.
Expected Behavior
The flush write sandbox should allow writes to both:
memory/YYYY-MM-DD.md (daily notes)
SESSION_HANDOFF.md (session continuity file)
...or any path explicitly mentioned in the user-configured memoryFlush.prompt.
Reproduction
- Configure
agents.defaults.compaction.memoryFlush.prompt to include SESSION_HANDOFF.md instruction (this is the default/recommended setup)
- Let a session reach the soft compaction threshold
- Observe that the flush turn writes to
memory/YYYY-MM-DD.md successfully but fails to write SESSION_HANDOFF.md
Workaround
SESSION_HANDOFF.md gets written in the next normal turn after the flush, but this is fragile — if the session resets immediately after flush, the handoff is lost.
Environment
- OpenClaw: latest (as of 2026-04-14)
- Config:
memoryFlush.enabled: true, softThresholdTokens: 8000
Bug
The pre-compaction memory flush prompt explicitly instructs the agent to update
SESSION_HANDOFF.md:However, the runtime tool sandbox during flush turns restricts writes to only
memory/YYYY-MM-DD.md, blocking the SESSION_HANDOFF.md write with an error like:Expected Behavior
The flush write sandbox should allow writes to both:
memory/YYYY-MM-DD.md(daily notes)SESSION_HANDOFF.md(session continuity file)...or any path explicitly mentioned in the user-configured
memoryFlush.prompt.Reproduction
agents.defaults.compaction.memoryFlush.promptto include SESSION_HANDOFF.md instruction (this is the default/recommended setup)memory/YYYY-MM-DD.mdsuccessfully but fails to writeSESSION_HANDOFF.mdWorkaround
SESSION_HANDOFF.md gets written in the next normal turn after the flush, but this is fragile — if the session resets immediately after flush, the handoff is lost.
Environment
memoryFlush.enabled: true,softThresholdTokens: 8000