Skip to content

Consolidate, auto-page, heal and mesh sync write Memories without updating the search index #442

Closed

Description

@possiblyneal

Problem

Several Memory write paths bypass the search indexes, so what they write or supersede is wrong in Recall until the next boot rebuilds BM25:

  • mem::consolidate writes a fresh Memory (no predecessor) with kv.set only (docs/supersession.md already notes this)
  • mem::auto-page writes a Memory without indexing it
  • mem::heal sets isLatest: false without deindexSupersededMemory()
  • mesh sync's merge writes Memories with no index hook

Evidence

  • src/functions/consolidate.ts:226-236
  • src/functions/working-memory.ts:233
  • src/functions/diagnostics.ts:783-797
  • src/functions/mesh.ts:357,522

Upstream diagnosis: rohitg00#1725, rohitg00#1704, rohitg00#1811.

Acceptance criteria

  • Every path that writes a latest Memory indexes it (BM25 and vector), and every path that sets isLatest: false calls deindexSupersededMemory()
  • Tests per path: the new Memory is returned by smart-search without a restart; the superseded one is not
  • Update docs/supersession.md (Memory evolve, consolidation and auto-forget) and the De-indexing bullet in CLAUDE.md

Activity

  1. added
    bugSomething isn't working
    ready-for-agentFully specified, ready for an AFK agent
    needs-triageMaintainer needs to evaluate this issue
    and removed
    ready-for-agentFully specified, ready for an AFK agent
    on Nov 18, 2026
  2. possiblyneal commented on Nov 18, 2026

    @possiblyneal
    OwnerAuthor

    Not verified on this tree yet. Held at needs-triage until Verify: four write paths skip the search index gives a tested verdict: a failing reproduction and a fix that works here, or a reject.

  3. possiblyneal commented on Nov 18, 2026

    @possiblyneal
    OwnerAuthor

    Verdict: apply (latent)

    Tested on verify/442-index-writes (from fdc3d459), per the bar in #449.

    Repro. test/memory-write-indexing.test.ts fails 4/4 on base. Four paths write a Memory without touching the live index, so until the next restart a new Memory is invisible to smart-search and prompt-context and a superseded one still ranks:

    • mem::consolidate, no-predecessor branch: new Memory not indexed
    • mem::auto-page: paged Memory not indexed
    • mem::heal: sets isLatest: false, id stays indexed
    • mem::mesh-receive / applySyncData: a received latest Memory is not indexed, a received closed one is not de-indexed

    Fix. indexNewMemoryVersion() after the consolidate and auto-page writes, deindexSupersededMemory() after heal, and a reindexMergedMemory hook passed as lwwMergeList's onWrite for both mesh merges. deindexSupersededMemory also drops chunk vectors (VectorIndex.remove clears id#*). docs/supersession.md and the CLAUDE.md De-indexing rule list the new paths.

    Checks. npm run typecheck 0 errors; npm test 3120 passed, 1 skipped; eval:gate and eval:gate:rules pass; eval:suite --tier fast vs base-fdc3d459: every metric Δ 0.000.

    Operator's data. None of the four paths has written a Memory on the live store (0 audit entries; all 42 Memories came from remember). Correctness only.

  4. added
    ready-for-agentFully specified, ready for an AFK agent
    and removed
    needs-triageMaintainer needs to evaluate this issue
    on Nov 18, 2026
  5. added a commit that references this issue on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions