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.
A closer lookMemory with a little more meaning.
Semantic organization gives an agent another way to retrieve its stored context.
- 01Collect the context
- 02Organize by meaning
- 03Retrieve what matters
01 — Concepts
01
Hierarchical Navigable Small-World index over Strand-backed history.
02
BLAKE3 content-addressing — identical vectors deduplicate at the chunk layer.
03
Defaults: M=12 neighbors per layer, M0=24 at the base, ef=24 search width.
04
Tombstone deletion preserves the audit trail; nothing is rewritten.
05
RAG retrieval, semantic search, anomaly detection — same primitive.
02 — 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);
}