Skip to content

fix(mcp): align hooks_learn persistence path with hooks_batch_learn#330

Open
dmoellenbeck wants to merge 2494 commits intoruvnet:mainfrom
dmoellenbeck:fix/hooks-learn-persistence
Open

fix(mcp): align hooks_learn persistence path with hooks_batch_learn#330
dmoellenbeck wants to merge 2494 commits intoruvnet:mainfrom
dmoellenbeck:fix/hooks-learn-persistence

Conversation

@dmoellenbeck
Copy link
Copy Markdown

Summary

  • hooks_learn and related handlers (hooks_learning_config, hooks_learning_stats, hooks_learning_update) used intel.learning — an instance property that is never persisted by save() (which writes this.data)
  • hooks_batch_learn correctly used intel.data.learning — inside this.data, persisted to disk
  • This caused Q-table updates from hooks_learn to be lost on every MCP restart, and the two handlers maintained separate, disconnected Q-tables

Fix

Change all 7 occurrences of intel.learning to intel.data.learning in npm/packages/ruvector/bin/mcp-server.js (lines 2376-2477). One-line semantic change, applied consistently.

Test plan

  • Start MCP server, call hooks_learn with a reward experience
  • Verify hooks_learning_stats shows totalUpdates > 0
  • Restart MCP server
  • Verify hooks_learning_stats still shows the same totalUpdates (persisted)
  • Call hooks_batch_learn, then hooks_learn — verify both see the same Q-table

Ref: #280

claude and others added 30 commits March 16, 2026 23:21
…omains

New discovery files covering unexplored knowledge frontiers:
- Exotic AI architectures (25): Liquid NNs, KANs, Mamba, Neural ODEs, MoE
- Consciousness & cognition (20): IIT, GWT, Free Energy, Active Inference
- Quantum biology (20): photosynthesis coherence, enzyme tunneling, magnetoreception
- Convergent technologies (20): BCI, xenobots, molecular machines, DNA computing
- Dark frontiers (21): dark matter/energy, vacuum decay, Fermi paradox
- Xenolinguistics (15): SETI protocols, whale decoding, biosemiotics
- Post-scarcity economics (15): UBI, DAOs, degrowth, circular economy
- Biomimetic systems (15): slime mold computing, mycelial networks, neuromorphic
- Temporal physics (14): time crystals, CTCs, retrocausality, causal sets
- Metacognition & learning (18): MAML, self-play, DreamerV3, MuZero, RLHF

https://claude.ai/code/session_01UWE22wnsZRSHKhT4h4Axby
- Add clippy allow attributes to ruvllm for:
  - needless_return, missing_safety_doc, unwrap_or_default
  - assertions_on_constants, if_same_then_else
- Add #[allow(dead_code)] to scalar fallback functions in simd_intrinsics.rs
- Fix Windows test workflow with explicit bash shell
- Add cache-on-failure: true to rust-cache action

Co-Authored-By: claude-flow <ruv@ruv.net>
- Allow clippy::manual_range_contains for test range checks
- Allow clippy::needless_range_loop for test iteration patterns
- These are test-specific patterns that prioritize readability

Co-Authored-By: claude-flow <ruv@ruv.net>
- Add [lints.clippy] and [lints.rust] sections to ruvllm Cargo.toml
- Allow manual_range_contains, needless_range_loop, useless_vec,
  unnecessary_cast, excessive_precision in clippy
- Allow unused_imports, unused_variables, dead_code, unreachable_code,
  unused_parens in rust lints
- These lints are acceptable in test code where readability matters

Co-Authored-By: claude-flow <ruv@ruv.net>
Doc comments use array notation [name] which rustdoc interprets as
intra-doc links. Allow these to prevent doc generation failures.

Co-Authored-By: claude-flow <ruv@ruv.net>
- Fix Option<MetalBuffer>.buffer access in metal/buffers.rs test
- Add clippy lint allows for metal code patterns
- Ignore nested node_modules and UI build artifacts

Co-Authored-By: claude-flow <ruv@ruv.net>
…et-finder-YUAhU

