Skip to main content

Crate ruvix_vecgraph

Crate ruvix_vecgraph 

Source
Expand description

Kernel-Resident Vector and Graph Stores for RuVix Cognition Kernel.

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

  • Vector data lives in kernel-managed slab regions with capability protection
  • HNSW index nodes are slab-allocated (fixed-size slots, zero allocator overhead)
  • Coherence metadata is co-located with each vector
  • All mutations are proof-gated (no proof, no mutation)
  • Every successful mutation emits a witness attestation

§Syscalls Implemented

  • vector_get: Read vector data and coherence metadata (capability-gated, no proof required)
  • vector_put_proved: Write vector with proof verification (proof-gated, PROVE right required)
  • graph_apply_proved: Apply graph mutation with proof verification (proof-gated)

§Example

use ruvix_vecgraph::{KernelVectorStore, VectorStoreBuilder};
use ruvix_types::{VectorKey, ProofToken, CapRights};

// Create a vector store with 768 dimensions and 10000 capacity
let store = VectorStoreBuilder::new(768, 10000)
    .with_proof_policy(ProofPolicy::standard())
    .build(backing)?;

// Read a vector (no proof required)
let (data, meta) = store.vector_get(key, cap)?;

// Write a vector (proof required)
let attestation = store.vector_put_proved(key, &data, proof, cap)?;

§Features

  • std: Enable standard library support (default)
  • stats: Enable statistics collection
  • coherence: Enable coherence scoring

Re-exports§

pub use coherence::CoherenceConfig;
pub use coherence::CoherenceTracker;
pub use graph_store::GraphMutationResult;
pub use graph_store::GraphStoreBuilder;
pub use graph_store::KernelGraphStore;
pub use graph_store::PartitionMeta;
pub use hnsw::HnswConfig;
pub use hnsw::HnswNode;
pub use hnsw::HnswRegion;
pub use proof_policy::NonceTracker;
pub use proof_policy::ProofPolicy;
pub use proof_policy::ProofVerifier;
pub use vector_store::KernelVectorStore;
pub use vector_store::VectorEntry;
pub use vector_store::VectorStoreBuilder;
pub use witness::WitnessEntry;
pub use witness::WitnessLog;
pub use simd_distance::cosine_similarity;
pub use simd_distance::dot_product;
pub use simd_distance::euclidean_distance_squared;
pub use simd_distance::l2_norm;
pub use simd_distance::SimdCapabilities;

Modules§

coherence
Coherence tracking for kernel vector and graph stores.
graph_store
Kernel-resident graph store implementation.
hnsw
HNSW (Hierarchical Navigable Small World) index for kernel vector stores.
proof_policy
Proof policy and verification for kernel vector/graph stores.
simd_distance
SIMD-accelerated vector distance functions for kernel vector stores.
vector_store
Kernel-resident vector store implementation.
witness
Witness log for kernel vector/graph mutations.

Type Aliases§

Result
Result type for vecgraph operations.