L2 scene blocks grow monotonically: UPDATE appends instead of rewriting — quantitative evidence & fix proposal
Environment
- Host: OpenClaw 2026.9.6 (gateway mode), plugin
@tencentdb-agent-memory/memory-tencentdb1.0.3 - Extraction model:
zai/glm-5.3-flash(weak instruction-following tier) - OS: macOS arm64; heavy daily usage triggering frequent L2 consolidation
Summary
Scene blocks (scene_blocks/*.md) grow monotonically. The ≤1500-char spec exists only in prompt text and is never reliably upheld: UPDATE operations append new content while preserving all prior content — a "current snapshot" degrades into an append-only chronicle.
Quantitative evidence (real deployment; only structural metrics shared for privacy)
- 14 blocks reached 76KB within ~24h of activity (56KB→76KB, +20KB/day at peak)
- Largest block: 4009 chars vs the 1500-char spec (2.7× over)
- One recurring decision duplicated across 6 different blocks
- A short directive phrase appears 7 times across blocks
- 6 of 7 "evolution trajectory" entries in one block are from the same day (process events recorded as evolutions)
Root cause: three permissive-wording gaps in src/core/prompts/scene-extraction.ts
- Size constraints are phrased permissively ("can rewrite", "may consolidate") — weak models take the cheaper path
- The UPDATE example explicitly demonstrates a local
editreplacement path, making "touch one section, preserve the rest" the path of least resistance - The trajectory section invites appending with no dedup/merge rule
With weak-tier extraction models, adherence is insufficient and the ratchet compounds on every consolidation run.
Relation to prior reports
- #1038 — maxScenes=15 / 1500-char limits observed to never hold in practice
- #1056 — notes code-mode content is "inherently additive, never shrinks"; this report adds the quantitative pathology and a concrete fix
- #1245 — same write-without-dedup pattern at L0/L1
Proposed fix (patched and deployed on our side)
Four hard constraints injected into the scene-extraction prompt: mandatory full rewrite (UPDATE = read→rewrite→write whole file; superseded content deleted), hard size cap with pre-write self-check (≤1500 chars), single-location storage (each fact appears in exactly one section), trajectory merging (same-period transitions collapse to one entry).
A patched-prompt validation run is in progress; I will follow up with before/after metrics in this issue. Happy to submit this as a PR.
Source: TencentCloud/TencentDB-Agent-Memory