Merged after resolving conflicts. Adds:
- Cloud-native data pipeline with real-time injection
- PubMed/arXiv research discovery integration  
- Multi-domain learning optimization endpoints
- 7-phase ingestion pipeline (validate → dedupe → chunk → embed → novelty score → compress → store)
- Cloud Scheduler jobs for brain optimization
  Built from commit a0a0f23

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

  🤖 Generated by GitHub Actions
…96 §10)

- CommonCrawlAdapter with CDX index queries and WARC range-GET fetch
- URL and content deduplication using DashMap (1M URLs, 0.1% FPR)
- Text extraction from WARC with script/style removal
- New endpoints: /v1/pipeline/crawl/discover and /v1/pipeline/crawl/stats
- InjectionSource::CommonCrawl variant added
- Feature-gate temporal_neural_solver for non-x86 platforms
- Fix missing brace in optimize_endpoint

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

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

  🤖 Generated by GitHub Actions
Three-tier value framework:
- Tier 1 (practical): Agent memory, drift detection, distillation, retrieval
- Tier 2 (if works): Conservative vs aggressive compression paths
- Tier 3 (exotic): Semantic nervous system, swarm memory, web archaeology

Conservative claims:
- PiQ3 quantization: 10.7x (validated)
- SimHash dedup: 3-5x on news, 1.5-2x diverse (validated)
- HNSW: indexing, not compression (clarified)
- Attractor distillation: 100x (hypothesis, requires validation)

Use case prioritization table with value/risk/fit scoring.
Failure modes: edge case destruction, HNSW complexity, temporal
hallucination, provenance loss.

Acceptance test: 3 monthly crawls, measure recall@10 >= 0.90
with >= 10x storage reduction before claiming aggressive ratios.

Cost estimates: $150/mo conservative, $75/mo aggressive.

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

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

  🤖 Generated by GitHub Actions
Fixes per review feedback:

1. Crawl ID hygiene:
   - Changed all CC-MAIN-2026-10 references to CC-MAIN-2026-08 (latest public)
   - Acceptance test uses CC-MAIN-2026-06, 07, 08 (all publicly available)

2. Memorystore cost correction:
   - $8/mo → $5-200/mo with footnote
   - Notes ~$160/mo for 8 GiB Basic tier (actual Google pricing)
   - Offers disk-backed SQLite as $5-50/mo alternative

3. Cloud Run costs now usage-dependent:
   - Split by workload type: ingest ($20-50), retrieval ($100-200), backfill
   - Total estimates: $160-340/mo (disk cache), $230-480/mo (Memorystore)
   - Optimization options table with trade-offs

4. Tightened acceptance test:
   - Exact dataset: 1M pages × 3 crawls
   - Required measurements table: Recall@10, nDCG@10, storage, p95/p99, provenance
   - Pass criteria: all targets met simultaneously

5. Added mandatory exemplar retention rule (§9.0):
   - At least one raw exemplar per cluster
   - At least one provenance anchor per cluster
   - Preserve high-novelty outliers
   - Never merge without preserving lineage edges

6. Updated decision summary to engineering language:
   - Phase 1 scope explicitly limited to validated techniques
   - Research scope marked experimental pending benchmark gates
   - Acceptance gate with specific crawl IDs and metrics

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

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

  🤖 Generated by GitHub Actions
…DR-115)

Implements tier-aware product quantization for embedding compression:
- 3-bit (CentroidMerged): 8.68x compression, 99.05% recall
- 4-bit (DeltaCompressed): 6.83x compression, 99.78% recall
- 2-bit (Archived): 11.91x compression, 95.43% recall

Key changes:
- Add quantization.rs with PiQQuantizer and QuantizedEmbedding types
- Integrate quantization into web_ingest.rs Phase 5
- Add quantized_embedding field to WebMemory struct
- Update ADR-115 with POC validation results

Throughput: 97K-134K embeddings/sec on Apple Silicon

Co-Authored-By: claude-flow <ruv@ruv.net>
- Add web_store and crawl_adapter fields to AppState (types.rs)
- Initialize persistent adapter and web store in create_router (routes.rs)
- Update crawl/discover endpoint to use persistent adapter
- Update crawl/stats endpoint to include WebMemoryStore metrics
- Stats now show tier distribution (full/delta/centroid/archived)

