Skip to content

feat(brain): auto-persist SONA state to Firestore after training (#274)#286

Open
ruvnet wants to merge 2306 commits intomainfrom
feat/sona-auto-persist-firestore
Open

feat(brain): auto-persist SONA state to Firestore after training (#274)#286
ruvnet wants to merge 2306 commits intomainfrom
feat/sona-auto-persist-firestore

Conversation

@ruvnet
Copy link
Copy Markdown
Owner

@ruvnet ruvnet commented Mar 23, 2026

Summary

Wires SONA state persistence into the brain server's training cycle and startup, completing the server-side integration for #274.

Changes

After each training cycle (run_training_cycle):

  • If SONA has patterns, persist stats to Firestore (sona_state/latest)
  • Async write — doesn't block the training response
  • Runs every 5 minutes via brain-train scheduler

On startup (create_router):

Dependency

This PR works now but full pattern-level persistence requires:

What this solves

Before: Every Cloud Run deploy reset SONA to 0 patterns.
After: SONA stats auto-saved to Firestore every 5 min. Once PR #285 merges, patterns will be fully restored on cold start.

Contributes to #274

🤖 Generated with claude-flow

claude and others added 30 commits February 27, 2026 05:16
…WTA partial select

- Fix all 35 compiler warnings across 23 files (unused imports, dead code,
  unused vars, unnecessary parens) — build is now warning-clean
- Optimize NeuromorphicBackend::kuramoto_step O(n²)→O(n):
  use sin/cos sum identity so coupling_i = (K/N)[cos(φ_i)·ΣsinΦ - sin(φ_i)·ΣcosΦ],
  eliminates inner loop for 1000-neuron network (1M→1K ops per tick)
- Optimize k_wta: full sort O(n log n) → select_nth_unstable O(n avg)
  using Rust's pdqselect partial sort
- Add #[inline] to hot paths: kuramoto_step, k_wta, hd_encode, lif_tick
- Fix federation: correctly swap unused FederationError (crdt.rs) and
  unused HashMap (consensus.rs) — both in opposite files from first guess

https://claude.ai/code/session_019Lt11HYsW1265X7jB7haoC
The DRY refactor that extracted shared clustering code accidentally
removed the HashMap import still needed by merge_scenes.

https://claude.ai/code/session_01H1GkTK5z9ppVVQDQukjBsY
  Built from commit cff4349

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
…ross-domain transfer

Performance optimizations (net -134 lines):
- BinaryHeap kNN: O(n log k) vs O(n log n) full sort in SpatialIndex
- Zero-clone behavior tree tick via pointer-based borrow splitting
- VecDeque percept buffer for O(1) front eviction
- HashSet assigned_robots for O(1) membership checks
- Shared clustering module eliminates 3 duplicate implementations

Correctness fixes:
- UntilFail decorator 10k iteration guard prevents infinite loops
- OccupancyGrid bounds-checked get() returns Option<f32>
- Pipeline position_history capped at 1000 entries
- Skill learning gracefully handles empty demonstrations
- Anomaly type gets Serialize/Deserialize derives

Dead code removal:
- Remove unused TrajectoryPoint struct
- Remove unused tracing and rand dependencies

Domain expansion integration (behind `domain-expansion` feature flag):
- RoboticsDomain implements domain::Domain trait with 5 task categories:
  PointCloudClustering, ObstacleAvoidance, SceneGraphConstruction,
  SkillSequencing, SwarmFormation
- 64-dim embedding space compatible with planning/orchestration/synthesis
- Reference solutions, difficulty scaling, cross-domain transfer tests
- Enables Meta Thompson Sampling transfer between robotics and
  existing domains (Rust synthesis, structured planning, tool orchestration)

All 257 tests pass (231 unit + 25 integration + 1 doc-test).

https://claude.ai/code/session_01H1GkTK5z9ppVVQDQukjBsY
…ical

Implements Phase 1 of the EXO-AI × domain-expansion integration plan:
register EXO classical operations as first-class transfer-learning domains
so Thompson Sampling can discover optimal retrieval/traversal strategies.

New: crates/exo-backend-classical/src/domain_bridge.rs

ExoRetrievalDomain (implements Domain trait)
- Vector similarity search as a 3-arm bandit: exact / approximate / beam_rerank
- Tasks parameterized by dim (64-1024), k (3-50), noise (0-0.5)
- Evaluation: correctness = Recall@K, efficiency = inverse-latency, elegance = k-precision
- reference_solution: selects optimal arm based on dim+noise+k

ExoGraphDomain (implements Domain trait)
- Hypergraph traversal as a 3-arm bandit: bfs / approx / hierarchical
- Tasks parameterized by n_entities (50-1000), max_hops (2-6), min_coverage (5-100)
- Evaluation: correctness = coverage ratio, efficiency = hops saved, elegance = headroom
- reference_solution: hierarchical for large graphs, approx for medium

Aligned 64-dim embeddings (dims 5/6/7 = strategy one-hot in both domains)
enables meaningful cross-domain transfer priors:
  "approximate wins on high-dim noisy retrieval" →
  "approx expansion wins on large sparse graphs"

ExoTransferAdapter
- Wraps DomainExpansionEngine, registers both EXO domains
- warmup(N): trains both domains N cycles via evaluate_and_record
- transfer_ret_to_graph(N): initiate_transfer then measure acceleration
- All 8 domain_bridge unit tests pass + doctest compiles

https://claude.ai/code/session_019Lt11HYsW1265X7jB7haoC
- Remove unsafe pointer aliasing in BehaviorTree::tick(), use safe
  disjoint field borrowing instead (P0)
- Fix usize underflow in score_scene_graph when expected_objects < 2 (P0)
- Fix cluster ID overflow in reference_solution for PointCloudClustering (P0)
- Fix NaN handling in MaxDistEntry::cmp — NaN treated as maximally
  distant so it gets evicted from kNN heap first (P1)
- Clamp cosine_distance output to prevent negative values from
  floating-point rounding (P1)
- Change search_radius to return Ok(Vec::new()) for empty index instead
  of Err(EmptyIndex) for correct semantics (P1)
- Add debug_assert guards for empty slices in bounding_sphere and
  cluster_to_object (P1)
- Remove dead PipelineConfig.spatial_search_k field (P2)
- Use serde_json::from_value instead of to_string+from_str roundtrip
  in domain_expansion for better performance (P2)

All 257 tests pass.

https://claude.ai/code/session_01H1GkTK5z9ppVVQDQukjBsY
Phase 2 — exo-manifold/src/transfer_store.rs
  TransferManifold stores (src, dst) transfer priors as 64-dim deformable
  patterns via ManifoldEngine::deform. Sinusoidal domain-ID hashing gives
  meaningful cosine distances for retrieve_similar.

Phase 3 — exo-temporal/src/transfer_timeline.rs
  TransferTimeline records transfer events in the temporal causal graph.
  Each event is linked to its predecessor so the system can trace full
  transfer trajectories. anticipate_next() returns CausalChain +
  SequentialPattern hints.

Phase 4 — exo-federation/src/transfer_crdt.rs
  TransferCrdt propagates transfer priors across the federation using
  LWW-Map (cycle = timestamp) + G-Set for domain discovery. Merges are
  idempotent and commutative. promote_via_consensus runs PBFT Byzantine
  commit before accepting a prior.

Phase 5 — exo-exotic/src/domain_transfer.rs
  StrangeLoopDomain implements the Domain trait: self-referential tasks
  whose solutions are scored by meta-cognitive keyword density.
  CollectiveDomainTransfer couples CollectiveConsciousness with
  DomainExpansionEngine — arm rewards flow into the substrate and
  collective Φ serves as the cycle quality metric.
  EmergentTransferDetector wraps EmergenceDetector to surface non-linear
  capability gains from cross-domain transfer.

All 4 crates gain the ruvector-domain-expansion path dep. 36 new tests,
all green alongside the existing suite.

https://claude.ai/code/session_019Lt11HYsW1265X7jB7haoC
…usion, and benchmarks

New modules for ruvector-robotics:
- bridge/gaussian: GaussianSplat types, PointCloud→Gaussian conversion, vwm-viewer JSON export
- planning: A* pathfinding on OccupancyGrid with octile heuristic, potential field velocity commands
- mcp/executor: ToolExecutor dispatching ToolRequests to perception pipeline and spatial index
- perception/sensor_fusion: multi-sensor cloud fusion with timestamp alignment and voxel downsampling

Rewrites integration tests to use actual crate APIs instead of local reimplementations,
eliminating ~280 lines of false-positive test code. Adds 15 benchmark groups covering
all new modules (Gaussian conversion, A* planning, potential fields, sensor fusion, MCP execution).

All 270+ tests pass including domain-expansion feature.

https://claude.ai/code/session_01H1GkTK5z9ppVVQDQukjBsY
- vector.rs: convert exo_core::Filter Equal conditions to ruvector HashMap
  filter; store and round-trip _pattern_id in metadata
- substrate.rs: implement BettiNumbers, PersistentHomology, SheafConsistency
  for hypergraph_query using VectorDB stats
- anticipation.rs: implement TemporalCycle pre-fetching via sinusoidal
  phase encoding
- crdt.rs: add T: Display bound to reconcile_crdt; look up score from
  ranking_map by format!("{}", result)
- thermodynamics.rs: rust,ignore → rust,no_run
- ExoTransferOrchestrator: new cross-phase wiring module in
  exo-backend-classical that runs all 5 integration phases in a single
  run_cycle() call (bridge → manifold → timeline → CRDT → emergence)
- transfer_pipeline_test.rs: 5 end-to-end integration tests covering the
  full pipeline (single cycle, multi-cycle, emergence, manifold, CRDT)

All 0 failures across full workspace test suite.

https://claude.ai/code/session_019Lt11HYsW1265X7jB7haoC
- ExoTransferOrchestrator.package_as_rvf(): serializes all TransferPriors,
  PolicyKernels, and CostCurves into a 64-byte-aligned RVF byte stream
- ExoTransferOrchestrator.save_rvf(path): convenience write-to-file method
- Enable ruvector-domain-expansion rvf feature in exo-backend-classical
- 3 new RVF tests: empty packager, post-cycle magic verification, save-to-file
- substrate.rs: fill pattern field from returned search vector (r.vector.map(Pattern::new))
- README: document 5-phase transfer pipeline, RVF packaging, updated
  architecture diagram, 4 new Key Discoveries, 3 new Practical Applications

All 0 failures across full workspace test suite.

https://claude.ai/code/session_019Lt11HYsW1265X7jB7haoC
New `rvf` feature flag enables the `ruvf::RoboticsRvf` wrapper that
bridges point clouds, scene graphs, trajectories, Gaussian splats, and
obstacles into the RuVector Format (.rvf) for persistence and similarity
search.

RoboticsRvf supports:
- pack_point_cloud (dim 3)
- pack_scene_objects / pack_scene_graph (dim 9)
- pack_trajectory (dim 3)
- pack_gaussians (dim 7) — converts PointCloud→GaussianSplatCloud→RVF
- pack_obstacles (dim 6)
- query_nearest (kNN via HNSW index)
- open/open_readonly/close lifecycle

9 unit tests covering create, ingest, query, reopen, dimension mismatch,
and empty data rejection. Also fixes unused import warnings in integration
tests. All 290 tests pass across default, domain-expansion, and rvf features.

https://claude.ai/code/session_01H1GkTK5z9ppVVQDQukjBsY
Implements energy-driven computation with Landauer dissipation and
Langevin/Metropolis noise.  Key components:

- State: activation vector + cumulative dissipated-joules counter
- EnergyModel trait + Ising (Hopfield) + SoftSpin (double-well) Hamiltonians
- Couplings: zeros, ferromagnetic ring, Hopfield memory factories
- Params: inverse temperature β, Langevin step η, Landauer cost per irreversible flip
- step_discrete: Metropolis-Hastings spin-flip with Boltzmann acceptance
- step_continuous: overdamped Langevin (central-difference gradient + FDT noise)
- anneal_discrete / anneal_continuous: traced annealing helpers
- inject_spikes: Poisson kick noise, clamp-aware
- Metrics: magnetisation, Hopfield overlap, binary entropy, free energy, Trace
- Motifs: IsingMotif (ring, fully-connected, Hopfield), SoftSpinMotif (random)
- 19 correctness tests: energy invariants, Metropolis, Langevin, Hopfield retrieval
- 4 Criterion benchmark groups: step, 10k-anneal, Langevin, energy eval
- GitHub Actions CI: fmt + clippy + test (ubuntu/macos/windows) + bench compile

https://claude.ai/code/session_019Lt11HYsW1265X7jB7haoC
ruvector-dither (new crate):
- GoldenRatioDither: additive φ-sequence with best 1-D equidistribution
- PiDither: cyclic 256-entry π-byte table for deterministic weight dithering
- quantize_dithered / quantize_slice_dithered: drop-in pre-quantization offset
- quantize_to_code: integer-code variant for packed-weight use
- ChannelDither: per-channel pool seeded by (layer_id, channel_id) pairs
- DitherSource trait for generic dither composition
- 15 unit tests + 3 doctests; 4 Criterion benchmark groups

exo-backend-classical integration:
- ThermoLayer (thermo_layer.rs): Ising motif coherence gate using thermorust
  - Runs Metropolis steps on clamped activations
  - Returns ThermoSignal { lambda, magnetisation, dissipation_j, energy_after }
  - λ-signal = −ΔE/|E₀|: positive means pattern is settling toward coherence
- DitheredQuantizer (dither_quantizer.rs): wraps ruvector-dither for exo tensors
  - GoldenRatio or Pi kind, per-layer seeding, reset support
  - Supports 3/5/7/8-bit quantization with ε-LSB dither amplitude
- 8 new unit tests across both modules; all 74 existing tests still pass

https://claude.ai/code/session_019Lt11HYsW1265X7jB7haoC
…erception

SpatialIndex: replace Vec<Vec<f32>> with flat Vec<f32> buffer for cache
locality and zero per-point heap allocation; use squared Euclidean
distance in kNN/radius search (defer sqrt to final k results); fuse
cosine distance into single loop.

Clustering: add union-by-rank to union-find preventing tree
degeneration (O(α(n)) amortized); add #[inline] on hot helpers.

A* planning: add closed set (HashSet) to avoid re-expanding nodes;
reuse neighbor buffer to eliminate per-expansion Vec allocation;
pre-allocate HashMap capacity; add #[inline] on helpers.

Perception: defer sqrt in bounding_sphere (compare squared distances,
one sqrt at end); defer sqrt in scene graph edge construction (filter
on squared threshold); add #[inline] on dist_3d.

Sensor fusion: pre-allocate merged vectors from total eligible cloud
size. Anomaly detection: fuse distance + statistics into single pass
using Welford's online algorithm (eliminates one full data pass).

All 281 tests pass.

https://claude.ai/code/session_01H1GkTK5z9ppVVQDQukjBsY
Implements ADR-057 with 7 modules (2,940 lines, 54 tests):
- types: 4 new segment types (FederatedManifest 0x33, DiffPrivacyProof 0x34,
  RedactionLog 0x35, AggregateWeights 0x36)
- pii_strip: 3-stage pipeline (detect, redact, attest) with 12 regex rules
- diff_privacy: Gaussian/Laplace noise, RDP accountant, gradient clipping
- federation: ExportBuilder + ImportMerger with version-aware conflict resolution
- aggregate: FedAvg, FedProx, Byzantine-tolerant weighted averaging
- policy: FederationPolicy for selective sharing with allow/deny lists
- error: 15 typed error variants

Also updates rvf-types with 4 new segment discriminants (0x33-0x36),
workspace Cargo.toml, and root README (crate count, segment count,
federated learning code example).

Co-Authored-By: claude-flow <ruv@ruv.net>
feat: rvf-federation crate for federated transfer learning
  Built from commit c550fff

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
Clippy fixes (8 warnings → 0):
- Replace 5 manual Default impls with #[derive(Default)]
- Use .clamp() instead of .min().max() chain
- Use .is_some_and() instead of .map_or(false, ...)
- Add type alias for complex return type in scene_graph_to_adjacency

P0 correctness fixes from code review:
- Fix NaN panic: use unwrap_or(Ordering::Equal) in cognitive_core think()
- Fix integer overflow: use checked_mul in OccupancyGrid::new
- Fix potential unwrap: use map_or in domain_expansion score_avoidance

Co-Authored-By: claude-flow <ruv@ruv.net>
Add repository, homepage, keywords, categories for crates.io listing.
Pin optional dependency versions (ruvector-domain-expansion 2.0.4,
rvf-runtime 0.2, rvf-types 0.2) required for cargo publish.

Co-Authored-By: claude-flow <ruv@ruv.net>
…on-VOZu2

Add ruvector-robotics: unified cognitive robotics platform
  Built from commit 85df6b9

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
- Replace debug_assert with assert for bits bounds in quantize functions
- Guard ChannelDither against 0 channels and invalid bits
- Handle non-finite beta/rate in Langevin/Poisson noise (return 0)
- Remove unused itertools dependency from thermorust
- Fix partial_cmp().unwrap() NaN panics across 7 exo-ai files
- Fix SystemTime unwrap() in transfer_crdt (use unwrap_or_default)
- Fix domain ID mismatch (exo_retrieval → exo-retrieval) in orchestrator
- Update tests to match corrected domain IDs

Co-Authored-By: claude-flow <ruv@ruv.net>
Required for crates.io publishing.

Co-Authored-By: claude-flow <ruv@ruv.net>
…README

- Add ruvector-dither to Advanced Math & Inference section
- Add thermorust to Neuromorphic & Bio-Inspired Learning section
- Add collapsed Cognitive Robotics section for ruvector-robotics

Co-Authored-By: claude-flow <ruv@ruv.net>
…rsion deps

- Run cargo fmt across entire workspace
- Create README.md files for all 9 EXO-AI crates
- Convert path dependencies to crates.io version dependencies for publishing
- Add [patch.crates-io] to exo workspace for local development

Co-Authored-By: claude-flow <ruv@ruv.net>
Published to crates.io:
- exo-core v0.1.1
- exo-temporal v0.1.1
- exo-hypergraph v0.1.1
- exo-manifold v0.1.1
- exo-federation v0.1.1
- exo-exotic v0.1.1
- exo-backend-classical v0.1.1

Changes from v0.1.0:
- Fix NaN panics in all partial_cmp().unwrap() calls
- Fix domain ID mismatch (underscores → hyphens)
- Fix SystemTime unwrap → unwrap_or_default
- Add README.md for all crates
- Gate rvf feature behind feature flag in exo-backend-classical
- Convert path dependencies to crates.io version dependencies

Co-Authored-By: claude-flow <ruv@ruv.net>
ADR-029: Multi-paradigm integration architecture for EXO-AI
Built from commit 75fa1c4

Platforms updated:
- linux-x64-gnu
- linux-x64-musl
- linux-arm64-gnu
- linux-arm64-musl
- darwin-x64
- darwin-arm64
- win32-x64-msvc
- wasm

Generated by GitHub Actions
github-actions Bot and others added 29 commits March 17, 2026 19:20
  Built from commit 084954f

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
HNSW fix (ruvllm-wasm v2.0.2):
- Fixed panic at 12+ patterns caused by entry_point referencing
  non-existent index before pattern was pushed to array
- Added bounds checking in search_layer() as defensive measure

ONNX routing fix (ruvector v0.2.14):
- Fixed IntelligenceEngine.route() using sync embed() instead of
  async embedAsync(), causing fallback to hash embeddings
- Route now correctly uses ONNX 384-dim semantic embeddings

π.ruv.io hooks integration:
- Added SessionStart hook to sync LoRA weights from π.ruv.io
- Added Stop hook to share session summary
- Added PostToolUse[Task] hook to share successful completions
- Generated Pi key for authentication

Co-Authored-By: claude-flow <ruv@ruv.net>
  Built from commit 593ad1a

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
The WASM build was panicking in Node.js because std::time::Instant
is not supported on wasm32-unknown-unknown target. This fix:

- Adds time_compat module with PortableInstant/PortableTimestamp
- Uses monotonic counter in WASM mode (sufficient for ordering/stats)
- Uses std::time::Instant on native platforms (accurate timing)
- Updates algorithm, canonical, certificate, optimization, subpolynomial modules

The fix uses conditional compilation via the existing `wasm` feature flag.

Closes #267

Co-Authored-By: claude-flow <ruv@ruv.net>
Update Claude agent definitions, streamline statusline helper,
improve hook handler routing, and fix native worker compatibility.

Co-Authored-By: claude-flow <ruv@ruv.net>
fix: WasmMinCut Node.js panic from std::time (fixes #267)
  Built from commit 1268423

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
* feat: add ruvector-sparsifier crate — dynamic spectral graph sparsification

Implements AdaptiveGeoSpar, a dynamic spectral sparsifier that maintains
a compressed shadow graph preserving Laplacian energy within (1±ε).

Core crate (ruvector-sparsifier):
- SparseGraph with dynamic edge operations and Laplacian QF
- Backbone spanning forest via union-find for connectivity
- Random walk effective resistance estimation for importance scoring
- Spectral sampling proportional to weight × importance × log(n)/ε²
- SpectralAuditor with quadratic form, cut, and conductance probes
- Pluggable traits: Sparsifier, ImportanceScorer, BackboneStrategy
- 49 tests (31 unit + 17 integration + 1 doc-test), all passing
- Benchmarks: build 161µs, insert 81µs, audit 39µs (n=100)

WASM crate (ruvector-sparsifier-wasm):
- Full wasm-bindgen bindings via WasmSparsifier and WasmSparseGraph
- JSON-based API for browser/edge deployment
- Compiles cleanly on native target

Research (docs/research/spectral-sparsification/):
- 00: Executive summary and impact projections
- 01: SOTA survey (ADKKP 2016 → STACS 2026)
- 02: Rust crate design and API
- 03: RuVector integration architecture (4-tier control plane)
- 04: Companion systems (conformal drift, attributed ANN)

https://claude.ai/code/session_01A6YKtTrSPeV36Xamz9hRCb

* perf: ultra optimizations across core distance, SIMD, and sparsifier hot paths

Core distance.rs:
- Manhattan distance now delegates to SIMD (was pure scalar)
- Cosine fallback uses single-pass computation (was 3 separate passes)
- Euclidean fallback uses 4x loop unrolling for better ILP

SIMD intrinsics:
- Add AVX2 manhattan distance (was only AVX-512 or scalar fallback)
- 2x loop unrolling with dual accumulators for AVX2 manhattan
- Sign-bit mask absolute value for branchless abs diff

Sparsifier (O(m) -> O(1) per insert):
- Cache total importance to avoid iterating ALL edges per insert
- Parallel edge scoring via rayon for graphs >100 edges
- Pre-sized HashMap adjacency lists (4 neighbors avg)
- Inline annotations on hot-path graph query methods

https://claude.ai/code/session_01A6YKtTrSPeV36Xamz9hRCb

* fix: resolve clippy warnings in ruvector-sparsifier

- Replace map_or(false, ...) with is_some_and(...) in graph.rs
- Derive Default instead of manual impl for LocalImportanceScorer
- Fix inner/outer attribute conflict on prelude module

Co-Authored-By: claude-flow <ruv@ruv.net>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-Authored-By: claude-flow <ruv@ruv.net>
  Built from commit 1d60bf0

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
  Built from commit 3b0cfaa

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
Co-Authored-By: claude-flow <ruv@ruv.net>
  Built from commit 4737167

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
Describes how ruvector-sparsifier integrates into the brain server's
KnowledgeGraph for O(n log n) analytics instead of O(n²).

Co-Authored-By: claude-flow <ruv@ruv.net>
Co-Authored-By: claude-flow <ruv@ruv.net>
  Built from commit 881e57e

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
  Built from commit 9679411

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
…116)

* feat: integrate ruvector-sparsifier into brain server (ADR-116)

- Add ruvector-sparsifier dependency to mcp-brain-server
- KnowledgeGraph now maintains an AdaptiveGeoSpar alongside full graph
- Sparsifier updates incrementally on add_memory / remove_memory
- Lazy initialization: sparsifier builds on first access or startup hydration
- rebuild_graph optimization action also rebuilds the sparsifier
- StatusResponse exposes sparsifier_compression and sparsifier_edges
- Full graph preserved for exact lookups — sparsifier is additive only

Co-Authored-By: claude-flow <ruv@ruv.net>

* build: add ruvector-sparsifier to Docker build context

- Add COPY for ruvector-sparsifier crate
- Add to workspace members in Cargo.workspace.toml
- Strip bench/example sections from sparsifier Cargo.toml in Docker

Co-Authored-By: claude-flow <ruv@ruv.net>
  Built from commit 61164d9

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
The Dockerfile comments out the simd_intrinsics module but distance.rs
still referenced it. Replace with pure Rust fallback for Cloud Run build.

Co-Authored-By: claude-flow <ruv@ruv.net>
  Built from commit 3e554c9

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
* docs: DrAgnes project overview and system architecture research

Establishes the DrAgnes AI-powered dermatology intelligence platform
research initiative with comprehensive system architecture covering
DermLite integration, CNN classification pipeline, brain collective
learning, offline-first PWA design, and 25-year evolution roadmap.

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: DrAgnes HIPAA compliance strategy and data sources research

Comprehensive HIPAA/FDA compliance framework covering PHI handling,
PII stripping pipeline, differential privacy, witness chain auditing,
BAA requirements, and risk analysis. Data sources document catalogs
18 training datasets, medical literature sources, and real-world data
streams including HAM10000, ISIC Archive, and Fitzpatrick17k.

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: DrAgnes DermLite integration and 25-year future vision research

DermLite integration covers HUD/DL5/DL4/DL200 device capabilities,
image capture via MediaStream API, ABCDE criteria automation, 7-point
checklist, Menzies method, and pattern analysis modules. Future vision
spans AR-guided biopsy (2028), continuous monitoring wearables (2040),
genomic fusion (2035), BCI clinical gestalt (2045), and global
elimination of late-stage melanoma detection by 2050.

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: DrAgnes competitive analysis and deployment plan research

Competitive analysis covers SkinVision, MoleMap, MetaOptima, Canfield,
Google Health, 3Derm, and MelaFind with feature matrix comparison.
Deployment plan details Google Cloud architecture with Cloud Run
services, Firestore/GCS data storage, Pub/Sub events, multi-region
strategy, security configuration, cost projections ($3.89/practice at
1000-practice scale), and disaster recovery procedures.

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: ADR-117 DrAgnes dermatology intelligence platform

Proposes DrAgnes as an AI-powered dermatology platform built on
RuVector's CNN, brain, and WASM infrastructure. Covers architecture,
data model, API design, HIPAA/FDA compliance strategy, 4-phase
implementation plan (2026-2051), cost model showing $3.89/practice
at scale, and acceptance criteria targeting >95% melanoma sensitivity
with offline-first WASM inference in <200ms.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(dragnes): deployment config — Dockerfile, Cloud Run, PWA manifest, service worker

Add production deployment infrastructure for DrAgnes:
- Multi-stage Dockerfile with Node 20 Alpine and non-root user
- Cloud Run knative service YAML (1-10 instances, 2 vCPU, 2 GiB)
- GCP deploy script with rollback support and secrets integration
- PWA manifest with SVG icons (192x192, 512x512)
- Service worker with offline WASM caching and background sync
- TypeScript configuration module with CNN, privacy, and brain settings

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs(dragnes): user-facing documentation and clinical guide

Add comprehensive DrAgnes documentation covering:
- Getting started and PWA installation
- DermLite device integration instructions
- HAM10000 classification taxonomy and result interpretation
- ABCDE dermoscopy scoring methodology
- Privacy architecture (DP, k-anonymity, witness hashing)
- Offline mode and background sync behavior
- Troubleshooting guide
- Clinical disclaimer and regulatory status

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(dragnes): brain integration — pi.ruv.io client, offline queue, witness chains, API routes

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(dragnes): CNN classification pipeline with ABCDE scoring and privacy layer

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(dragnes): resolve build errors by externalizing @ruvector/cnn

Mark @ruvector/cnn as external in Rollup/SSR config so the dynamic
import in the classifier does not break the production build.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(dragnes): app integration, health endpoint, build validation

- Add DrAgnes nav link to sidebar NavMenu
- Create /api/dragnes/health endpoint with config status
- Add config module exporting DRAGNES_CONFIG
- Update DrAgnes page with loading state & error boundaries
- All 37 tests pass, production build succeeds

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(dragnes): benchmarks, dataset metadata, federated learning, deployment runbook

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(dragnes): use @vite-ignore for optional @ruvector/cnn import

Prevents Vite dev server from failing on the optional WASM dependency
by using /* @vite-ignore */ comment and variable-based import path.

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(dragnes): reduce false positives with Bayesian-calibrated classifier

Apply HAM10000 class priors as Bayesian log-priors to demo classifier,
learned from pi.ruv.io brain specialist agent patterns:
- nv (66.95%) gets strong prior, reducing over-classification of rare types
- mel requires multiple simultaneous features (dark + blue + multicolor +
  high variance) to overcome its 11.11% prior
- Added color variance analysis as asymmetry proxy
- Added dermoscopic color count for multi-color detection
- Platt-calibrated feature weights from brain melanoma specialist

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(dragnes): require ≥2 concurrent evidence signals for melanoma

A uniformly dark spot was triggering melanoma at 74.5%. Now requires
at least 2 of: [dark >15%, blue-gray >3%, ≥3 colors, high variance]
to overcome the melanoma prior. Proven on 6 synthetic test cases:
0 false positives, 1/1 true melanoma detected at 91.3%.

Co-Authored-By: claude-flow <ruv@ruv.net>

* data(dragnes): HAM10000 metadata and analysis script

Add comprehensive analysis of the HAM10000 skin lesion dataset based on
published statistics from Tschandl et al. 2018. Generates class distribution,
demographic, localization, diagnostic method, and clinical risk pattern
analysis. Outputs both markdown report and JSON stats for the knowledge module.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(dragnes): HAM10000 clinical knowledge module with demographic adjustment

Add ham10000-knowledge.ts encoding verified HAM10000 statistics as structured
data for Bayesian demographic adjustment. Includes per-class age/sex/location
risk multipliers, clinical decision thresholds (biopsy at P(mal)>30%, urgent
referral at P(mel)>50%), and adjustForDemographics() function implementing
posterior probability correction based on patient demographics.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(dragnes): integrate HAM10000 knowledge into classifier

Add classifyWithDemographics() method to DermClassifier that applies Bayesian
demographic adjustment after CNN classification. Returns both raw and adjusted
probabilities for transparency, plus clinical recommendations (biopsy, urgent
referral, monitor, or reassurance) based on HAM10000 evidence thresholds.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(dragnes): wire HAM10000 demographics into UI

- Add patient age/sex inputs in Capture tab
- Toggle for HAM10000 Bayesian adjustment
- Pass body location from DermCapture to classifyWithDemographics()
- Clinical recommendation banner in Results tab with color-coded
  risk levels (urgent_referral/biopsy/monitor/reassurance)
- Shows melanoma + malignant probabilities and reasoning

Co-Authored-By: claude-flow <ruv@ruv.net>

* refactor(dragnes): move to standalone examples/dragnes/ app

Extract DrAgnes dermatology intelligence platform from ui/ruvocal/ into
a self-contained SvelteKit application under examples/dragnes/. Includes
all library modules, components, API routes, tests, deployment config,
PWA assets, and research documentation. Updated paths for standalone
routing (no /dragnes prefix), fixed static asset references, and
adjusted test imports.

Co-Authored-By: claude-flow <ruv@ruv.net>

* revert: restore ui/ruvocal to main state -- remove DrAgnes commingling

Remove all DrAgnes-related files, components, routes, and config from
ui/ruvocal/ so it matches the main branch exactly. DrAgnes now lives
as a standalone app in examples/dragnes/.

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(ruvocal): fix icon 404 and FoundationBackground crash

- Manifest icon paths: /chat/chatui/ → /chatui/ (matches static dir)
- FoundationBackground: guard against undefined particles in connections

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(ruvocal): MCP SSE auto-reconnect on stale session (404/connection errors)

- Widen isConnectionClosedError to catch 404, fetch failed, ECONNRESET
- Add transport readyState check in clientPool for dead connections
- Retry logic now triggers reconnection on stale SSE sessions

Co-Authored-By: claude-flow <ruv@ruv.net>

* chore: update gitignore for nested .env files and Cargo.lock

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: update links in README for self-learning, self-optimizing, embeddings, verified training, search, storage, PostgreSQL, graph, AI runtime, ML framework, coherence, domain models, hardware, kernel, coordination, packaging, routing, observability, safety, crypto, and lineage sections

* docs: ADR-115 cost-effective strategy + ADR-118 tiered crawl budget

Add Section 15 to ADR-115 with cost-effective implementation strategy:
- Three-phase budget model ($11-28/mo -> $73-108 -> $158-308)
- CostGuardrails Rust struct with per-phase presets
- Sparsifier-aware graph management (partition on sparse edges)
- Partition timeout fix via caching + background recompute
- Cloud Scheduler YAML for crawl jobs
- Anti-patterns and cost monitoring

Create ADR-118 as standalone cost strategy ADR with:
- Detailed per-phase cost breakdowns
- Guardrail enforcement points
- Partition caching strategy with request flow
- Acceptance criteria tied to cost targets

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: add pi.ruv.io brain guidance and project structure to CLAUDE.md

- When/how to use brain MCP tools during development
- Brain REST API fallback when MCP SSE is stale
- Google Cloud secrets and deployment reference
- Project directory structure quick reference
- Key rules: no PHI/secrets in brain, category taxonomy, stale session fix

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: Common Crawl Phase 1 benchmark — pipeline validation results

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(brain): make InjectRequest.source optional for batch inject

The batch endpoint falls back to BatchInjectRequest.source when items
don't have their own source field, but serde deserialization failed
before the handler could apply this logic (422). Adding #[serde(default)]
lets items omit source when using batch inject.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat: Common Crawl Phase 1 deployment script — medical domain scheduler jobs

Deploy CDX-targeted crawl for PubMed + dermatology domains via Cloud Scheduler.
Uses static Bearer auth (brain server API key) instead of OIDC since Cloud Run
allows unauthenticated access and brain's auth rejects long JWT tokens.

Jobs: brain-crawl-medical (daily 2AM, 100 pages), brain-crawl-derm (daily 3AM,
50 pages), brain-partition-cache (hourly graph rebuild).

Tested: 10 new memories injected from first run (1568->1578). CDX falls back to
Wayback API from Cloud Run. ADR-118 Phase 1 implementation.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat: ADR-119 historical crawl evolutionary comparison

Implement temporal knowledge evolution tracking across quarterly
Common Crawl snapshots (2020-2026). Includes:
- ADR-119 with architecture, cost model, acceptance criteria
- Historical crawl import script (14 quarterly snapshots, 5 domains)
- Evolutionary analysis module (drift detection, concept birth, similarity)
- Initial analysis report on existing brain content (71 memories)

Cost: ~$7-15 one-time for full 2020-2026 import.

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: update ADR-115/118/119 with Phase 1 implementation results

- ADR-115: Status → Phase 1 Implemented, actual import numbers (1,588 memories,
  372K edges, 28.7x sparsifier), CDX vs direct inject pipeline status
- ADR-118: Status → Phase 1 Active, scheduler jobs documented, CDX HTML
  extractor issue + direct inject workaround, actual vs projected cost
- ADR-119: 30+ temporal articles imported (2020-2026), search verification
  confirmed, acceptance criteria progress tracked

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat: WET processing pipeline for full medical + CS corpus import (ADR-120)

Bypasses broken CDX HTML extractor by processing pre-extracted text
from Common Crawl WET files. Filters by 30 medical + CS domains,
chunks content, and batch injects into pi.ruv.io brain.

Includes: processor, filter/injector, Cloud Run Job config,
orchestrator for multi-segment processing.

Target: full corpus in 6 weeks at ~$200 total cost.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat: Cloud Run Job deployment for full 6-year Common Crawl import

- Expanded domain list to 60+ medical + CS domains with categorized tagging
- Cloud Run Job config: 10 parallel tasks, 100 segments per crawl
- Multi-crawl orchestrator for 14 quarterly snapshots (2020-2026)
- Enhanced generateTags with domain-specific labels for oncology, dermatology,
  ML conferences, research labs, and academic institutions
- Target: 375K-500K medical/CS pages over 5 months

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix: correct Cloud Run Job deploy to use env-vars-file and --source build

- Use --env-vars-file (YAML) to avoid comma-splitting in domain list
- Use --source deploy to auto-build container from Dockerfile
- Use correct GCS bucket (ruvector-brain-us-central1)
- Use --tasks flag instead of --task-count

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix: bake WET paths into container image to avoid GCS auth at runtime

- Embed paths.txt directly into Docker image during build
- Remove GCS bucket dependency from entrypoint
- Add diagnostic logging for brain URL and crawl index per task

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: update ADR-120 with deployment results and expanded domain list

- Status → Phase 1 Deployed
- 8 local segments: 109 pages injected from 170K scanned
- Cloud Run Job executing (50 segments, 10 parallel)
- 4 issues fixed (paths corruption, task index, comma splitting, gsutil)
- Domain list expanded 30 → 60+
- Brain: 1,768 memories, 565K edges, 39.8x sparsifier

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix: WET processor OOM — process records inline, increase memory to 2Gi

Node.js heap exhausted at 512MB buffering 21K WARC records.
Fix: process each record immediately instead of accumulating in
pendingRecords array. Also cap per-record content length and
increase Cloud Run Job memory from 1Gi to 2Gi with --max-old-space-size=1536.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat: add 30 physics domains + keyword detection to WET crawler

Add CERN, INSPIRE-HEP, ADS, NASA, LIGO, Fermilab, SLAC, NIST,
Materials Project, Quanta Magazine, quantum journals, IOP, APS,
and national labs. Physics keyword detection for dark matter,
quantum, Higgs, gravitational waves, black holes, condensed matter,
fusion energy, neutrinos, and string theory.

Total domains: 90+ (medical + CS + physics).

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat: expand WET crawler to 130+ domains across all knowledge areas

Added: GitHub, Stack Overflow/Exchange, patent databases (USPTO, EPO),
preprint servers (bioRxiv, medRxiv, chemRxiv, SSRN), Wikipedia,
government (NSF, DARPA, DOE, EPA), science news, academic publishers
(JSTOR, Cambridge, Sage, Taylor & Francis), data repositories
(Kaggle, Zenodo, Figshare), and ML explainer blogs.

Total: 130+ domains covering medical, CS, physics, code, patents,
preprints, regulatory, news, and open data.

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(brain): update Gemini model to gemini-2.5-flash with env override

Old model ID gemini-2.5-flash-preview-05-20 was returning 404.
Updated default to gemini-2.5-flash (stable release).
Added GEMINI_MODEL env var override for future flexibility.

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat(brain): integrate Google Search Grounding into Gemini optimizer (ADR-121)

Add google_search tool to Gemini API calls so the optimizer verifies
generated propositions against live web sources. Grounding metadata
(source URLs, support scores, search queries) logged for auditability.

- google_search tool added to request body
- Grounding metadata parsed and logged
- Configurable via GEMINI_GROUNDING env var (default: true)
- Model updated to gemini-2.5-flash (stable)
- ADR-121 documents integration

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(brain): deploy-all.sh preserves env vars, includes all features

CRITICAL FIX: Changed --set-env-vars to --update-env-vars so deploys
don't wipe FIRESTORE_URL, GEMINI_API_KEY, and feature flags.

Now includes:
- FIRESTORE_URL auto-constructed from PROJECT_ID
- GEMINI_API_KEY fetched from Google Secrets Manager
- All 22 feature flags (GWT, SONA, Hopfield, HDC, DentateGyrus,
  midstream, sparsifier, DP, grounding, etc.)
- Session affinity for SSE MCP connections

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: update ADR-121 with deployment verification and optimization gaps

- Verified: Gemini 2.5 Flash + grounding working
- Brain: 1,808 memories, 611K edges, 42.4x sparsifier
- Documented 5 optimization opportunities:
  1. Graph rebuild timeout (>90s for 611K edges)
  2. In-memory state loss on deploy
  3. SONA needs trajectory injection path
  4. Scheduler jobs need first auto-fire
  5. WET daily needs segment rotation

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: design rvagent autonomous Gemini grounding agents (ADR-122)

Four-phase system for autonomous knowledge verification and enrichment
of the pi.ruv.io brain using Gemini 2.5 Flash with Google Search
grounding. Addresses the gap where all 11 propositions are is_type_of
and the Horn clause engine has no relational data to chain.

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: ADR-122 Rev 2 — candidate graph, truth maintenance, provenance

Applied 6 priority revisions from architecture review:
1. Reworked cost model with 3 scenarios (base/expected/worst)
2. Added candidate vs canonical graph separation with promotion gates
3. Narrowed predicate set to causes/treats/depends_on/part_of/measured_by
4. Replaced regex-only PHI with allowlist-based serialization
5. Added truth maintenance state machine (7 proposition states)
6. Added provenance schema for every grounded mutation

Status: Approved with Revisions

Co-Authored-By: claude-flow <ruv@ruv.net>

* feat: implement 4 Gemini grounding agents + Cloud Run deploy (ADR-122)

Phase 1 (Fact Verifier): verified 2 memories with grounding sources
Phase 2 (Relation Generator): found 1 'contradicts' relation
Phase 3 (Cross-Domain Explorer): framework working, needs JSON parse fix
Phase 4 (Research Director): framework working, needs drift data

Scripts: gemini-agents.js, deploy-gemini-agents.sh
Cloud Run Job + 4 scheduler entries deploying.
Brain grew: 1,809 → 1,812 (+3 from initial run)

Co-Authored-By: claude-flow <ruv@ruv.net>

* perf(brain): upgrade to 4 CPU / 4 GiB / 20 instances + rate limit WET injector

- Cloud Run: 2 CPU → 4 CPU, 2 GiB → 4 GiB, max 10 → 20 instances
- WET injector: 1s delay between batch injects to prevent brain saturation
- Deploy script updated to match new resource allocation

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs: ADR-122 Rev 2 — candidate graph, truth maintenance, provenance

Co-Authored-By: claude-flow <ruv@ruv.net>
  Built from commit 326fc77

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
#273: trajectoriesRecorded always returns 0
Root cause: Rust CoordinatorStats serializes as trajectories_buffered
but TypeScript expects trajectoriesRecorded. Added trajectories_recorded
field and mapped snake_case → camelCase in TypeScript wrapper.

#274: Save/load learned state for persistence across restarts
Added serialize_state() to LoopCoordinator and saveState() to
NAPI + TypeScript wrapper.
Co-Authored-By: claude-flow <ruv@ruv.net>
  Built from commit 32332e6

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
  Built from commit 1b1a85a

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
- After each training cycle, if patterns exist, persist SONA stats
  to Firestore collection 'sona_state' (doc 'latest')
- On startup, check Firestore for persisted state and log
- Full pattern restore (load_state) will activate once sona >= 0.1.8
  merges (PR #285)

This ensures SONA learning survives Cloud Run deploys by writing
to durable storage after every train cycle (every 5 minutes).

Co-Authored-By: claude-flow <ruv@ruv.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants