WeaveDocs
Basis
Vectors

Basis

Distributed vector store for approximate-nearest-neighbor search over high-dimensional embeddings, backed by an immutable Strand log.

What Basis is

Basis is a vector index that stores (uuid, Vec<f32>) entries and answers approximate-nearest-neighbor (ANN) queries using HNSW (Hierarchical Navigable Small World) graphs. Two Strand logs back every Basis instance:

  • A vector strand holds the canonical VectorEntry::Add / VectorEntry::Remove history. This is the source of truth.
  • An index strand holds checkpoints of the in-memory HNSW graph so a cold start does not rebuild from scratch.

Because Basis writes through a Strand, every change is signed, sequenced, and replicable to peers using the standard weave-dht and weave-swarm paths.

When to use Basis

WorkloadBasis fit
Semantic memory for an agent (embed(text) → ANN)Strong
Recommendation by embedding similarityStrong
Retrieval-augmented generation (RAG)Strong
Exact-distance retrievalUse a different index — Basis is approximate
Mutable embeddings with frequent overwritesAcceptable, but each remove forces an index rebuild

Index parameters

The current build pins two HNSW parameters at compile time:

ParameterValueMeaning
M12Max neighbors per node in the upper layers
M024Max neighbors per node in the base layer
ef (search width)max(k, 24)Set per query in search()

Distance is L2 (Euclidean), encoded as a u32 bit pattern of an f32 so HNSW can order it.

At a glance

FieldValue
Crate/packageweave-basis
Version0.1.0
Sourcemodels/basis
Backing logTwo strand::Strand instances
Indexhnsw::Hnsw<Point, StdRng, 12, 24>
Distance metricL2, f32u32 ordering
Asynctokio

Page map

Source modules

  • src/lib.rs — models/basis/src/lib.rs