Files
openclaw/extensions/memory-core/src
Yuval Dinodia d952566385 fix(memory-core): MEMORY.md compaction deletes user notes written under a promotion-style heading (#116180)
* fix(memory-core): stop MEMORY.md compaction from deleting marker-free user sections

Budget compaction decided that a MEMORY.md section belonged to OpenClaw purely
from its heading text, so a user-authored section under a heading that looks
generated, such as "## Promoted From Short-Term Memory (2026-04-10)", was
eligible for deletion once the file plus the new promotion exceeded
memoryFileMaxChars. The rewrite succeeded silently and the atomic replace made
the loss durable.

A matching heading is now provisional: the block is classified as a promotion
only when it structurally contains at least one
"<!-- openclaw-memory-promotion:... -->" marker, which buildPromotionSection
emits for every promoted candidate. Marker-free sections are preserved.
Generated sections, including the multi-project shape whose markers sit under
"### Global" and "### Project:" subsections, are still dropped oldest-first, so
the size bound from #73691 is unchanged.

Extends #116057, which made only subsection handling marker-aware and left the
top-level heading classifier trusting presentation text.

* fix(memory-core): preserve mixed promotion blocks

Validate the complete marker-and-entry grammar before treating a promotion-shaped block as writer-owned. Preserve marker-only and mixed blocks so unheaded operator notes cannot be deleted during budget compaction.

Co-authored-by: yetval <yetvald@gmail.com>

* test(memory-core): allow cold citation startup

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-07-30 16:24:32 +08:00
..