Memory: facts_vec never written — semantic search permanently empty (FTS5-only RRF) #12
Closed
opened 2026-05-12 19:03:11 +00:00 by KofTwentyTwo
·
1 comment
No Branch/Tag Specified
develop
ci/secrets-historical-baseline
feature/security-findings-2026-10
dependabot/npm_and_yarn/webview/npm_and_yarn-3ac77625be
dependabot/npm_and_yarn/webview/packages/bus/npm_and_yarn-c86b58a346
dependabot/npm_and_yarn/webview/vitejs/plugin-react-6.0.2
dependabot/npm_and_yarn/webview/vite-8.0.13
dependabot/npm_and_yarn/webview/zustand-5.0.13
dependabot/npm_and_yarn/webview/types/node-25.9.1
dependabot/npm_and_yarn/webview/vitest-4.1.6
dependabot/github_actions/actions/setup-node-6
dependabot/github_actions/github/codeql-action-4
dependabot/github_actions/actions/checkout-6
dependabot/github_actions/actions/cache-5
dependabot/github_actions/pnpm/action-setup-6
feat/local-first-llm-routing
docs/local-first-llm-routing-spec
fix/v0.2-wave-1-code-fixes
docs/v0.2-wave-1-doc-drift
docs/handoff-2026-05-14
docs/multi-runner-inventory
docs/ollama-baseline-58
fix/ci-env-harness-sqlite-voice-warmup
fix/ci-xcode-26-and-batcher-timing
chore/typecheck-blocking
fix/hud-typecheck-strict-undefined
wip/voice-log-menu-stash4
v0.1.0-dev.71
v0.1.0-dev.68
v0.1.0-dev.64
v0.1.0-dev.50
Labels
Clear labels
area:agent
area:build
area:bus
area:devtool
area:hud
area:logging
area:mcp
area:memory
area:vision
area:voice
audit-finding
bug
carry-forward
comment-cleanup
dependencies
documentation
duplicate
enhancement
epic
good first issue
help wanted
invalid
javascript
migration
question
severity:critical
severity:high
severity:low
severity:medium
wontfix
Something isn't working
Comment / docstring cleanup per .planning/code-commenting-guide.md
Dependency updates
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Pull requests that update javascript code
Further information is requested
This will not be worked on
Milestone
No items
No Milestone
v0.1 — It actually works (basic capabilities)
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: KofTwentyTwo/Jarvis#12
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
facts_vectable is never written. Semantic search branch is permanently empty. Hybrid SQL'svcCTE returns zero rows on every call. RRF degenerates to FTS5-only ranking. Semantic recall ("dog" → "Toby" via embedding similarity) silently doesn't work despite the schema being present and vec0 loaded.Evidence
packages/Memory/Sources/Memory/MemoryStore.swift:132-246(applyOp/insertNewFact)SELECT COUNT(*) FROM facts_vec_rowids→0despite 1 fact presentSELECT COUNT(*) FROM facts→1(Toby fact has FTS row but no vec row)vec_version()→v0.1.6(extension loaded fine)INSERT INTO facts_vecexists anywhere inMemoryStore.swift,MemoryExtractionOrchestrator.process, orMemoryExtractor.extractRoot cause / hypothesis
applyOpinserts intofactsand the schema's FTS5 trigger mirrorsfacts_ftsautomatically — but nothing inserts intofacts_vec. The embedder client (OllamaEmbeddingClient) exists and works forHybridSearch, but no producer wires it to the writer side. Schema-vs-writer impedance mismatch — same shape as today's FK calibration bug.Recommended fix
Inside
insertNewFact, afterINSERT INTO factssucceeds andnewIdis known, run the query embedder against"\(subject) \(predicate) \(object)"andINSERT INTO facts_vec(fact_id, embedding) VALUES (?, ?)inside the same transaction.Two options for embedder injection:
MemoryStore.inittakesembedder: any EmbeddingProviding?; skip vec INSERT when nilMemoryExtractionOrchestrator.processafterapplyOpreturns the newFactFailure mode discipline: log + leave the FTS row (degraded but searchable) rather than rolling back the fact row.
Test
Add
MemoryStoreApplyOpVecInsertTests:MemoryStorewith embedder injected, afterapplyOp(.add)thefacts_vectable contains exactly one row matching the newfact_idapplyOp(.add)still succeeds and writesfacts+ FTS row;facts_vecrow absentAdd parity assertion to
MemoryBootHealthProbe:facts_vecrow count tracksfactsrow count ± 1.Source
.planning/audit-2026-05-12/memory-audit.md(2026-05-12) — finding M-1 CRITICALCross-references
MemoryBootHealthProbeevidence misleading; parity check is structural defense against M-1-style bugs)Closed by v0.1 cluster merges on 2026-05-13. Develop now at
a8c7f1a0.