Skip to content

fix(memory): hide superseded entries from semantic recall - #20

Merged
ipiton merged 3 commits into
mainfrom
fix/recall-superseded-entries
Aug 11, 2026
Merged

fix(memory): hide superseded entries from semantic recall#20
ipiton merged 3 commits into
mainfrom
fix/recall-superseded-entries

Conversation

@ipiton

@ipiton ipiton commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Closes #18, closes #19. Picks up the recall fix from #17 (thanks @ch405canova-sudo) with one behavioural correction, and adds the regression coverage both issues were missing.

Issue #18 — superseded entries in recall

Recall never looked at superseded_by, so a merged/outdated entry stayed in the result set with its original vector and kept competing with its successor. MarkOutdated only downranks (importance capped at 0.25), which is not enough when the two embeddings are near-identical.

Recall now skips such entries. List/ListLightweight still return them, so the temporal-history and maintenance views are unchanged.

Difference from #17: the successor is looked up in the cache instead of being trusted. Delete does not clear superseded_by on predecessors, so an unconditional skip would bury an entry forever once its successor is deleted. An archived entry beats no entry at all.

MarkOutdated without a successor keeps the pre-existing downrank behaviour — nothing replaced the entry, so hiding it would just lose the knowledge.

Issue #19 — plain markdown dropped from the index

Already fixed on main in b052f2d / bd00d87 (the .md branch returns docs unconditionally); the fix is simply not in a release yet, which is why v0.9.1 still reproduces it. This PR only adds the two regression cases from #17 so the heuristic cannot come back.

Contract change

TestMarkOutdatedDownranksMemory pinned the old "superseded stays in recall, just lower" contract. Renamed to TestMarkOutdatedHidesSupersededMemoryFromRecall and updated.

Verification

  • go build ./..., go vet ./... clean
  • go test ./... — 709 passed, 0 failed
  • Guard check: with the new condition disabled, TestSupersededMemoryExcludedFromRecall fails on the expected assertion

ipiton added 3 commits August 10, 2026 12:19
The server never negotiated: handleInitialize discarded its params and
always answered with its own protocolVersion. A client moving to a newer
MCP revision was therefore unobservable — we would learn about it from a
failure rather than from telemetry.

Logging only; the response is unchanged and a mismatch is not an error.
This is step 1 of MCP-PROTOCOL-MIGRATION-2026-07-28, which turns the
migration trigger from a calendar guess into an instrumented signal.
Watching initialize turned out to be blind. Measured 2026-08-10 against a
live client: Claude Code reconnects to a restarted HTTP server by going
straight to tools/call and never re-sends initialize, which dispatch
accepts because no handshake is required. The detector added in 9355a79
therefore never fires for the case it was built for.

An unknown method is the reliable signal: a client on revision 2026-07-28
calls server/discover, a mandatory RPC we do not implement, and today that
returns method-not-found silently. The line also carries the protocol
version from _meta when present, so it says which revision the caller
speaks rather than only that something unknown was asked for.
An entry whose superseded_by points at a live successor stayed in recall
with its original vector, so the dead copy kept competing with — and
often out-ranking — the successor. Downranking via MarkOutdated was not
enough. Recall now skips it; List/ListLightweight still return it so the
maintenance and temporal-history views are unchanged.

The successor is looked up in the cache rather than trusted: Delete does
not clear superseded_by on predecessors, and a dangling pointer would
otherwise bury the entry forever. MarkOutdated without a successor keeps
the pre-existing downrank behaviour.

TestMarkOutdatedDownranksMemory pinned the old contract and is renamed
and updated accordingly.

Also pins issue #19 (plain markdown must classify as docs) with the two
regression cases from PR #17; the fix itself already landed in b052f2d.

Fixes #18
Fixes #19
@ipiton
ipiton merged commit 723d663 into main Aug 11, 2026
1 check passed
@ipiton
ipiton deleted the fix/recall-superseded-entries branch August 11, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: plain markdown files silently dropped from RAG index (0 chunks) Bug: merged/superseded memories still surface as top recall results

1 participant