feat: Phase 3 — Brain Mode hybrid search (usearch + RRF)#362
Merged
Conversation
- Add CodeVectorIndex (usearch HNSW) with file locking (fs2) - Schema v4: embedding metadata columns on projects table - brain_search(): FTS5 + vector KNN + graph BFS → RRF k=60 fusion - Index-time embedding via static tokens (256d) during cora index - CLI: cora brain <query> [--json] [--limit N] - MCP tool: cora.brain_search Closes #359
- Add #![allow(dead_code)] to vector.rs (Phase 4+ API) and token_vocab.rs (Phase 5) - Add #[allow(dead_code)] on TokenEmbedding::into_vec - Add #[cfg(test)] on cosine_similarity (test-only) - Remove unused codecora_home import from brain.rs
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
Phase 3: Brain Mode — hybrid code search combining 3 signals with RRF fusion.
What's new
CodeVectorIndexbrain_search()embedding_tier,embedding_dims,embedding_model,last_embedded_atonprojectscora brain <query>--jsonand--limitflagscora.brain_searchcora indexArchitecture
Files
src/index/vector.rs(384 lines) — CodeVectorIndex: usearch wrapper with CRUD, persistence, lockingsrc/index/brain.rs(257 lines) — Hybrid search engine + index-time embeddingsrc/index/schema.rs— Schema v4 migrationsrc/index/mod.rs— Wire embed_project into index pipelinesrc/main.rs— Brain CLI commandsrc/mcp/tools.rs— MCP tool registration + handlerCargo.toml— usearch v2, fs2 v0.4Test results
cora index→ 1734 symbols embedded,cora brain "TokenEmbedding"→ top result =TokenEmbeddingstruct withfts,vectorsignalsCloses #359