You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Memory janitor: deterministic auto-resolution of dead/stale/certain queue rows #720
Extend the janitor (memory-server/src/janitor.js, runs at boot + every 6h) with deterministic, LLM-free queue consumption. All auto-resolutions write resolution plus a detail note naming the rule, and only ever tombstone — never delete.
Auto-noop dead pairs: open queue rows where either entry is superseded/invalidated are currently noop-only (guard at memory.js:1671). Resolve them as noop automatically. Zero risk.
Age-out stale rows: open rows older than 30 days resolve as noop — if nobody acted in a month, the pair is not actionable.
Auto-invalidate high-confidence semantic dups: near_dup rows with cosine ≥ 0.95 (Mem0's entity-link bar; our enqueue bar is 0.9 = "related") resolve as invalidate (tombstones the older entry). Validate the threshold against the live store first: sample current open rows, measure the false-merge rate at 0.95 vs 0.93 vs 0.97, pick the bar, record it in the issue before enabling.
Auto-expire ancient runs: run entries live > 30 days (AGING_RUN_DAYS is 7 for reporting) auto-invalidate. Runs are distill raw material; distillation window is 14 days (DISTILL_RUN_DAYS), so 30 keeps margin.
Tests: extend memory-server/test/janitor.test.js + resolve.test.js — one case per rule, plus "does not touch rows younger than X" and "tombstone not delete" assertions.
#723 (Memory tab activity line) is ready to consume janitor auto-resolutions.
Write review_queue.detail as auto:<snake_case_rule> (optional extra tokens after a space are ignored). Shared helpers: AUTO_RESOLVE_PREFIX and autoResolveRule in memory-server/src/review.js — import from there, not memory.js (cycle).
Examples that count in maintenance().autoResolved (last 7 days):
auto:dead_pair
auto:stale_row
auto:semantic_dup cosine=0.97
Hand-resolved rows keep their enqueue detail (jaccard=0.5, …) and are not counted.
Sampled open review_queue on the Solenta memory.db (450 open: 333 near_dup, 117 contradiction).
Tagged cosine= rows (the semantic enqueue path this rule consumes): 10, all run/run.
bar
tagged hits
false-merge
0.93
1 (0.937)
1/1 — sequential merge-resolution notes, same thread title, different hunks/SHAs
0.95
0
0
0.97
0
0
The 9 tagged pairs in [0.90, 0.93) are the same shape: related run notes, not the same fact. That matches the 0.9 enqueue bar = "related".
Recomputed vector cosine on all 333 open near_dups (includes jaccard= rows, not used by this rule): 2 at ≥0.95. One is a true identical knowledge pair (jaccard=1, cosine=1.0). The other is a 0.960 run/run pair with different SHAs and different "what's on screen" — a false merge if we scored vectors instead of the tagged cosine. So this rule parses cosine= from detail only and does not recompute.
Pick: 0.95. Same as Mem0's entity-link bar. 0.93 is empirically too low on this store. 0.97 adds no extra safety on tagged rows.
Other auto-resolve volume right now: 36 dead pairs (noop, zero risk), 0 stale queue rows >30d, 0 live runs >30d (1586 runs >7d, the reporting window).
Implemented on coder/fork-memory-janitor-deterministic-auto-r-ab7a00.
Janitor step autoResolve (boot + every 6h), LLM-free:
near_dup with tagged cosine= ≥ 0.95 → invalidate (older loser tombstoned). Detail auto:semantic_dup cosine=…. Bar recorded in the previous comment; parses detail only, does not recompute vectors.
Live run entries older than 30 days → tombstone, reason auto:ancient_run.
Open rows where either entry is superseded/invalidated/missing → noop, detail auto:dead_pair.
Remaining open rows older than 30 days → noop, detail auto:stale_row.
Never deletes. Dead-pair runs after the tombstone rules so leftovers clear in the same pass. Tests in janitor.test.js + resolve.test.js (one case per rule, younger-than-X, tombstone-not-delete).
Activity
currentbits commentedon Aug 27, 2026
#723 (Memory tab activity line) is ready to consume janitor auto-resolutions.
Write
review_queue.detailasauto:<snake_case_rule>(optional extra tokens after a space are ignored). Shared helpers:AUTO_RESOLVE_PREFIXandautoResolveRuleinmemory-server/src/review.js— import from there, notmemory.js(cycle).Examples that count in
maintenance().autoResolved(last 7 days):auto:dead_pairauto:stale_rowauto:semantic_dup cosine=0.97Hand-resolved rows keep their enqueue detail (
jaccard=0.5, …) and are not counted.currentbits commentedon Aug 27, 2026
Cosine bar (live store, 2026-08-27)
Sampled open
review_queueon the Solenta memory.db (450 open: 333near_dup, 117contradiction).Tagged
cosine=rows (the semantic enqueue path this rule consumes): 10, allrun/run.The 9 tagged pairs in
[0.90, 0.93)are the same shape: related run notes, not the same fact. That matches the 0.9 enqueue bar = "related".Recomputed vector cosine on all 333 open near_dups (includes
jaccard=rows, not used by this rule): 2 at ≥0.95. One is a true identical knowledge pair (jaccard=1, cosine=1.0). The other is a 0.960 run/run pair with different SHAs and different "what's on screen" — a false merge if we scored vectors instead of the tagged cosine. So this rule parsescosine=fromdetailonly and does not recompute.Pick: 0.95. Same as Mem0's entity-link bar. 0.93 is empirically too low on this store. 0.97 adds no extra safety on tagged rows.
Other auto-resolve volume right now: 36 dead pairs (noop, zero risk), 0 stale queue rows >30d, 0 live runs >30d (1586 runs >7d, the reporting window).
currentbits commentedon Aug 27, 2026
Implemented on
coder/fork-memory-janitor-deterministic-auto-r-ab7a00.Janitor step
autoResolve(boot + every 6h), LLM-free:near_dupwith taggedcosine=≥ 0.95 →invalidate(older loser tombstoned). Detailauto:semantic_dup cosine=…. Bar recorded in the previous comment; parses detail only, does not recompute vectors.runentries older than 30 days → tombstone, reasonauto:ancient_run.noop, detailauto:dead_pair.noop, detailauto:stale_row.Never deletes. Dead-pair runs after the tombstone rules so leftovers clear in the same pass. Tests in
janitor.test.js+resolve.test.js(one case per rule, younger-than-X, tombstone-not-delete).currentbits commentedon Aug 27, 2026
Landed from Solenta thread "Fork: Memory janitor: deterministic auto-resolution of dead/". Closed on merge.