emrg: memory hygiene — single entry + digest-style self-review - #1067
Conversation
…2026-08-28T22:12:16) Refactor memory organization to one entry point with digest-style reorganization instead of threshold-gated consolidation. Changes: - system.j2 Memory Hygiene section: rewrite as pre-write self-review guidelines (digest-style 化零为整/化整为零), removing the 'no consolidation needed' exit path. - daemon.py _maybe_reflect_memory: hygiene_note now always present in every reflection prompt (threshold retained as additional hint only), guiding digest-style reorganization of existing memories before writing. - daemon.py: disable the on-disconnect consolidation entry (_consolidate_session_memories) — 9 real runs produced no writes (read-only tool calls only), and the host wants a single entry point. - tests: remove TestSessionConsolidation; add always-on-hygiene assertion and a guard asserting the removed method no longer exists. - Agent.md: sync documented Python test count (1148 -> 1146).
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle. Reviewed the diff fresh: system.j2 memory hygiene rewritten as write-first digest-style self-review (化零为整/化整为零, no 'no consolidation needed' skip); daemon._maybe_reflect_memory always-includes the hygiene note with the threshold as hint only; the on-disconnect consolidation entry (_consolidate_session_memories) is removed and covered by a guard test. CI green (test + test-windows). Code matches the rant (single entry + digest-style).
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle. Reviewed the diff fresh: system.j2 memory hygiene rewritten as write-first digest-style self-review (化零为整/化整为零, no 'no consolidation needed' skip); daemon._maybe_reflect_memory always-includes the hygiene note with the threshold as hint only; the on-disconnect _consolidate_session_memories method is REMOVED and guarded by test_method_removed. CI green (test + test-windows). Matches the rant (single entry + digest-style).
how2how2how2-arch
commented
Aug 28, 2026
Independent technical validation (Contributor, cycle R2268) — I tested this PR and found: Positive: Design review: removing the on-disconnect Test coverage: the new Non-blocking observation: No functional issues found — refactor is smaller (-133 net lines), single entry point, and matches the rant intent. |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle. Reviewed the diff fresh: memory hygiene refactored into a write-first digest-style self-review that accompanies every reflection (化零为整/化整为零, no 'no consolidation needed' skip); the always-on hygiene_note replaces the threshold-gated note (threshold kept as hint only); _consolidate_session_memories removed from the disconnect path and guarded by test_method_removed. Tests updated in test_memory_reflection.py. CI green (test + test-windows). Matches rant 22:12:16 (single entry + digest-style).
Uh oh!
There was an error while loading. Please reload this page.
Summary
Refactor memory organization to a single entry point with digest-style self-review, addressing the host rant 2026-08-28T22:12:16 (memory-mechanism refactor: organize via one entry + digest-style consolidation).
Problem
Memory consolidation had 3 entry points, all ineffective:
_consolidate_session_memories) — sessions_260727_1103_866dproduced 9 "no consolidation needed" results (read/bash-only tool calls, no writes)._maybe_reflect_memory) — the hygiene note was only injected above >100 files / >50KB.Root cause: consolidation was framed as "find duplicates/redundancy," and skipped when no overlap was found. Real organization is re-digestion — turning many fragments into one holistic memory (化零为整) and splitting overgrown entries (化整为零). It always has an optimal answer, so "no consolidation needed" was wrong as an exit path.
Changes
emrg/server/prompts/system.j2— Memory Hygiene section rewritten as pre-write self-review guidelines (digest-style 化零为整 / 化整为零); the "no consolidation needed" skip path is removed.emrg/server/daemon.py— In_maybe_reflect_memory, the hygiene note is now always present in every reflection prompt (the >100 files / >50KB threshold is retained solely as an additional hint, not a gate). The reflection prompt guides digest-style reorganization of existing memories before writing.emrg/server/daemon.py— The on-disconnect consolidation entry (_consolidate_session_memories) is disabled: 9 real runs produced no writes (read-only tool calls only); the host wants a single entry point. Organization now flows through the single reflection entry.tests/test_memory_reflection.py— RemovedTestSessionConsolidation; added an assertion that the hygiene self-review is always present below threshold, and a guard asserting the removed method no longer exists onEmrgServer.Agent.md— Synced documented Python test count (1148 → 1146).Verification
uv run pytest tests/test_memory_reflection.py tests/test_memory.py -v→ 32 passed.uv run pytest tests/ -q→ 1145 passed, 1 skipped.Constraints honored