ruvix-vecgraph
Kernel-resident vector and graph stores for the RuVix Cognition Kernel (ADR-087).
Overview
This crate implements the Vector/Graph Kernel Objects from ADR-087 Section 4.3. Unlike conventional kernels where all data structures are userspace constructs, RuVix makes vector stores and graph stores kernel-resident objects.
Design Principles
| Principle | Description |
|---|---|
| Kernel-resident | Vector data lives in kernel-managed slab regions |
| Capability-protected | All access requires valid capabilities |
| Proof-gated | All mutations require cryptographic proof |
| Coherence-aware | Metadata co-located with each vector |
| Witness-emitting | Every mutation emits an attestation |
Syscalls Implemented
| Syscall | Description | Rights Required |
|---|---|---|
vector_get |
Read vector data and coherence metadata | READ |
vector_put_proved |
Write vector with proof verification | WRITE + PROVE |
graph_apply_proved |
Apply graph mutation with proof | WRITE + PROVE |
Components
KernelVectorStore
Main vector storage engine:
use ;
use ;
// Create a vector store with 768 dimensions and 10000 capacity
let store = new
.with_proof_policy
.build?;
// Read a vector (no proof required, only READ capability)
let = store.vector_get?;
// Write a vector (proof required, WRITE + PROVE capability)
let attestation = store.vector_put_proved?;
KernelGraphStore
Graph storage with mincut-aware mutations:
use ;
use GraphMutation;
let store = new // 1000 nodes max
.with_proof_policy
.build?;
// Apply graph mutation with proof
let mutation = AddEdge ;
let attestation = store.graph_apply_proved?;
HnswRegion
HNSW index backed by slab allocation:
use ;
let config = HnswConfig ;
let hnsw = new?;
// Insert vector
hnsw.insert?;
// Search nearest neighbors
let neighbors = hnsw.search?;
CoherenceTracker
Track coherence metadata for vectors:
use ;
let tracker = new;
// Get coherence score (0.0 - 1.0)
let score = tracker.score?;
// Update on mutation
tracker.update?;
WitnessLog
Record attestations for all mutations:
use ;
let mut log = new;
// Every successful mutation returns an attestation
let entry = log.append?;
println!;
SIMD Distance Functions
Optimized distance computations:
use ;
let a = &;
let b = &;
let cos_sim = cosine_similarity;
let l2_dist = euclidean_distance_squared;
let dot = dot_product;
let norm = l2_norm;
Statistics
With the stats feature enabled:
use VecGraphStats;
let stats = store.stats;
println!;
println!;
println!;
println!;
Features
std(default): Enable standard library supportalloc: Enable alloc crate supportstats: Enable statistics collectioncoherence: Enable coherence scoring
Integration with RuVix
This crate integrates with:
ruvix-types: Core type definitions (VectorKey,GraphHandle,CoherenceMeta)ruvix-cap: Capability checking for READ/WRITE/PROVE rightsruvix-region: Slab regions for vector storageruvix-proof: Proof verification for mutationsruvector-coherence: Spectral coherence scoring (optional)
License
MIT OR Apache-2.0