This enables persistent stats accumulation across requests and
prepares for production Common Crawl ingestion per ADR-115.

Co-Authored-By: claude-flow <ruv@ruv.net>
- Add CdxCacheEntry struct with TTL (24h expiration)
- Add cdx_cache DashMap to CommonCrawlAdapter
- Cache CDX query results before URL filtering
- Track cache hits/misses in CommonCrawlStats
- Expose cache stats in /v1/pipeline/crawl/stats endpoint
- Calculate and display cache hit rate percentage

This eliminates redundant CDX API calls when querying the same
domain pattern multiple times, reducing latency and API load.

Co-Authored-By: claude-flow <ruv@ruv.net>
Common Crawl CDX API returns length and offset as strings, not
integers. Add custom deserialize_string_to_u64 function to handle
the type conversion.

Co-Authored-By: claude-flow <ruv@ruv.net>
- Increase request timeout to 120s for slow CDX responses
- Add connect_timeout (30s) and pool_idle_timeout (90s)
- Disable default MIME/status filters for simpler queries
- Update default crawl index to CC-MAIN-2026-08
- Use expect() instead of unwrap_or_default() for clearer errors

Co-Authored-By: claude-flow <ruv@ruv.net>
- Add /v1/pipeline/crawl/test endpoint for diagnosing CDX issues
- Add tracing for CDX query URLs and errors
- Tests connectivity to Common Crawl index API

Co-Authored-By: claude-flow <ruv@ruv.net>
Common Crawl servers don't send proper TLS close_notify, causing
rustls to error. Switch to native-tls which is more lenient.

- Change reqwest feature from rustls-tls to native-tls
- Add openssl to build dependencies
- Add libssl3 to runtime image

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

Common Crawl CDX servers have issues with HTTP/2 and connection reuse:
- Force HTTP/1.1 with http1_only() to avoid protocol issues
- Disable connection pooling (pool_max_idle_per_host=0) since CC closes connections
- Add tcp_nodelay for lower latency
The diagnostic endpoint was using reqwest::get() which creates a new
client with default settings, potentially using rustls instead of our
configured native-tls client. Now uses adapter.test_connectivity()
which uses the properly configured HTTP client.
Compare Common Crawl connectivity against httpbin.org to determine
if the issue is Cloud Run networking or specifically Common Crawl.
The discover endpoint was calling query_cdx twice:
1. Once explicitly to get cdx_records_found
2. Again inside discover_domain

Due to URL deduplication in query_cdx, the second call returned
0 records. Fixed by adding discover_from_records() which accepts
pre-fetched CDX records.
Common Crawl CDX servers are flaky and sometimes return incomplete
responses. Added 3-attempt retry with exponential backoff (1s, 2s)
for both CDX queries and connectivity tests.
Test Internet Archive CDX, data.commoncrawl.org, and httpbin.org
to diagnose if the issue is specific to index.commoncrawl.org.
Try adding HTTP headers that might help with server compatibility:
- Accept: application/json
- Connection: close (avoid keep-alive issues)
When the CDX API at index.commoncrawl.org is unreachable from Cloud Run,
fall back to pre-computed sample CDX records for demonstration purposes.
This allows testing the full pipeline (WARC fetch, extraction, injection)
while the CDX connectivity issue is being investigated.
…wasm

Security:
- Fix ruvnet#256: Add sanitizeShellArg() to MCP workers_create handler
  preventing shell command injection via name/preset/triggers params

Bug fixes:
- Fix ruvnet#257: Add fallback parser in sona-wrapper.js for Rust debug
  format strings from SonaEngine.getStats()
- Fix ruvnet#258: Add force parameter to BackgroundLoop::run_cycle() so
  forceLearn() bypasses 100-trajectory minimum requirement

Features:
- Fix ruvnet#254: Build and publish @ruvector/mincut-wasm@0.1.0 to npm
- Add Wayback Machine fallback for Common Crawl CDX API

Published:
- @ruvector/mincut-wasm@0.1.0
- ruvector@0.2.13

Co-Authored-By: claude-flow <ruv@ruv.net>
ruvnet and others added 29 commits April 3, 2026 14:32
Co-Authored-By: claude-flow <ruv@ruv.net>
…larations

