09 · Vector memory

Basis

Vectors as first-class records. A hierarchical navigable small-world index sits on top of Strand-backed history, giving you content-addressed embeddings, sub-linear k-NN, and an audit trail that any peer can verify offline. Defaults — M=12, M0=24, ef=24 — tuned for agent-scale recall.

Concepts

What you’re working with.

  • 01Hierarchical Navigable Small-World index over Strand-backed history.
  • 02BLAKE3 content-addressing — identical vectors deduplicate at the chunk layer.
  • 03Defaults: M=12 neighbors per layer, M0=24 at the base, ef=24 search width.
  • 04Tombstone deletion preserves the audit trail; nothing is rewritten.
  • 05RAG retrieval, semantic search, anomaly detection — same primitive.
Code

A handful of lines.

use basis::{Node, NodeConfig, Vector};

let node = Node::open(NodeConfig::default()).await?;

// Append a 768-dim embedding with metadata.
let id = node.add_vector(
    Vector::from(embedding),
    serde_json::json!({ "doc_id": "post:00a4" }),
).await?;

// k-NN search across 1M vectors at ef=24.
let hits = node.search_vectors(&query, /* k */ 8).await?;
for hit in hits {
    println!("{} → score {:.4}", hit.id, hit.score);
}

Ready to build?

Start with the SDK or load the agent context. Every library is independently documented and versioned.