What
cora brain <query> (and MCP cora.brain_search) never include the vector signal in a fresh process. Every query returns signals=fts (+ graph) only, despite a valid cora_index.usearch on disk.
Root cause
vector_search (src/index/brain.rs:360-366) only reads VECTOR_CACHE:
rust let cache = VECTOR_CACHE.read().unwrap(); let vi = match cache.as_ref() { Some(v) if !v.is_empty() => v, _ => return Vec::new(), // ← fresh process: cache is None → bail };
The cache is populated only by embed_project (the cora index path, src/index/brain.rs:150-159). CodeVectorIndex::load_or_create has no caller on the search path. cora brain and cora index are separate processes, so the vector index built by index is invisible to brain.
Repro (develop @ 55f965c, isolated CODECORA_HOME)
$ printf 'fn alpha() {}\nfn beta() {}\n' > lib.rs
$ cora index
✅ Indexed 2 symbols from 2 files
$ ls ~/.codecora/cora-code/
cora_index.usearch cora_index.keys cora.db
$ cora brain alpha
🧠 1 results for 'alpha'
alpha (lib.rs) [function] score=0.0164 signals=fts ← no vector signal
Cross-process check: rename cora_index.usearch → cora_index.usearch.bak, run cora brain alpha again — identical output, no warning. Search never touches the file.
Impact
Suggested fix
In vector_search, on cache miss load the index from disk before giving up (respecting current_vector_store() for the extension), e.g.:
rust let vi = match cache.as_ref() { Some(v) if !v.is_empty() => v, _ => { drop(cache); // populate cache from disk (load_or_create), then re-read } };
Mind the write-lock ordering with embed_project and the dimension-mismatch handling (check_dimension_compat). A user-visible notice when the store is empty but symbols exist would also help diagnosis.
Found while reviewing #543 (that PR is opt-in vecq; this bug is pre-existing on develop).
What
cora brain <query>(and MCPcora.brain_search) never include the vector signal in a fresh process. Every query returnssignals=fts(+ graph) only, despite a validcora_index.usearchon disk.Root cause
vector_search(src/index/brain.rs:360-366) only readsVECTOR_CACHE:rust let cache = VECTOR_CACHE.read().unwrap(); let vi = match cache.as_ref() { Some(v) if !v.is_empty() => v, _ => return Vec::new(), // ← fresh process: cache is None → bail };The cache is populated only by
embed_project(thecora indexpath, src/index/brain.rs:150-159).CodeVectorIndex::load_or_createhas no caller on the search path.cora brainandcora indexare separate processes, so the vector index built byindexis invisible tobrain.Repro (develop @ 55f965c, isolated CODECORA_HOME)
Cross-process check: rename
cora_index.usearch→cora_index.usearch.bak, runcora brain alphaagain — identical output, no warning. Search never touches the file.Impact
Suggested fix
In
vector_search, on cache miss load the index from disk before giving up (respectingcurrent_vector_store()for the extension), e.g.:rust let vi = match cache.as_ref() { Some(v) if !v.is_empty() => v, _ => { drop(cache); // populate cache from disk (load_or_create), then re-read } };Mind the write-lock ordering with
embed_projectand the dimension-mismatch handling (check_dimension_compat). A user-visible notice when the store is empty but symbols exist would also help diagnosis.Found while reviewing #543 (that PR is opt-in vecq; this bug is pre-existing on develop).