Repository navigation
memory: write co-occurrence edges so the graph retriever has data to walk (#307) - #327
Merged
currentbits merged 12 commits intoAug 17, 2026
Merged
Conversation
… Named agent profiles (provider + model + effort + permission
DigestRun/DigestResult in shared/ipc plus the pure ranking in src/digest.ts: main collects evidence, the renderer decides merge-ready / needs-you / discard, so the receipt can be re-ranked without re-walking git. Co-Authored-By: Claude Opus 5 <[email protected]>
Types and a green seam so backend and UI can land in parallel: GcCandidate/GcScanResult/GcCleanResult, ProjectInfo.worktreeRetention, and git.gcScan/gcClean across preload, wireClient and devCoder. worktrees.gcScan/gcClean are placeholders returning empty scans until the real engine lands. Co-Authored-By: Claude Opus 5 <[email protected]>
entries.source column migration and src/trust.js: the trust multiplier both halves of #309 build on. Provenance plumbing and the DB aggregation land on top of this. Co-Authored-By: Claude Opus 5 <[email protected]>
Add the coffee-time receipt: ranked merge-ready / needs-you / discard with cost, check evidence and risk flags. Wasted spend stays visible.
Main gathers facts only: windowed threads, usage, git stats, and scraped test/build evidence. Ranking stays in src/digest.ts.
linkEntities now inserts unordered co_occurs pairs (src < dst) at store time. Existing DBs get a one-shot mentions self-join backfill guarded by janitor_state edges_backfill_v1.
The edges PK indexes src as its leading column, so the UNION half of graphSearch's neighbour query (WHERE dst = ?) fell back to a full scan -- once per dequeued node. Free while the table was empty; now that entries write up to 105 co-occurrence rows each, it is not. Co-Authored-By: Claude Opus 5 <[email protected]>
|
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-graph-is-dead-in-production-edges-fba1f2
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.
Fixes #307.
The bug
memory-serverdeclares anedgestable (src/db.js:215) that nothing insrc/ever wrote to — onlytest/graph.test.jsdid. SoMemory.graphSearch()'s 2-hop BFS always terminated at hop 0 and silently degenerated into a plainmentionslookup. ~130 lines of retriever running against a permanently empty table.What changed
Wire the writer, not delete the leg.
linkEntities()already resolves entities and writesmentionsat store time, so co-occurrence edges cost ~10 lines in that same loop and bring the existing BFS alive without touching it.linkEntities()(src/memory.js) collects the resolved entity ids and writes oneco_occursedge per unordered pair, normalisedsrc < dstso a pair never becomes two mirrored rows.INSERT OR IGNOREon the existing PK.extractEntities()already caps at 15 entities/entry, so ≤105 rows per entry. No new cap.backfillCoOccurrenceEdgesinsrc/db.js) derives edges from pre-existingmentionsvia a self-join, guarded byjanitor_state.edges_backfill_v1so it runs at most once per database. Existing installs get a populated graph without a re-index.Found on review
The
edgesPRIMARY KEY(src, dst, relation, entry_id)indexessrcas its leading column, so the UNION half of the BFS neighbour probe —WHERE dst = ?— fell back to a full table scan, executed once per dequeued node.EXPLAIN QUERY PLANconfirmedSCAN edges. That cost nothing while the table was permanently empty; fixing the writer is exactly what makes it expensive. Addedidx_edges_dst. No index onentry_id— that path isdeleteEntryonly, not a loop.Verification
131/131
memory-servertests pass. New coverage intest/graph.test.js:co_occursedges,src<dst, with no mirrored duplicategraphSearch()genuinely reaches a 2-hop entry — entry A mentions X+Y, entry B mentions Y+Z, a query seeded on X returns BdeleteEntry()and the janitor's orphan-edge cleanup already handlededges; both still hold with real edge data.Deliberately out of scope
memory_expandtool — a new feature, not the reported bug. The existing retriever is what was broken, and it now works. File separately if an agent needs manual traversal.extract.jsregex-only extraction, and the declared-but-unusedrepo/agent/toolkinds — harmless as-is, no consumer blocked.🤖 Generated with Claude Code