Skip to main content

Crate rvcsi_ruvector

Crate rvcsi_ruvector 

Source
Expand description

§rvCSI RuVector bridge

Exports temporal RF embeddings + event metadata as a queryable RF-memory store (ADR-095 FR8, D8).

This crate is a standin for the production RuVector vector-database binding (which gets wired in later). It provides:

Everything here is pure and deterministic given the same sequence of operations — no clocks, randomness, or order-dependent reductions — so captures replayed twice yield byte-identical stores and query results.

use rvcsi_ruvector::{InMemoryRfMemory, RfMemoryStore, window_embedding};
use rvcsi_core::{CsiWindow, SessionId, SourceId, WindowId};

let w = CsiWindow {
    window_id: WindowId(0),
    session_id: SessionId(1),
    source_id: SourceId::from("esp32"),
    start_ns: 1_000,
    end_ns: 2_000,
    frame_count: 10,
    mean_amplitude: vec![1.0, 2.0, 3.0],
    phase_variance: vec![0.1, 0.2, 0.1],
    motion_energy: 0.3,
    presence_score: 0.7,
    quality_score: 0.9,
};
let mut mem = InMemoryRfMemory::new();
let id = mem.store_window(&w).unwrap();
let hits = mem.query_similar(&window_embedding(&w), 1).unwrap();
assert_eq!(hits[0].id, id);
assert!((hits[0].score - 1.0).abs() < 1e-5);

Structs§

DriftReport
Result of a baseline-drift comparison (RfMemoryStore::compute_drift).
EmbeddingId
Identifier minted for each stored embedding (monotonic within a store).
InMemoryRfMemory
An entirely in-process RfMemoryStore — no persistence.
JsonlRfMemory
A file-backed RfMemoryStore. See the module docs for the on-disk format.
SimilarHit
One hit returned by RfMemoryStore::query_similar.

Enums§

RecordKind
Which kind of record an embedding came from.

Constants§

EVENT_EMBEDDING_DIM
Length of an event_embedding vector.
WINDOW_EMBEDDING_DIM
Length of a window_embedding vector.

Traits§

RfMemoryStore
A queryable RF-memory store: append window/event embeddings, search by cosine similarity, and track per-room baseline drift.

Functions§

cosine_similarity
Cosine similarity of two equal-length vectors.
event_embedding
Build the deterministic embedding for a CsiEvent.
window_embedding
Build the deterministic embedding for a CsiWindow.