Repository navigation
Memory: use the stored embeddings for near-dup detection and contradiction ranking - #336
Merged
currentbits merged 11 commits intoAug 17, 2026
Merged
Conversation
added 11 commits
August 17, 2026 18:27
… Memory graph is dead in production: edges table has no write
… Orchestrator worker threads are never deleted, only archived
… Verification loop: agents must prove their work before a thr
… No preload/renderer protocol version check (spec-promised)
… Observability: OTel spans from the orchestrator + failure-mo
… Auto-dispatch threads from Planboard state (issue enters pla
Lexical Jaccard still hard-blocks store(). After embed, checkSemanticDup enqueues a near_dup review when cosine >= 0.90 so paraphrases Jaccard misses still get flagged. store() stays sync; semantic hits never refuse the write.
Use entry_vectors cosine as an extra contradiction signal (paraphrases Jaccard misses), rank partners by similarity, and cap at CONTRA_TOP so a hub entity cannot flood the review queue.
…into coder/memory-use-the-existing-embeddings-for-d-d60c60
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
currentbits
deleted the
coder/memory-use-the-existing-embeddings-for-d-d60c60
branch
October 3, 2026 16:07
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.
Closes #310.
Entries were already being embedded into
entry_vectors(all-MiniLM-L6-v2), but nothing on the write path or in the janitor ever read those vectors: dedup on write was lexical Jaccard over the 500 newest entries, and the contradiction scan was shared-entity-count plus Jaccard. Both miss paraphrases — the same fact worded differently sails through as a fresh entry. This wires the existing vectors into both.Write path (
memory-server/src/memory.js)New
checkSemanticDup(id), chained off the fire-and-forget embed thatstore()already issues. It reads the new entry's vector, runs cosine against live vectors in the same scope (same project, or either side global), and a best match at or aboveSEMANTIC_DUP = 0.90enqueues anear_dupreview pair with acosine=detail. Dim- and model-guarded, skipstaskentries to match the existing dedup skip, and fail-soft throughout.store()stays synchronous and the hard block stays lexical, deliberately: the real MiniLM embedder is async and lazily loads its model, so blocking every write on an embed is not acceptable. Semantic hits enqueue a pair for review; they never refuse the write.Janitor (
memory-server/src/janitor.js)scanContradictionsgains cosine as a third signal —shared >= 1 && cosine >= CONTRA_SIM (0.75)— catching the paraphrased contradiction that Jaccard misses. Qualifying partners are ranked by cosine (unscored pairs sort last, preserving today's behaviour as the tail) and capped atCONTRA_TOP = 5per candidate, so one hub entity can no longer flood the review queue; the truncation is logged rather than silent. An entry already scanned this pass is skipped as a partner, so the other side cannot re-add a pair the cap dropped.The scan stays synchronous and needs no embedder — the vectors are already in the DB. Each vector decodes at most once per pass via a cache, and a missing
entry_vectorstable (old DBs mid-migration) degrades to "no score" instead of throwing. The existing best-effort contract is unchanged.Notes
shared >= 2) were previously all enqueued and now cap at 5 per candidate.ponytail:comment onvectorSearchnames the ceiling and the upgrade path for when the store outgrows it. No new dependencies.Testing
cd memory-server && npm test— 151 pass, 0 fail. New coverage: paraphrase pairs that fall below the Jaccard warn threshold but are near-identical in vector space, dissimilar pairs producing nothing,taskentries skipped, theCONTRA_TOPcap enqueueing highest-cosine first, and vectorless entries behaving exactly as before.