RuVector is a High Performance, Real-Time, Self-Learning Ai, Vector GNN, Memory DB built in Rust.
RuVector is a High Performance, Real-Time, Self-Learning Ai, Vector GNN, Memory DB built in Rust.
RuVector is a Rust native memory substrate for agents that need to remember across sessions. It combines local semantic embeddings, persistent vector retrieval, graph relationships, explicit feedback learning, memory lifecycle controls, and optional shared memory.
The default retrieval path runs locally. Learning happens from recorded outcomes and feedback, not from reads alone. Hosted services remain optional and create a separate data boundary.
No database server or API key is required.
npx ruvector hooks remember --semantic --type decision \
"The customer requires all inference to remain in Canada."
npx ruvector hooks recall --semantic --top-k 3 \
"Where may customer data be processed?"Memory is stored under the current project and remains available to later processes. The first semantic command downloads and caches the local all-MiniLM-L6-v2 model. Keep one embedding model and dimension per store; use npx ruvector hooks reembed before changing an existing store from hash to semantic embeddings. Use npx ruvector hooks stats to inspect the store.
npm install ruvector…Reopen the same storagePath in another process to recover the stored vectors, metadata, configuration, and searchability. Search score is a distance, so lower values are closer. See the Node.js API and Rust API for the complete interfaces.
flowchart TD
A[Capture an event, fact, or outcome] --> B[Create a local or external embedding]
B --> C[Persist vectors, metadata, and relationships]
C --> D[Recall by similarity, filters, time, or graph]
D --> E[Use memory in an agent decision]
E --> F[Record outcome and feedback]
F --> G[Adapt ranking or learning state]
G --> C
C --> H[Compact, snapshot, branch, or replicate]RuVector provides primitives for this loop. Your application remains responsible for deciding what is worth remembering, which evidence is trusted, when a memory expires, and which actions recalled context may influence.
Memory classes are application semantics over vectors, metadata, and graphs. The core store is general purpose. RuVector currently exposes two typed layers:
ruvllm::context::AgenticMemory combines working, episodic, semantic, and procedural memory behind one runtime API. It is implemented, but its unified manager is currently in memory and its cross type consolidation method is not complete.
ruvector-core::AgenticDB persists Reflexion episodes, skills, causal edges, learning sessions, policy state, session turns, and a hash linked witness log. Its typed memory APIs support ONNX, Candle, and API embedding providers for semantic retrieval.
| Memory class | Representation | RuVector surface |
|---|---|---|
| Working and session | Current task, scratchpad, tool cache, turns, namespace, TTL | WorkingMemory, SessionStateIndex |
| Episodic and Reflexion | Trajectory, task, action, observation, critique, outcome | EpisodicMemory, ReflexionEpisode |
| Semantic | Facts, confidence, source, tags, relations, collection | VectorDB, SemanticFact |
| Procedural | Skills, actions, triggers, examples, policies, Q values | ProceduralSkill, PolicyMemoryStore |
| Causal and relational | Nodes, edges, hyperedges, Cypher paths | ruvector-graph |
| Learning | Trajectories, rewards, adapters, EWC state | SONA |
| Shared | Contributions, provenance, voting, transfer | mcp-brain |
| Auditable | Hash linked entries, snapshots, RVF witnesses | WitnessLog, ruvector-snapshot, RVF |
| Capability | What it enables | Surface |
|---|---|---|
| Local semantic embeddings | Text memory without a per query API fee | OnnxEmbedder |
| External embeddings | Bring an existing embedding model or provider | EmbeddingProvider |
| Embedding provenance | Track model, dimension, normalization, and query or passage role | ADR 210 |
| Batch and parallel embedding | Higher throughput during memory ingestion | ONNX implementation |
| Capability | What it enables | Surface |
|---|---|---|
| Durable vector storage | Vectors, metadata, deletes, and restart recovery | ruvector-core |
| Unified four type runtime memory | Working, episodic, semantic, and procedural recall | AgenticMemory |
| Typed persistent agent records | Reflexion episodes, skills, causal edges, policy state, sessions, and witness logs | AgenticDB |
| HNSW and flat indexes | Approximate or exact local similarity search | ruvector-core |
| Collections and aliases | Separate schemas and namespaces by workload | ruvector-collections |
| Graph and hypergraph storage | Explicit relationships and multi-hop memory | ruvector-graph |
| High write ingestion | Mutable L0 memory plus background L1 and L2 compaction | ruvector-lsm-ann |
| Edge and embedded persistence | Lightweight local vector storage through the RVF Core Profile | rvlite |
| PostgreSQL extension | Keep vector memory beside relational data | ruvector-postgres |
| Capability | Best use | Surface |
|---|---|---|
| Dense similarity | General semantic recall | VectorDB::search |
| Metadata filtering | Simple structured narrowing | SearchQuery |
| Sparse and dense fusion | Exact terms plus semantic meaning | ruvector-hybrid, ADR 256 |
| Predicate aware ANN | Selective filters without post filter recall collapse | ruvector-acorn |
| Temporal decay | Prefer recent memories when the domain changes | ruvector-temporal-coherence, ADR 211 |
| Coherence gating | Prefer memories supported by related observations | ruvector-temporal-coherence |
| Graph reconstruction | Follow Cue, Tag, and Content associations instead of retrieving one flat chunk | MRAgent example, ADR 269 |
| Multi-vector MaxSim | Late interaction over token or passage vectors | ruvector-maxsim, ADR 252 |
| GNN reranking | Rerank a noisy candidate graph | ruvector-gnn-rerank, ADR 194 |
| Matryoshka funnel | Coarse to fine search for truncatable embeddings | ruvector-matryoshka |
| Disk backed ANN | Move read heavy indexes toward SSD scale | ruvector-diskann |
| Capability | What changes | Trigger |
|---|---|---|
| SONA MicroLoRA | Small adapter weights | Recorded trajectory and reward |
| EWC++ consolidation | Protects important learned weights from catastrophic forgetting | Explicit consolidation |
| Outcome aware routing | Policy and routing preferences | Success, failure, or quality signal |
| GNN reranking | Candidate ordering | Training data or configured reranker |
| Self reconstructing graph memory | Shortcut edges after successful reconstruction | Successful graph traversal |
| Darwin optimization | Retrieval and reconstruction configuration | External benchmark and promotion gate |
Reading or searching memory does not, by itself, mutate learned weights or guarantee better future results.
| Capability | What it controls | Surface |
|---|---|---|
| LRU, LFU, and coherence compaction | Which memories survive a capacity limit | ruvector-agent-memory, ADR 252 |
| Temporal tensor codecs | Low bit storage and temporal segment reuse | ruvector-temporal-tensor |
| Product quantization | Compressed candidate search with exact query vectors | ruvector-pq-search |
| RaBitQ | Deterministic one bit candidate encoding and optional reranking | ruvector-rabitq |
| Graph condensation | Smaller graph memory while retaining original member provenance | ruvector-graph-condense |
| Full snapshots | Serialized recovery data with compression and checksums | ruvector-snapshot |
| Copy on write branches | Isolated memory experiments without full copies | RVF |
| Cache consistency modes | Fresh, eventual, or frozen reads across data sources | ruvector-rulake |
The DbOptions.quantization field in ruvector-core is persisted but is not currently applied to core storage or indexes. Use a specialized compression crate when physical compression is required. See the source note in types.rs.
| Capability | What it provides | Surface |
|---|---|---|
| Namespace isolation | Separate collections and schemas | ruvector-collections |
| Capability gated retrieval | Per vector 64 bit read masks inside search | ruvector-capgated, ADR 268 |
| Tamper evident lineage | Hash linked records and witness verification | RVF |
| Replication primitives | Vector clocks, local change propagation, and conflict strategies | ruvector-replication |
| Raft primitives | Election, log, and metadata state machine components | ruvector-raft |
| Shared collective memory | Remote contributions, search, provenance, and voting | mcp-brain |
| Requirement | Start with | Add when needed |
|---|---|---|
| Local agent or coding memory | npx ruvector hooks |
ONNX semantic mode, MCP |
| Embedded Node.js service | ruvector and VectorDB |
Graph, SONA, snapshots |
| Embedded Rust service | ruvector-core |
Specialized retrieval crates |
| Typed in-process agent memory | ruvllm::context::AgenticMemory |
External persistence and consolidation policy |
| High write event stream | ruvector-lsm-ann |
Snapshot and compaction policy |
| Multi-hop enterprise knowledge | ruvector-graph |
Hybrid cue search and reconstruction harness |
| Recency sensitive memory |
No open issues yet, or sync has not completed.