Status: Accepted Date: 2026-03-11 Decision makers: Nexus-MCP team
Phase 2 needs a vector database schema to store code chunks extracted from parsed symbols. The schema must support vector similarity search, metadata filtering (by language, symbol type), and incremental reindexing (delete by filepath).
Use a PyArrow schema with 12 columns in a single chunks table:
id(string) — deterministic SHA256 hash offilepath:name:line_start, truncated to 16 hex charsvector(list[N]) — embedding vector (768d for jina-code default, 384d for bge-small-en)text(string) — formatted chunk text used for embeddingfilepath,symbol_name,symbol_type,language— metadata for filteringline_start,line_end(int32) — source locationsignature,parent,docstring— code context
Use flat search (no IVF index) for codebases up to ~100K chunks. IVF indexing can hang on large datasets (per LanceDB docs) and flat search is fast enough for typical codebases.
- Easier: Filtering by language/type via SQL-style
.where()clauses; incremental reindex viadelete("filepath = '...'"). - Harder: Switching to a different embedding model requires re-indexing (different vector dimensions).
- Vector dimensions are configurable via
vector_dimsparameter onLanceDBVectorEngine.
The search tool transforms raw LanceDB results before returning them:
vectorfield is stripped (saves tokens, not useful to LLMs)textis renamed tocode_snippetand truncated to 2000 chars with a... (truncated)markerabsolute_pathis added alongside the relativefilepathfor direct use with file-reading tools- A
hintfield guides tool selection for the next action
The internal schema still stores text; the rename happens at the tool response layer only.
- Separate tables per language: Rejected — adds complexity with minimal benefit since LanceDB filters are fast.
- Storing raw code in vector table: Rejected —
textfield contains the formatted chunk (signature + docstring + snippet), not raw source. Raw source can be read from disk.