981 Louvain modules, 599K edges, 32,091 names inferred.
Discoveries: Agent Teams, Auto Dream Mode, opus-4-6/sonnet-4-6,
6 amber codenames, Advisor Tool, Agentic Search, 117 new env vars.

Co-Authored-By: claude-flow <ruv@ruv.net>
Full 981-module output too large for git (621MB).
Available as GitHub release download (121MB tar.gz):
https://github.com/ruvnet/rudevolution/releases/tag/v0.1.0-claude-code-v2.1.91

Repo keeps: modules-manifest.json (lists all 661 modules),
witness.json, metrics.json, README.md

Co-Authored-By: claude-flow <ruv@ruv.net>
Compiled ruvector-decompiler to WASM via wasm-pack:
- crates/ruvector-decompiler-wasm/ — wasm-bindgen wrapper (cdylib)
- rayon gated behind optional `parallel` feature (sequential in WASM)
- DecompileConfig now Deserializable for JSON config passing
- 1.5MB WASM binary at npm/packages/ruvector/wasm/

npx ruvector decompile now tries: WASM Louvain → Rust binary → keyword split
Result: 589 modules from Claude Code (was 5 with keyword splitter)

59 Rust tests pass, WASM verified from Node.js.

Co-Authored-By: claude-flow <ruv@ruv.net>
tree.rs fixes:
- Target 10 top-level folders (was collapsing to 1)
- Max cluster size capped at 20% of total (prevents mega-folders)
- Geometric mean normalization (prevents giant clusters absorbing all)
- Leaf threshold: 20 modules at depth 1+ (was 3)

Claude Code result: 19 directories with graph-derived names
(asyncgenerator, bedrockclient, systempromptsectioncache, etc.)

59 tests passing.

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

748 .js files across 19 directories, 3.9MB total.
Folder names derived from TF-IDF scoring of graph clusters:
- asyncgenerator/ (109 files) — async patterns, agent loop
- bedrockclient/ (4) — AWS Bedrock
- react_memo_cache_sentinel/ (585) — React/UI main code
- tengu_log_datadog_events/ (3) — telemetry
- systempromptsectioncache/ (2) — prompt caching
- managedidentitycredential/ (6) — Azure auth

Co-Authored-By: claude-flow <ruv@ruv.net>
Model weight decompilation:
- GGUF v2/v3 parser (self-contained, no ruvllm dep)
- Safetensors JSON header parser
- Architecture inference from tensor shapes (GQA, FFN, vocab)
- Tokenizer extraction, quantization detection
- Witness chain for model provenance
- 6 integration tests, behind `model` feature flag

API probing (live tested):
- Probes Claude, OpenAI, Gemini APIs without weight access
- Detects: streaming, tools, system_prompt, vision capabilities
- Measures: latency, tokens/sec, tokenizer type
- Model fingerprinting via self-identification + math tests
- Verified: Gemini 2.0 Flash (556ms, 46 tok/s, all caps detected)

CLI: npx ruvector decompile --model file.gguf
     npx ruvector decompile --api gemini-2.0-flash

78 Rust tests passing.

Co-Authored-By: claude-flow <ruv@ruv.net>
5 optimization dimensions:
1. Env var injection per task type (effort, brief, subagent model)
2. Agent Booster fast path (WASM Tier 1 from decompiled tool schemas)
3. Permission mode optimization (6 modes mapped to agent types)
4. Context window optimization (cache, deferred loading, compaction)
5. Unreleased feature exploitation (Agent Teams, Plan V2, KAIROS)

Co-Authored-By: claude-flow <ruv@ruv.net>
…R-139)

8 task profiles, 15 tool schemas, context optimizer, settings generator.
133 tests passing. CLI: npx ruvector optimize --profile <type>

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

