Weave documentation
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 is reserved for checkpoints; saving and restoring HNSW snapshots is not implemented.

The vector records can be transported through a separately configured Strand integration. The Basis graph itself is local and is not rebuilt automatically after restart or remote updates.

Current boundary: restart creates an empty index, snapshots are a stub, and present-id removal can deadlock. See recovery limitations.

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 deletesPresent-id removal can deadlock; use only after runtime repair and verification

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, f32 → u32 ordering
Asynctokio

Page map

Source modules

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

On this page