Upstream: openclaw#45608
Summary
Run a silent agentic memory flush before /new, /reset, and the daily reset destroy the session — same mechanism that already runs before compaction.
The asymmetry
- Compaction → agentic flush (agent curates what to save) ✅
/new / /reset → mechanical dump (raw 15 messages, no curation) ❌
- Daily reset → same mechanical dump, silently, every morning ❌
The daily reset is the default for every user (mode: "daily", atHour: 4). Any context not written to disk before 4 AM is gone.
Proposed solution
Before destroying the session, run a silent agentic turn (reusing runMemoryFlushIfNeeded) that lets the agent write durable notes to memory/YYYY-MM-DD.md or MEMORY.md, then NO_REPLY.
Most infrastructure exists:
runMemoryFlushIfNeeded (src/auto-reply/reply/agent-runner-memory.ts:253)
before_reset plugin hook (src/plugins/types.ts:541)
NO_REPLY suppression
- Daily memory checkpoint (
shouldRunDailyMemoryCheckpoint)
Main work: wire flush into the reset path before session destruction.
Open questions
- Blocking vs background flush on
/new
- Config location:
compaction.memoryFlush.onReset vs session.reset.memoryFlush
- Daily reset: proactive "bedtime flush" via heartbeat, background flush on next message, or accept daily checkpoint is good enough
- Keep
session-memory hook alongside (raw audit trail + curated memory)
Related
Upstream: openclaw#45608
Summary
Run a silent agentic memory flush before
/new,/reset, and the daily reset destroy the session — same mechanism that already runs before compaction.The asymmetry
/new//reset→ mechanical dump (raw 15 messages, no curation) ❌The daily reset is the default for every user (
mode: "daily",atHour: 4). Any context not written to disk before 4 AM is gone.Proposed solution
Before destroying the session, run a silent agentic turn (reusing
runMemoryFlushIfNeeded) that lets the agent write durable notes tomemory/YYYY-MM-DD.mdorMEMORY.md, thenNO_REPLY.Most infrastructure exists:
runMemoryFlushIfNeeded(src/auto-reply/reply/agent-runner-memory.ts:253)before_resetplugin hook (src/plugins/types.ts:541)NO_REPLYsuppressionshouldRunDailyMemoryCheckpoint)Main work: wire flush into the reset path before session destruction.
Open questions
/newcompaction.memoryFlush.onResetvssession.reset.memoryFlushsession-memoryhook alongside (raw audit trail + curated memory)Related
docs/proposals/pre-reset-memory-flush.md