Co-Authored-By: claude-flow <ruv@ruv.net>
Removed large model weight files from git tracking:
- model/*.bin, model-v2/*.pt, model-v2-r1/*.bin
(Generate locally via scripts/training/train-deobfuscator.py)

Updated: Cargo.lock, npm package.json

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

Server now responds to health/ready within 2 seconds of startup
(was ~3 minutes blocking on Firestore load + re-embedding).

- Firestore load_from_firestore() moved to tokio::spawn (non-blocking)
- Re-embedding deferred to first training cycle (30s after startup)
- HTTP listener binds before any data loading begins

Co-Authored-By: claude-flow <ruv@ruv.net>
Resend monthly limit hit by duplicate welcome emails.
Added recent_welcomes HashMap tracking last welcome time per email.
Skips if same email welcomed within 24 hours.

Co-Authored-By: claude-flow <ruv@ruv.net>
Complete implementation of the RVM microhypervisor:

13 Rust crates (all #![no_std], #![forbid(unsafe_code)]):
- rvm-types: Foundation types (64-byte WitnessRecord, ~40 ActionKind variants)
- rvm-hal: AArch64 EL2 HAL (stage-2 page tables, PL011 UART, GICv2, timer)
- rvm-cap: Capability system (P1/P2 proof verification, derivation trees)
- rvm-witness: Witness logging (FNV-1a hash chain, ring buffer, replay)
- rvm-proof: Proof engine (3-tier, constant-time P2 evaluation)
- rvm-partition: Partition model (lifecycle, split/merge, IPC, device leases)
- rvm-sched: Scheduler (2-signal priority, SMP coordinator, switch hot path)
- rvm-memory: Memory tiers (buddy allocator, 4-tier, RLE compression)
- rvm-coherence: Coherence engine (Stoer-Wagner mincut, adaptive frequency)
- rvm-boot: Bare-metal boot (7-phase measured, EL2 entry, linker script)
- rvm-wasm: Agent runtime (7-state lifecycle, migration, quotas)
- rvm-security: Security gate (validation, attestation, DMA budget)
- rvm-kernel: Integration kernel (boot/tick/create/destroy)

602 tests, 0 failures, 0 clippy warnings.
21 criterion benchmarks (all ADR targets exceeded).
9 ADRs (132-140), 15 design constraints (DC-1 through DC-15).
11 security findings addressed.

Co-Authored-By: claude-flow <ruv@ruv.net>
Wire the unified CoherenceEngine into the kernel with full lifecycle:

- CoherenceEngine: graph-driven scoring, adaptive recomputation, pluggable
  MinCut/Coherence backends (builtin Stoer-Wagner + ruvector stubs)
- Kernel integration: create/destroy auto-register in coherence graph,
  tick() returns EpochResult (scheduler + coherence decision),
  record_communication() feeds the graph
- Scheduler integration: enqueue_partition() injects CutPressure into
  priority (deadline_urgency + cut_pressure_boost per ADR-132 DC-4)
- Split/merge execution: execute_split(), execute_merge() with
  StructuralSplit/StructuralMerge witnesses and precondition checks
- apply_decision() dispatcher: tick → decision → action in one call
- AArch64 bare-metal main.rs: _start → BSS clear → stack → rvm_main
- 614 tests pass across the full RVM workspace (43 in rvm-kernel)

Co-Authored-By: claude-flow <ruv@ruv.net>
Connect the three remaining subsystems through the kernel:

IPC integration:
- create_channel() registers CommEdge + emits witness
- ipc_send() auto-increments coherence graph edge weight (1 per msg)
- ipc_receive() / destroy_channel() with witness records
- IPC traffic directly drives mincut/split/merge decisions

Memory tier integration:
- TierManager integrated into kernel tick (epoch advance + recency decay)
- register_region() / promote_region() / demote_region() with witnesses
- update_region_cut_value() bridges coherence scores → tier placement
- Residency rule: cut_value + recency_score drives Hot/Warm/Dormant/Cold

End-to-end pipeline verified:
  IPC messages → coherence graph weight → tick → split decision →
  apply_decision → new partition → register memory → feed cut_value

625 tests pass across the full RVM workspace (54 in rvm-kernel).

Co-Authored-By: claude-flow <ruv@ruv.net>
Three capability/performance improvements across rvm-cap, rvm-wasm,
and rvm-sched:

P3 Deep Proof Verification (rvm-cap):
- verify_p3() now walks the derivation tree from leaf to root
- Validates: ancestor validity, monotonic depth, epoch ordering
- Bounded by max_depth to prevent DoS (O(depth), typically 8)
- Added find_parent() to DerivationTree for chain traversal
- New DerivationChainBroken error variant

Wasm Host Context Trait (rvm-wasm):
- HostContext trait decouples dispatch from kernel subsystems
- Default implementations provide stub behaviour for testing
- StubHostContext for backward compatibility
- dispatch_host_call() now generic over H: HostContext
- Custom contexts can intercept Send/Receive/Alloc/Free/Spawn

Switch Context Init (rvm-sched):
- SwitchContext::init() sets entry point, SP, VMID, S2 table base
- vmid() / s2_table_base() extract fields from VTTBR_EL2
- save_from() copies full context for simulation
- is_valid_entry() validates non-zero ELR + VTTBR
- SwitchResult captures from/to VMIDs + elapsed_ns
- partition_switch() returns SwitchResult instead of bare u64

633 tests pass across the full RVM workspace.

Co-Authored-By: claude-flow <ruv@ruv.net>
Performance and capability improvements across 4 crates:

Edge weight decay (rvm-coherence):
- decay_weights(decay_bp) decays all edges by N% per epoch
- Auto-prunes edges that reach zero weight
- Engine ticks with 5% decay to prevent stale patterns dominating
- 4 new graph tests (decay, prune, 100%, zero)

Coherence score propagation (rvm-kernel):
- sync_partition_scores() pushes engine scores into Partition objects
- Called automatically in tick() — downstream consumers see fresh values
- PartitionManager::get_mut() and active_ids() for iteration

Security-gated kernel operations:
- checked_create_partition(config, token) — P1 type + rights check
- checked_ipc_send(edge, msg, token) — capability-gated IPC
- SecurityGate pipeline: type → rights → witness → execute
- ProofRejected witness on denial

Degraded mode (DC-6):
- enter_degraded_mode() / exit_degraded_mode() with witnesses
- Zeroes CutPressure in scheduler — deadline-only scheduling
- DegradedModeEntered / DegradedModeExited witness records
- is_degraded() accessor

645 tests pass across the full RVM workspace (62 in rvm-kernel).

Co-Authored-By: claude-flow <ruv@ruv.net>
- README: updated test count to 645, refreshed crate descriptions
  for rvm-kernel (62 tests, full integration), rvm-coherence (59 tests,
  unified engine), rvm-cap (40 tests, P3 verification), rvm-sched
  (49 tests, VMID-aware switch), rvm-wasm (33 tests, HostContext trait)
- ADR-141: documents the coherence engine runtime pipeline —
  IPC→graph feeding, edge decay, score propagation, split/merge
  execution, security gates, degraded mode, tier integration
- Updated P3 proof description from "stub" to "derivation chain"
- Updated DC-6 status to reflect enter/exit with witnesses

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

Seven files changed to close every identified gap:

PartitionManager (rvm-partition):
- Added remove() that frees the slot for reuse
- Added active_ids() iterator for score propagation

Kernel destroy_partition (rvm-kernel):
- Now calls remove() to actually deallocate the partition
- Enforces valid_transition() — rejects invalid state changes
- destroy_partition(id) on already-destroyed ID returns PartitionNotFound

Wasm section parser (rvm-wasm):
- Full validate_module() with LEB128 section size decoding
- Validates section ordering (non-decreasing), no duplicates
- Tracks Type/Function/Memory/Export/Code presence
- WasmSectionId enum with 13 standard Wasm section types
- WasmValidationResult summary struct

KernelHostContext (rvm-kernel):
- Routes Wasm Send → IPC manager with sequence numbering
- Routes Wasm Receive → IPC manager receive
- Connects to real kernel subsystems via mutable references

P3 in SecurityGate (rvm-security):
- GateRequest gains require_p3 + p3_chain_valid fields
- Gate pipeline checks P3 derivation chain validity
- DerivationChainBroken error variant
- proof_tier=3 on successful P3 verification

P3 in ProofEngine (rvm-proof):
- verify_p3() accepts chain_valid bool from rvm-cap
- Emits ProofVerifiedP3 witness on success
- Emits ProofRejected witness on failure
- No more Unsupported stub

Device lease integration (rvm-kernel):
- DeviceLeaseManager added to Kernel struct
- register_device(), grant_device_lease(), revoke_device_lease()
- DeviceLeaseGrant/DeviceLeaseRevoke witness records

648 tests pass, 0 warnings, 0 stubs in hot paths.

Co-Authored-By: claude-flow <ruv@ruv.net>
Co-Authored-By: claude-flow <ruv@ruv.net>
…, performance hardening

Complete security audit remediation across all 14 RVM hypervisor crates:

Security (87 findings fixed — 11 critical, 23 high, 30 medium, 23 low):
- HAL: SPSR_EL2 sanitization before ERET, per-partition VMID with TLB flush,
  2MB mapping alignment enforcement, UART TX timeout
- Proof: Real P3 verification replacing stubs (Hash/Witness/ZK tiers),
  SecurityGate self-verifies P3 (no caller-trusted boolean)
- Witness: SHA-256 chain hashing (ADR-142), strict signing default,
  NullSigner test-gated, XOR-fold hash truncation
- IPC: Kernel-enforced sender identity, channel authorization
- Cap: GRANT_ONCE consumption, delegation depth overflow protection,
  owner verification, derivation tree slot leak rollback
- Types: PartitionId validation (reject 0/hypervisor, >4096)
- WASM: Target/length validation on send(), module size limit, quota dedup
- Scheduler: Binary heap run queue, epoch wrapping_add, SMP cpu_count enforcement
- All integer overflow paths use wrapping_add/saturating_add/checked_add

TEE implementation (ADR-142, all 4 phases):
- Phase 1: SHA-256 replaces FNV-1a in witness chain, attestation, measured boot
- Phase 2: WitnessSigner trait with SignatureError enum, HmacSha256WitnessSigner,
  Ed25519WitnessSigner (verify_strict), DualHmacSigner, constant_time.rs
- Phase 3: SoftwareTeeProvider/Verifier, TeeWitnessSigner<P,V> pipeline
- Phase 4: SignedSecurityGate, WitnessLog::signed_append, CryptoSignerAdapter,
  ProofEngine::verify_p3_signed, KeyBundle derivation infrastructure
- subtle crate integration for ConstantTimeEq

Performance (26 optimizations):
- O(1) lookups: IPC channel, partition, coherence node, nonce replay
- Binary max-heap scheduler queue (O(log n) enqueue/dequeue)
- Coherence adjacency matrix + cached per-node weights
- BuddyAllocator trailing_zeros bitmap scan + precomputed bit_offset LUT
- Cache-line aligned SwitchContext (hot fields first) and PerCpuScheduler
- DerivationTree O(1) parent_index, combined region overlap+free scan
- #[inline] on 11+ hot-path functions, FNV-1a 8x loop unroll
- CapSlot packing (generation sentinel), RunQueueEntry sentinel, MessageQueue bitmask

Documentation:
- ADR-142: TEE-Backed Cryptographic Verification (with 6 reviewer amendments)
- ADR-135 addendum: P3 no longer deferred
- ADR-132 addendum: DC-3 deferral resolved
- ADR-134 addendum: SHA-256 + HMAC signatures

752 tests, 0 failures across 11 library crates + integration suite.

Co-Authored-By: claude-flow <ruv@ruv.net>
feat: ruDevolution AI decompiler + open-claude-code v2 + infrastructure hardening
feat(rvm): security audit + TEE crypto + performance hardening
  Built from commit a8693fc

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

  🤖 Generated by GitHub Actions
  Built from commit 453aed0

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

  🤖 Generated by GitHub Actions
hooks_learn, hooks_learning_config, hooks_learning_stats, and
hooks_learning_update all used `intel.learning` (instance property,
in-memory only, lost on restart). hooks_batch_learn used
`intel.data.learning` (inside `this.data`, persisted by `save()`).

This caused two bugs:
1. hooks_learn Q-table updates lost on MCP restart
2. hooks_learn and hooks_batch_learn maintained separate Q-tables

Fix: change all 7 occurrences of `intel.learning` to
`intel.data.learning` so all handlers share the same persisted path.

Ref: ruvnet#280
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.

3 participants