ruv-neural-memory
Persistent neural state memory with vector search and longitudinal tracking.
Overview
ruv-neural-memory provides in-memory and persistent storage for neural
embeddings, supporting brute-force and HNSW-based approximate nearest neighbor
search. It includes session-based memory management for organizing recordings
by subject and session, longitudinal drift detection for tracking embedding
distribution changes over time, and RVF/bincode persistence for durable storage.
Features
- Embedding store (
store):NeuralMemoryStorefor inserting, querying, and managing collections ofNeuralEmbeddingvalues with brute-force nearest neighbor search - HNSW index (
hnsw):HnswIndexfor approximate nearest neighbor search with configurable M (max connections), ef_construction, and ef_search parameters; provides 150x-12,500x speedup over brute-force for large collections - Session management (
session):SessionMemoryandSessionMetadatafor organizing embeddings by recording session, subject ID, and timestamp ranges - Longitudinal tracking (
longitudinal):LongitudinalTrackerfor detecting embedding distribution drift over time withTrendDirectionclassification (stable, increasing, decreasing) - Persistence (
persistence):save_store/load_storefor bincode serialization,save_rvf/load_rvffor RuVector format I/O
Usage
use ;
use ;
// Create a memory store and insert embeddings
let mut store = new;
let meta = EmbeddingMetadata ;
let emb = new.unwrap;
store.insert;
// Query nearest neighbors (brute-force)
let query = vec!;
let neighbors = store.query_nearest;
// Build HNSW index for fast approximate search
let mut hnsw = new;
// ... insert vectors, then search
// Session-based memory management
let session = new;
// Persistence
save_store.unwrap;
let loaded = load_store.unwrap;
API Reference
| Module | Key Types / Functions |
|---|---|
store |
NeuralMemoryStore |
hnsw |
HnswIndex |
session |
SessionMemory, SessionMetadata |
longitudinal |
LongitudinalTracker, TrendDirection |
persistence |
save_store, load_store, save_rvf, load_rvf |
Feature Flags
| Feature | Default | Description |
|---|---|---|
std |
Yes | Standard library support |
wasm |
No | WASM-compatible storage |
Integration
Depends on ruv-neural-core for NeuralEmbedding types. Receives embeddings
from ruv-neural-embed. Stored embeddings are queried by ruv-neural-decoder
for KNN-based cognitive state classification. Uses bincode for efficient
binary serialization.
License
MIT OR Apache-2.0