mnem-ann
Approximate-nearest-neighbour (HNSW) vector index for mnem. Feature-gated alternative to the built-in brute-force index in mnem-core.
Implements the VectorIndex trait from mnem-core with an HNSW backend.
The built-in BruteForceVectorIndex is 100%-recall and O(n x dim) per
query; HnswVectorIndex trades ~1% recall for O(log n x dim) queries and
is the right choice once a repo grows past roughly 10k indexed vectors or
for long-lived servers where query latency dominates. Both impls return
Vec<VectorHit> sorted by descending score with NodeId-ASC tiebreak, so
replay stays byte-stable either way. Kept in a separate crate because most
HNSW implementations carry SIMD intrinsics or architecture-specific unsafe
blocks that would fail mnem-core's #![forbid(unsafe_code)] and WASM
targets.
use HnswVectorIndex;
use VectorIndex;
let idx = build_from_repo?;
let hits = idx.search?;
Workspace top: ../../README.md.
Licensed under Apache-2.0.