wifi-densepose/v2/crates/ruv-neural/ruv-neural-memory
rUv f49c722764
chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427)
The Rust port lived two directories deep (rust-port/wifi-densepose-rs/)
without any sibling under rust-port/ that warranted the extra level.
Move the whole workspace up to v2/ to match v1/ (Python) at the same
depth and shorten every cd / build command across the repo.

git mv preserves history for all tracked files. 60 files updated for
path references (CI workflows, ADRs, docs, scripts, READMEs, internal
.claude-flow state). Two manual fixes for relative-cd paths in
CLAUDE.md and ADR-043 that became wrong after the depth change
(cd ../.. → cd ..).

Validated:
- cargo check --workspace --no-default-features → clean (after target/
  nuke; the gitignored target/ was carried by the OS rename and had
  hard-coded old paths in build scripts)
- cargo test --workspace --no-default-features → 1,539 passed, 0 failed,
  8 ignored (same totals as pre-rename)
- ESP32-S3 on COM7 → still streaming live CSI (cb #40300, RSSI -64 dBm)

After-merge follow-up: contributors should `rm -rf v2/target` once and
let cargo regenerate from the new path.
2026-04-25 21:28:13 -04:00
..
benches chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00
src chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00
Cargo.toml chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00
README.md chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00

README.md

ruv-neural-memory

Persistent neural state memory with vector search and longitudinal tracking.

Overview

ruv-neural-memory provides in-memory and persistent storage for neural embeddings, supporting brute-force and HNSW-based approximate nearest neighbor search. It includes session-based memory management for organizing recordings by subject and session, longitudinal drift detection for tracking embedding distribution changes over time, and RVF/bincode persistence for durable storage.

Features

  • Embedding store (store): NeuralMemoryStore for inserting, querying, and managing collections of NeuralEmbedding values with brute-force nearest neighbor search
  • HNSW index (hnsw): HnswIndex for approximate nearest neighbor search with configurable M (max connections), ef_construction, and ef_search parameters; provides 150x-12,500x speedup over brute-force for large collections
  • Session management (session): SessionMemory and SessionMetadata for organizing embeddings by recording session, subject ID, and timestamp ranges
  • Longitudinal tracking (longitudinal): LongitudinalTracker for detecting embedding distribution drift over time with TrendDirection classification (stable, increasing, decreasing)
  • Persistence (persistence): save_store / load_store for bincode serialization, save_rvf / load_rvf for RuVector format I/O

Usage

use ruv_neural_memory::{
    NeuralMemoryStore, HnswIndex, SessionMemory, SessionMetadata,
    LongitudinalTracker, save_store, load_store,
};
use ruv_neural_core::{NeuralEmbedding, EmbeddingMetadata, Atlas};

// Create a memory store and insert embeddings
let mut store = NeuralMemoryStore::new();
let meta = EmbeddingMetadata {
    subject_id: Some("sub-01".into()),
    session_id: Some("ses-01".into()),
    cognitive_state: None,
    source_atlas: Atlas::Schaefer100,
    embedding_method: "spectral".into(),
};
let emb = NeuralEmbedding::new(vec![0.1, 0.5, -0.3], 0.0, meta).unwrap();
store.insert(emb);

// Query nearest neighbors (brute-force)
let query = vec![0.1, 0.4, -0.2];
let neighbors = store.query_nearest(&query, 5);

// Build HNSW index for fast approximate search
let mut hnsw = HnswIndex::new(16, 200);
// ... insert vectors, then search

// Session-based memory management
let session = SessionMemory::new(SessionMetadata {
    subject_id: "sub-01".into(),
    session_id: "ses-01".into(),
    ..Default::default()
});

// Persistence
save_store(&store, "memory.bin").unwrap();
let loaded = load_store("memory.bin").unwrap();

API Reference

Module Key Types / Functions
store NeuralMemoryStore
hnsw HnswIndex
session SessionMemory, SessionMetadata
longitudinal LongitudinalTracker, TrendDirection
persistence save_store, load_store, save_rvf, load_rvf

Feature Flags

Feature Default Description
std Yes Standard library support
wasm No WASM-compatible storage

Integration

Depends on ruv-neural-core for NeuralEmbedding types. Receives embeddings from ruv-neural-embed. Stored embeddings are queried by ruv-neural-decoder for KNN-based cognitive state classification. Uses bincode for efficient binary serialization.

License

MIT OR Apache-2.0