Skip to main content

Module store

Module store 

Source
Expand description

Embedding storage: read/write embeddings from/to the structural index SQLite.

Operates through direct libsql calls on the same connection as FileIndex. The embeddings table is created lazily on first write.

When sqlite-vec is available (vec_embeddings virtual table exists), inserts and deletes are mirrored there so that ann_search can use the ANN index instead of loading all vectors into memory.

Constants§

ANN_CANDIDATE_COUNT
Number of ANN candidates to retrieve before staleness re-ranking.

Functions§

ann_search
ANN search using the vec_embeddings virtual table.
count_embeddings
Count embeddings stored for a given model.
delete_embeddings_for_path
Delete embeddings for a specific (source_type, source_path) pair, all models. Used during incremental rebuild when a file changes.
drop_embedding_tables
Drop embedding tables entirely for a full rebuild.
embedded_paths
Return the set of file paths that have at least one embedding for the given model.
ensure_schema
Ensure the embeddings table and indices exist.
ensure_vec_schema
Ensure the vec_embeddings ANN virtual table exists.
load_all_embeddings
Load all stored embeddings for a given model name.
load_embeddings_for_type
Load stored embeddings filtered by a specific source type.
upsert_embedding
Insert or replace one embedding row.
vacuum
Run VACUUM to reclaim space after a full rebuild.
vec_table_available
Returns true if the vec_embeddings virtual table exists and is queryable.