fix: exclude superseded memories from recall and classify all markdown as docs - #17
Open
ch405canova-sudo wants to merge 1 commit into
Conversation
…n as docs Two bugs in the memory and RAG indexers: 1. recall (internal/memory/read.go): entries marked as superseded_by (e.g. after a merge) were still returned as top semantic matches. They now stay invisible to recall while remaining visible to List/ListLightweight for maintenance tools. 2. markdown classification (internal/rag/documents.go): classifySourceType received empty content, so a plain .md file (not README, not under docs/) fell through and was silently skipped with 0 chunks. Every .md file is now classified as 'docs'. Adds regression test cases.
This was referenced Aug 4, 2026
Author
|
This work is a joint effort by chaos (@ch405canova-sudo) and opencode — found and fixed together on a live llama.cpp + agent-memory-mcp stack (August 2026). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two real bugs found while operating the server against a live memory store:
1. Superseded entries still surfaced in semantic recall
internal/memory/read.go— theRecallloop never filtered entries whosesuperseded_bycolumn is set (e.g. after a merge viaMarkOutdated/merge flow). A merged duplicate kept ranking as a top result.Fix: skip entries with
m.SupersededBy != ""in the recall loop. They remain visible toList/ListLightweightso maintenance tools can still see the temporal history.2. Plain markdown files silently dropped from the RAG index
internal/rag/documents.go—classifySourceTypewas called with empty content (classifySourceType(relPath, "", "")), so the.mdheuristic relying onstrings.Contains(contentLower, "# ")never matched. A normal.mdfile (not namedreadme.md, not under adocs/path) classified as""→ 0 chunks, silently ignored.Fix: every
.mdfile classifies as"docs". Added regression cases toTestClassifySourceType.Verification
go test ./internal/rag/passes (incl. new cases).mdfile now produces a chunk in the vector store; recall no longer returns the superseded duplicateFiles changed
internal/memory/read.gointernal/rag/documents.gointernal/rag/rag_test.go.gitignoreFixes #18
Fixes #19