Repository navigation
Description
Problem
The Memory tab's review queue accumulates manual items that the user must resolve by hand (Keep both / Mark reviewed / Invalidate older). The system produces manual work (write-time jaccard ≥0.4 enqueue, semantic ≥0.9 enqueue, janitor contradiction scan) but has no consumer except the human. Additionally four report-only lists (nearDupes, agingRuns, fatConventions, suspect agents) are computed by memory_maintenance but never rendered anywhere — only an agent that chooses to call the MCP tool ever sees them.
Research summary
Our system (memory-server/): every primitive for auto-resolution already exists — resolve(invalidate) tombstones (reversible), supersede merges, invalidateEntry expires runs, janitor runs every 6h. Missing: (1) a decision path for when a pair is safe to auto-invalidate (thresholds are tuned to enqueue, not adjudicate), (2) update resolution performs no merge, (3) dead pairs (one side superseded/invalidated) still need a manual noop, (4) report-only lists have no queue rows and no write paths.
External systems (Mem0, Zep/Graphiti, Letta sleep-time, Claude Code Auto Dream, Generative Agents) converge on:
- Cheap layers first: exact-hash dedup, recency/access decay, constrain adjudication to top-k or same-entity-pair candidates.
- Contradictions resolved at write time by an LLM judging ADD/UPDATE/DELETE/NOOP over top-k neighbors — nobody trusts a bare similarity threshold for contradiction.
- Periodic sleep-time consolidation agent, dual-gated (≥24h elapsed AND activity threshold), merges/absolutizes/deletes-contradicted in one pass, sandboxed writes.
- New information wins; losers are invalidated, not deleted (reversible, auditable).
- Cosine ≥0.95 is the common "same thing" bar (Mem0 entity linking); 0.9 is "related", not "duplicate".
Roadmap
Child issues in dependency order:
- Deterministic janitor auto-resolution (no LLM): auto-noop dead pairs, age-out stale queue rows, auto-invalidate cosine ≥0.95 pairs, auto-expire ancient run entries.
- Write-time near-dup handoff:
memory_storewarn response includes the duplicate's id so the writing agent can supersede immediately — zero extra model calls. - Sleep-time consolidation pass: a periodic background agent per project that consumes
memory_maintenance+memory_distill, adjudicates the ambiguous remainder, merges via supersede, distills strategies. On-brand: an agent curating its own memory. - Memory tab update: queue card shows only genuinely ambiguous pairs + an auto-resolution activity line; surface (or drop) the report-only lists.
Acceptance
- Review queue open count trends to ~0 without user action; only genuinely ambiguous pairs remain.
- All auto-resolutions are reversible (tombstone, not delete) and logged with the rule that fired.
- No false-merge reports; auto-invalidate bar validated against the live store before enabling.
Activity
currentbits commentedon Aug 26, 2026
Addendum: GBrain (garrytan/gbrain) findings
Reviewed GBrain (Garry Tan's production agent brain, 155K pages) plus a code-grounded independent review. It is the most battle-tested example of the sleep-time pattern and confirms the roadmap, with four design refinements worth stealing:
runCyclecomposes phases — sync, fact extraction, transcript synthesis, pattern detection, fact consolidation, take grading, calibration, orphan checks, purge — each under locks, each declared deterministic or LLM. Refinement for Memory: periodic sleep-time consolidation agent (dual-gated, memory-tools only) #722: define our consolidation pass as a phase manifest (deterministic janitor rules first, LLM adjudication second, distill last) so each phase is individually testable and skippable, instead of one big prompt.gbrain eval suspected-contradictionssamples retrieval pairs, applies a layered date pre-filter (cheap gate before any model call), then a query-conditioned LLM judge, and caches verdicts so pairs are never re-judged. Refinement for Memory janitor: deterministic auto-resolution of dead/stale/certain queue rows #720/Memory: periodic sleep-time consolidation agent (dual-gated, memory-tools only) #722: ourreview_queueopen-pair unique index already gives us the "never re-judge" property — keep it, and add a date/type pre-filter before the LLM pass so it only sees plausible candidates.runentries →strategy/knowledgevia distill (Memory: periodic sleep-time consolidation agent (dual-gated, memory-tools only) #722 phase 3), and supersession already exists. GBrain validates the shape.Cautions from the independent review that apply to us: LLM-derived writes need provenance + reversible tombstones (we have this); background maintenance should be a visible operational contract (our janitor snapshot at
/healthis the seed — extend it with consolidation-pass results); don't let ambient capture bypass an authority boundary (not our problem today — our writes are already agent-initiated).Not borrowing: Postgres/pgvector scale, 100+ ops, schema packs, hosted multi-user OAuth — our SQLite + 15-op MCP server is the right size for a desktop app's project memory.
currentbits commentedon Aug 26, 2026
Addendum 2: academic systems + OSS memory servers
Two more research tracks: recent papers (A-MEM, MemoryBank, MemoryOS, Nemori, EverMemOS, Hindsight, HippoRAG, benchmarks) and practical OSS servers (reference MCP memory, basic-memory, supermemory, cognee, OpenClaw/Hermes native, LangMem). Full notes in thread. Net effect on the roadmap:
Findings that change design decisions
updates/extends/derives+isLatestflip, old fact kept) is the same shape. Adopt typed outcomes for the consolidation pass.minScore+minRecallCount+minUniqueQueries; MemoryOS heat): entries earn salience by being retrieved, not by being written. We already trackaccess_countand decay it; consider folding access counts into bootstrap ranking so never-recalled entries sink out of CLAUDE.md/AGENTS.md templating too (config doctor currently sorts by importance only — worth a look in Memory tab: auto-resolution activity line, queue card shows only ambiguous pairs #723 scope).Anti-patterns we already avoid (keep avoiding)
Refined acceptance metrics for the roadmap (from LongMemEval / MemoryAgentBench):
Explicitly rejected for our scale: PPR/graph-walk retrieval (HippoRAG — append-only, no supersession anyway), RL-learned memory policies (Mem-α), read-time KV compression (EM-LLM/LongMem — wrong layer), belief-revision formalism (arXiv:2603.17244 — nice vocabulary: our queue states map to contraction vs revision, but too heavyweight to implement).
currentbits commentedon Sep 8, 2026
Roadmap is complete: #720 janitor auto-resolve, #721 write-time near-dup id, #722 sleep-time consolidation, and #723 memory-tab activity line are all plan:done and in tree.