The vector database that gets smarter the more you use it.
npx ruvectorMost vector databases are staticβthey store embeddings and search them. That's it. RuVector is different: it learns from every query, runs LLMs locally, scales horizontally, and costs nothing to operate.
| Pinecone/Weaviate | RuVector | |
|---|---|---|
| Search improves over time | β | β GNN layers learn from usage |
| Run LLMs locally | β | β ruvllm + RuvLTRA models ($0) |
| Graph queries (Cypher) | β | β
MATCH (a)-[:SIMILAR]->(b) |
| Self-learning AI hooks | β | β Q-learning, HNSW memory |
| Real-time graph updates | β Rebuild index | β Dynamic min-cut (no rebuild) |
| Horizontal scaling | π° Paid | β Raft consensus, free |
| Works offline | β | β Browser, edge, embedded |
One package. Everything included: vector search, graph queries, GNN learning, distributed clustering, local LLMs, 39 attention mechanisms, and WASM support.
π See Full Capabilities (30+ features)
Core Vector Database
| # | Capability | What It Does |
|---|---|---|
| 1 | Store vectors | Embeddings from OpenAI, Cohere, local ONNX with HNSW indexing |
| 2 | Query with Cypher | Graph queries like Neo4j (MATCH (a)-[:SIMILAR]->(b)) |
| 3 | The index learns | GNN layers make search results improve over time |
| 4 | Hyperbolic HNSW | Hierarchical data in hyperbolic space for better tree structures |
| 5 | Compress automatically | 2-32x memory reduction with adaptive tiered compression |
Distributed Systems
| # | Capability | What It Does |
|---|---|---|
| 6 | Raft consensus | Leader election, log replication, fault-tolerant coordination |
| 7 | Multi-master replication | Vector clocks, conflict resolution, geo-distributed sync |
| 8 | Burst scaling | 10-50x capacity scaling for traffic spikes |
| 9 | Auto-sharding | Automatic data partitioning across nodes |
AI & Machine Learning
| # | Capability | What It Does |
|---|---|---|
| 10 | Run LLMs locally | ruvllm with GGUF, Metal/CUDA/ANE acceleration |
| 11 | RuvLTRA models | Pre-trained GGUF for routing & embeddings (<10ms) β HuggingFace |
| 12 | SONA learning | Self-Optimizing Neural Architecture with LoRA, EWC++ |
| 13 | 39 attention mechanisms | Flash, linear, graph, hyperbolic, mincut-gated (50% compute) |
| 14 | Spiking neural networks | Event-driven neuromorphic computing |
| 15 | Mincut-gated transformer | Dynamic attention via graph min-cut optimization |
| 16 | Route AI requests | Semantic routing + FastGRNN for LLM optimization |
Specialized Processing
| # | Capability | What It Does |
|---|---|---|
| 17 | SciPix OCR | LaTeX/MathML extraction from scientific documents |
| 18 | DAG workflows | Self-learning directed acyclic graph execution |
| 19 | Cognitum Gate | Cognitive AI gateway with TileZero acceleration |
| 20 | FPGA transformer | Hardware-accelerated transformer inference |
| 21 | Quantum coherence | ruQu for quantum error correction via dynamic min-cut |
Platform & Integration
| # | Capability | What It Does |
|---|---|---|
| 22 | Run anywhere | Node.js, browser (WASM), edge (rvLite), HTTP server, Rust |
| 23 | Drop into Postgres | pgvector-compatible extension with SIMD acceleration |
| 24 | MCP integration | Model Context Protocol server for AI assistant tools |
| 25 | Cloud deployment | One-click deploy to Cloud Run, Kubernetes |
Self-Learning & Adaptation
| # | Capability | What It Does |
|---|---|---|
| 26 | Self-learning hooks | Q-learning, neural patterns, HNSW memory |
| 27 | ReasoningBank | Trajectory learning with verdict judgment |
| 28 | Economy system | Tokenomics, CRDT-based distributed state |
| 29 | Nervous system | Event-driven reactive architecture |
| 30 | Agentic synthesis | Multi-agent workflow composition |
Think of it as: Pinecone + Neo4j + PyTorch + llama.cpp + postgres + etcd β in one Rust package.
RuVector powers two major AI orchestration platforms:
| Platform | Purpose | Install |
|---|---|---|
| Claude-Flow | Enterprise multi-agent orchestration for Claude Code | npx @claude-flow/cli@latest |
| Agentic-Flow | Standalone AI agent framework (any LLM provider) | npx agentic-flow@latest |
Claude-Flow v3 β Turn Claude Code into a collaborative AI team
54+ specialized agents working together on complex software engineering tasks:
# Install
npx @claude-flow/cli@latest init --wizard
# Spawn a swarm
npx @claude-flow/cli@latest swarm init --topology hierarchical --max-agents 8Key Features:
- SONA Learning: Sub-50ms adaptive routing, learns optimal patterns over time
- Queen-led Swarms: Byzantine fault-tolerant consensus with 5 protocols (Raft, Gossip, CRDT)
- HNSW Memory: 150x-12,500x faster pattern retrieval via RuVector
- 175+ MCP Tools: Native Model Context Protocol integration
- Cost Optimization: 3-tier routing extends Claude Code quota by 2.5x
- Security: AIDefence threat detection (<10ms), prompt injection blocking
Agentic-Flow v2 β Production AI agents for any cloud
66 self-learning agents with Claude Agent SDK, deployable to any cloud:
# Install
npx agentic-flow@latest
# Or with npm
npm install agentic-flowKey Features:
- SONA Architecture: <1ms adaptive learning, +55% quality improvement
- Flash Attention: 2.49x JS speedup, 7.47x with NAPI bindings
- 213 MCP Tools: Swarm management, memory, GitHub integration
- Agent Booster: 352x faster code editing for simple transforms
- Multi-Provider: Claude, GPT, Gemini, Cohere, local models with failover
- Graph Reasoning: GNN query refinement with +12.4% recall improvement
Traditional vector search:
Query β HNSW Index β Top K Results
RuVector with GNN:
Query β HNSW Index β GNN Layer β Enhanced Results
β β
βββββ learns from ββββββ
The GNN layer:
- Takes your query and its nearest neighbors
- Applies multi-head attention to weigh which neighbors matter
- Updates representations based on graph structure
- Returns better-ranked results
Over time, frequently-accessed paths get reinforced, making common queries faster and more accurate.
# Interactive installer - lists all packages
npx ruvector install
# Or install directly
npm install ruvector
npx ruvector
# Self-learning hooks for Claude Code
npx @ruvector/cli hooks init
npx @ruvector/cli hooks install
# LLM runtime (SONA learning, HNSW memory)
npm install @ruvector/ruvllm# Install
npm install ruvector
# Or try instantly
npx ruvectorπ Comparison with Other Vector Databases
| Feature | RuVector | Pinecone | Qdrant | Milvus | ChromaDB |
|---|---|---|---|---|---|
| Latency (p50) | 61Β΅s | ~2ms | ~1ms | ~5ms | ~50ms |
| Memory (1M vec) | 200MB* | 2GB | 1.5GB | 1GB | 3GB |
| Graph Queries | β Cypher | β | β | β | β |
| SPARQL/RDF | β W3C 1.1 | β | β | β | β |
| Hyperedges | β | β | β | β | β |
| Dynamic Min-Cut | β n^0.12 | β | β | β | β |
| Self-Learning (GNN) | β | β | β | β | β |
| Runtime Adaptation (SONA) | β LoRA+EWC++ | β | β | β | β |
| AI Agent Routing | β Tiny Dancer | β | β | β | β |
| Attention Mechanisms | β 40 types | β | β | β | β |
| Coherence Gate | β Prime-Radiant | β | β | β | β |
| Hyperbolic Embeddings | β PoincarΓ©+Lorentz | β | β | β | β |
| Local Embeddings | β 8+ models | β | β | β | β |
| PostgreSQL Extension | β 77+ functions | β | β | β | β |
| SIMD Optimization | β AVX-512/NEON | Partial | β | β | β |
| Metadata Filtering | β | β | β | β | β |
| Sparse Vectors | β BM25/TF-IDF | β | β | β | β |
| Raft Consensus | β | β | β | β | β |
| Multi-Master Replication | β | β | β | β | β |
| Auto-Sharding | β | β | β | β | β |
| Auto-Compression | β 2-32x | β | β | β | β |
| Snapshots/Backups | β | β | β | β | β |
| Browser/WASM | β WebGPU | β | β | β | β |
| Standalone Edge DB | β rvLite | β | β | β | β |
| LLM Runtime | β ruvllm | β | β | β | β |
| Pre-trained Models | β RuvLTRA (HF) | β | β | β | β |
| MCP Server | β mcp-gate | β | β | β | β |
| Self-Learning Hooks | β Q-learning+Neural+HNSW | β | β | β | β |
| Quantum Coherence | β ruQu | β | β | β | β |
| MinCut-Gated Attention | β 50% compute | β | β | β | β |
| FPGA Acceleration | β | β | β | β | β |
| Local ONNX Embeddings | β 8+ models | β | β | β | β |
| Differentiable | β | β | β | β | β |
| Multi-Tenancy | β Collections | β | β | β | β |
| DAG Workflows | β Self-learning | β | β | β | β |
| ReasoningBank | β Trajectory learning | β | β | β | β |
| Economy System | β CRDT tokenomics | β | β | β | β |
| Nervous System | β Event-driven | β | β | β | β |
| Cognitum Gate | β TileZero | β | β | β | β |
| SciPix OCR | β LaTeX/MathML | β | β | β | β |
| Spiking Neural Nets | β Neuromorphic | β | β | β | β |
| Node.js Native | β napi-rs | β | β | β | β |
| Burst Scaling | β 10-50x | β | β | β | β |
| Streaming API | β | β | β | β | β |
| Open Source | β MIT | β | β | β | β |
*With PQ8 compression. Benchmarks on Apple M2 / Intel i7.
β‘ Core Features & Capabilities
| Feature | What It Does | Why It Matters |
|---|---|---|
| Vector Search | HNSW index, <0.5ms latency, SIMD acceleration | Fast enough for real-time apps |
| Cypher Queries | MATCH, WHERE, CREATE, RETURN |
Familiar Neo4j syntax |
| GNN Layers | Neural network on index topology | Search improves with usage |
| Hyperedges | Connect 3+ nodes at once | Model complex relationships |
| Metadata Filtering | Filter vectors by properties | Combine semantic + structured search |
| Collections | Namespace isolation, multi-tenancy | Organize vectors by project/user |
| Hyperbolic HNSW | PoincarΓ© ball indexing for hierarchies | Better tree/taxonomy embeddings |
| Sparse Vectors | BM25/TF-IDF hybrid search | Combine keyword + semantic |
| Feature | What It Does | Why It Matters |
|---|---|---|
| ruvllm | Local LLM inference with GGUF models | Run AI without cloud APIs |
| Metal/CUDA/ANE | Hardware acceleration on Mac/NVIDIA/Apple | 10-50x faster inference |
| ruvllm-wasm | Browser LLM with WebGPU acceleration | Client-side AI, zero latency |
| RuvLTRA Models | Pre-trained GGUF for routing & embeddings | <10ms inference β HuggingFace |
| Streaming Tokens | Real-time token generation | Responsive chat UX |
| Quantization | Q4, Q5, Q8 model support | Run 7B models in 4GB RAM |
npm install @ruvector/ruvllm # Node.js
cargo add ruvllm # Rust| Feature | What It Does | Why It Matters |
|---|---|---|
| rvLite | Standalone 2MB edge database | IoT, mobile, embedded |
| PostgreSQL Extension | 77+ SQL functions, pgvector replacement | Drop-in upgrade for existing DBs |
| MCP Server | Model Context Protocol integration | AI assistant tool calling |
| WASM/Browser | Full client-side vector search | Offline-first apps |
| Node.js Bindings | Native napi-rs, zero-copy | No serialization overhead |
| HTTP/gRPC Server | REST API with streaming | Easy microservice integration |
docker pull ruvnet/ruvector-postgres # PostgreSQL
npm install rvlite # Edge DB
npx ruvector mcp start # MCP Server| Feature | What It Does | Why It Matters |
|---|---|---|
| Raft Consensus | Leader election, log replication | Strong consistency for metadata |
| Auto-Sharding | Consistent hashing, shard migration | Scale to billions of vectors |
| Multi-Master Replication | Write to any node, conflict resolution | High availability, no SPOF |
| Snapshots | Point-in-time backups, incremental | Disaster recovery |
| Cluster Metrics | Prometheus-compatible monitoring | Observability at scale |
| Burst Scaling | 10-50x capacity for traffic spikes | Handle viral moments |
cargo add ruvector-raft ruvector-cluster ruvector-replication| Feature | What It Does | Why It Matters |
|---|---|---|
| Tensor Compression | f32βf16βPQ8βPQ4βBinary | 2-32x memory reduction |
| Differentiable Search | Soft attention k-NN | End-to-end trainable |
| Semantic Router | Route queries to optimal endpoints | Multi-model AI orchestration |
| Hybrid Routing | Keyword-first + embedding fallback | 90% accuracy for agent routing |
| Tiny Dancer | FastGRNN neural inference | Optimize LLM inference costs |
| Adaptive Routing | Learn optimal routing strategies | Minimize latency, maximize accuracy |
| SONA | Two-tier LoRA + EWC++ + ReasoningBank | Runtime learning without retraining |
| Local Embeddings | 8+ ONNX models built-in | No external API needed |
| Feature | What It Does | Why It Matters |
|---|---|---|
| SciPix OCR | LaTeX/MathML from scientific docs | Index research papers |
| DAG Workflows | Self-learning directed acyclic graphs | Complex pipeline orchestration |
| Cognitum Gate | Cognitive AI gateway + TileZero | Unified AI model routing |
| FPGA Transformer | Hardware-accelerated inference | Ultra-low latency serving |
| ruQu Quantum | Quantum error correction via min-cut | Future-proof algorithms |
| Mincut-Gated Transformer | Dynamic attention via graph optimization | 50% compute reduction |
| Sparse Inference | Efficient sparse matrix operations | 10x faster for sparse data |
| Feature | What It Does | Why It Matters |
|---|---|---|
| Self-Learning Hooks | Q-learning + neural patterns + HNSW | System improves automatically |
| ReasoningBank | Trajectory learning with verdict judgment | Learn from successes/failures |
| Economy System | Tokenomics, CRDT-based distributed state | Incentivize agent behavior |
| Nervous System | Event-driven reactive architecture | Real-time adaptation |
| Agentic Synthesis | Multi-agent workflow composition | Emergent problem solving |
| EWC++ | Elastic weight consolidation | Prevent catastrophic forgetting |
npx @ruvector/cli hooks init # Install self-learning hooks
npx @ruvector/cli hooks install # Configure for Claude Code| Feature | What It Does | Why It Matters |
|---|---|---|
| 40 Mechanisms | Dot-product, multi-head, flash, linear, sparse, cross-attention, CGT sheaf | Cover all transformer and GNN use cases |
| Graph Attention | RoPE, edge-featured, local-global, neighborhood | Purpose-built for graph neural networks |
| Hyperbolic Attention | PoincarΓ© ball operations, curved-space math | Better embeddings for hierarchical data |
| SIMD Optimized | Native Rust with AVX2/NEON acceleration | 2-10x faster than pure JS |
| Streaming & Caching | Chunk-based processing, KV-cache | Constant memory, 10x faster inference |
Documentation: Attention Module Docs
Standard attention layers for sequence modeling and transformers.
| Mechanism | Complexity | Memory | Best For |
|---|---|---|---|
| DotProductAttention | O(nΒ²) | O(nΒ²) | Basic attention for small-medium sequences |
| MultiHeadAttention | O(nΒ²Β·h) | O(nΒ²Β·h) | BERT, GPT-style transformers |
| FlashAttention | O(nΒ²) | O(n) | Long sequences with limited GPU memory |
| LinearAttention | O(nΒ·d) | O(nΒ·d) | 8K+ token sequences, real-time streaming |
| HyperbolicAttention | O(nΒ²) | O(nΒ²) | Tree-like data: taxonomies, org charts |
| MoEAttention | O(nΒ·k) | O(nΒ·k) | Large models with sparse expert routing |
Attention layers designed for graph-structured data and GNNs.
| Mechanism | Complexity | Best For |
|---|---|---|
| GraphRoPeAttention | O(nΒ²) | Position-aware graph transformers |
| EdgeFeaturedAttention | O(nΒ²Β·e) | Molecules, knowledge graphs with edge data |
| DualSpaceAttention | O(nΒ²) | Hybrid flat + hierarchical embeddings |
| LocalGlobalAttention | O(nΒ·k + n) | 100K+ node graphs, scalable GNNs |
Task-specific attention variants for efficiency and multi-modal learning.
| Mechanism | Type | Best For |
|---|---|---|
| SparseAttention | Efficiency | Long docs, low-memory inference |
| CrossAttention | Multi-modal | Image-text, encoder-decoder models |
| NeighborhoodAttention | Graph | Local message passing in GNNs |
| HierarchicalAttention | Structure | Multi-level docs (section β paragraph) |
| CGTSheafAttention | Coherence | Consistency-gated graph transformers |
Operations for PoincarΓ© ball embeddingsβcurved space that naturally represents hierarchies.
| Function | Description | Use Case |
|---|---|---|
expMap(v, c) |
Map to hyperbolic space | Initialize embeddings |
logMap(p, c) |
Map to flat space | Compute gradients |
mobiusAddition(x, y, c) |
Add vectors in curved space | Aggregate features |
poincareDistance(x, y, c) |
Measure hyperbolic distance | Compute similarity |
projectToPoincareBall(p, c) |
Ensure valid coordinates | Prevent numerical errors |
Utilities for high-throughput inference and training optimization.
| Operation | Description | Performance |
|---|---|---|
asyncBatchCompute() |
Process batches in parallel | 3-5x faster |
streamingAttention() |
Process in chunks | Fixed memory usage |
HardNegativeMiner |
Find hard training examples | Better contrastive learning |
AttentionCache |
Cache key-value pairs | 10x faster inference |
# Install attention module
npm install @ruvector/attention
# CLI commands
npx ruvector attention list # List all 39 mechanisms
npx ruvector attention info flash # Details on FlashAttention
npx ruvector attention benchmark # Performance comparison
npx ruvector attention compute -t dot -d 128 # Run attention computation
npx ruvector attention hyperbolic -a distance -v "[0.1,0.2]" -b "[0.3,0.4]"| Feature | What It Does | Why It Matters |
|---|---|---|
| Sheaf Laplacian | Measures consistency via E(S) = Ξ£ wβ Β· βΟα΅€(xα΅€) - Οα΅₯(xα΅₯)βΒ² | Mathematical proof of coherence |
| Compute Ladder | Reflex (<1ms) β Retrieval (~10ms) β Heavy (~100ms) β Human | Route by confidence level |
| LLM Hallucination Gate | Block incoherent responses with witnesses | Refuse generation when math says contradiction |
| GPU/SIMD Acceleration | wgpu + AVX-512/NEON + vec4 WGSL kernels | 4-16x speedup on coherence checks |
| Governance Audit | Blake3 hash chain, cryptographic witnesses | Every decision is provable |
| Traditional AI | Prime-Radiant |
|---|---|
| "I'm 85% confident" | "Zero contradictions found" |
| Can be confidently wrong | Knows when it doesn't know |
| Guesses about the future | Proves consistency right now |
| Trust the model | Trust the math |
| Energy | Lane | Latency | Action |
|---|---|---|---|
| < 0.1 | Reflex | < 1ms | Immediate approval |
| 0.1-0.4 | Retrieval | ~10ms | Fetch more evidence |
| 0.4-0.7 | Heavy | ~100ms | Deep analysis |
| > 0.7 | Human | async | Escalate to review |
# Install coherence engine
cargo add prime-radiant
# With GPU acceleration
cargo add prime-radiant --features gpu,simdπ Deployment Options
| Feature | What It Does | Why It Matters |
|---|---|---|
| HTTP/gRPC Server | REST API, streaming support | Easy integration |
| WASM/Browser | Full client-side support | Run AI search offline |
| Node.js Bindings | Native napi-rs bindings | No serialization overhead |
| FFI Bindings | C-compatible interface | Use from Python, Go, etc. |
| CLI Tools | Benchmarking, testing, management | DevOps-friendly |
π Performance Benchmarks
Measured results from /bench_results/:
| Configuration | QPS | p50 Latency | p99 Latency | Recall |
|---|---|---|---|---|
| ruvector (optimized) | 1,216 | 0.78ms | 0.78ms | 100% |
| Multi-threaded (16) | 3,597 | 2.86ms | 8.47ms | 100% |
| ef_search=50 | 674 | 1.35ms | 1.35ms | 100% |
| Python baseline | 77 | 11.88ms | 11.88ms | 100% |
| Brute force | 12 | 77.76ms | 77.76ms | 100% |
Dataset: 384D, 10K-50K vectors. See full results in latency_benchmark.md.
| Operation | Dimensions | Time | Throughput |
|---|---|---|---|
| HNSW Search (k=10) | 384 | 61Β΅s | 16,400 QPS |
| HNSW Search (k=100) | 384 | 164Β΅s | 6,100 QPS |
| Cosine Distance | 1536 | 143ns | 7M ops/sec |
| Dot Product | 384 | 33ns | 30M ops/sec |
| Batch Distance (1000) | 384 | 237Β΅s | 4.2M/sec |
Production-validated metrics at hyperscale:
| Metric | Value | Details |
|---|---|---|
| Concurrent Streams | 500M baseline | Burst capacity to 25B (50x) |
| Global Latency (p50) | <10ms | Multi-region + CDN edge caching |
| Global Latency (p99) | <50ms | Cross-continental with failover |
| Availability SLA | 99.99% | 15 regions, automatic failover |
| Cost per Stream/Month | $0.0035 | 60% optimized ($1.74M total at 500M) |
| Regions | 15 global | Americas, EMEA, APAC coverage |
| Throughput per Region | 100K+ QPS | Adaptive batching enabled |
| Memory Efficiency | 2-32x compression | Tiered hot/warm/cold storage |
| Index Build Time | 1M vectors/min | Parallel HNSW construction |
| Replication Lag | <100ms | Multi-master async replication |
ποΈ Adaptive Compression Tiers
The architecture adapts to your data. Hot paths get full precision and maximum compute. Cold paths compress automatically and throttle resources. Recent data stays crystal clear; historical data optimizes itself in the background.
Think of it like your computer's memory hierarchyβfrequently accessed data lives in fast cache, while older files move to slower, denser storage. RuVector does this automatically for your vectors:
| Access Frequency | Format | Compression | What Happens |
|---|---|---|---|
| Hot (>80%) | f32 | 1x | Full precision, instant retrieval |
| Warm (40-80%) | f16 | 2x | Slight compression, imperceptible latency |
| Cool (10-40%) | PQ8 | 8x | Smart quantization, ~1ms overhead |
| Cold (1-10%) | PQ4 | 16x | Heavy compression, still fast search |
| Archive (<1%) | Binary | 32x | Maximum density, batch retrieval |
No configuration needed. RuVector tracks access patterns and automatically promotes/demotes vectors between tiers. Your hot data stays fast; your cold data shrinks.
π‘ Use Cases
| Use Case | Features Used | Example |
|---|---|---|
| RAG Pipelines | Vector search, Local embeddings, ruvllm | examples/ruvLLM |
| AI Agent Routing | Tiny Dancer, Semantic router, SONA | Claude-Flow |
| Multi-Agent Orchestration | GNN, HNSW memory, Consensus | Agentic-Flow |
| Self-Learning Chatbots | ReasoningBank, EWC++, Neural patterns | examples/meta-cognition |
// RAG with local LLM (zero cloud costs)
import { RuVector } from 'ruvector';
import { RuvLLM } from '@ruvector/ruvllm';
const db = new RuVector({ dimensions: 384 });
const llm = new RuvLLM({ model: 'ruvltra-small-0.5b-q4_k_m.gguf' });
// Search learns from usage via GNN layers
const context = await db.search(questionEmbedding, { k: 5 });
const response = await llm.generate(`Context: ${context}\n\nQ: ${question}`);| Use Case | Features Used | Example |
|---|---|---|
| Semantic Search | HNSW, Metadata filtering, SIMD | Core feature |
| Hybrid Search | BM25 + embeddings, Sparse vectors | docs/api |
| Image Similarity | CLIP embeddings, Hyperbolic HNSW | examples/wasm-react |
| Code Search | Local ONNX embeddings, Graph queries | examples/nodejs |
// Hybrid search: keyword + semantic
const results = await db.search(query, {
k: 10,
filter: { category: 'electronics', price: { $lt: 500 } },
hybridAlpha: 0.7, // 70% semantic, 30% keyword
rerank: true // GNN-enhanced reranking
});| Use Case | Features Used | Example |
|---|---|---|
| Product Recommendations | Graph queries, Cypher, GNN | examples/graph |
| Content Personalization | User embeddings, Collaborative filtering | Real-time adaptation |
| Similar Items | Cosine similarity, Hyperbolic space | Hierarchical taxonomies |
// Neo4j-style recommendations with learning
MATCH (user:User {id: $userId})-[:VIEWED]->(item:Product)
MATCH (item)-[:SIMILAR_TO]->(rec:Product)
WHERE NOT (user)-[:PURCHASED]->(rec)
RETURN rec ORDER BY rec.gnn_score DESC LIMIT 10| Use Case | Features Used | Example |
|---|---|---|
| Knowledge Graphs | Hypergraph, Cypher, SPARQL | docs/api/CYPHER_REFERENCE.md |
| Document Q&A | Chunking, Embeddings, RAG | examples/refrag-pipeline |
| Scientific Papers | SciPix OCR, LaTeX extraction | examples/scipix |
| Research Discovery | Citation graphs, Concept linking | Hyperedge relationships |
// Multi-hop knowledge graph traversal
MATCH (paper:Paper)-[:CITES*1..3]->(cited:Paper)
WHERE paper.topic = 'machine learning'
MATCH (cited)-[:AUTHORED_BY]->(author:Researcher)
RETURN author, count(cited) as influence
ORDER BY influence DESC LIMIT 20| Use Case | Features Used | Example |
|---|---|---|
| Browser AI | WASM, WebGPU, ruvllm-wasm | examples/wasm-vanilla |
| IoT Sensors | rvLite, Edge DB, no_std | examples/edge |
| Mobile Apps | 2MB footprint, Offline-first | examples/edge-net |
| Streaming Data | Real-time indexing, Dynamic min-cut | examples/neural-trader |
// Browser-based AI (no server required)
import init, { RuvLLMWasm } from '@ruvector/ruvllm-wasm';
await init();
const llm = await RuvLLMWasm.new(true); // WebGPU enabled
await llm.load_model_from_url('https://cdn.example.com/model.gguf');
// Runs entirely in browser
const response = await llm.generate('Explain quantum computing', {
max_tokens: 200,
temperature: 0.7
});| Use Case | Features Used | Example |
|---|---|---|
| Neural Network Analysis | Spiking NN, Meta-cognition | examples/meta-cognition |
| Algorithmic Trading | Neural Trader, Time-series | examples/neural-trader |
| Quantum Computing | ruQu, Min-cut coherence | crates/ruQu |
| Brain Connectivity | Dynamic min-cut, Network analysis | examples/mincut |
// Neuromorphic computing with spiking networks
use ruvector_nervous_system::{SpikingNetwork, LIFNeuron};
let mut network = SpikingNetwork::new();
network.add_layer(LIFNeuron::new(128)); // 128 spiking neurons
network.enable_stdp(); // Spike-timing plasticity
// 10-50x more energy efficient than traditional ANNs
let output = network.forward(&input_spikes);Novel neuromorphic discoveries for brain-inspired vector search in 11.8KB WASM.
| Discovery | Description | Benefit |
|---|---|---|
| Spike-Timing Vector Encoding | Convert vectors to temporal spike patterns | Temporal similarity matching |
| Homeostatic Plasticity | Self-stabilizing network activity | Prevents runaway activation |
| Oscillatory Resonance | Gamma-frequency (40Hz) search amplification | Improved recall via resonance |
| Winner-Take-All Circuits | Competitive neural selection with lateral inhibition | Sparse, efficient representations |
| Dendritic Computation | Non-linear local processing in dendrites | Complex pattern detection |
| STDP Learning | Spike-Timing Dependent Plasticity | Unsupervised Hebbian learning |
// micro-hnsw: Neuromorphic HNSW in 11.8KB WASM
use micro_hnsw_wasm::{MicroHnsw, LIFNeuron, SpikeTrain};
// 256 cores Γ 32 vectors = 8K total capacity
let mut hnsw = MicroHnsw::new(16, Metric::Cosine); // 16-dim vectors
// Spike-timing vector encoding
let spike_train = SpikeTrain::encode(&embedding, 8); // 8-bit temporal resolution
// LIF neuron with STDP learning
let neuron = LIFNeuron::new(0.8); // threshold = 0.8
neuron.enable_stdp(0.01, 0.012); // A+ = 0.01, A- = 0.012
neuron.enable_homeostasis(0.1); // Target rate: 0.1 spikes/ms
// Winner-take-all search with lateral inhibition
let results = hnsw.search_wta(&query, 10, 0.8); // WTA inhibition = 0.8| Use Case | Features Used | Example |
|---|---|---|
| Multi-Region Deployment | Raft consensus, Replication | docs/cloud-architecture |
| High Availability | Auto-sharding, Failover | 99.99% SLA capable |
| PostgreSQL Integration | 230+ SQL functions, pgvector replacement | crates/ruvector-postgres |
| Burst Traffic | 10-50x scaling, Load balancing | examples/google-cloud |
-- PostgreSQL with RuVector extension
CREATE EXTENSION ruvector;
-- Create vector column with GNN-enhanced index
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
content TEXT,
embedding VECTOR(384)
);
CREATE INDEX ON documents USING hnsw_gnn (embedding);
-- Self-improving search
SELECT * FROM documents
ORDER BY embedding <-> query_vector
LIMIT 10;A 256-tile WASM fabric for real-time AI agent safety decisions with cryptographic verification.
| Component | Description | Memory |
|---|---|---|
| Worker Tiles (255) | Local graph shards, evidence accumulation, witness fragments | 64KB each |
| TileZero Arbiter | Supergraph merging, global decisions, permit tokens | Central |
| Gate Decisions | Permit / Defer / Deny with confidence scores | <1ms |
| Witness Receipts | Hash-chained cryptographic audit trail | Immutable |
| Feature | Description |
|---|---|
| Anytime-Valid Testing | Sequential hypothesis testing with e-values |
| Min-Cut Aggregation | Global coherence via distributed min-cut |
| Signed Permits | Cryptographic tokens for approved actions |
| Evidence Filters | Three-filter decision system (structural, evidence, combined) |
// Cognitum Gate: AI agent safety in microseconds
use cognitum_gate_tilezero::{GateDecision, ActionContext, PermitToken};
let gate = CoherenceGate::new_256_tiles();
// Evaluate action safety
let context = ActionContext {
action_id: "deploy-model-v2".into(),
action_type: "config_change".into(),
agent_id: "coder-agent-01".into(),
..Default::default()
};
let decision = gate.evaluate(&context).await?;
match decision {
GateDecision::Permit(token) => {
// Cryptographically signed permit token
assert!(token.verify(&gate.public_key()));
execute_action(token);
}
GateDecision::Defer(reason) => {
// Needs more evidence - retry later
log::info!("Deferred: {}", reason);
}
GateDecision::Deny(evidence) => {
// Action blocked with witness receipt
log::warn!("Denied: {:?}", evidence);
}
}// Browser: Real-time safety checks via WASM
import { CognitumGate } from '@cognitum/gate';
const gate = await CognitumGate.init();
// Check action in <1ms
const result = await gate.evaluate({
action: 'modify_user_data',
agent: 'assistant-v3',
context: { user_id: '12345' }
});
if (result.permitted) {
const receipt = result.witnessReceipt; // Hash-chained audit log
console.log('Permit token:', result.token);
}| Use Case | Features Used | Example |
|---|---|---|
| Real-Time Adaptation | MicroLoRA (<1ms), Per-request learning | docs/ruvllm/FINE_TUNING.md |
| Contrastive Training | Triplet loss, Hard negatives, InfoNCE | npm/packages/ruvllm |
| Task-Specific Adapters | 5 pre-defined adapters (Coder, Researcher, Security, Architect, Reviewer) | docs/training |
| Catastrophic Forgetting Prevention | EWC++ (Elastic Weight Consolidation) | crates/sona |
| Browser Fine-Tuning | MicroLoRA WASM, <50KB adapters | crates/ruvllm-wasm |
Three-Tier Adaptation System:
| Tier | Technique | Latency | Use Case |
|---|---|---|---|
| Instant | MicroLoRA (rank 1-2) | <1ms | Per-request adaptation |
| Background | Adapter Merge + EWC++ | ~100ms | Pattern consolidation |
| Deep | Full Training Pipeline | Minutes | Periodic optimization |
// Real-time embedding fine-tuning with contrastive learning
import { ContrastiveTrainer, tripletLoss } from '@ruvector/ruvllm';
const trainer = new ContrastiveTrainer({
epochs: 10,
batchSize: 16,
margin: 0.5, // Triplet loss margin
hardNegativeRatio: 0.7 // 70% hard negatives for better learning
});
// Train with triplets: anchor (task) β positive (correct agent) β negative (wrong agent)
trainer.addTriplet(taskEmb, correctAgentEmb, wrongAgentEmb, isHardNegative);
const results = trainer.train();
trainer.exportTrainingData('./fine-tuned-model');// Rust: MicroLoRA for per-request adaptation
use ruvllm::lora::{MicroLoRA, MicroLoraConfig, AdaptFeedback};
let lora = MicroLoRA::new(MicroLoraConfig::for_hidden_dim(4096));
// During inference: apply LoRA delta
let output = model.forward(&input)?;
let delta = lora.forward(&input, &TargetModule::QProj);
let enhanced = output.iter().zip(delta.iter()).map(|(o, d)| o + d).collect();
// After response: adapt based on quality feedback
lora.adapt(&input, AdaptFeedback::from_quality(0.85))?;
lora.apply_updates(0.01); // Learning rate// Browser: Real-time fine-tuning with MicroLoRA WASM
import init, { MicroLoraWasm, MicroLoraConfigWasm } from 'ruvllm-wasm';
await init();
const config = new MicroLoraConfigWasm();
config.rank = 2; // Tiny rank for browser (<50KB)
config.alpha = 4.0;
config.inFeatures = 768;
const lora = new MicroLoraWasm(config);
const delta = lora.forward(hiddenStates); // <1ms latency
// Persist to localStorage/IndexedDB
const json = lora.toJson();
localStorage.setItem('user-adapter', json);| Use Case | Features Used | Example |
|---|---|---|
| Version Control for AI | Agentic Jujutsu, Branching | examples/agentic-jujutsu |
| Data Pipelines | DAG workflows, Self-learning | crates/ruvector-dag |
| Web Scraping | Apify integration, Embeddings | examples/apify |
| Synthetic Data | Agentic synthesis, Generation | Agentic-Flow |
// Self-learning DAG workflow
import { QueryDag, AttentionSelector } from '@ruvector/dag';
const dag = new QueryDag();
dag.addNode({ type: 'fetch', source: 'api' });
dag.addNode({ type: 'embed', model: 'local-onnx' });
dag.addNode({ type: 'index', engine: 'hnsw' });
// DAG learns optimal execution paths over time
dag.enableSonaLearning();
await dag.execute();| Platform | Command |
|---|---|
| npm | npm install ruvector |
| npm (SONA) | npm install @ruvector/sona |
| Browser/WASM | npm install ruvector-wasm |
| Rust | cargo add ruvector-core ruvector-graph ruvector-gnn |
| Rust (SONA) | cargo add ruvector-sona |
| Rust (LLM) | cargo add ruvllm |
π Documentation
| Topic | Link |
|---|---|
| Getting Started | docs/guides/GETTING_STARTED.md |
| API Reference | docs/api/ |
| Cypher Reference | docs/api/CYPHER_REFERENCE.md |
| Performance Tuning | docs/optimization/PERFORMANCE_TUNING_GUIDE.md |
| Topic | Link |
|---|---|
| GNN Architecture | docs/gnn/ |
| HNSW Indexing | docs/hnsw/ |
| DAG System | docs/dag/ |
| Nervous System | docs/nervous-system/ |
| Sparse Inference | docs/sparse-inference/ |
| Topic | Link |
|---|---|
| Node.js API | crates/ruvector-gnn-node/README.md |
| WASM API | crates/ruvector-gnn-wasm/README.md |
| PostgreSQL | docs/postgres/ |
| Self-Learning Hooks | docs/hooks/ |
| Integration Guides | docs/integration/ |
| Topic | Link |
|---|---|
| RuvLLM | docs/ruvllm/ |
| Training Guides | docs/training/ |
| Topic | Link |
|---|---|
| Architecture | docs/architecture/ |
| Cloud Deployment | docs/cloud-architecture/ |
| Security | docs/security/ |
| Benchmarks | docs/benchmarks/ |
| Testing | docs/testing/ |
| Topic | Link |
|---|---|
| Research Papers | docs/research/ |
| GNN V2 Features | docs/research/gnn-v2/ |
| Min-Cut Algorithms | docs/research/mincut/ |
| SPARQL Support | docs/research/sparql/ |
| Latent Space | docs/research/latent-space/ |
| ADR | Status | Description |
|---|---|---|
| ADR-001 | Accepted | Core architecture design |
| ADR-002 | Accepted | RuvLLM integration |
| ADR-003 | Accepted | SIMD optimization strategy |
| ADR-004 | Accepted | KV cache management |
| ADR-005 | Accepted | WASM runtime integration |
| ADR-006 | Accepted | Memory management |
| ADR-007 | Accepted | Security review |
| ADR-008 | New | Mistral-rs backend integration |
| ADR-009 | New | Structured output (SOTA) |
| ADR-010 | New | Function calling (SOTA) |
| ADR-011 | New | Prefix caching (SOTA) |
| ADR-012 | New | Security remediation |
| ADR-013 | New | HuggingFace publishing |
π¦ npm Packages (45+ Packages)
| Package | Description | Version | Downloads |
|---|---|---|---|
| ruvector | All-in-one CLI & package | ||
| @ruvector/core | Core vector database with HNSW | ||
| @ruvector/node | Unified Node.js bindings | ||
| ruvector-extensions | Advanced features: embeddings, UI |
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/gnn | Graph Neural Network layers | ||
| @ruvector/graph-node | Hypergraph with Cypher queries | ||
| @ruvector/graph-wasm | Browser graph queries | ||
| @ruvector/graph-data-generator | AI-powered synthetic graph data |
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/tiny-dancer | FastGRNN neural routing | ||
| @ruvector/router | Semantic router + HNSW | ||
| @ruvector/attention | 39 attention mechanisms |
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/sona | Self-Optimizing Neural Architecture | ||
| @ruvector/spiking-neural | Spiking neural networks (SNN) |
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/ruvllm | LLM orchestration + SONA | ||
| @ruvector/ruvllm-cli | LLM CLI: inference, benchmarks | ||
| @ruvector/ruvllm-wasm | Browser LLM inference |
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/cluster | Distributed clustering | ||
| @ruvector/server | HTTP/gRPC server | ||
| @ruvector/raft | Raft consensus | ||
| @ruvector/replication | Multi-master replication | ||
| @ruvector/burst-scaling | 10-50x burst scaling |
| Package | Description | Version | Downloads |
|---|---|---|---|
| rvlite | SQLite-style edge DB | ||
| @ruvector/rudag | Self-learning DAG |
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/agentic-synth | AI synthetic data generator | ||
| @ruvector/agentic-integration | Distributed agent coordination | ||
| @cognitum/gate | AI coherence gate |
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/cli | CLI + self-learning hooks | ||
| @ruvector/postgres-cli | PostgreSQL extension CLI | ||
| @ruvector/scipix | Scientific OCR client |
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/wasm | Unified WASM meta-package | ||
| @ruvector/wasm-unified | Unified TypeScript API | ||
| @ruvector/gnn-wasm | GNN WASM bindings | ||
| @ruvector/attention-wasm | Attention WASM bindings | ||
| @ruvector/attention-unified-wasm | All 39 attention mechanisms | ||
| @ruvector/tiny-dancer-wasm | AI routing WASM | ||
| @ruvector/router-wasm | Semantic router WASM | ||
| @ruvector/learning-wasm | Learning module WASM | ||
| @ruvector/economy-wasm | Tokenomics WASM | ||
| @ruvector/exotic-wasm | Exotic features WASM | ||
| @ruvector/nervous-system-wasm | Nervous system WASM | ||
| ruvector-attention-wasm | WASM attention (Flash, MoE, Hyperbolic, CGT Sheaf) |
π¦ Rust Crates (63 Packages)
All crates are published to crates.io under the ruvector-* namespace.
| Crate | Description | crates.io |
|---|---|---|
| ruvector-core | Vector database engine with HNSW indexing | |
| ruvector-collections | Collection and namespace management | |
| ruvector-filter | Vector filtering and metadata queries | |
| ruvector-metrics | Performance metrics and monitoring | |
| ruvector-snapshot | Snapshot and persistence management | |
| ruvector-node | Node.js bindings via NAPI-RS | |
| ruvector-wasm | WASM bindings for browser/edge | |
| ruvector-cli | CLI and MCP server | |
| ruvector-bench | Benchmarking suite |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-graph | Hypergraph database with Neo4j-style Cypher | |
| ruvector-graph-node | Node.js bindings for graph operations | |
| ruvector-graph-wasm | WASM bindings for browser graph queries | |
| ruvector-gnn | Graph Neural Network layers and training | |
| ruvector-gnn-node | Node.js bindings for GNN inference | |
| ruvector-gnn-wasm | WASM bindings for browser GNN |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-attention | 39 attention mechanisms (Flash, Hyperbolic, MoE, Graph) | |
| ruvector-attention-node | Node.js bindings for attention mechanisms | |
| ruvector-attention-wasm | WASM bindings for browser attention | |
| ruvector-attention-cli | CLI for attention testing and benchmarking |
| Crate | Description | crates.io |
|---|---|---|
| ruvllm | LLM serving runtime with SONA, paged attention, KV cache | |
| ruvllm-cli | CLI for model inference and benchmarking | |
| ruvllm-wasm | WASM bindings for browser LLM inference |
Features: Candle backend, Metal/CUDA acceleration, Apple Neural Engine, GGUF support, SONA learning integration.
cargo add ruvllm --features inference-metal # Mac with Metal
cargo add ruvllm --features inference-cuda # NVIDIA GPURuvLTRA Models β Pre-trained GGUF models optimized for Claude Code workflows:
| Model | Size | Use Case | Link |
|---|---|---|---|
| ruvltra-claude-code-0.5b-q4_k_m | 398 MB | Agent routing | HuggingFace |
| ruvltra-small-0.5b-q4_k_m | 398 MB | Embeddings | HuggingFace |
| ruvltra-medium-1.1b-q4_k_m | 800 MB | Classification | HuggingFace |
# Download and use
wget https://huggingface.co/ruv/ruvltra/resolve/main/ruvltra-small-0.5b-q4_k_m.gguf| Crate | Description | crates.io |
|---|---|---|
| ruvector-cluster | Cluster management and coordination | |
| ruvector-raft | Raft consensus implementation | |
| ruvector-replication | Data replication and synchronization | |
| ruvector-server | REST/gRPC API server |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-tiny-dancer-core | FastGRNN neural inference for AI routing | |
| ruvector-tiny-dancer-node | Node.js bindings for AI routing | |
| ruvector-tiny-dancer-wasm | WASM bindings for browser AI routing |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-router-core | Core semantic routing engine | |
| ruvector-router-cli | CLI for router testing and benchmarking | |
| ruvector-router-ffi | FFI bindings for other languages | |
| ruvector-router-wasm | WASM bindings for browser routing |
Hybrid Routing achieves 90% accuracy for agent routing using keyword-first strategy with embedding fallback. See Issue #122 for benchmarks and the training tutorials for fine-tuning guides.
| Crate | Description | crates.io |
|---|---|---|
| ruvector-mincut | Subpolynomial fully-dynamic min-cut (arXiv:2512.13105) | |
| ruvector-mincut-node | Node.js bindings for min-cut | |
| ruvector-mincut-wasm | WASM bindings for browser min-cut |
First deterministic exact fully-dynamic min-cut with verified n^0.12 subpolynomial update scaling:
- Brain connectivity β Detect Alzheimer's markers by tracking neural pathway changes in milliseconds
- Network resilience β Predict outages before they happen, route around failures instantly
- AI agent coordination β Find communication bottlenecks in multi-agent systems
- Neural network pruning β Identify which connections can be removed without losing accuracy
- 448+ tests, 256-core parallel optimization, 8KB per core (compile-time verified)
use ruvector_mincut::{DynamicMinCut, Graph};
let mut graph = Graph::new();
graph.add_edge(0, 1, 10.0);
graph.add_edge(1, 2, 5.0);
let mincut = DynamicMinCut::new(&graph);
let (value, cut_edges) = mincut.compute();
// Updates in subpolynomial time as edges change| Crate | Description | crates.io |
|---|---|---|
| ruqu | Classical nervous system for quantum machines - coherence via min-cut | |
| cognitum-gate-kernel | Anytime-valid coherence gate kernel | |
| cognitum-gate-tilezero | TileZero arbiter for coherence decisions | |
| mcp-gate | MCP server for coherence gate integration | |
| prime-radiant | Universal coherence engine - sheaf Laplacian AI safety & hallucination detection |
ruQu Features: Real-time quantum coherence assessment, MWPM decoder integration, mincut-gated attention (50% FLOPs reduction).
use ruqu::{CoherenceGate, SyndromeFilter};
let gate = CoherenceGate::new();
let syndrome = gate.assess_coherence(&quantum_state)?;| Crate | Description | crates.io |
|---|---|---|
| ruvector-math | Core math utilities, SIMD operations | |
| ruvector-math-wasm | WASM bindings for math operations | |
| ruvector-sparse-inference | Sparse tensor inference engine | |
| ruvector-sparse-inference-wasm | WASM bindings for sparse inference | |
| ruvector-hyperbolic-hnsw | HNSW in hyperbolic space (PoincarΓ©/Lorentz) | |
| ruvector-hyperbolic-hnsw-wasm | WASM bindings for hyperbolic HNSW |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-fpga-transformer | FPGA-optimized transformer inference | |
| ruvector-fpga-transformer-wasm | WASM simulation of FPGA transformer | |
| ruvector-mincut-gated-transformer | MinCut-gated attention for 50% compute reduction | |
| ruvector-mincut-gated-transformer-wasm | WASM bindings for mincut-gated transformer |
| Crate | Description | crates.io |
|---|---|---|
| ruvector-nervous-system | Spiking neural networks with BTSP learning & EWC plasticity | |
| ruvector-nervous-system-wasm | WASM bindings for neuromorphic learning | |
| ruvector-learning-wasm | MicroLoRA adaptation (<100Β΅s latency) | |
| ruvector-economy-wasm | CRDT-based autonomous credit economy | |
| ruvector-exotic-wasm | Exotic AI primitives (strange loops, time crystals) | |
| ruvector-attention-unified-wasm | Unified 18+ attention mechanisms (Neural, DAG, Mamba SSM) | |
| micro-hnsw-wasm | Neuromorphic HNSW with spiking neurons (11.8KB WASM) |
Bio-inspired features:
- Spiking Neural Networks (SNNs) β 10-50x energy efficiency vs traditional ANNs
- BTSP Learning β Behavioral Time-Scale Synaptic Plasticity for rapid adaptation
- MicroLoRA β Sub-microsecond fine-tuning for per-operator learning
- Mamba SSM β State Space Model attention for linear-time sequences
| Crate | Description | crates.io |
|---|---|---|
| sona | Self-Optimizing Neural Architecture - LoRA, EWC++, ReasoningBank |
SONA Features: Two-tier LoRA adaptation, Elastic Weight Consolidation (EWC++), ReasoningBank for trajectory learning, runtime-adaptive learning for LLM routers.
| Crate | Description | crates.io |
|---|---|---|
| rvlite | Standalone 2MB edge database with SQL, SPARQL, Cypher |
rvLite Features: Powered by RuVector WASM, supports SQL/SPARQL/Cypher queries, ideal for IoT, mobile, and embedded systems.
| Crate | Description | crates.io |
|---|---|---|
| ruvector-postgres | pgvector replacement with 230+ SQL functions, SIMD, Flash Attention |
PostgreSQL Features: Drop-in pgvector replacement, GNN layers, hybrid search, multi-tenancy, self-healing, self-learning capabilities.
docker pull ruvnet/ruvector-postgres # Docker image
cargo add ruvector-postgres # Rust crate| Crate | Description | crates.io |
|---|---|---|
| ruvector-dag | Neural self-learning DAG for automatic query optimization | |
| ruvector-dag-wasm | WASM bindings for browser DAG optimization (58KB gzipped) |
Make your queries faster automatically. RuVector DAG learns from every query execution and continuously optimizes performanceβno manual tuning required.
- 7 Attention Mechanisms: Automatically selects the best strategy (Topological, Causal Cone, Critical Path, MinCut Gated, etc.)
- SONA Learning: Self-Optimizing Neural Architecture adapts in <100ΞΌs per query
- MinCut Control: Rising "tension" triggers automatic strategy switching and predictive healing
- 50-80% Latency Reduction: Queries improve over time without code changes
use ruvector_dag::{QueryDag, OperatorNode};
use ruvector_dag::attention::{AttentionSelector, SelectionPolicy};
let mut dag = QueryDag::new();
let scan = dag.add_node(OperatorNode::hnsw_scan(0, "vectors_idx", 64));
let filter = dag.add_node(OperatorNode::filter(1, "score > 0.5"));
dag.add_edge(scan, filter).unwrap();
// System learns which attention mechanism works best
let selector = AttentionSelector::new();
let scores = selector.select_and_apply(SelectionPolicy::Adaptive, &dag)?;See ruvector-dag README for full documentation.
| Crate | Description | crates.io |
|---|---|---|
| ruvector-raft | Raft consensus with leader election & log replication | |
| ruvector-replication | Multi-master replication with vector clocks | |
| ruvector-cluster | Cluster coordination and sharding |
Build distributed vector databases with strong consistency guarantees:
- Raft Consensus β Leader election, log replication, automatic failover
- Vector Clocks β Causal ordering for conflict detection
- Conflict Resolution β Last-Write-Wins, custom merge functions, CRDT support
- Change Data Capture β Stream changes to replicas in real-time
- Automatic Failover β Promote replicas on primary failure
import { RaftNode, ReplicaSet, VectorClock } from '@ruvector/raft';
import { ReplicationManager, ConflictStrategy } from '@ruvector/replication';
// Raft consensus cluster
const node = new RaftNode({
nodeId: 'node-1',
peers: ['node-2', 'node-3'],
electionTimeout: [150, 300],
});
await node.start();
const entry = await node.propose({ op: 'insert', vector: embedding });
// Multi-master replication
const replicaSet = new ReplicaSet();
replicaSet.addReplica('primary', 'localhost:5001', 'primary');
replicaSet.addReplica('replica-1', 'localhost:5002', 'replica');
const manager = new ReplicationManager(replicaSet, {
conflictStrategy: ConflictStrategy.LastWriteWins,
syncMode: 'async',
});
await manager.write('vectors', { id: 'v1', data: embedding });See npm/packages/raft/README.md and npm/packages/replication/README.md for full documentation.
| Crate | Description | crates.io |
|---|---|---|
| rvlite | SQLite-style vector database for browsers & edge |
Runs anywhere JavaScript runs β browsers, Node.js, Deno, Bun, Cloudflare Workers, Vercel Edge:
- SQL + SPARQL + Cypher unified query interface
- Zero dependencies β thin orchestration over existing WASM crates
- Self-learning via SONA ReasoningBank integration
import { RvLite } from '@rvlite/wasm';
const db = await RvLite.create();
await db.sql(`CREATE TABLE docs (id SERIAL, embedding VECTOR(384))`);
await db.sparql(`SELECT ?s WHERE { ?s rdf:type ex:Document }`);
await db.cypher(`MATCH (d:Doc)-[:SIMILAR]->(r) RETURN r`);| Crate | Description | crates.io | npm |
|---|---|---|---|
| ruvector-sona | Runtime-adaptive learning with LoRA, EWC++, and ReasoningBank |
SONA enables AI systems to continuously improve from user feedback without expensive retraining:
- Two-tier LoRA: MicroLoRA (rank 1-2) for instant adaptation, BaseLoRA (rank 4-16) for long-term learning
- EWC++: Elastic Weight Consolidation prevents catastrophic forgetting
- ReasoningBank: K-means++ clustering stores and retrieves successful reasoning patterns
- Lock-free Trajectories: ~50ns overhead per step with crossbeam ArrayQueue
- Sub-millisecond Learning: <0.8ms per trajectory processing
# Rust
cargo add ruvector-sona
# Node.js
npm install @ruvector/sonause ruvector_sona::{SonaEngine, SonaConfig};
let engine = SonaEngine::new(SonaConfig::default());
let traj_id = engine.start_trajectory(query_embedding);
engine.record_step(traj_id, node_id, 0.85, 150);
engine.end_trajectory(traj_id, 0.90);
engine.learn_from_feedback(LearningSignal::positive(50.0, 0.95));// Node.js
const { SonaEngine } = require('@ruvector/sona');
const engine = new SonaEngine(256); // 256 hidden dimensions
const trajId = engine.beginTrajectory([0.1, 0.2, ...]);
engine.addTrajectoryStep(trajId, activations, attention, 0.9);
engine.endTrajectory(trajId, 0.95);π Self-Learning DAG (Query Optimization)
Make your queries faster automatically. RuVector DAG learns from every query execution and continuously optimizes performanceβno manual tuning required.
A self-learning query optimization systemβlike a "nervous system" for your database queries that:
- Watches how queries execute and identifies bottlenecks
- Learns which optimization strategies work best for different query patterns
- Adapts in real-time, switching strategies when conditions change
- Heals itself by detecting anomalies and fixing problems before they impact users
Unlike traditional query optimizers that use static rules, RuVector DAG learns from actual execution patterns and gets smarter over time.
| Benefit | What It Does | Result |
|---|---|---|
| Automatic Improvement | Queries get faster without code changes | 50-80% latency reduction after learning |
| Zero-Downtime Adaptation | Adapts to pattern changes automatically | No manual index rebuilds |
| Predictive Prevention | Detects rising "tension" early | Intervenes before slowdowns |
| Works Everywhere | PostgreSQL, Browser (58KB WASM), Embedded | Universal deployment |
| Use Case | Why RuVector DAG Helps |
|---|---|
| Vector Search Applications | Optimize similarity searches that traditional databases struggle with |
| High-Traffic APIs | Automatically adapt to changing query patterns throughout the day |
| Real-Time Analytics | Learn which aggregation paths are fastest for your specific data |
| Edge/Embedded Systems | 58KB WASM build runs in browsers and IoT devices |
| Multi-Tenant Platforms | Learn per-tenant query patterns without manual tuning |
Query comes in β DAG analyzes execution plan β Best attention mechanism selected
β
Query executes β Results returned β Learning system records what worked
β
Next similar query benefits from learned optimizations
The system maintains a MinCut tension score that acts as a health indicator. When tension rises, the system automatically switches to more aggressive optimization strategies and triggers predictive healing.
| Mechanism | When to Use | Trigger |
|---|---|---|
| Topological | Default baseline | Low variance |
| Causal Cone | Downstream impact analysis | Write-heavy patterns |
| Critical Path | Latency-bound queries | p99 > 2x p50 |
| MinCut Gated | Bottleneck-aware weighting | Cut tension rising |
| Hierarchical Lorentz | Deep hierarchical queries | Depth > 10 |
| Parallel Branch | Wide parallel execution | Branch count > 3 |
| Temporal BTSP | Time-series workloads | Temporal patterns |
Rust:
use ruvector_dag::{QueryDag, OperatorNode, OperatorType};
use ruvector_dag::attention::{TopologicalAttention, DagAttention};
// Build a query DAG
let mut dag = QueryDag::new();
let scan = dag.add_node(OperatorNode::hnsw_scan(0, "vectors_idx", 64));
let filter = dag.add_node(OperatorNode::filter(1, "score > 0.5"));
let result = dag.add_node(OperatorNode::new(2, OperatorType::Result));
dag.add_edge(scan, filter).unwrap();
dag.add_edge(filter, result).unwrap();
// Compute attention scores
let attention = TopologicalAttention::new(Default::default());
let scores = attention.forward(&dag).unwrap();Node.js:
import { QueryDag, TopologicalAttention } from '@ruvector/rudag';
// Build DAG
const dag = new QueryDag();
const scan = dag.addNode({ type: 'hnsw_scan', table: 'vectors', k: 64 });
const filter = dag.addNode({ type: 'filter', condition: 'score > 0.5' });
dag.addEdge(scan, filter);
// Apply attention
const attention = new TopologicalAttention();
const scores = attention.forward(dag);
console.log('Attention scores:', scores);Browser (WASM - 58KB):
<script type="module">
import init, { QueryDag, TopologicalAttention } from '@ruvector/rudag-wasm';
await init();
const dag = new QueryDag();
// ... same API as Node.js
</script>SONA (Self-Optimizing Neural Architecture) runs post-query in background, never blocking execution:
use ruvector_dag::sona::{DagSonaEngine, SonaConfig};
let config = SonaConfig {
embedding_dim: 256,
lora_rank: 2, // Rank-2 for <100ΞΌs updates
ewc_lambda: 5000.0, // Catastrophic forgetting prevention
trajectory_capacity: 10_000,
};
let mut sona = DagSonaEngine::new(config);
// Pre-query: Get enhanced embedding (fast path)
let enhanced = sona.pre_query(&dag);
// Execute query...
let execution_time = execute_query(&dag);
// Post-query: Record trajectory (async, background)
sona.post_query(&dag, execution_time, baseline_time, "topological");Reactive (Z-score anomaly detection) + Predictive (rising MinCut tension triggers early intervention):
use ruvector_dag::healing::{HealingOrchestrator, AnomalyConfig, PredictiveConfig};
let mut orchestrator = HealingOrchestrator::new();
// Reactive: Z-score anomaly detection
orchestrator.add_detector("query_latency", AnomalyConfig {
z_threshold: 3.0,
window_size: 100,
min_samples: 10,
});
// Predictive: Rising cut tension triggers early intervention
orchestrator.enable_predictive(PredictiveConfig {
tension_threshold: 0.6, // Intervene before 0.7 crisis
variance_threshold: 1.5, // Rising variance = trouble coming
lookahead_window: 50, // Predict 50 queries ahead
});A slow query converges over several runs:
[run 1] query: SELECT * FROM vectors WHERE embedding <-> $1 < 0.5
attention: topological (default)
mincut_tension: 0.23
latency: 847ms (improvement: 0.4%)
[run 4] mincut_tension: 0.71 > 0.7 (THRESHOLD)
--> switching attention: topological -> mincut_gated
latency: 412ms (improvement: 51.5%)
[run 10] attention: mincut_gated
mincut_tension: 0.22 (stable)
latency: 156ms (improvement: 81.6%)
| Component | Target | Notes |
|---|---|---|
| Attention (100 nodes) | <100ΞΌs | All 7 mechanisms |
| MicroLoRA adaptation | <100ΞΌs | Rank-2, per-operator |
| Pattern search (10K) | <2ms | K-means++ indexing |
| MinCut update | O(n^0.12) | Subpolynomial amortized |
| Anomaly detection | <50ΞΌs | Z-score, streaming |
| WASM size | 58KB | Gzipped, browser-ready |
# Rust
cargo add ruvector-dag
# Node.js
npm install @ruvector/rudag
# WASM (browser)
npm install @ruvector/rudag-wasmFull Documentation: ruvector-dag README
π¦ rvLite - Standalone Edge Database
A complete vector database that runs anywhere JavaScript runs β browsers, Node.js, Deno, Bun, Cloudflare Workers, Vercel Edge Functions.
rvLite is a lightweight, standalone vector database that runs entirely in WebAssembly. It provides SQL, SPARQL, and Cypher query interfaces, along with graph neural networks and self-learning capabilitiesβall in under 3MB.
| Feature | What It Does | Why It Matters |
|---|---|---|
| SQL Interface | Familiar SELECT, INSERT, WHERE |
No learning curve |
| SPARQL Support | W3C-compliant RDF queries | Knowledge graphs in browser |
| Cypher Queries | Neo4j-style graph queries | Graph traversals anywhere |
| GNN Embeddings | Graph neural network layers | Self-learning search |
| ReasoningBank | Trajectory learning | Gets smarter over time |
| SIMD Optimized | Vector operations accelerated | Native-like performance |
| Platform | Status | Use Case |
|---|---|---|
| Browsers | β | Offline-first apps |
| Node.js | β | Server-side |
| Deno | β | Edge functions |
| Bun | β | Fast runtime |
| Cloudflare Workers | β | Edge computing |
| Vercel Edge | β | Serverless |
βββββββββββββββββββββββββββββββββββββββββββ
β RvLite (Orchestration) β
β ββ SQL executor β
β ββ SPARQL executor β
β ββ Cypher executor β
β ββ Unified WASM API β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β depends on (100% reuse)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββ
β Existing WASM Crates β
ββββββββββββββββββββββββββββββββββββββββββββ€
β β’ ruvector-core (vectors, SIMD) β
β β’ ruvector-graph-wasm (Cypher) β
β β’ ruvector-gnn-wasm (GNN layers) β
β β’ sona (ReasoningBank learning) β
β β’ micro-hnsw-wasm (ultra-fast HNSW) β
ββββββββββββββββββββββββββββββββββββββββββββ
import { RvLite } from '@ruvector/rvlite';
// Create database
const db = await RvLite.create();
// SQL with vector search
await db.sql(`
CREATE TABLE docs (
id SERIAL PRIMARY KEY,
content TEXT,
embedding VECTOR(384)
)
`);
await db.sql(`
SELECT id, content, embedding <=> $1 AS distance
FROM docs
ORDER BY distance
LIMIT 10
`, [queryVector]);
// Cypher graph queries
await db.cypher(`
CREATE (a:Person {name: 'Alice'})-[:KNOWS]->(b:Person {name: 'Bob'})
`);
// SPARQL RDF queries
await db.sparql(`
SELECT ?name WHERE {
?person foaf:name ?name .
}
`);
// GNN embeddings
const embeddings = await db.gnn.computeEmbeddings('social_network', [
db.gnn.createLayer('gcn', { inputDim: 128, outputDim: 64 })
]);
// Self-learning with ReasoningBank
await db.learning.recordTrajectory({ state: [0.1], action: 2, reward: 1.0 });
await db.learning.train({ algorithm: 'q-learning', iterations: 1000 });| Component | Size | Purpose |
|---|---|---|
| ruvector-core | ~500KB | Vectors, SIMD |
| SQL parser | ~200KB | Query parsing |
| SPARQL executor | ~300KB | RDF queries |
| Cypher (graph-wasm) | ~600KB | Graph queries |
| GNN layers | ~300KB | Neural networks |
| ReasoningBank (sona) | ~300KB | Self-learning |
| Total | ~2.3MB | Gzipped |
# npm
npm install @ruvector/rvlite
# Rust
cargo add rvlite
# Build WASM
wasm-pack build --target web --releaseFull Documentation: rvlite README
π Edge-Net - Collective AI Computing Network
Share, Contribute, Compute Together β A distributed computing platform that enables collective resource sharing for AI workloads.
Edge-Net creates a collective computing network where participants share idle browser resources to power distributed AI workloads:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EDGE-NET: COLLECTIVE AI COMPUTING NETWORK β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Your β β Collective β β AI Tasks β β
β β Browser ββββββββΊβ Network ββββββββΊβ Completed β β
β β (Idle CPU) β P2P β (1000s) β β for You β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β β β β
β Contribute βββββββΊ Earn rUv Units βββββββΊ Use for AI Workloads β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Step | What Happens | Result |
|---|---|---|
| 1. Contribute | Share unused CPU cycles when browsing | Help the network |
| 2. Earn | Accumulate rUv (Resource Utility Vouchers) | Build credits |
| 3. Use | Spend rUv to run AI tasks | Access collective power |
| 4. Network Grows | More participants = more power | Everyone benefits |
| Traditional AI | Collective Edge-Net |
|---|---|
| Expensive GPU servers | Free idle browser CPUs |
| Centralized data centers | Distributed global network |
| Pay-per-use pricing | Contribution-based access |
| Single point of failure | Resilient P2P mesh |
| Limited by your hardware | Scale with the collective |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI INTELLIGENCE STACK β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MicroLoRA Adapter Pool (from ruvLLM) β β
β β β’ LRU-managed pool (16 slots) β’ <50Β΅s rank-1 forward β β
β β β’ 4-bit/8-bit quantization β’ 2,236+ ops/sec β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β SONA - Self-Optimizing Neural Architecture β β
β β β’ Instant Loop: Per-request MicroLoRA adaptation β β
β β β’ Background Loop: Hourly K-means consolidation β β
β β β’ Deep Loop: Weekly EWC++ (prevents catastrophic forgetting) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββ β
β β HNSW Vector Index β β Federated Learning β β ReasoningBank β β
β β β’ 150x faster β β β’ Byzantine tolerantβ β β’ Pattern learn β β
β β β’ O(log N) search β β β’ Diff privacy β β β’ 87x energy β β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Task Type | Use Case | Performance |
|---|---|---|
| Vector Search | Find similar items | 150x speedup via HNSW |
| Embeddings | Text understanding | Semantic vectors |
| Semantic Match | Intent detection | Classify meaning |
| LoRA Inference | Task adaptation | <100Β΅s forward |
| Pattern Learning | Self-optimization | ReasoningBank trajectories |
Ultra-compact cryptographic identity using mathematical constants:
| Key Type | Size | Purpose |
|---|---|---|
| Ο (Pi-Key) | 40 bytes | Permanent identity |
| e (Session) | 34 bytes | Encrypted sessions |
| Ο (Genesis) | 21 bytes | Network origin markers |
| Feature | Mechanism | Benefit |
|---|---|---|
| Task Routing | Multi-head attention | Work goes to best nodes |
| Topology Optimization | Self-organizing mesh | Network adapts to load |
| Q-Learning Security | Reinforcement learning | Learns to defend threats |
| Economic Balance | rUv token system | Self-sustaining economy |
Add to Your Website:
<script type="module">
import init, { EdgeNetNode, EdgeNetConfig } from '@ruvector/edge-net';
async function joinCollective() {
await init();
// Join the collective
const node = new EdgeNetConfig('my-website')
.cpuLimit(0.3) // Contribute 30% CPU when idle
.memoryLimit(256 * 1024 * 1024) // 256MB max
.respectBattery(true) // Reduce on battery
.build();
node.start();
// Monitor participation
setInterval(() => {
console.log(`Contributed: ${node.ruvBalance()} rUv`);
}, 10000);
}
joinCollective();
</script>Use the Collective's AI Power:
// Submit an AI task to the collective
const result = await node.submitTask('vector_search', {
query: embeddings,
k: 10,
index: 'shared-knowledge-base'
}, 5); // Spend up to 5 rUv
console.log('Similar items:', result);Monitor Your Contribution:
const stats = node.getStats();
console.log(`
rUv Earned: ${stats.ruv_earned}
rUv Spent: ${stats.ruv_spent}
Tasks Completed: ${stats.tasks_completed}
Reputation: ${(stats.reputation * 100).toFixed(1)}%
`);| Feature | Benefit |
|---|---|
| Idle CPU Utilization | Use resources that would otherwise be wasted |
| Browser-Based | No installation, runs in any modern browser |
| Adjustable Contribution | Control how much you share (10-50% CPU) |
| Battery Aware | Automatically reduces on battery power |
| Fair Distribution | Work routed based on capability matching |
| Privacy-First | Pi-Key cryptographic identity |
| Federated Learning | Learn collectively without sharing data |
| Byzantine Tolerance | Resilient to malicious nodes |
# npm
npm install @ruvector/edge-net
# Or include directly
<script src="https://unpkg.com/@ruvector/edge-net"></script>Full Documentation: edge-net README
π² Agentic-Synth - AI Synthetic Data Generation
AI-Powered Synthetic Data Generation at Scale β Generate unlimited, high-quality synthetic data for training AI models, testing systems, and building robust agentic applications.
| Problem | Solution |
|---|---|
| Real data is expensive to collect | Generate unlimited synthetic data |
| Privacy-sensitive with compliance risks | Fully synthetic, no PII concerns |
| Slow to generate at scale | 10-100x faster than manual creation |
| Insufficient for edge cases | Customizable schemas for any scenario |
| Hard to reproduce across environments | Reproducible with seed values |
| Feature | Description |
|---|---|
| Multi-Model Support | Gemini, OpenRouter, GPT, Claude, and 50+ models via DSPy.ts |
| Context Caching | 95%+ performance improvement with intelligent LRU cache |
| Smart Model Routing | Automatic load balancing, failover, and cost optimization |
| DSPy.ts Integration | Self-learning optimization with 20-25% quality improvement |
| Streaming | AsyncGenerator for real-time data flow |
| Memory Efficient | <50MB for datasets up to 10K records |
| Type | Use Cases |
|---|---|
| Time-Series | Financial data, IoT sensors, metrics |
| Events | Logs, user actions, system events |
| Structured | JSON, CSV, databases, APIs |
| Embeddings | Vector data for RAG systems |
# Install
npm install @ruvector/agentic-synth
# Or run instantly with npx
npx @ruvector/agentic-synth generate --count 100
# Interactive mode
npx @ruvector/agentic-synth interactiveimport { AgenticSynth } from '@ruvector/agentic-synth';
// Initialize with your preferred model
const synth = new AgenticSynth({
model: 'gemini-pro',
apiKey: process.env.GEMINI_API_KEY
});
// Generate structured data
const users = await synth.generate({
schema: {
name: 'string',
email: 'email',
age: 'number:18-65',
role: ['admin', 'user', 'guest']
},
count: 1000
});
// Generate time-series data
const stockData = await synth.timeSeries({
fields: ['open', 'high', 'low', 'close', 'volume'],
interval: '1h',
count: 500,
volatility: 0.02
});
// Stream large datasets
for await (const batch of synth.stream({ count: 100000, batchSize: 1000 })) {
await processData(batch);
}import { AgenticSynth, DSPyOptimizer } from '@ruvector/agentic-synth';
// Enable self-learning optimization
const synth = new AgenticSynth({
model: 'gemini-pro',
optimizer: new DSPyOptimizer({
learningRate: 0.1,
qualityThreshold: 0.85
})
});
// Quality improves automatically over time
const data = await synth.generate({
schema: { ... },
count: 1000,
optimize: true // Enable learning
});
console.log(`Quality score: ${data.metrics.quality}`);
// First run: 0.72
// After 100 runs: 0.94 (+25% improvement)| Metric | Value |
|---|---|
| With caching | 98.2% faster |
| P99 latency | 2500ms β 45ms |
| Memory | <50MB for 10K records |
| Throughput | 1000+ records/sec |
| Package | Purpose |
|---|---|
| RuVector | Native vector database for RAG |
| DSPy.ts | Prompt optimization |
| Agentic-Jujutsu | Version-controlled generation |
# npm
npm install @ruvector/agentic-synth
# Examples package (50+ production examples)
npm install @ruvector/agentic-synth-examplesFull Documentation: agentic-synth README
π Neural Trader - AI Trading System
Production-ready neural trading system combining state-of-the-art ML for automated trading, sports betting, and portfolio management. Zero external ML dependencies, sub-millisecond latency.
| Engine | Description | Performance |
|---|---|---|
| Fractional Kelly | Optimal position sizing with risk-adjusted bet scaling | 588,885 ops/s |
| LSTM-Transformer | Deep learning price prediction (temporal + attention) | 1,468 seq/s |
| DRL Portfolio | Reinforcement learning ensemble (PPO/SAC/A2C) | 17,043 steps/s |
| Sentiment Alpha | Real-time sentiment analysis for alpha generation | 3,764 pipeline/s |
| Traditional ML | Neural Trader |
|---|---|
| TensorFlow/PyTorch required | Zero dependencies |
| 1.2MB+ bundle size | 45KB bundle |
| 2.1ms LSTM inference | 0.68ms inference |
| Complex deployment | Works in browser & Node.js |
| Algorithm | Research Finding |
|---|---|
| Kelly Criterion | 1/5th fractional achieves 98% ROI with 85% less risk of ruin |
| LSTM-Transformer | Temporal + attention fusion outperforms single architectures |
| DRL Ensemble | PPO/SAC/A2C voting reduces variance vs single agent |
| Sentiment Alpha | 3% annual excess returns documented in academia |
import { KellyCriterion, HybridLSTMTransformer, DRLPortfolioManager } from 'neural-trader';
// Kelly position sizing
const kelly = new KellyCriterion();
const stake = kelly.calculateStake(9000, 0.55, 2.0, 0.2); // 1/5th Kelly
// β $180 recommended stake (2% of bankroll)
// LSTM-Transformer prediction
const model = new HybridLSTMTransformer({
lstm: { hiddenSize: 64, layers: 2 },
transformer: { heads: 4, layers: 2 }
});
const prediction = model.predict(candles);
// β { signal: 'BUY', confidence: 0.73, direction: 'bullish' }
// DRL portfolio allocation
const manager = new DRLPortfolioManager({ numAssets: 10 });
await manager.train(marketData, { episodes: 100 });
const allocation = manager.getAction(currentState);
// β [0.15, 0.12, 0.08, ...] optimal weights| Use Case | Example |
|---|---|
| Stock Trading | DAG-based pipeline with parallel execution |
| Sports Betting | Kelly sizing with ML calibration |
| Crypto Trading | DRL portfolio for 20+ assets |
| News Trading | Real-time sentiment stream processing |
| Portfolio Rebalancing | Reinforcement learning allocation |
| Package | Description |
|---|---|
neural-trader |
Core engine with native HNSW, SIMD |
@neural-trader/core |
Ultra-low latency Rust + Node.js bindings |
@neural-trader/strategies |
Strategy management and backtesting |
@neural-trader/execution |
Trade execution and order management |
@neural-trader/mcp |
MCP server with 87+ trading tools |
@neural-trader/risk |
VaR, stress testing, risk metrics |
@neural-trader/portfolio |
Markowitz, Risk Parity optimization |
@neural-trader/neural |
Neural network training |
@neural-trader/brokers |
Alpaca, Interactive Brokers |
@neural-trader/sports-betting |
Arbitrage, Kelly, odds analysis |
# Real-time trading
node cli.js run --strategy=hybrid --symbol=AAPL --capital=100000
# Backtest historical performance
node cli.js backtest --days=252 --capital=50000 --strategy=drl
# Paper trading simulation
node cli.js paper --capital=100000 --strategy=sentiment
# Performance benchmarks
node cli.js benchmark --iterations=100| Example | Description |
|---|---|
| Multi-Agent Swarm | Distributed trading intelligence with consensus |
| GNN Correlation Network | Graph neural network correlation analysis |
| Attention Regime Detection | Transformer-based market regime classification |
| Quantum Portfolio | QAOA & quantum annealing optimization |
| Hyperbolic Embeddings | PoincarΓ© disk market embeddings |
| Atomic Arbitrage | Cross-exchange with MEV protection |
| Module | Latency | Throughput | Status |
|---|---|---|---|
| Kelly Engine | 0.014ms | 71,295/s | β Ready |
| LSTM-Transformer | 0.681ms | 1,468/s | β Ready |
| DRL Portfolio | 0.059ms | 17,043/s | β Ready |
| Sentiment Alpha | 0.266ms | 3,764/s | β Ready |
| Full Pipeline | 4.68ms | 214/s | β Ready |
# npm
npm install neural-trader
# Full ecosystem
npm install @neural-trader/core @neural-trader/strategies @neural-trader/mcpFull Documentation: neural-trader README
π₯ Agentic-Jujutsu - Quantum-Resistant Version Control
Agentic-Jujutsu is a quantum-resistant, self-learning version control system designed for AI agents. It combines lock-free concurrent operations with ReasoningBank trajectory learning for continuous improvement.
| Traditional Git | Agentic-Jujutsu |
|---|---|
| Lock-based commits | Lock-free (23x faster) |
| Manual conflict resolution | 87% automatic resolution |
| Static operations | Self-learning from patterns |
| No quantum protection | SHA3-512 + HQC-128 |
| Sequential agents | Concurrent multi-agent |
| Feature | Performance | Description |
|---|---|---|
| Concurrent Commits | 350 ops/s | 23x faster than Git (15 ops/s) |
| Context Switching | <100ms | 10x faster than Git (500-1000ms) |
| Conflict Resolution | 87% auto | AI-powered pattern matching |
| Quantum Security | <1ms verify | SHA3-512 fingerprints, HQC-128 encryption |
| ReasoningBank | Continuous | Trajectory learning with verdicts |
# Install
npm install agentic-jujutsu
# Basic usage
npx agentic-jujutsuimport { JjWrapper } from 'agentic-jujutsu';
const jj = new JjWrapper();
// Start learning trajectory
jj.startTrajectory('Implement feature X');
// Make changes and commit
await jj.newCommit('Add authentication module');
jj.addToTrajectory();
// Finalize with success score
jj.finalizeTrajectory(0.9, 'Feature implemented successfully');
// Get AI-powered suggestions
const suggestions = await jj.getSuggestions();// Concurrent commits without locks
const agents = ['agent-1', 'agent-2', 'agent-3'];
await Promise.all(agents.map(agent =>
jj.newCommit(`Changes from ${agent}`)
));
// All commits succeed - no lock waiting!Full Documentation: agentic-jujutsu README
π¬ SciPix - Scientific Document OCR
SciPix is a blazing-fast, memory-safe OCR engine written in pure Rust, purpose-built for scientific documents, mathematical equations, and technical diagrams.
| Feature | SciPix | Tesseract | Mathpix |
|---|---|---|---|
| Simple Text OCR | 50ms | 120ms | 200ms* |
| Math Equation | 80ms | N/A | 150ms* |
| Batch (100 images) | 2.1s | 8.5s | N/A |
| Memory Usage | 45MB | 180MB | Cloud |
| LaTeX Output | Yes | No | Yes |
*API latency, not processing time
| Feature | Description |
|---|---|
| ONNX Runtime | GPU-accelerated with CUDA, TensorRT, CoreML |
| LaTeX Output | Mathematical equation recognition with LaTeX, MathML, AsciiMath |
| SIMD Optimized | 4x faster image preprocessing with AVX2, SSE4, NEON |
| REST API | Production-ready HTTP server with rate limiting |
| MCP Server | Integrate with Claude, ChatGPT via Model Context Protocol |
| WebAssembly | Run OCR directly in browsers |
# Add to Cargo.toml
cargo add ruvector-scipix
# With features
ruvector-scipix = { version = "0.1.16", features = ["ocr", "math", "optimize"] }use ruvector_scipix::{SciPixOcr, OcrConfig};
// Initialize OCR engine
let ocr = SciPixOcr::new(OcrConfig::default())?;
// Process scientific image
let result = ocr.process_image("equation.png")?;
println!("LaTeX: {}", result.latex);
println!("Confidence: {:.2}%", result.confidence * 100.0);- Academic Paper Digitization - Extract text and equations from scanned research papers
- Math Homework Assistance - Convert handwritten equations to LaTeX for AI tutoring
- Technical Documentation - Process engineering diagrams and scientific charts
- AI/LLM Integration - Feed scientific content to language models via MCP
Full Documentation: scipix README
π§ Meta-Cognition SNN - Spiking Neural Networks
A hybrid AI architecture combining Spiking Neural Networks (SNN), SIMD-optimized vector operations, and 5 attention mechanisms with meta-cognitive self-discovery capabilities.
| Capability | Performance | Description |
|---|---|---|
| Spiking Neural Networks | 10-50x faster | LIF neurons + STDP learning with N-API SIMD |
| SIMD Vector Operations | 5-54x faster | Loop-unrolled distance/dot product calculations |
| 5 Attention Mechanisms | Sub-millisecond | Multi-Head, Flash, Linear, Hyperbolic, MoE |
| Vector Search | 150x faster | RuVector-powered semantic search |
| Meta-Cognition | Autonomous | Self-discovering emergent capabilities |
| Operation | Speedup | Notes |
|---|---|---|
| LIF Updates | 16.7x | Leaky integrate-and-fire neurons |
| Synaptic Forward | 14.9x | Forward propagation |
| STDP Learning | 26.3x | Spike-timing dependent plasticity |
| Distance (128d) | 54x | Euclidean distance calculation |
| Full Simulation | 18.4x | End-to-end SNN simulation |
| Mechanism | Best For | Latency |
|---|---|---|
| Flash | Long sequences | 0.023ms |
| MoE | Specialized domains | 0.021ms |
| Multi-Head | Complex patterns | 0.047ms |
| Linear | Real-time processing | 0.075ms |
| Hyperbolic | Hierarchical data | 0.222ms |
# Install and run demos
cd examples/meta-cognition-spiking-neural-network
npm install
node demos/run-all.jsconst { createFeedforwardSNN, rateEncoding } = require('./demos/snn/lib/SpikingNeuralNetwork');
// Create SNN with SIMD optimization
const snn = createFeedforwardSNN([100, 50, 10], {
dt: 1.0,
tau: 20.0,
a_plus: 0.005,
lateral_inhibition: true
});
// Train with STDP
const input = rateEncoding(pattern, snn.dt, 100);
snn.step(input);- Multi-Scale Attention Hierarchy (Novelty: 5/5)
- Spike Synchronization Patterns
- Attention-Gated Spike Propagation
- Temporal Coherence Emergence
- Emergent Sparsity (80% fewer active neurons)
- Meta-Plasticity (faster learning on later tasks)
Full Documentation: meta-cognition-snn README
π€ RuvLLM - Self-Learning LLM Orchestration
RuvLLM is a self-learning language model orchestration system that combines frozen foundation models with adaptive memory and intelligent routing. Unlike traditional LLMs that rely solely on static parameters, RuvLLM continuously improves from every interaction.
"The intelligence is not in one model anymore. It is in the loop."
| Loop | Frequency | Latency | Description |
|---|---|---|---|
| A: Instant | Per-request | <100ΞΌs | MicroLoRA adaptation (rank 1-2) |
| B: Background | Hourly | ~1.3ms | K-means++ clustering, base LoRA (rank 4-16) |
| C: Deep | Weekly | N/A | EWC++ consolidation, concept hierarchies |
| Component | Description |
|---|---|
| LFM2 Cortex | Frozen reasoning engine (135M-2.6B params) |
| Ruvector Memory | Adaptive synaptic mesh with HNSW indexing |
| FastGRNN Router | Intelligent model selection circuit |
| Graph Attention | 8-head attention with edge features |
| SONA Engine | LoRA + EWC++ + ReasoningBank |
| Metric | Value |
|---|---|
| Initialization | 3.71ms |
| Average Query | 0.09ms |
| Session Query | 0.04ms |
| Throughput | ~38,000 q/s |
| Memory | ~50MB |
use ruvllm::{RuvLLMOrchestrator, OrchestratorConfig};
// Initialize orchestrator
let config = OrchestratorConfig::default();
let orchestrator = RuvLLMOrchestrator::new(config)?;
// Query with automatic learning
let response = orchestrator.query("Explain quantum entanglement").await?;
println!("{}", response.text);
// Response improves over time as SONA learns patterns// Ephemeral agents collect trajectories
let agent = EphemeralAgent::new("task-specific-agent");
agent.process_task(&task).await?;
let export = agent.export();
// Central coordinator aggregates learning
coordinator.accept_export(export)?;
coordinator.consolidate(); // Share patterns with new agentsRuvLLM's adaptive learning system enables real-time model improvement without retraining.
| Feature | Description | Latency |
|---|---|---|
| MicroLoRA | Per-request adaptation (rank 1-2), <50KB adapters | <1ms |
| Contrastive Training | Triplet loss with hard negatives for embedding optimization | Batch |
| Task-Specific Adapters | Pre-tuned for Coder, Researcher, Security, Architect, Reviewer | Hot-swap |
| EWC++ Consolidation | Prevents catastrophic forgetting during continuous learning | Background |
| Adapter Merging | Average, Weighted, SLERP, TIES, DARE strategies | On-demand |
// Contrastive fine-tuning for agent routing
import { ContrastiveTrainer } from '@ruvector/ruvllm';
const trainer = new ContrastiveTrainer({
margin: 0.5,
hardNegativeRatio: 0.7
});
// Learn: task β correct agent, not wrong agent
trainer.addTriplet(taskEmb, correctAgentEmb, wrongAgentEmb, true);
const model = trainer.train();// Task-specific adapter hot-swapping
use ruvllm::lora::RuvLtraAdapters;
let adapters = RuvLtraAdapters::new();
let coder = adapters.create_lora("coder", 768)?; // Rank 16, code patterns
let security = adapters.create_lora("security", 768)?; // Rank 16, vulnerability detection
// Hot-swap at runtime without model reload
orchestrator.set_adapter(coder);
let code_response = orchestrator.query("Implement binary search").await?;
orchestrator.set_adapter(security);
let audit_response = orchestrator.query("Audit this code for vulnerabilities").await?;- SIMD Inference: AVX2/AVX512/SSE4.1 optimization
- Q4 Quantization: 4-bit weights for memory efficiency
- HuggingFace Export: Export LoRA weights and preference pairs
- Multi-Model Routing: SmolLM, Qwen2, TinyLlama selection
- WASM Support: Run SONA in browsers and edge devices
- Browser Fine-Tuning: MicroLoRA WASM with localStorage persistence
Full Documentation: ruvLLM README | Fine-Tuning Guide | Task Adapters
ποΈ REFRAG - Compress-Sense-Expand RAG
REFRAG implements the Compress-Sense-Expand architecture from arXiv:2509.01092, achieving ~30x RAG latency reduction by storing pre-computed representation tensors instead of raw text.
ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββ
β COMPRESS βββββΆβ SENSE βββββΆβ EXPAND β
β Layer β β Layer β β Layer β
ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββ
Binary tensor Policy network Dimension projection
storage with decides COMPRESS (768 β 4096 dims)
zero-copy access vs EXPAND
| Strategy | Compression | Use Case |
|---|---|---|
None |
1x | Maximum precision |
Float16 |
2x | Good balance |
Int8 |
4x | Memory constrained |
Binary |
32x | Extreme compression |
| Policy | Latency | Description |
|---|---|---|
ThresholdPolicy |
~2ΞΌs | Cosine similarity threshold |
LinearPolicy |
~5ΞΌs | Single layer classifier |
MLPPolicy |
~15ΞΌs | Two-layer neural network |
# Run demo
cargo run --bin refrag-demo
# Run benchmarks
cargo run --bin refrag-benchmark --releaseuse refrag_pipeline_example::{RefragStore, RefragEntry};
// Create REFRAG-enabled store
let store = RefragStore::new(384, 768)?;
// Insert with representation tensor
let entry = RefragEntry::new("doc_1", search_vector, "The quick brown fox...")
.with_tensor(tensor_bytes, "llama3-8b");
store.insert(entry)?;
// Hybrid search (policy-based COMPRESS/EXPAND)
let results = store.search_hybrid(&query, 10, Some(0.85))?;
for result in results {
match result.response_type {
RefragResponseType::Compress => {
// Tensor directly injectable into LLM context
println!("Tensor: {} dims", result.tensor_dims.unwrap());
}
RefragResponseType::Expand => {
// Original text when full context needed
println!("Text: {}", result.content.unwrap());
}
}
}| Source | Target | LLM |
|---|---|---|
| 768 | 4096 | LLaMA-3 8B |
| 768 | 8192 | LLaMA-3 70B |
| 1536 | 8192 | GPT-4 |
Full Documentation: refrag-pipeline README
π¦ 7sense - Bioacoustic Intelligence Platform
7sense transforms bird calls into navigable geometric space using cutting-edge AI and vector search. It converts audio recordings of bird songs into rich, searchable embeddings using Perch 2.0 neural networks and ultra-fast HNSW indexing.
| Traditional Monitoring | 7sense |
|---|---|
| Expert human listeners | Instant AI species ID |
| Basic spectrogram analysis | Neural embeddings (1536-dim) |
| Limited scale | Millions of recordings |
| Manual pattern finding | Automated discovery |
| Metric | Target | Status |
|---|---|---|
| HNSW Search Speedup | 150x vs brute force | Achieved |
| Query Latency (p99) | < 50ms | Achieved |
| Recall@10 | >= 0.95 | Achieved |
| Embedding Throughput | > 100 segments/sec | Achieved |
| Memory per 1M vectors | < 6 GB | Achieved |
| Crate | Description |
|---|---|
sevensense-core |
Species taxonomy, temporal types |
sevensense-audio |
WAV/MP3/FLAC, Mel spectrograms |
sevensense-embedding |
Perch 2.0 ONNX, 1536-dim vectors |
sevensense-vector |
HNSW with 150x speedup |
sevensense-learning |
GNN training, EWC regularization |
sevensense-analysis |
HDBSCAN clustering, Markov models |
sevensense-interpretation |
Evidence packs, species narratives |
sevensense-api |
GraphQL, REST, WebSocket streaming |
sevensense-benches |
Criterion.rs performance suites |
# Build and run
cd examples/vibecast-7sense
cargo build --release
cargo run -p sevensense-api --releaseuse sevensense_audio::AudioProcessor;
use sevensense_embedding::EmbeddingPipeline;
use sevensense_vector::HnswIndex;
// Load and process audio
let processor = AudioProcessor::new(Default::default());
let segments = processor.process_file("recording.wav").await?;
// Generate Perch 2.0 embeddings
let pipeline = EmbeddingPipeline::new(Default::default()).await?;
let embeddings = pipeline.embed_segments(&segments).await?;
// Search for similar calls (150x faster)
let index = HnswIndex::new(Default::default());
index.add_batch(&embeddings)?;
let neighbors = index.search(&embeddings[0], 10)?;
println!("Found {} similar bird calls", neighbors.len());- Species Identification - Instant predictions with confidence scores
- Pattern Discovery - Find similar calls across millions of recordings
- Behavioral Insights - Detect singing patterns, dialects, anomalies
- Conservation Monitoring - Track biodiversity at scale
Full Documentation: 7sense README
𧬠EXO-AI - Advanced Cognitive Substrate
EXO-AI 2025 is a comprehensive cognitive substrate implementing cutting-edge theories from neuroscience, physics, and consciousness research. It provides 9 interconnected Rust crates totaling ~15,800+ lines of research-grade code.
Traditional AI systems process information. EXO-AI aims to understand it.
| Operation | Speedup | Notes |
|---|---|---|
| Distance (128d) | 54x | AVX2/NEON optimized |
| Cosine Similarity | 2.73x | Batch operations |
| Pattern Matching | 8-54x | Loop-unrolled |
| Meta-Simulation | 13+ quadrillion/s | From ultra-low-latency-sim |
| Crate | Description |
|---|---|
exo-core |
IIT consciousness (Ξ¦) measurement & Landauer thermodynamics |
exo-temporal |
Temporal memory with causal tracking & consolidation |
exo-hypergraph |
Topological analysis with persistent homology |
exo-manifold |
SIREN networks + SIMD-accelerated retrieval |
exo-exotic |
10 cutting-edge cognitive experiments |
exo-federation |
Post-quantum federated cognitive mesh |
exo-backend-classical |
SIMD-accelerated compute backend |
exo-wasm |
Browser & edge WASM deployment |
exo-node |
Node.js bindings via NAPI-RS |
| Theory | Implementation |
|---|---|
| IIT (Integrated Information Theory) | Consciousness level (Ξ¦) measurement |
| Landauer's Principle | Computational thermodynamics |
| Free Energy Principle | Friston's predictive processing |
| Strange Loops | Hofstadter's self-referential patterns |
| Morphogenesis | Pattern formation emergence |
[dependencies]
exo-core = "0.1"
exo-temporal = "0.1"
exo-exotic = "0.1"
exo-manifold = "0.1" # SIMD acceleration!use exo_core::consciousness::{ConsciousnessSubstrate, IITConfig};
use exo_core::thermodynamics::CognitiveThermometer;
// Measure integrated information (Ξ¦)
let substrate = ConsciousnessSubstrate::new(IITConfig::default());
substrate.add_pattern(pattern);
let phi = substrate.compute_phi();
println!("Consciousness level (Ξ¦): {:.4}", phi);
// Track computational thermodynamics
let thermo = CognitiveThermometer::new(300.0); // Kelvin
let cost = thermo.landauer_cost_bits(1024);
println!("Landauer cost: {:.2e} J", cost);use exo_manifold::{ManifoldEngine, cosine_similarity_simd, batch_distances};
// 54x faster similarity search
let query = vec![0.5; 768];
let results = engine.retrieve(&query, 10)?;
// Batch distance computation
let distances = batch_distances(&query, &database); // 8-54x speedupFull Documentation: exo-ai README
π PostgreSQL Extension
The most advanced PostgreSQL vector extension β a drop-in pgvector replacement with 230+ SQL functions, hardware-accelerated SIMD operations, and built-in AI capabilities. Transform your existing PostgreSQL database into a full-featured vector search engine with GNN layers, attention mechanisms, and self-learning capabilities.
# Quick Install from Docker Hub
docker run -d --name ruvector \
-e POSTGRES_PASSWORD=secret \
-p 5432:5432 \
ruvnet/ruvector-postgres:latest
# Connect and use
psql -h localhost -U ruvector -d ruvector_test
# Create extension
CREATE EXTENSION ruvector;Why RuVector Postgres?
- Zero Migration β Works with existing pgvector code, just swap the extension
- 10x More Functions β 230+ SQL functions vs pgvector's ~20
- 2x Faster β AVX-512/AVX2/NEON SIMD acceleration
- AI-Native β GNN layers, 39 attention mechanisms, local embeddings
- Self-Learning β Improves search quality over time with ReasoningBank
| Feature | pgvector | RuVector Postgres |
|---|---|---|
| SQL Functions | ~20 | 230+ |
| SIMD Acceleration | Basic | AVX-512/AVX2/NEON (~2x faster) |
| Index Types | HNSW, IVFFlat | HNSW, IVFFlat + Hyperbolic |
| Attention Mechanisms | β | 39 types (Flash, Linear, Graph) |
| GNN Layers | β | GCN, GraphSAGE, GAT, GIN |
| Sparse Vectors | β | BM25, TF-IDF, SPLADE |
| Self-Learning | β | ReasoningBank, trajectory learning |
| Local Embeddings | β | 6 fastembed models built-in |
| Multi-Tenancy | β | Built-in namespace isolation |
| Quantization | β | Scalar, Product, Binary (4-32x compression) |
π³ Docker Hub (Recommended)
Pull from Docker Hub: hub.docker.com/r/ruvnet/ruvector-postgres
# Quick start
docker run -d --name ruvector \
-e POSTGRES_PASSWORD=secret \
-p 5432:5432 \
ruvnet/ruvector-postgres:latest
# Connect
psql -h localhost -U ruvector -d ruvector_test
# Create extension
CREATE EXTENSION ruvector;Environment Variables:
| Variable | Default | Description |
|---|---|---|
POSTGRES_USER |
ruvector |
Database user |
POSTGRES_PASSWORD |
ruvector |
Database password |
POSTGRES_DB |
ruvector_test |
Default database |
Docker Compose:
version: '3.8'
services:
ruvector-postgres:
image: ruvnet/ruvector-postgres:latest
environment:
POSTGRES_PASSWORD: secret
POSTGRES_DB: ruvector_test
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:Available Tags:
ruvnet/ruvector-postgres:latest- PostgreSQL + RuVector 2.0ruvnet/ruvector-postgres:2.0.0- Specific version
π¦ npm CLI
# Install globally
npm install -g @ruvector/postgres-cli
# Or use npx
npx @ruvector/postgres-cli --help
# Commands available as 'ruvector-pg' or 'rvpg'
ruvector-pg --version
rvpg --helpCLI Commands:
# Install extension to existing PostgreSQL
ruvector-pg install
# Create vector table with HNSW index
ruvector-pg vector create table embeddings --dim 1536 --index hnsw
# Import vectors from file
ruvector-pg vector import embeddings data.json
# Search vectors
ruvector-pg vector search embeddings --query "0.1,0.2,..." --limit 10
# Benchmark performance
ruvector-pg bench --iterations 1000
# Check extension status
ruvector-pg statusProgrammatic Usage:
import { RuvectorPG } from '@ruvector/postgres-cli';
const client = new RuvectorPG({
host: 'localhost',
port: 5432,
database: 'vectors',
user: 'postgres',
password: 'secret'
});
// Create table with HNSW index
await client.createTable('embeddings', {
dimensions: 1536,
indexType: 'hnsw',
distanceMetric: 'cosine'
});
// Insert vectors
await client.insert('embeddings', {
id: '1',
vector: [0.1, 0.2, ...],
metadata: { source: 'openai' }
});
// Search
const results = await client.search('embeddings', queryVector, { limit: 10 });π¦ Rust Crate
# Install pgrx (PostgreSQL extension framework)
cargo install cargo-pgrx --version "0.12.9" --locked
cargo pgrx init
# Build and install extension
cd crates/ruvector-postgres
cargo pgrx install --release
# Or install specific PostgreSQL version
cargo pgrx install --release --pg-config /usr/lib/postgresql/17/bin/pg_configCargo.toml:
[dependencies]
ruvector-postgres = "2.0"
# Optional features
[features]
default = ["pg17"]
pg16 = ["ruvector-postgres/pg16"]
pg15 = ["ruvector-postgres/pg15"]
# AI features (opt-in)
ai-complete = ["ruvector-postgres/ai-complete"] # All AI features
learning = ["ruvector-postgres/learning"] # Self-learning
attention = ["ruvector-postgres/attention"] # 39 attention mechanisms
gnn = ["ruvector-postgres/gnn"] # Graph neural networks
hyperbolic = ["ruvector-postgres/hyperbolic"] # Hyperbolic embeddings
embeddings = ["ruvector-postgres/embeddings"] # Local embedding generationBuild with all features:
cargo pgrx install --release --features "ai-complete,embeddings"π SQL Examples
-- Enable extension
CREATE EXTENSION ruvector;
-- Create table with vector column
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
content TEXT,
embedding VECTOR(1536)
);
-- Create HNSW index
CREATE INDEX ON documents USING hnsw (embedding vector_cosine_ops)
WITH (m = 16, ef_construction = 200);
-- Insert vectors
INSERT INTO documents (content, embedding)
VALUES ('Hello world', '[0.1, 0.2, ...]'::vector);
-- Semantic search (cosine similarity)
SELECT id, content, embedding <=> '[0.1, 0.2, ...]'::vector AS distance
FROM documents
ORDER BY distance
LIMIT 10;
-- Hybrid search (vector + full-text)
SELECT id, content
FROM documents
WHERE to_tsvector(content) @@ to_tsquery('machine & learning')
ORDER BY embedding <=> query_embedding
LIMIT 10;
-- GNN-enhanced search (with learning)
SELECT * FROM ruvector_gnn_search(
'documents',
'[0.1, 0.2, ...]'::vector,
10, -- limit
'gcn' -- gnn_type: gcn, graphsage, gat, gin
);
-- Generate embeddings locally (no API needed)
SELECT ruvector_embed('all-MiniLM-L6-v2', 'Your text here');
-- Flash attention
SELECT ruvector_flash_attention(query, key, value);See ruvector-postgres README for full SQL API reference (230+ functions).
π οΈ Tools & Utilities
| Crate | Description | crates.io |
|---|---|---|
| ruvector-bench | Benchmarking suite for vector operations | |
| ruvector-metrics | Observability, metrics, and monitoring | |
| ruvector-filter | Metadata filtering and query predicates | |
| ruvector-collections | Multi-tenant collection management | |
| ruvector-snapshot | Point-in-time snapshots and backups | |
| micro-hnsw-wasm | Lightweight HNSW implementation for WASM |
| Crate | Description | Target |
|---|---|---|
| ruvector-esp32 | ESP32/ESP-IDF vector search | ESP32, ESP32-S3 |
| rvlite | SQLite-style edge DB (no_std compatible) | ARM, RISC-V, WASM |
| micro-hnsw-wasm | <50KB HNSW for constrained devices | WASM, embedded |
// ESP32 example (no_std)
#![no_std]
use rvlite::RvLite;
let db = RvLite::new(128); // 128-dim vectors
db.insert(0, &embedding);
let results = db.search(&query, 5);π WASM Packages (Browser & Edge)
Specialized WebAssembly modules for browser and edge deployment. These packages bring advanced AI and distributed computing primitives to JavaScript/TypeScript with near-native performance.
# Core vector search
npm install ruvector-wasm @ruvector/rvlite
# AI & Neural
npm install @ruvector/gnn-wasm @ruvector/attention-wasm @ruvector/sona-wasm
# Graph & Algorithms
npm install @ruvector/graph-wasm @ruvector/mincut-wasm @ruvector/hyperbolic-hnsw-wasm
# Exotic AI
npm install @ruvector/economy-wasm @ruvector/exotic-wasm @ruvector/nervous-system-wasm
# LLM (browser inference)
npm install @ruvector/ruvllm-wasm| Category | Packages | Total Size |
|---|---|---|
| Core | ruvector-wasm, rvlite | ~200KB |
| AI/Neural | gnn, attention, sona | ~300KB |
| Graph | graph, mincut, hyperbolic-hnsw | ~250KB |
| Exotic | economy, exotic, nervous-system | ~350KB |
| LLM | ruvllm-wasm | ~500KB |
# Install individual packages
npm install @ruvector/learning-wasm
npm install @ruvector/economy-wasm
npm install @ruvector/exotic-wasm
npm install @ruvector/nervous-system-wasm
npm install @ruvector/attention-unified-wasm
# Or build from source
cd crates/ruvector-learning-wasm
wasm-pack build --target webMicroLoRA, BTSP, and HDC for self-learning AI systems.
Ultra-fast Low-Rank Adaptation (LoRA) optimized for WASM execution with <100us adaptation latency. Designed for real-time per-operator learning in query optimization and AI agent systems.
| Feature | Performance | Description |
|---|---|---|
| MicroLoRA | <100us latency | Rank-2 LoRA matrices for instant weight adaptation |
| Per-Operator Scoping | Zero-allocation hot paths | Separate adapters for different operator types |
| Trajectory Tracking | Lock-free buffers | Record learning trajectories for replay |
Architecture:
Input Embedding (256-dim)
|
v
+---------+
| A: d x 2 | Down projection
+---------+
|
v
+---------+
| B: 2 x d | Up projection
+---------+
|
v
Delta W = alpha * (A @ B)
|
v
Output = Input + Delta W
JavaScript/TypeScript Example:
import init, { WasmMicroLoRA } from '@ruvector/learning-wasm';
await init();
// Create MicroLoRA engine (256-dim, alpha=0.1, lr=0.01)
const lora = new WasmMicroLoRA(256, 0.1, 0.01);
// Forward pass with adaptation
const input = new Float32Array(256).fill(0.5);
const output = lora.forward_array(input);
// Adapt based on gradient signal
const gradient = new Float32Array(256).fill(0.1);
lora.adapt_array(gradient);
// Adapt with reward signal for RL
lora.adapt_with_reward(0.8); // 80% improvement
console.log(`Adaptations: ${lora.adapt_count()}`);
console.log(`Delta norm: ${lora.delta_norm()}`);CRDT-based autonomous credit economy for distributed compute networks.
P2P-safe concurrent transactions using Conflict-free Replicated Data Types (CRDTs). Features a 10x-to-1x early adopter contribution curve and stake/slash mechanisms for participation incentives.
| Feature | Description |
|---|---|
| CRDT Ledger | G-Counter (earned) + PN-Counter (spent) for P2P consistency |
| Contribution Curve | 10x early adopter multiplier decaying to 1x baseline |
| Stake/Slash | Participation requirements with slashing for bad actors |
| Reputation Scoring | Multi-factor: accuracy * uptime * stake_weight |
| Merkle Verification | SHA-256 state root for quick ledger verification |
Architecture:
+------------------------+
| CreditLedger | <-- CRDT-based P2P-safe ledger
| +------------------+ |
| | G-Counter: Earned| | <-- Monotonically increasing
| | PN-Counter: Spent| | <-- Can handle disputes/refunds
| | Stake: Locked | | <-- Participation requirement
| | State Root | | <-- Merkle root for verification
| +------------------+ |
+------------------------+
|
v
+------------------------+
| ContributionCurve | <-- Exponential decay: 10x -> 1x
+------------------------+
|
v
+------------------------+
| ReputationScore | <-- accuracy * uptime * stake_weight
+------------------------+
JavaScript/TypeScript Example:
import init, {
CreditLedger,
ReputationScore,
contribution_multiplier
} from '@ruvector/economy-wasm';
await init();
// Create a new ledger for a node
const ledger = new CreditLedger("node-123");
// Earn credits (with early adopter multiplier)
ledger.creditWithMultiplier(100, "task:abc");
console.log(`Balance: ${ledger.balance()}`);
console.log(`Multiplier: ${ledger.currentMultiplier()}x`);
// Stake for participation
ledger.stake(50);
console.log(`Staked: ${ledger.stakedAmount()}`);
// Check multiplier for network compute hours
const mult = contribution_multiplier(50000.0); // 50K hours
console.log(`Network multiplier: ${mult}x`); // ~8.5x
// Track reputation
const rep = new ReputationScore(0.95, 0.98, 1000);
console.log(`Composite score: ${rep.composite_score()}`);
// P2P merge with another ledger (CRDT operation)
const otherEarned = new Uint8Array([/* serialized earned counter */]);
const otherSpent = new Uint8Array([/* serialized spent counter */]);
const mergedCount = ledger.merge(otherEarned, otherSpent);Exotic AI mechanisms for emergent behavior in distributed systems.
Novel coordination primitives inspired by decentralized governance, developmental biology, and quantum physics.
| Mechanism | Inspiration | Use Case |
|---|---|---|
| Neural Autonomous Organization (NAO) | DAOs + oscillatory sync | Decentralized AI agent governance |
| Morphogenetic Network | Developmental biology | Emergent network topology |
| Time Crystal Coordinator | Quantum time crystals | Robust distributed coordination |
NAO Features:
- Stake-weighted quadratic voting
- Oscillatory synchronization for coherence
- Quorum-based consensus (configurable threshold)
Morphogenetic Network Features:
- Cellular differentiation through morphogen gradients
- Emergent network topology via growth/pruning
- Synaptic pruning for optimization
Time Crystal Features:
- Period-doubled oscillations for stable coordination
- Floquet engineering for noise resilience
- Phase-locked agent synchronization
JavaScript/TypeScript Example:
import init, {
WasmNAO,
WasmMorphogeneticNetwork,
WasmTimeCrystal,
ExoticEcosystem
} from '@ruvector/exotic-wasm';
await init();
// Neural Autonomous Organization
const nao = new WasmNAO(0.7); // 70% quorum
nao.addMember("agent_1", 100); // 100 stake
nao.addMember("agent_2", 50);
const propId = nao.propose("Upgrade memory backend");
nao.vote(propId, "agent_1", 0.9); // 90% approval weight
nao.vote(propId, "agent_2", 0.6);
if (nao.execute(propId)) {
console.log("Proposal executed!");
}
// Morphogenetic Network
const net = new WasmMorphogeneticNetwork(100, 100); // 100x100 grid
net.seedSignaling(50, 50); // Seed signaling cell at center
for (let i = 0; i < 1000; i++) {
net.grow(0.1); // 10% growth rate
}
net.differentiate();
net.prune(0.1); // 10% pruning threshold
// Time Crystal Coordinator
const crystal = new WasmTimeCrystal(10, 100); // 10 oscillators, 100ms period
crystal.crystallize();
for (let i = 0; i < 200; i++) {
const pattern = crystal.tick();
// Use pattern for coordination decisions
}
console.log(`Synchronization: ${crystal.orderParameter()}`);
// Combined Ecosystem (all three working together)
const eco = new ExoticEcosystem(5, 50, 8); // 5 agents, 50x50 grid, 8 oscillators
eco.crystallize();
for (let i = 0; i < 100; i++) {
eco.step();
}
console.log(eco.summaryJson());Bio-inspired neural system components for browser execution.
| Component | Performance | Description |
|---|---|---|
| BTSP | Immediate | Behavioral Timescale Synaptic Plasticity for one-shot learning |
| HDC | <50ns bind, <100ns similarity | Hyperdimensional Computing with 10,000-bit vectors |
| WTA | <1us | Winner-Take-All for instant decisions |
| K-WTA | <10us | K-Winner-Take-All for sparse distributed coding |
| Global Workspace | <10us | 4-7 item attention bottleneck (Miller's Law) |
Hyperdimensional Computing:
- 10,000-bit binary hypervectors
- 10^40 representational capacity
- XOR binding (associative, commutative, self-inverse)
- Hamming distance similarity with SIMD optimization
Biological References:
- BTSP: Bittner et al. 2017 - Hippocampal place fields
- HDC: Kanerva 1988, Plate 2003 - Hyperdimensional computing
- WTA: Cortical microcircuits - Lateral inhibition
- Global Workspace: Baars 1988, Dehaene 2014 - Consciousness
JavaScript/TypeScript Example:
import init, {
BTSPLayer,
Hypervector,
HdcMemory,
WTALayer,
KWTALayer,
GlobalWorkspace,
WorkspaceItem,
} from '@ruvector/nervous-system-wasm';
await init();
// One-shot learning with BTSP
const btsp = new BTSPLayer(100, 2000.0); // 100 dim, 2000ms tau
const pattern = new Float32Array(100).fill(0.1);
btsp.one_shot_associate(pattern, 1.0); // Immediate association
const output = btsp.forward(pattern);
// Hyperdimensional Computing
const apple = Hypervector.random();
const orange = Hypervector.random();
const fruit = apple.bind(orange); // XOR binding
const similarity = apple.similarity(orange); // ~0.0 (orthogonal)
console.log(`Similarity: ${similarity}`); // Random vectors are orthogonal
// HDC Memory
const memory = new HdcMemory();
memory.store("apple", apple);
memory.store("orange", orange);
const results = memory.retrieve(apple, 0.9); // threshold 0.9
const topK = memory.top_k(fruit, 3); // top-3 similar
// Instant decisions with WTA
const wta = new WTALayer(1000, 0.5, 0.8); // 1000 neurons, threshold, inhibition
const activations = new Float32Array(1000);
// ... fill activations ...
const winner = wta.compete(activations);
// Sparse coding with K-WTA
const kwta = new KWTALayer(1000, 50); // 1000 neurons, k=50 winners
const winners = kwta.select(activations);
// Attention bottleneck with Global Workspace
const workspace = new GlobalWorkspace(7); // Miller's Law: 7 +/- 2
const item = new WorkspaceItem(
new Float32Array([1, 2, 3]), // content
0.9, // salience
1, // source
Date.now() // timestamp
);
workspace.broadcast(item);Unified API for 18+ attention mechanisms across Neural, DAG, Graph, and SSM domains.
A single WASM interface that routes to the appropriate attention implementation based on your data structure and requirements.
| Category | Mechanisms | Best For |
|---|---|---|
| Neural | Scaled Dot-Product, Multi-Head, Hyperbolic, Linear, Flash, Local-Global, MoE | Transformers, sequences |
| DAG | Topological, Causal Cone, Critical Path, MinCut-Gated, Hierarchical Lorentz, Parallel Branch, Temporal BTSP | Query DAGs, workflows |
| Graph | GAT, GCN, GraphSAGE | GNNs, knowledge graphs |
| SSM | Mamba | Long sequences, streaming |
Mechanism Selection:
+------------------+ +-------------------+
| Your Data | --> | UnifiedAttention | --> Optimal Mechanism
+------------------+ +-------------------+
|
+----------------------+----------------------+
| | |
+----v----+ +-----v-----+ +-----v----+
| Neural | | DAG | | Graph |
+---------+ +-----------+ +----------+
| dot_prod| | topological| | gat |
| multi_hd| | causal_cone| | gcn |
| flash | | mincut_gtd | | graphsage|
+---------+ +-----------+ +----------+
JavaScript/TypeScript Example:
import init, {
UnifiedAttention,
availableMechanisms,
getStats,
softmax,
temperatureSoftmax,
cosineSimilarity,
// Neural attention
ScaledDotProductAttention,
MultiHeadAttention,
// DAG attention
TopologicalAttention,
MinCutGatedAttention,
// Graph attention
GraphAttention,
// SSM
MambaSSM,
} from '@ruvector/attention-unified-wasm';
await init();
// List all available mechanisms
console.log(availableMechanisms());
// { neural: [...], dag: [...], graph: [...], ssm: [...] }
console.log(getStats());
// { total_mechanisms: 18, neural_count: 7, dag_count: 7, ... }
// Unified selector - routes to appropriate implementation
const attention = new UnifiedAttention("multi_head");
console.log(`Category: ${attention.category}`); // "neural"
console.log(`Supports sequences: ${attention.supportsSequences()}`); // true
console.log(`Supports graphs: ${attention.supportsGraphs()}`); // false
// For DAG structures
const dagAttention = new UnifiedAttention("topological");
console.log(`Category: ${dagAttention.category}`); // "dag"
console.log(`Supports graphs: ${dagAttention.supportsGraphs()}`); // true
// Hyperbolic attention for hierarchical data
const hypAttention = new UnifiedAttention("hierarchical_lorentz");
console.log(`Supports hyperbolic: ${hypAttention.supportsHyperbolic()}`); // true
// Utility functions
const logits = [1.0, 2.0, 3.0, 4.0];
const probs = softmax(logits);
console.log(`Probabilities sum to: ${probs.reduce((a, b) => a + b)}`); // 1.0
// Temperature-scaled softmax (lower = more peaked)
const sharperProbs = temperatureSoftmax(logits, 0.5);
// Cosine similarity
const vecA = [1.0, 0.0, 0.0];
const vecB = [1.0, 0.0, 0.0];
console.log(`Similarity: ${cosineSimilarity(vecA, vecB)}`); // 1.0| Package | Size Target | Key Features |
|---|---|---|
@ruvector/learning-wasm |
<50KB | MicroLoRA (<100us), trajectory tracking |
@ruvector/economy-wasm |
<100KB | CRDT ledger, 10x->1x curve, stake/slash |
@ruvector/exotic-wasm |
<150KB | NAO, Morphogenetic, Time Crystal |
@ruvector/nervous-system-wasm |
<100KB | BTSP, HDC (10K-bit), WTA, Global Workspace |
@ruvector/attention-unified-wasm |
<200KB | 18+ attention mechanisms, unified API |
Common Patterns:
// All packages follow the same initialization pattern
import init, { /* exports */ } from '@ruvector/<package>-wasm';
await init();
// Version check
import { version } from '@ruvector/<package>-wasm';
console.log(`Version: ${version()}`);
// Feature discovery
import { available_mechanisms } from '@ruvector/<package>-wasm';
console.log(available_mechanisms());π§ Self-Learning Intelligence Hooks
Make your AI assistant smarter over time.
When you use Claude Code (or any AI coding assistant), it starts fresh every session. It doesn't remember which approaches worked, which files you typically edit together, or what errors you've seen before.
RuVector Hooks fixes this. It's a lightweight intelligence layer that:
- Remembers what works β Tracks which agent types succeed for different tasks
- Learns from mistakes β Records error patterns and suggests fixes you've used before
- Predicts your workflow β Knows that after editing
api.rs, you usually editapi_test.rs - Coordinates teams β Manages multi-agent swarms for complex tasks
Think of it as giving your AI assistant a memory and intuition about your codebase.
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Claude Code ββββββΆβ RuVector Hooks ββββββΆβ Intelligence β
β (PreToolUse) β β (pre-edit) β β Layer β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββ
βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Q-Learning β β Vector Memory β β Swarm Graph β
β Ξ±=0.1 Ξ³=0.95 β β 64-dim embed β β Coordination β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
The hooks integrate with Claude Code's event system:
- PreToolUse β Provides guidance before edits (agent routing, related files)
- PostToolUse β Records outcomes for learning (success/failure, patterns)
- SessionStart/Stop β Manages session state and metrics export
| Component | Implementation | Details |
|---|---|---|
| Q-Learning | Temporal Difference | Ξ±=0.1, Ξ³=0.95, Ξ΅=0.1 (Ξ΅-greedy exploration) |
| Embeddings | Hash-based vectors | 64 dimensions, normalized, cosine similarity |
| LRU Cache | lru crate |
1000 entries, ~10x faster Q-value lookups |
| Compression | flate2 gzip |
70-83% storage reduction, fast compression |
| Storage | JSON / PostgreSQL | Auto-fallback, 5000 memory entry limit |
| Cross-platform | Rust + TypeScript | Windows (USERPROFILE), Unix (HOME) |
| Metric | Value |
|---|---|
| Q-value lookup (cached) | <1Β΅s |
| Q-value lookup (uncached) | ~50Β΅s |
| Memory search (1000 entries) | <5ms |
| Storage compression ratio | 70-83% |
| Session start overhead | <10ms |
| Crate/Package | Description | Status |
|---|---|---|
| ruvector-cli hooks | Rust CLI with 34 hooks commands | |
| @ruvector/cli hooks | npm CLI with 29 hooks commands |
# Rust CLI
cargo install ruvector-cli
ruvector hooks init
ruvector hooks install
# npm CLI
npx @ruvector/cli hooks init
npx @ruvector/cli hooks install| Feature | Description | Technical Details |
|---|---|---|
| Q-Learning Routing | Routes tasks to best agent with learned confidence scores | TD learning with Ξ±=0.1, Ξ³=0.95, Ξ΅-greedy exploration |
| Semantic Memory | Vector-based memory with embeddings for context retrieval | 64-dim hash embeddings, cosine similarity, top-k search |
| Error Learning | Records error patterns and suggests fixes | Pattern matching for E0308, E0433, TS2322, etc. |
| File Sequences | Predicts next files to edit based on historical patterns | Markov chain transitions, frequency-weighted suggestions |
| Swarm Coordination | Registers agents, tracks coordination edges, optimizes | Graph-based topology, weighted edges, task assignment |
| LRU Cache | 1000-entry cache for faster Q-value lookups | ~10x speedup, automatic eviction, RefCell for interior mutability |
| Gzip Compression | Storage savings with automatic compression | flate2 fast mode, 70-83% reduction, transparent load/save |
| Batch Saves | Dirty flag tracking to reduce disk I/O | Only writes when data changes, force_save() override |
| Shell Completions | Tab completion for all commands | bash, zsh, fish, PowerShell support |
The intelligence layer has built-in knowledge for common error patterns:
| Language | Error Codes | Auto-Suggested Fixes |
|---|---|---|
| Rust | E0308, E0433, E0425, E0277, E0382 | Type mismatches, missing imports, borrow checker |
| TypeScript | TS2322, TS2339, TS2345, TS7006 | Type assignments, property access, argument types |
| Python | ImportError, AttributeError, TypeError | Module imports, attribute access, type errors |
| Go | undefined, cannot use, not enough arguments | Variable scope, type conversion, function calls |
# Setup
ruvector hooks init [--force] [--postgres] # Initialize hooks (--postgres for DB schema)
ruvector hooks install # Install into Claude settings
# Core
ruvector hooks stats # Show intelligence statistics
ruvector hooks session-start [--resume] # Start/resume a session
ruvector hooks session-end # End session with metrics
# Memory
ruvector hooks remember -t edit "content" # Store in semantic memory
ruvector hooks recall "query" -k 5 # Search memory semantically
# Learning
ruvector hooks learn <state> <action> --reward 0.8 # Record trajectory
ruvector hooks suggest <state> --actions "a,b,c" # Get action suggestion
ruvector hooks route "implement caching" --file src/cache.rs # Route to agent
# Claude Code Hooks
ruvector hooks pre-edit <file> # Pre-edit intelligence hook
ruvector hooks post-edit <file> --success # Post-edit learning hook
ruvector hooks pre-command <cmd> # Pre-command hook
ruvector hooks post-command <cmd> --success # Post-command hook
ruvector hooks suggest-context # UserPromptSubmit context injection
ruvector hooks track-notification # Track notification patterns
ruvector hooks pre-compact [--auto] # Pre-compact hook (auto/manual)
# Claude Code v2.0.55+ Features
ruvector hooks lsp-diagnostic --file <f> --severity error # LSP diagnostics
ruvector hooks suggest-ultrathink "complex task" # Recommend extended reasoning
ruvector hooks async-agent --action spawn --agent-id <id> # Async sub-agents
# Intelligence
ruvector hooks record-error <cmd> <stderr> # Record error pattern
ruvector hooks suggest-fix E0308 # Get fix for error code
ruvector hooks suggest-next <file> -n 3 # Predict next files
ruvector hooks should-test <file> # Check if tests needed
# Swarm
ruvector hooks swarm-register <id> <type> # Register agent
ruvector hooks swarm-coordinate <src> <tgt> # Record coordination
ruvector hooks swarm-optimize "task1,task2" # Optimize distribution
ruvector hooks swarm-recommend "rust" # Recommend agent for task
ruvector hooks swarm-heal <agent-id> # Handle agent failure
ruvector hooks swarm-stats # Show swarm statistics
# Optimization (Rust only)
ruvector hooks compress # Compress storage (70-83% savings)
ruvector hooks cache-stats # Show LRU cache statistics
ruvector hooks completions bash # Generate shell completions1. Initialize and install hooks:
ruvector hooks init
ruvector hooks install --settings-dir .claudeThis creates .claude/settings.json with hook configurations:
{
"hooks": {
"PreToolUse": [
{ "matcher": "Edit|Write|MultiEdit", "hooks": ["ruvector hooks pre-edit \"$TOOL_INPUT_FILE_PATH\""] },
{ "matcher": "Bash", "hooks": ["ruvector hooks pre-command \"$TOOL_INPUT_COMMAND\""] }
],
"PostToolUse": [
{ "matcher": "Edit|Write|MultiEdit", "hooks": ["ruvector hooks post-edit ... --success"] },
{ "matcher": "Bash", "hooks": ["ruvector hooks post-command ... --success"] }
],
"SessionStart": ["ruvector hooks session-start"],
"Stop": ["ruvector hooks session-end --export-metrics"],
"PreCompact": ["ruvector hooks pre-compact"]
}
}All 7 Claude Code hooks covered:
| Hook | When It Fires | What RuVector Does |
|---|---|---|
PreToolUse |
Before file edit, command, or Task | Suggests agent, shows related files, validates agent assignments |
PostToolUse |
After file edit or command | Records outcome, updates Q-values, injects context |
SessionStart |
When session begins/resumes | Loads intelligence, shows stats (startup vs resume) |
Stop |
When session ends | Saves state, exports metrics |
PreCompact |
Before context compaction | Preserves critical memories (auto vs manual) |
UserPromptSubmit |
Before processing user prompt | Injects learned patterns as context |
Notification |
On system notifications | Tracks notification patterns |
Advanced Features:
- Stdin JSON Parsing: Hooks receive full JSON via stdin (session_id, tool_input, tool_response)
- Context Injection: PostToolUse returns
additionalContextto inject into Claude's context - Timeout Optimization: All hooks have optimized timeouts (1-5 seconds vs 60s default)
2. Use routing for intelligent agent selection:
# Route a task to the best agent
$ ruvector hooks route "implement vector search" --file src/lib.rs
{
"recommended": "rust-developer",
"confidence": 0.85,
"reasoning": "learned from 47 similar edits"
}3. Learn from outcomes:
# Record successful outcome
ruvector hooks learn "edit-rs-lib" "rust-developer" --reward 1.0
# Record failed outcome
ruvector hooks learn "edit-rs-lib" "typescript-dev" --reward -0.54. Get error fix suggestions:
$ ruvector hooks suggest-fix E0308
{
"code": "E0308",
"type": "type_mismatch",
"fixes": [
"Check return type matches function signature",
"Use .into() or .as_ref() for type conversion",
"Verify generic type parameters"
]
}1. Register agents:
ruvector hooks swarm-register agent-1 rust-developer --capabilities "rust,async,testing"
ruvector hooks swarm-register agent-2 typescript-dev --capabilities "ts,react,node"
ruvector hooks swarm-register agent-3 reviewer --capabilities "review,security,performance"2. Record coordination patterns:
# Agent-1 hands off to Agent-3 for review
ruvector hooks swarm-coordinate agent-1 agent-3 --weight 0.93. Optimize task distribution:
$ ruvector hooks swarm-optimize "implement-api,write-tests,code-review"
{
"assignments": {
"implement-api": "agent-1",
"write-tests": "agent-1",
"code-review": "agent-3"
}
}4. Handle failures with self-healing:
# Mark agent as failed and redistribute
ruvector hooks swarm-heal agent-2For production deployments, use PostgreSQL instead of JSON files:
# Set connection URL
export RUVECTOR_POSTGRES_URL="postgres://user:pass@localhost/ruvector"
# Initialize PostgreSQL schema (automatic)
ruvector hooks init --postgres
# Or apply schema manually
psql $RUVECTOR_POSTGRES_URL -f crates/ruvector-cli/sql/hooks_schema.sql
# Build CLI with postgres feature
cargo build -p ruvector-cli --features postgresThe PostgreSQL backend provides:
- Vector embeddings with native
ruvectortype - Q-learning functions (
ruvector_hooks_update_q,ruvector_hooks_best_action) - Swarm coordination tables with foreign key relationships
- Automatic memory cleanup (keeps last 5000 entries)
π¬ Scientific OCR (SciPix)
| Package | Description | Install |
|---|---|---|
| ruvector-scipix | Rust OCR engine for scientific documents | cargo add ruvector-scipix |
| @ruvector/scipix | TypeScript client for SciPix API | npm install @ruvector/scipix |
SciPix extracts text and mathematical equations from images, converting them to LaTeX, MathML, or plain text.
Features:
- Multi-format output β LaTeX, MathML, AsciiMath, plain text, structured JSON
- Batch processing β Process multiple images with parallel execution
- Content detection β Equations, tables, diagrams, mixed content
- Confidence scoring β Per-region confidence levels (high/medium/low)
- PDF support β Extract from multi-page PDFs with page selection
import { SciPixClient, OutputFormat } from '@ruvector/scipix';
const client = new SciPixClient({
baseUrl: 'http://localhost:8080',
apiKey: 'your-api-key',
});
// OCR an image file
const result = await client.ocrFile('./equation.png', {
formats: [OutputFormat.LaTeX, OutputFormat.MathML],
detectEquations: true,
});
console.log('LaTeX:', result.latex);
console.log('Confidence:', result.confidence);
// Quick LaTeX extraction
const latex = await client.extractLatex('./math.png');
// Batch processing
const batchResult = await client.batchOcr({
images: [
{ source: 'base64...', id: 'eq1' },
{ source: 'base64...', id: 'eq2' },
],
defaultOptions: { formats: [OutputFormat.LaTeX] },
});# Rust CLI usage
scipix-cli ocr --input equation.png --format latex
scipix-cli serve --port 3000
# MCP server for Claude/AI assistants
scipix-cli mcp
claude mcp add scipix -- scipix-cli mcpSee npm/packages/scipix/README.md for full documentation.
π ONNX Embeddings
| Example | Description | Path |
|---|---|---|
| ruvector-onnx-embeddings | Production-ready ONNX embedding generation in pure Rust | examples/onnx-embeddings |
ONNX Embeddings provides native embedding generation using ONNX Runtime β no Python required. Supports 8+ pretrained models (all-MiniLM, BGE, E5, GTE), multiple pooling strategies, GPU acceleration (CUDA, TensorRT, CoreML, WebGPU), and direct RuVector index integration for RAG pipelines.
use ruvector_onnx_embeddings::{Embedder, PretrainedModel};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Create embedder with default model (all-MiniLM-L6-v2)
let mut embedder = Embedder::default_model().await?;
// Generate embedding (384 dimensions)
let embedding = embedder.embed_one("Hello, world!")?;
// Compute semantic similarity
let sim = embedder.similarity(
"I love programming in Rust",
"Rust is my favorite language"
)?;
println!("Similarity: {:.4}", sim); // ~0.85
Ok(())
}Supported Models:
| Model | Dimension | Speed | Best For |
|---|---|---|---|
AllMiniLmL6V2 |
384 | Fast | General purpose (default) |
BgeSmallEnV15 |
384 | Fast | Search & retrieval |
AllMpnetBaseV2 |
768 | Accurate | Production RAG |
π§ Bindings & Tools
Native bindings and tools for integrating RuVector into any environment β Node.js, browsers, CLI, or as an HTTP/gRPC server.
| Crate | Description | crates.io |
|---|---|---|
| ruvector-node | Native Node.js bindings via napi-rs | |
| ruvector-wasm | WASM bindings for browsers & edge | |
| ruvllm-wasm | Browser LLM inference with WebGPU | |
| ruvector-cli | Command-line interface | |
| ruvector-server | HTTP/gRPC server |
Node.js (Native Performance)
npm install @ruvector/nodeconst { RuVector } = require('@ruvector/node');
const db = new RuVector({ dimensions: 1536 });
db.insert('doc1', embedding, { title: 'Hello' });
const results = db.search(queryEmbedding, 10);Browser (WASM)
npm install @ruvector/wasmimport { RuVectorWasm } from '@ruvector/wasm';
const db = await RuVectorWasm.create({ dimensions: 384 });
await db.insert('doc1', embedding);
const results = await db.search(query, 5);CLI
cargo install ruvector-cli
ruvector init mydb --dim 1536
ruvector insert mydb --file embeddings.json
ruvector search mydb --query "[0.1, 0.2, ...]" --limit 10HTTP Server
cargo install ruvector-server
ruvector-server --port 8080 --data ./vectors
# REST API
curl -X POST http://localhost:8080/search \
-H "Content-Type: application/json" \
-d '{"vector": [0.1, 0.2, ...], "limit": 10}'π Production Examples
28 production-ready examples demonstrating RuVector integration patterns.
| Example | Description | Type |
|---|---|---|
| agentic-jujutsu | Quantum-resistant version control for AI agents (23x faster than Git) | Rust |
| mincut | 6 self-organizing network demos: strange loops, time crystals, causal discovery | Rust |
| subpolynomial-time | n^0.12 subpolynomial algorithm demos | Rust |
| exo-ai-2025 | Cognitive substrate with 9 neural-symbolic crates + 11 research experiments | Rust/TS |
| neural-trader | AI trading with DRL + sentiment analysis + SONA learning | Rust |
| ultra-low-latency-sim | 13+ quadrillion meta-simulations/sec with SIMD | Rust |
| meta-cognition-spiking-neural-network | Spiking neural network with meta-cognitive learning (10-50x speedup) | npm |
| spiking-network | Biologically-inspired spiking neural networks | Rust |
| ruvLLM | LLM integration patterns for RAG and AI agents | Rust |
| onnx-embeddings | Production ONNX embedding generation without Python | Rust |
| onnx-embeddings-wasm | WASM ONNX embeddings for browsers | WASM |
| refrag-pipeline | RAG pipeline with vector search and document processing | Rust |
| scipix | Scientific OCR: equations β LaTeX/MathML with ONNX inference | Rust |
| graph | Graph database examples with Cypher queries | Rust |
| edge | 364KB WASM edge deployment | Rust |
| edge-full | Full-featured edge vector DB | Rust |
| edge-net | Networked edge deployment with zero-cost swarms | Rust |
| vibecast-7sense | 7-sense perception AI application | TypeScript |
| apify | 13 Apify actors: trading, memory engine, synth data, market research | npm |
| google-cloud | GCP templates for Cloud Run, GKE, Vertex AI | Terraform |
| wasm-react | React integration with WASM vector operations | WASM |
| wasm-vanilla | Vanilla JS WASM example for browser vector search | WASM |
| wasm | Core WASM examples and bindings | WASM |
| nodejs | Node.js integration examples | Node.js |
| rust | Core Rust usage examples | Rust |
π Tutorials
import { VectorDB } from 'ruvector';
// Create DB with 384-dimensional vectors
const db = new VectorDB(384);
// Add vectors
db.insert('doc1', [0.1, 0.2, ...]); // 384 floats
db.insert('doc2', [0.3, 0.1, ...]);
// Search (returns top 5 nearest neighbors)
const results = db.search(queryVector, 5);
// -> [{ id: 'doc1', score: 0.95 }, { id: 'doc2', score: 0.87 }]import { GraphDB } from 'ruvector';
const graph = new GraphDB();
// Create nodes and relationships
graph.query(`
CREATE (a:Person {name: 'Alice', embedding: $emb1})
CREATE (b:Person {name: 'Bob', embedding: $emb2})
CREATE (a)-[:KNOWS {since: 2020}]->(b)
`, { emb1: aliceVector, emb2: bobVector });
// Hybrid query: graph traversal + vector similarity
const results = graph.query(`
MATCH (p:Person)-[:KNOWS*1..3]->(friend)
WHERE vector.similarity(friend.embedding, $query) > 0.8
RETURN friend.name, vector.similarity(friend.embedding, $query) as score
ORDER BY score DESC
`, { query: queryVector });use ruvector_sona::{SonaEngine, SonaConfig};
// Initialize SONA with LoRA adapters
let sona = SonaEngine::with_config(SonaConfig {
hidden_dim: 256,
lora_rank: 8,
ewc_lambda: 0.4, // Elastic Weight Consolidation
..Default::default()
});
// Record successful action
let mut trajectory = sona.begin_trajectory(query_embedding);
trajectory.add_step(result_embedding, vec![], 1.0); // reward=1.0
sona.end_trajectory(trajectory, true); // success=true
// SONA learns and improves future predictions
sona.force_learn();
// Later: get improved predictions
let prediction = sona.predict(&new_query_embedding);use ruvector_mincut::{DynamicMinCut, Graph};
// Build graph
let mut graph = Graph::new(100); // 100 nodes
graph.add_edge(0, 1, 10.0);
graph.add_edge(1, 2, 5.0);
graph.add_edge(0, 2, 15.0);
// Compute initial min-cut
let mut mincut = DynamicMinCut::new(&graph);
let (value, cut_edges) = mincut.compute();
println!("Min-cut value: {}", value); // -> 15.0
// Dynamic update - subpolynomial time O(n^0.12)!
graph.update_edge(1, 2, 20.0);
let (new_value, _) = mincut.recompute(); // Much faster than recomputing from scratchuse ruvector_attention::{
Attention, FlashAttention, LinearAttention,
HyperbolicAttention, GraphAttention, MinCutGatedAttention
};
// FlashAttention - O(n) memory, fastest for long sequences
let flash = FlashAttention::new(512, 8); // dim=512, heads=8
let output = flash.forward(&query, &key, &value);
// LinearAttention - O(n) time complexity
let linear = LinearAttention::new(512, 8);
// HyperbolicAttention - for hierarchical data (PoincarΓ© ball)
let hyper = HyperbolicAttention::new(512, 8, Curvature(-1.0));
// GraphAttention - respects graph structure
let gat = GraphAttention::new(512, 8, &adjacency_matrix);
// MinCutGatedAttention - 50% compute reduction via sparsity
let mincut_gated = MinCutGatedAttention::new(512, 8, sparsity: 0.5);
let sparse_output = mincut_gated.forward(&query, &key, &value);import { SpikingNetwork, HDCEncoder } from '@ruvector/spiking-neural';
// High-Dimensional Computing encoder (10K-bit vectors)
const encoder = new HDCEncoder(10000);
const encoded = encoder.encode("hello world");
// Spiking network with BTSP learning
const network = new SpikingNetwork({
layers: [784, 256, 10],
learning: 'btsp', // Behavioral Time-Scale Plasticity
threshold: 1.0
});
// Train with spike timing
network.train(spikes, labels, { epochs: 10 });
// Inference
const output = network.forward(inputSpikes);# 1. Initialize hooks
npx @ruvector/cli hooks init
# 2. Install into Claude settings
npx @ruvector/cli hooks install
# 3. Hooks now capture:
# - File edits (pre/post)
# - Commands (pre/post)
# - Sessions (start/end)
# - Errors and fixes
# 4. Query learned patterns
npx @ruvector/cli hooks recall "authentication error"
# -> Returns similar past solutions
# 5. Get AI routing suggestions
npx @ruvector/cli hooks route "implement caching"
# -> Suggests: rust-developer (confidence: 0.89)import { RvLite } from '@ruvector/rvlite';
// Create persistent edge database (IndexedDB in browser)
const db = await RvLite.create({
path: 'my-vectors.db',
dimensions: 384
});
// Works offline - all computation local
await db.insert('doc1', embedding1, { title: 'Hello' });
await db.insert('doc2', embedding2, { title: 'World' });
// Semantic search with metadata filtering
const results = await db.search(queryEmbedding, {
limit: 10,
filter: { title: { $contains: 'Hello' } }
});
// Sync when online
await db.sync('https://api.example.com/vectors');π WASM & Utility Packages
| Package | Description | Version | Downloads |
|---|---|---|---|
| @ruvector/wasm | WASM core vector DB | ||
| @ruvector/gnn-wasm | WASM GNN layers | ||
| @ruvector/graph-wasm | WASM graph DB | ||
| @ruvector/attention-wasm | WASM attention | ||
| @ruvector/tiny-dancer-wasm | WASM AI routing | ||
| @ruvector/router-wasm | WASM semantic router | ||
| @ruvector/postgres-cli | Postgres extension CLI | ||
| @ruvector/agentic-synth | Synthetic data generator | ||
| @ruvector/graph-data-generator | Graph data generation | ||
| @ruvector/agentic-integration | Agentic workflows | ||
| rvlite | SQLite-style edge DB (SQL/SPARQL/Cypher) |
Platform-specific native bindings (auto-detected):
@ruvector/node-linux-x64-gnu,@ruvector/node-linux-arm64-gnu,@ruvector/node-darwin-x64,@ruvector/node-darwin-arm64,@ruvector/node-win32-x64-msvc@ruvector/gnn-linux-x64-gnu,@ruvector/gnn-linux-arm64-gnu,@ruvector/gnn-darwin-x64,@ruvector/gnn-darwin-arm64,@ruvector/gnn-win32-x64-msvc@ruvector/tiny-dancer-linux-x64-gnu,@ruvector/tiny-dancer-linux-arm64-gnu,@ruvector/tiny-dancer-darwin-x64,@ruvector/tiny-dancer-darwin-arm64,@ruvector/tiny-dancer-win32-x64-msvc@ruvector/router-linux-x64-gnu,@ruvector/router-linux-arm64-gnu,@ruvector/router-darwin-x64,@ruvector/router-darwin-arm64,@ruvector/router-win32-x64-msvc@ruvector/attention-linux-x64-gnu,@ruvector/attention-linux-arm64-gnu,@ruvector/attention-darwin-x64,@ruvector/attention-darwin-arm64,@ruvector/attention-win32-x64-msvc@ruvector/ruvllm-linux-x64-gnu,@ruvector/ruvllm-linux-arm64-gnu,@ruvector/ruvllm-darwin-x64,@ruvector/ruvllm-darwin-arm64,@ruvector/ruvllm-win32-x64-msvc
See GitHub Issue #20 for multi-platform npm package roadmap.
# Install all-in-one package
npm install ruvector
# Or install individual packages
npm install @ruvector/core @ruvector/gnn @ruvector/graph-node
# List all available packages
npx ruvector installconst ruvector = require('ruvector');
// Vector search
const db = new ruvector.VectorDB(128);
db.insert('doc1', embedding1);
const results = db.search(queryEmbedding, 10);
// Graph queries (Cypher)
db.execute("CREATE (a:Person {name: 'Alice'})-[:KNOWS]->(b:Person {name: 'Bob'})");
db.execute("MATCH (p:Person)-[:KNOWS]->(friend) RETURN friend.name");
// GNN-enhanced search
const layer = new ruvector.GNNLayer(128, 256, 4);
const enhanced = layer.forward(query, neighbors, weights);
// Compression (2-32x memory savings)
const compressed = ruvector.compress(embedding, 0.3);
// Tiny Dancer: AI agent routing
const router = new ruvector.Router();
const decision = router.route(candidates, { optimize: 'cost' });π¦ Rust Usage Examples
cargo add ruvector-graph ruvector-gnnuse ruvector_graph::{GraphDB, NodeBuilder};
use ruvector_gnn::{RuvectorLayer, differentiable_search};
let db = GraphDB::new();
let doc = NodeBuilder::new("doc1")
.label("Document")
.property("embedding", vec![0.1, 0.2, 0.3])
.build();
db.create_node(doc)?;
// GNN layer
let layer = RuvectorLayer::new(128, 256, 4, 0.1);
let enhanced = layer.forward(&query, &neighbors, &weights);use ruvector_raft::{RaftNode, RaftNodeConfig};
use ruvector_cluster::{ClusterManager, ConsistentHashRing};
use ruvector_replication::{SyncManager, SyncMode};
// Configure a 5-node Raft cluster
let config = RaftNodeConfig {
node_id: "node-1".into(),
cluster_members: vec!["node-1", "node-2", "node-3", "node-4", "node-5"]
.into_iter().map(Into::into).collect(),
election_timeout_min: 150, // ms
election_timeout_max: 300, // ms
heartbeat_interval: 50, // ms
};
let raft = RaftNode::new(config);
// Auto-sharding with consistent hashing (150 virtual nodes per real node)
let ring = ConsistentHashRing::new(64, 3); // 64 shards, replication factor 3
let shard = ring.get_shard("my-vector-key");
// Multi-master replication with conflict resolution
let sync = SyncManager::new(SyncMode::SemiSync { min_replicas: 2 });π RuvLLM Training & RLM Fine-Tuning Tutorials
RuvLTRA achieves 90% routing accuracy using a keyword-first strategy with embedding fallback:
// Optimal routing: Keywords first, embeddings as tiebreaker
function routeTask(task, taskEmbedding, agentEmbeddings) {
const keywordScores = getKeywordScores(task);
const maxKw = Math.max(...Object.values(keywordScores));
if (maxKw > 0) {
const candidates = Object.entries(keywordScores)
.filter(([_, score]) => score === maxKw)
.map(([agent]) => agent);
if (candidates.length === 1) return { agent: candidates[0] };
return pickByEmbedding(candidates, taskEmbedding, agentEmbeddings);
}
return embeddingSimilarity(taskEmbedding, agentEmbeddings);
}Run the benchmark: node npm/packages/ruvllm/scripts/hybrid-model-compare.js
# Using CLI (recommended)
npx @ruvector/ruvllm train stats # View dataset statistics
npx @ruvector/ruvllm train dataset # Export training data
npx @ruvector/ruvllm train contrastive # Run full training pipeline
# With options
npx @ruvector/ruvllm train dataset --output ./my-training
npx @ruvector/ruvllm train contrastive --epochs 20 --batch-size 32 --lr 0.0001Programmatic API:
import { ContrastiveTrainer, generateTrainingDataset, getDatasetStats } from '@ruvector/ruvllm';
const stats = getDatasetStats();
console.log(`${stats.totalExamples} examples, ${stats.agentTypes} agent types`);
const trainer = new ContrastiveTrainer({ epochs: 10, margin: 0.5 });
trainer.addTriplet(anchor, anchorEmb, positive, positiveEmb, negative, negativeEmb, true);
const result = trainer.train();
trainer.exportTrainingData('./output');pip install transformers peft datasets accelerate
python -m peft.lora_train \
--model_name Qwen/Qwen2.5-0.5B-Instruct \
--dataset ./data/training/routing-examples.jsonl \
--output_dir ./ruvltra-routing-lora \
--lora_r 8 --lora_alpha 16 \
--num_train_epochs 3 \
--learning_rate 2e-4# Merge LoRA weights
python -c "
from peft import PeftModel
from transformers import AutoModelForCausalLM
base = AutoModelForCausalLM.from_pretrained('Qwen/Qwen2.5-0.5B-Instruct')
model = PeftModel.from_pretrained(base, './ruvltra-routing-lora')
model.merge_and_unload().save_pretrained('./ruvltra-routing-merged')
"
# Convert and quantize
python llama.cpp/convert_hf_to_gguf.py ./ruvltra-routing-merged --outfile ruvltra-routing-f16.gguf
./llama.cpp/llama-quantize ruvltra-routing-f16.gguf ruvltra-routing-q4_k_m.gguf Q4_K_MUsing RuvLLM CLI (recommended):
# Full contrastive training pipeline with triplet loss
npx @ruvector/ruvllm train contrastive --output ./training-output
# Exports: triplets.jsonl, embeddings.json, lora_config.json, train.shUsing Python (for GPU training):
from sentence_transformers import SentenceTransformer, losses, InputExample
from torch.utils.data import DataLoader
train_examples = [
InputExample(texts=["implement login", "build auth component"], label=1.0),
InputExample(texts=["implement login", "write unit tests"], label=0.0),
]
model = SentenceTransformer("Qwen/Qwen2.5-0.5B-Instruct")
train_loss = losses.CosineSimilarityLoss(model)
model.fit([(DataLoader(train_examples, batch_size=16), train_loss)], epochs=5)Resources: Issue #122 | LoRA Paper | Sentence Transformers
For production-scale dataset generation, use the Rust training module (full docs):
use ruvllm::training::{DatasetGenerator, DatasetConfig};
let config = DatasetConfig {
examples_per_category: 100,
enable_augmentation: true,
seed: 42,
..Default::default()
};
let dataset = DatasetGenerator::new(config).generate();
let (train, val, test) = dataset.split(0.7, 0.15, 0.15, 42);
dataset.export_jsonl("training.jsonl")?;Features:
- 5 agent categories: Coder, Researcher, Security, Architecture, Reviewer (20% each)
- Model routing: Haiku (simple) β Sonnet (moderate) β Opus (complex/security)
- Data augmentation: Paraphrasing, complexity variations, domain transfer
- 8 technical domains: Web, Systems, DataScience, Mobile, DevOps, Security, Database, API
- Quality scores: 0.80-0.96 based on template quality and category
- Performance: ~10,000 examples/second, ~50 MB/s JSONL export
cargo run --example generate_claude_dataset --release
# Outputs: train.jsonl, val.jsonl, test.jsonl, stats.jsonπ Project Structure
crates/
βββ ruvector-core/ # Vector DB engine (HNSW, storage)
βββ ruvector-graph/ # Graph DB + Cypher parser + Hyperedges
βββ ruvector-gnn/ # GNN layers, compression, training
βββ ruvector-tiny-dancer-core/ # AI agent routing (FastGRNN)
βββ ruvector-*-wasm/ # WebAssembly bindings
βββ ruvector-*-node/ # Node.js bindings (napi-rs)
We welcome contributions! See CONTRIBUTING.md.
# Run tests
cargo test --workspace
# Run benchmarks
cargo bench --workspace
# Build WASM
cargo build -p ruvector-gnn-wasm --target wasm32-unknown-unknownMIT License β free for commercial and personal use.