Whether the HNSW index is currently active and queryable.
Number of vectors currently indexed.
Add a vector to the index. If below threshold, does nothing. If threshold is crossed, caller should call rebuildFromData().
The trace ID to associate with this vector.
The embedding vector.
Current total trace count (unused, kept for API compat).
Query the HNSW index for top-K nearest neighbors. Returns trace IDs sorted by distance (closest first).
Query vector.
Number of results to return.
Array of { id, distance } sorted by distance ascending.
Rebuild the entire index from a set of id/embedding pairs. Called on first threshold crossing or when brain.hnsw is missing/corrupt. Filters out dimension-mismatched vectors before delegating.
Array of { id, embedding } to index.
Memory-specific HNSW sidecar that wraps the canonical HnswIndexSidecar.
Maintains the original constructor-based API expected by
Memoryfacade andSqliteBrainconsumers, while delegating all index operations to the shared RAG implementation.