Commit graph

393 commits

Author SHA1 Message Date
ruvnet
d5e2fc2d87 fix(turbovec): preserve padded geometry and harden inputs 2026-07-27 14:06:25 -04:00
Ofer Shaal
39137f7033 docs(adr): renumber turbovec ADR-194 → ADR-254 to resolve collision
ADR-194 is already taken on main (ruvector ONNX embedder API & throughput).
Renumber this PR's turbovec ADR to the next free number (254), matching the
canonical record on main. Keeps the fuller PR version (D1–D5 divergences table,
D3/D4 measured-milestone markers) and adds a numbering note. Updates the 13
in-crate ADR-194 references and two stray ADR-193 'future work' pointers so they
no longer resolve to the unrelated ONNX ADR.

Refs #520, #521
2026-07-27 14:01:42 -04:00
Ofer Shaal
8c7e35374b test(turbovec): distortion-bound oracle (ADR-194 D4)
Add quantizer_mse_within_paper_bound: draw 400k N(0,1) samples (Box–Muller,
no new deps), quantize via the real quantize_coord path, and assert the
per-coordinate MSE for every width stays under TurboQuant's distortion bound
D_mse ≤ (√3·π/2)·4^(−b) (arXiv:2504.19874) AND within 5% of the Max-1960
Lloyd–Max optimum. A corrupted centroid level trips this far more precisely
than the existing recall>0.5 threshold.

Marks D4 done in ADR-194; updates test count to 17. The full-pipeline
inner-product bound D_prod remains future work (tracked with D5).
2026-07-27 14:01:31 -04:00
Ofer Shaal
4afabb99d6 feat(turbovec): add 3-bit width (ADR-194 D3) — fills the 2↔4-bit recall cliff
Adds BitWidth::Three (8-level Max-1960 optimal N(0,1) reconstruction
levels). pack/unpack, calibration, scoring, and IdMap are width-generic,
so only the centroid table + the enum arms change.

Measured (cargo run --release -p ruvector-turbovec, n=5000 uniform-random,
dim=256, k=10, no rerank, vs exact L2):
  3-bit: recall@10 0.767, 112 B/vec, 9.8x compression, bias -0.0000
landing squarely between 2-bit (0.561) and 4-bit (0.879) — a useful
memory/recall midpoint (~22% smaller than 4-bit for ~0.11 recall).

Also refresh ADR-194: add the 3-bit Validation row, mark D3 done, widen
T2 to {2,3,4}, correct the test count to 16, and scope the provenance
note so the measured recall/compression/bias figures are called measured
while the FAISS-competitive claims stay attributed targets.

16 unit + 1 doc-test pass; clippy clean; new code is rustfmt-clean.
2026-07-27 14:01:31 -04:00
Ofer Shaal
e302958acb docs(adr-194): document divergences from the TurboQuant paper
Add an explicit 'Divergences from the TurboQuant paper (arXiv:2504.19874)'
section mapping where M1 departs from the paper, so the gaps are reviewable
and the follow-ups are paper-grounded:

- D1: M1 uses a heuristic per-vector c_x scale, not the paper's provably-
  unbiased two-stage MSE + 1-bit-QJL-residual estimator. Soften the T4 and
  Validation wording accordingly (empirically near-unbiased, not proven).
- D2: M1 quantizes against the N(0,1) limit + empirical TQ+ calibration, not
  the paper's exact d-aware Beta-optimal codebooks.
- D3: M1 ships 1/2/4-bit; paper highlights ~2.5/3.5 bpc sweet spots — add 3-bit.
- D4: assert measured distortion under the paper's closed-form bounds as a
  stronger test oracle than recall > 0.5.
- D5: estimator variance deferred.

Add milestones M5 (paper-grade QJL-residual estimator) and M6 (Beta-optimal
codebooks); note what M1 already matches (norm-based L2, online ingest,
full-precision query). No code change.
2026-07-27 14:01:31 -04:00
Ofer Shaal
c23d7a311e chore(turbovec): drop unused deps; attribute external benchmark claims
- Cargo.toml: remove unused rand_distr dependency and the redundant
  rand dev-dependency (rand is a normal dep for the demo bin + tests).
- Cargo.lock: drop rand_distr from ruvector-turbovec.
- ADR-194: attribute the FAISS-competitive figures to the upstream
  RyanCodrai/turbovec project rather than presenting them as this
  crate's measured results; point readers to the reproducible
  uniform-random Validation table instead.

No code changes; 16 unit + 1 doc-test still pass, clippy clean.
2026-07-27 14:01:30 -04:00
Claude
f40fc539fa fix(turbovec): address CodeRabbit review — validate inputs, propagate errors
- index: TurboVecIndex::add/search now return RabitqError::DimensionMismatch
  in release builds instead of silently accepting/masking wrong-length
  vectors (was debug_assert + unwrap_or_default).
- index: finalize() excludes zero vectors from calibration fit so they
  don't bias shift/scale toward zero.
- idmap: add_with_id validates dim up front and reports the real length
  (was hardcoded got: 0); add_with_ids rejects vectors/ids length
  mismatch with new TurboVecError::BatchLenMismatch instead of zip-truncating.
- quantize: pack/unpack document preconditions and debug_assert code-range
  and slice-length (proportionate to internal helpers; no Result churn).
- calibrate: fit debug_asserts every row has length dim.
- ADR-194 frontmatter status proposed -> accepted to match body.

Adds 4 tests (wrong-dim reject on add/search, zero-vector calibration
exclusion via self-retrieval, batch-len mismatch, idmap wrong-dim).
16 unit tests + 1 doc-test pass; clippy clean; demo unchanged.

https://claude.ai/code/session_012AzArCzBwxrJp8mUngUcH5
2026-07-27 14:01:30 -04:00
Claude
65b9b0c926 feat(turbovec): implement ADR-194 M1 multi-bit TurboQuant ANN index
New crate crates/ruvector-turbovec implementing the scalar-reference
milestone of ADR-194 — the 2/4-bit FastScan-style ANN regime ruvector
lacked (rabitq is 1-bit; ruvllm's TurboQuant is a KV-cache codec, not a
search index).

Pipeline: normalize -> randomized Hadamard rotation (reused from
ruvector-rabitq) -> TQ+ per-coordinate calibration -> Lloyd-Max 2/4-bit
scalar quantization -> per-vector length-renormalized unbiased scoring.
Implements the shared ruvector_rabitq::AnnIndex trait. Adds IdMapIndex
with O(1) delete and allowlist-filtered search.

Proof (cargo run --release -p ruvector-turbovec), n=5000 uniform-random
vectors, dim=256, k=10, no f32 rerank, vs exact brute-force L2:
  1-bit: recall@10 0.308, 25.6x compression, bias +0.0005
  2-bit: recall@10 0.561, 14.2x compression, bias +0.0001
  4-bit: recall@10 0.879,  7.5x compression, bias -0.0000
Recall rises monotonically with bit-width; mean cosine bias ~0 confirms
the unbiased estimator. Determinism + IdMap delete/filter verified.

12 unit tests + 1 doc-test pass; build green; clippy clean.
M2-M4 (FastScan nibble-LUT SIMD kernel, AVX-512, dispatcher) are future
milestones; the scalar scorer here is their determinism oracle.

https://claude.ai/code/session_012AzArCzBwxrJp8mUngUcH5
2026-07-27 14:01:30 -04:00
Claude
7689f1a9cf docs(adr): ADR-194 ruvector-turbovec multi-bit TurboQuant FastScan ANN index
Research and scope a new crate adapting TurboQuant techniques from
RyanCodrai/turbovec: 2/4-bit Lloyd-Max scalar quantization, TQ+
per-coordinate calibration, length-renormalized unbiased scoring, and a
nibble-LUT FastScan SIMD kernel (AVX-512BW/AVX2/NEON). Reuses
ruvector-rabitq's Hadamard rotation + AnnIndex/VectorKernel traits and
borrows ruvllm's MSE quantizer math, closing the missing 2-4-bit FastScan
ANN regime.

https://claude.ai/code/session_012AzArCzBwxrJp8mUngUcH5
2026-07-27 14:01:30 -04:00
rUv
a4f9991d9d
feat: add k-scoped adaptive ANN calibration (#718)
* research: add nightly survey for adaptive-recall-ann

Identifies adaptive recall-targeted ANN as the 2026-07-23 nightly topic.
Connects vector search, agent memory, edge AI, MCP tool latency SLAs,
and ruFlo workflow recall budgets. No prior nightly covered this angle.

* feat: add ruvector-adaptive-ann Rust proof of concept

Implements RecallTargetedSearch trait with three variants:
- FixedEfSearch (baseline): constant ef=64, ignore recall target
- BinarySearchCalibrated: binary-search ef per query with ground truth
- TableCalibratedSearch: O(1) ef lookup from offline calibration table

Core insight: calibration queries must match production query distribution.
CalibrationTable is a monotone ef→recall mapping from 50-100 held-out queries.

Benchmark: N=3000×D=64, recall_target=0.90
- FixedEf(64): 0.778 recall, 9,497 QPS (misses target)
- BinarySearch: 0.902 recall, 738 QPS (oracle, 13x slower)
- TableCalibrated: 0.940 recall, 4,390 QPS (exceeds target, O(1) ef)

* test: add 7 integration tests for ruvector-adaptive-ann

- beam search at ef=N achieves near-perfect recall
- recall is monotone in ef
- FixedEf(128) achieves minimum recall threshold
- CalibrationTable returns valid ef
- TableCalibratedSearch achieves recall within distribution-mismatch tolerance
- BinarySearchCalibrated achieves per-query target on 12/15 queries
- effective_ef_for_target returns Some for Table, None for Fixed

All 7 tests pass.

* docs: add ADR-272 for adaptive-recall-ann

Documents the calibration table approach, distribution matching constraint,
three implementation variants, benchmark evidence, failure modes, security
considerations, and migration path for adopting recall-targeted search.

ADR-272 status: Proposed.

* bench: capture adaptive-recall-ann benchmark results

cargo run --release -p ruvector-adaptive-ann --bin benchmark
x86_64 Linux, release build, N=3000 D=64 300 queries

FixedEf(64): recall=0.778, mean=105.3µs, QPS=9497
BinarySearch: recall=0.902, mean=1355µs, QPS=738
TableCalibrated: recall=0.940, mean=227.8µs, QPS=4390
All acceptance tests PASSED.

* fix adaptive ANN calibration scope

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-27 09:57:49 -07:00
rUv
9a31a37ca2
feat: add threshold-driven ANN with empirical recall (#719)
* research: add nightly survey for recall-bounded-ann

Nightly 2026-07-24: Recall-Bounded Approximate Nearest-Neighbour Search.
Establishes the RecallBoundedIndex trait and three measured Rust variants
for quality-first agent memory retrieval (search_above_threshold instead
of top-k). All 8 tests pass; acceptance gate met at recall >= 0.80.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01GyrjFPrMZCH3knQuw8QgLk

* fix recall-bounded ANN ids and search budgets

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-27 09:57:00 -07:00
rUv
e24813cd7b
feat: add bounded RAG graph retrieval research (ADR-272) (#720)
* feat: add ruvector-bounded-rag MinCut context window retrieval crate

Three BoundedRetriever variants: TopK baseline, GraphBFS coherence expansion,
and MinCutBounded Edmonds-Karp max-flow partition. All 9 tests pass with
precision=1.000 acceptance on synthetic 2-cluster corpora.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_012eSJ4Y33PH9w8RCv73ugu5

* docs: add ADR-272 for bounded-rag-mincut

Documents decision to add MinCut-bounded RAG retrieval, benchmark evidence,
failure modes, security considerations, and Phase 2 production hardening plan.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_012eSJ4Y33PH9w8RCv73ugu5

* docs: add nightly research README and gist for bounded-rag-mincut

Full research document with SOTA survey, architecture diagrams, real benchmark
numbers, practical/exotic applications, and public SEO gist.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_012eSJ4Y33PH9w8RCv73ugu5

* chore: update Cargo.lock for ruvector-bounded-rag dependencies

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_012eSJ4Y33PH9w8RCv73ugu5

* fix bounded RAG flow and input validation

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-27 09:55:59 -07:00
rUv
f0e53cf9e7
feat: add measured diverse beam ANN research (ADR-272) (#723)
* feat(diverse-beam): add ruvector-diverse-beam crate with MMR and coherence-pruned beam search

Implements three beam-search variants on a flat kNN graph:
- GreedyBeam: baseline greedy BFS (recall@10=0.816, QPS=10975 on uniform n=2500)
- MMRRerank: greedy pool + MMR post-reranking (λ=0.75, +1.67% diversity, −13.4% recall)
- CoherenceBeam: cosine-gated BFS (anti-pattern for clustered data, documented)

Also includes odd-stride entry point fix, normalised MMR scoring, and a benchmark
binary with acceptance thresholds. All 9 unit tests pass; benchmark PASS ✓.

* docs(adr): ADR-272 diverse beam ANN — MMR post-reranking and coherence-pruned beam search

Documents decision to implement ruvector-diverse-beam, measured results, two negative
results (MMR during traversal, CoherenceBeam on clustered data), and alternatives
considered (DPP, structural diversity). Status: Proposed.

* research(nightly): 2026-07-26 diverse beam ANN — README and gist

README: full 24-section research document with SOTA survey, architecture diagram,
all measured benchmark results, key findings (MMR traversal anti-pattern, coherence
cluster failure), memory model, practical/exotic applications, and future work.

gist.md: SEO-optimized public technical article targeting engineers building
RAG/agent-memory systems on vector databases.

* fix diverse beam traversal and scoring

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-27 09:55:22 -07:00
rUv
e1784a2934
feat: add audited speculative ANN search (ADR-272) (#725)
* feat: add speculative-ann-search Rust PoC with adaptive k' controller (ADR-272)

Implements the speculative decoding protocol for ANN retrieval:
- QuantizedDraft: u8 scalar-quantized linear scan (4× memory compression)
- SpeculativeANN: u8 draft proposes k' candidates; exact f32 verify + re-rank
- Adaptive controller: rolling recall feedback tunes k' to maintain target recall

Benchmark results (10K vectors, 128 dims, 500 queries, k=10):
  LinearFull:     recall=1.000  805 q/s  4.9 MB
  QuantizedDraft: recall=0.858  1385 q/s  1.2 MB  (1.7× faster, 4× smaller)
  SpeculativeANN: recall=0.964  1293 q/s  6.1 MB  (mult=2: 99.5% recall, <1% latency overhead)

18 unit tests + 6 acceptance tests — all green.
Research README, ADR-272, and SEO gist included.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Us7kwnqa65p1FUALNC3X8p

* fix speculative ANN feedback and packaging

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-27 09:54:31 -07:00
rUv
c410250467
fix: harden MCP, native HNSW gates, and ruvector 0.2.37 (#724)
* fix ruvector MCP startup and harden release

* chore: normalize ruvector package metadata

* fix ruvector HNSW defaults and CI gates

* fix clean ruvector artifact tests
2026-07-27 09:10:04 -07:00
rUv
fe11269ed1
fix: SONA zero-vector bug, RVF wasm persistence, metadata safety, doc gaps (#708)
- #706: apply_micro_lora/apply_base_lora seeded their output buffer with
  zeros in napi.rs, napi_simple.rs, and wasm.rs, but the Rust LoRA forward
  pass has residual semantics (adds delta into the buffer). Cold queries
  collapsed to the zero vector, and post-feedback queries returned only
  the delta instead of input+delta. Fixed by seeding with a clone of the
  input in all three binding layers. Added regression tests.

- #705: WasmBackend had no byte-level persistence. The underlying
  rvf_store_export/rvf_store_open C-ABI functions already existed —
  wired them into WasmBackend.exportBytes()/openBytes() and
  RvfDatabase.exportBytes()/openBytes(), verified against the real
  compiled .wasm binary.

- #704: NodeBackend.ingestBatch() silently dropped RvfIngestEntry.metadata
  instead of forwarding it, and query() filter serialization omitted the
  native parser's required valueType. Since a full field-name-to-id
  design for metadata durability is a larger follow-up, applied the
  issue's own suggested interim fix: ingest now throws
  MetadataNotSupported instead of silently losing data. Filter
  serialization now infers and includes valueType.

- #707: docs/api/NODEJS_API.md and docs/guides/ADVANCED_FEATURES.md
  advertised HybridSearch/FilteredSearch/MMRSearch/ConformalPredictor as
  Node exports; none are bound by crates/ruvector-node. Corrected with
  explicit "not yet shipped" notes pointing at the tracking issue.

README corrections for #705/#707 (WasmRvfStore, HybridSearch docs) are
staged separately — a repo hook requires a visual design-grade ritual for
any README change that this session cannot complete (no browser/screenshot
access), so they'll follow once that's resolved.
2026-07-17 13:34:16 -04:00
rUv
ca8224e0cd
feat(maxsim): add GraphMaxSim centroid-graph variant (salvaged from #622) (#623)
Adds a fourth MultiVecIndex variant to ruvector-maxsim: a greedy kNN graph
over per-document centroids + multi-seed beam search + exact MaxSim rerank.
Complements the token-level HnswMaxSim with a one-node-per-document graph.

Includes the consecutive-seeding correctness fix discovered in nightly PR
#622: step-based beam seeding collapses recall when the step is a multiple
of the cluster count. Documented in graph.rs and ADR-252.

#622 produced a duplicate ruvector-maxsim crate (the name was already taken
by #569, merged 2026-06-15); rather than merge the duplicate, its unique
value is salvaged here. The public research gist from #622 remains published.

- 5 new tests (recall vs Flat, dim validation, build/empty guards) — 23/23 pass
- cargo fmt clean, cargo clippy -D warnings clean
2026-06-29 10:47:01 -04:00
rUv
b2a32eae2f
feat(sona): metaharness-Darwin evolves EWC++ config beyond hand-tuned SOTA (#615)
* feat(sona): metaharness-Darwin evolves EWC++ config beyond hand-tuned SOTA

examples/darwin_ewc: applies the Meta-Harness 'freeze the model, evolve the
harness' pattern to SONA's continual-learning layer — frozen = the EWC++
algorithm (EwcPlusPlus), evolved = its EwcConfig genome (lambda schedule, Fisher
decay, auto task-boundary threshold, learning rate).

Benchmark: a single weight vector trained on a sequence of tasks (no replay,
auto-detected boundaries) — the canonical plasticity-vs-forgetting frontier.
Darwin (GA + coordinate-descent polish) evolves the genome on TRAIN task-
sequences; results reported on HELD-OUT sequences (different seeds).

Measured (deterministic), held-out: the evolved config beats EwcConfig::default()
(the crate's hand-tuned 'OPTIMIZED' values) by 35% lower final loss and 98.6%
less forgetting — a strict Pareto win (plasticity also improves), and it
generalizes to unseen task sequences. clippy -D warnings clean, fmt clean.

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

* feat(sona): weightAdapter gene — Darwin selects/prunes a fine-tuned adapter

Extends the metaharness-Darwin line: expose a fine-tuned adapter (e.g. a LoRA
distilled from verified SWE-bench trajectories — the 'autonomous data engine')
as a gene (which_adapter, alpha) so evolutionary selection decides whether/how
much to apply it (w_eff = w_base + alpha·Δw) instead of assuming new weights are
better. examples/darwin_weightadapter demonstrates it on two conflicting domains
with a generalizing adapter and an overfit one.

Key finding (sharpens the idea): 'selection prunes overfit adapters' holds ONLY
under per-domain evaluation. Measured (held-out, in-dist-majority eval):
  overfit α=0.55 → ΔA +0.249 / ΔB -0.357 (regresses out-dist)
  AGGREGATE (volume-weighted) fitness  → picks the overfit adapter (silent B regression)
  PER-DOMAIN (no-regression Pareto)    → prunes it, keeps the generalizing adapter
So: evolve the adapter as a gene, but score it per-repository. clippy/fmt clean.

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

* docs(adr): ADR-271 metaharness-Darwin for SONA self-improvement

Documents the metaharness-Darwin-evolves-SONA architecture: EWC++ config
evolution (PR #615), the weightAdapter gene (per-domain Pareto selection of
fine-tuned adapters), the Autonomous Data Engine (execution-verified SWE-bench
trajectories -> DPO pairs), and four Ornith-1.0 borrows (immutable-boundary +
deterministic-monitor-with-exclude-from-advantage + frozen-LLM-judge-veto
reward-hacking defense; per-task-category specialization; two-stage scaffold
reward credit; staleness-weighted replay). Method-not-model: external
evolutionary vs Ornith's in-weights RL.

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

* feat(sona): darwin-guard reward-hacking defense (Ornith-1.0 borrow, ADR-271)

3-layer defense for evolutionary config search: (1) immutable verifier boundary
(screen is a pure fn of verifier output the candidate can't fabricate);
(2) deterministic monitor — non-finite / out-of-bounds / degenerate candidates
are EXCLUDED from selection (best_accepted), not zero-scored, so a hack can
neither win nor bias the advantage; (3) IntentJudge trait = frozen-LLM veto-only
layer. Wired into darwin_ewc: NaN/collapsed configs are excluded from the GA
ranking (also fixes the partial_cmp().unwrap() NaN-panic). 4 unit tests; benchmark
still reaches beyond-SOTA (35% lower loss, 98.6% less forgetting) unchanged.
clippy -D warnings + fmt clean.

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

* feat(sona): per-task-category genome router beats single global config (ADR-271)

Ornith-1.0 borrow #2 (per-category specialization): evolve a router task-class
-> genome instead of one global EwcConfig. Two continual-learning workload
classes with conflicting optima (STABLE wants high lambda / retain; VOLATILE
wants low lambda / stay plastic). Guard-screened evolution.

Measured (held-out, adequate per-class data): per-category router 0.1122 vs
single best global genome 0.1144 -> router ~1.9% better on unseen sequences,
because one config cannot serve conflicting workloads.

Honest caveat (discovered + documented): the gain REVERSES when per-class data
is scarce — a specialized config overfits while the pooled global generalizes.
Per-category routing needs enough per-category samples (Ornith's regime). ADR-271
updated; clippy/fmt clean.

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

* feat(sona): online auto-tuner with staleness-weighted replay (ADR-271, Ornith borrow #4)

auto_tuner module: StalenessSchedule (Ornith w(d_t): fresh<=k1, exp-decay,
drop>k2) + StalenessWindow (staleness-weighted running estimate of recent
config performance, evicts stale obs). 4 unit tests.

examples/darwin_autotuner: a (1+1)-ES that adapts a DEPLOYED EwcConfig to a
drifting workload stream (regime A -> B at the midpoint), scoring the incumbent
on the staleness window and accepting a perturbation only when it beats the
recent score. Measured: online tuner ~3% lower post-drift loss than the static
deployment config (10 accepted re-tunes). Margin is modest on synthetic regimes;
the durable win is the reusable staleness machinery + the online-adaptation
principle (a fixed offline-tuned config goes stale under drift).

Completes the four ADR-271 components. clippy --all-targets -D warnings + fmt
clean; 102 sona tests pass.

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

* feat(sona): contamination/disjointness guard in darwin-guard (weight-eft/ADR-198 borrow)

Adds the train/eval contamination guard — the gap @metaharness/weight-eft exposed
in our reward-hacking-only guard. contamination()/assert_train_eval_disjoint()
fail on any train∩eval instance-ID overlap (training/selecting on eval instances
is fake lift); filter_holdout() partitions a set disjoint-by-construction and
surfaces what was excluded. The SONA-side analog of weight-eft's
assertTrainEvalDisjoint. 2 new tests (6 total in darwin_guard).

ADR-271 updated: §3 Data Engine now cites @metaharness/weight-eft + adopts its
RLHF-correct recipe (SFT distills ALL gold incl. off-policy frontier successes;
DPO ON-POLICY cheap-vs-cheap only), and the darwin-guard borrow gains layer (iv)
the contamination disjointness guard. clippy -D warnings + fmt clean.

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

* chore(release): ruvector-sona 0.2.1 — darwin_guard + auto_tuner modules

Non-breaking minor feature release (new public modules darwin_guard,
auto_tuner). Patch bump keeps the ^0.2 requirement of all in-workspace
dependents (ruvllm, rvlite, mcp-brain, ...) satisfied.

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

---------

Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-27 12:57:48 -04:00
rUv
edf96d83ed
feat(mragent): self-reconstructing graph memory over RuVector, evolved by Darwin (ADR-269/270) (#611)
* feat(mragent): MRAgent graph memory over RuVector with Darwin optimization

Add ADR-269 and a runnable reference implementation of MRAgent ("Memory is
Reconstructed, Not Retrieved") on RuVector, optimized by Meta-Harness Darwin
Mode under the "freeze the model, evolve the harness" invariant.

- Frozen model: deterministic Cue-Tag-Content memory substrate mirroring
  RuVector hybrid (RRF) search + bounded-depth Cypher traversal semantics
  (examples/mragent/agent/memory.mjs)
- Evolved harness: 10-gene reconstruction genome (cueK, efSearch, hybridAlpha,
  fusion, traversalDepth, tagFanout, pruneThreshold, maxContent, rerank,
  promptStrategy) in DARWIN_MUTABLE_BLOCK regions (agent/harness.mjs)
- Darwin evolution loop with mapLimit/paretoFront and ADR-150 graceful fallback
  when @metaharness/darwin is absent (optimize.mjs)
- scorePolicy.ts fitness mirroring ADR-266; benchmark + probe + 7 deterministic
  acceptance gates
- eval corpus with chained multi-hop "bridge" tasks so traversal depth, fan-out
  and pruning are genuinely load-bearing

Runs with zero optional deps: baseline 83.3% -> evolved 100% accuracy, faster
and ~33% smaller context. Darwin discovers traversalDepth=3 (LINKED_TO*1..3).

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_017MDmEV4svuFxuDBGg8zek2

* feat(mragent): self-reconstructing graph memory, beyond SOTA (ADR-270)

Extend the MRAgent harness past the paper into calibrated, adaptive,
self-reorganizing memory, co-evolved by Darwin. Also fixes the corpus being
silently excluded by the root .gitignore data/ rule (the example was missing
its eval set).

Beyond-SOTA mechanisms (each a tunable gene Darwin evolves):
- Adaptive depth (haltConfidence): halt traversal once evidence is decisive
- Abstention + risk-adjusted utility (abstainThreshold): refuse on weak
  evidence instead of hallucinating; graded on calibrated utility, not raw acc
- Consolidation/replay (agent/consolidate.mjs): store reorganizes its own
  topology, laying Cue->shortcut->Content edges (RuVector self-learning GNN)

Substrate upgrades:
- Concept layer (agent/concepts.mjs): dense (concept) vs sparse (token) signals
  genuinely decoupled, so hybridAlpha/fusion become load-bearing
- Hardened 24-task corpus, 6 classes (semantic/lexical/hybrid/bridge/
  distractor/unanswerable) synthesized from structured signal specs
- All 12 genes proven load-bearing (some via epistatic interaction)
- Memetic optimizer: GA (mapLimit/paretoFront) + multi-start coordinate-descent
  polish that reliably finds the narrow calibration optimum

Measured (deterministic, zero optional deps): baseline acc 81% / risk 0.708 /
halluc 0.13 -> evolved 100% / risk 1.000 / halluc 0.00; consolidation -25%
hops at 100% accuracy. 11 acceptance gates pass. ADR-150 compliant.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_017MDmEV4svuFxuDBGg8zek2

* feat(mragent): generalization protocol (train/test/CV) + overfit fixes

Add a held-out evaluation regime that proves the evolved harness GENERALIZES
rather than memorizing the eval set, and fix the overfitting it surfaced.

Protocol:
- Scale corpus to 60 tasks via a deterministic generator (tools/genCorpus.mjs,
  npm run gen-corpus), 10 per class, difficulty-varied (1-hop AND 2-hop bridges,
  1-3 ranking-distractors) so train constrains every gene
- Optimizer evolves on a class-stratified TRAIN split, selects via 3-fold
  cross-validation with a variance penalty (mean - 0.5*range), and reports a
  held-out TEST split it never saw
- Generalization gate = does evolution improve the unseen split

Overfit fixes uncovered by held-out eval:
- Abstention confidence now derives from the answer's RAW relevance, not its
  decay^depth path score, so deep-but-relevant bridge answers aren't mistaken
  for weak ones (b-test confidence 0.39 -> 0.79); abstention generalizes across
  depths. Adaptive-depth halt uses the same raw-relevance signal.
- Larger difficulty-varied corpus + CV variance penalty stop the optimizer
  shaving under-constrained genes (maxContent->1) to train-fragile settings

Result (held-out test, reproducible): baseline ~30% acc / risk 0.25 / halluc
0.17 -> evolved ~65% / 0.81 / 0.04 (+35pt acc, +0.56 risk). Honest ceiling
(~80%) documented: synthetic embedding noise + one global hybridAlpha can't
serve both dense- and sparse-keyed queries. 12 acceptance gates pass.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_017MDmEV4svuFxuDBGg8zek2

* feat(mragent): GPU LLM write-layer for the Darwin optimizer (local RTX 5080)

Adds the directed-proposal layer the GA lacks (ADR-260 'real Darwin write-layer
proposes leaps from failure traces'): agent/llmMutator.mjs shows a local,
GPU-served code model (qwen2.5-coder via an OpenAI-compatible endpoint) the
current genome + its failing cases and asks for improved genomes. Every proposal
is clamped to the declared gene bounds (coerceGenome) before entering the
population, so untrusted LLM output can only ever be a safe genome — never an
unsafe gene. Wired into optimize.mjs every 3rd generation; folded into the
archive so GPU candidates compete in polish + acceptance.

Fully opt-in + gracefully degrading (ADR-150): MRAGENT_LLM=off or no reachable
endpoint => identical deterministic GA+coordinate-descent run as before. Auto-
detects http://localhost:11434/v1 (ollama) by default; MRAGENT_LLM_URL/MODEL
override.

Measured (RTX 5080, qwen2.5-coder:7b): 8 genomes proposed across gens, bounds-
safe; the deterministic polish still wins on this small synthetic corpus (the
GA+grid already enumerates the optimum), so the write-layer is a no-regression
enhancement that matters on larger corpora the grid can't cover. 14/14 tests
pass (2 new coerceGenome safety tests).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-27 11:08:26 -04:00
rUv
137a02ee9c
research(nightly): capability-gated-ann — per-vector read access control in ANN search (#604)
* research: add nightly survey for capability-gated-ann

Selects capability-gated ANN search as 2026-06-25 nightly topic.
Three research loop passes completed: Discover, Deepen, Critique.
Topic fills the missing per-vector read access control gap in RuVector
(ADR-227 already covers proof-gated writes; this adds gated reads).

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Gayqu5K44VptZqJLhxX1Vb

* feat: add capability-gated ANN Rust proof of concept

crates/ruvector-capgated: zero-dep Rust crate implementing three
capability-gated ANN search variants using 64-bit CapMask bitsets.

- CapMask: 64-bit bitset for capability requirements/holdings
- CapGatedIndex trait: unified API across all backends
- PostFilter: O(n) scan, 100% recall, baseline
- EagerMask: O(auth_frac*n*d), 100% recall, 7.9x speedup at 12.5% access
- CapGraph: k-NN graph walk with ef-bounded exploration, 90.6% recall
- Oracle: brute-force ground truth for recall measurement
- Deterministic LCG dataset generation (no external deps)

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Gayqu5K44VptZqJLhxX1Vb

* test: add 22 numeric acceptance tests for capability-gated-ann

Tests cover: CapMask satisfies semantics, dist_sq correctness,
recall computation, Oracle filtering/ordering, PostFilter
filtering/ordering/k-limit, EagerMask equivalence to Oracle,
EagerMask zero-access, CapGraph authorisation enforcement,
CapGraph k-limit, CapGraph empty index, CapGraph full-access,
dataset determinism, pick_caps count/range, LCG reproducibility.

All 22 tests pass with cargo test -p ruvector-capgated.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Gayqu5K44VptZqJLhxX1Vb

* docs: add ADR-268 for capability-gated ANN search

ADR-268-capability-gated-ann.md covers:
- Context: gap between proof-gated writes (ADR-227) and read access control
- Decision: CapGatedIndex trait, CapMask bitset, three variants
- Benchmark evidence: PostFilter 2,023 QPS, EagerMask 17,548 QPS (low-access),
  CapGraph 3,396 QPS / 0.869 recall
- Alternatives considered: post-hoc filter, per-group index, homomorphic encryption
- Failure modes and security considerations
- Migration path into ruvector-core

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Gayqu5K44VptZqJLhxX1Vb

* bench: capture capability-gated-ann benchmark results

Real cargo run --release numbers on x86_64 Linux, Rust 1.94.1:

High-access (37.5% authorised):
  PostFilter:  494 μs mean / 2,023 QPS / 1.000 recall
  EagerMask:   175 μs mean / 5,728 QPS / 1.000 recall  (2.8x speedup)
  CapGraph:    289 μs mean / 3,466 QPS / 0.906 recall

Low-access (12.5% authorised):
  PostFilter:  450 μs mean / 2,221 QPS / 1.000 recall
  EagerMask:    57 μs mean / 17,548 QPS / 1.000 recall  (7.9x speedup)
  CapGraph:    295 μs mean / 3,396 QPS / 0.869 recall

ACCEPTANCE RESULT: PASS -- all thresholds met.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Gayqu5K44VptZqJLhxX1Vb

* docs: add SEO gist for capability-gated-ann

docs/research/nightly/2026-06-25-capability-gated-ann/gist.md:
- Public-facing technical article with real benchmark numbers
- Comparison table vs Milvus, Qdrant, Weaviate, Pinecone, LanceDB,
  FAISS, pgvector, Chroma, Vespa
- 8 practical applications, 8 exotic applications
- Deep research notes with ACORN, filtered-ANN, Milvus citations
- Usage guide, optimization guide, roadmap
- SEO keywords and GitHub topic tags

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Gayqu5K44VptZqJLhxX1Vb

* fix(ruvector-capgated): clippy + rustfmt cleanup for clean CI

Resolve the clippy warnings that were red on #604: unused VecEntry import,
needless_range_loop (dataset.rs cap-mask build), useless_vec (eager_mask),
and unusual_byte_groupings (benchmark SEED literal). Apply rustfmt.

cargo clippy -p ruvector-capgated --all-targets -- -D warnings now clean;
22/22 tests pass.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruv <ruvnet@users.noreply.github.com>
2026-06-25 14:05:34 -04:00
rUv
e4d19b3454
research(nightly): spann-partition-spill — boundary-safe ANN in Rust (#602)
* research: add nightly survey for spann-partition-spill

SPANN-inspired partition spilling for boundary-safe ANN (2026-06-24).
Three measured variants, zero external deps, 10 passing tests.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_015jtrAifbFHQ1YWupgjA5HH

* docs: add ADR-268 for spann-partition-spill

ADR documents the design, benchmark evidence, failure modes, migration
path, and open questions for SPANN-style partition spilling in RuVector.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_015jtrAifbFHQ1YWupgjA5HH

* docs: add nightly research README and SEO gist for spann-partition-spill

Research document with full benchmark results, ecosystem fit analysis,
practical applications, exotic applications, and production roadmap.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_015jtrAifbFHQ1YWupgjA5HH

* fix(ruvector-spann): remove nested workspace root + lint cleanup

The crate declared its own [workspace] while also being a member of the
root workspace, producing "multiple workspace roots" and turning every CI
check red (build, check, all test shards, fmt). Remove the stray
[workspace] block and the committed nested Cargo.lock, then apply
clippy --fix (sort_by -> sort_by_key) and rustfmt.

cargo build/test/clippy -p ruvector-spann now green: 10/10 tests pass.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruv <ruvnet@users.noreply.github.com>
2026-06-25 14:03:59 -04:00
rUv
7a79b74d13
feat(sonic_ct): acoustic digital human workbench — Rust/WASM USCT + R3F UI (#595)
* feat(sonic_ct): acoustic digital human workbench — Rust/WASM USCT + R3F UI

Add `sonic_ct`, a research-grade Ultrasound Computed Tomography (USCT)
simulator and reconstruction workbench.

Core (crates/sonic-ct, pure Rust, zero deps, 17 tests):
- procedural z-varying torso phantom (fat/muscle/organ shells, spine, ribs,
  pelvis, liver/spleen/kidneys/aorta, heart+lungs in thorax)
- circular ring acquisition with straight-ray travel-time + attenuation
- SART time-of-flight reconstruction (1 sweep == delay backprojection)
- transparent speed-band segmentation with per-cell uncertainty
- coordinate-ascent threshold training (mean Dice ~0.30 -> ~0.63)
- RuVector-style acoustic memory: NSW vector index, longitudinal drift,
  warm-start, anatomical graph-coherence checks, .rvf-style serialization
- 3-D volume sweep (truth / recon / error / confidence channels)
- mock Butterfly Embedded acquisition boundary (trait, no hardware SDK)

WASM (crates/sonic-ct-wasm): raw C-ABI cdylib (no wasm-bindgen, ~39 KB)
exposing the single-slice + progressive volume pipeline.

UI (examples/sonic-ct): React Three Fiber "Sonic Chamber" — water chamber,
transducer ring(s), holographic torso with internal organ glows and
class-tinted contour slices, live HUD (acoustic paths, phantom fidelity,
path confidence, body composition), cranio-caudal scrubber. Driven entirely
by real reconstruction data.

Docs (docs/sonic-ct): 8 ADRs, SOTA research map, market brief, SPARC.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(sonic_ct ui): welcome modal + GLB body-model loader with procedural fallback

- WelcomeModal: Simulate/Reconstruct/Analyze/Validate intro, Get Started cards,
  "show on startup" preference, research-only disclaimer.
- BodyModel: loads a supplied GLB anatomy model (GLB_URL) and applies a ghost
  material override + per-organ tinting from organ_manifest.json; cleanly falls
  back to the procedural violet ghost (torso + internal organ glows) when no
  asset is supplied or it fails to load. GLB is a visual prior only — the Rust
  phantom stays the physics ground truth.
- Refined holographic ghost: violet volumetric glow, class-tinted contour
  slices, twin transducer rings, glowing base, internal organ volumes.
- docs/sonic-ct/BODY-MODELS.md: researched model sources (Zygote, BioDigital,
  SMPL/Meshcapade, Z-Anatomy, BodyParts3D) + GLB integration pipeline.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(sonic_ct ui): load open-source CesiumMan GLB as the ghost body shell

- Ship CesiumMan (Khronos glTF Sample Assets, CC-BY 4.0) as public/models/human.glb,
  loaded via useGLTF, auto-fit to the chamber, and styled with the ghost-material
  override; procedural internal organ glows render inside it.
- GLB_URL now points at the bundled model; missing/broken asset still falls back
  to the procedural torso shell via the error boundary.
- Attribution recorded in organ_manifest.json and docs/sonic-ct/BODY-MODELS.md.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(metabiohacker): organ-hypothesis detector, Darwin optimizer, rebrand

Rename the app to MetaBioHacker (Acoustic Digital Human Workbench · Sonic
Chamber) across HUD, welcome modal, and metadata.

Organ inference (ADR-0009/0010): new `crates/sonic-ct/src/organ.rs` detects
liver, spleen, kidneys, aorta, heart, and lungs from the reconstructed
volume using anatomical priors (zone, side, size, posterior adjacency,
slice-consistency) — never from speed alone. Each hypothesis carries a
confidence and an evidence bitmask. Exposed via WASM (sct_organ_*,
sct_quality_flag) and surfaced in a new HUD panel with per-organ confidence
bars + quality flags (bone shadowing / sparse coverage / boundary
uncertainty / gas). 18 Rust tests pass; clippy clean.

Harness optimization (examples/sonic-ct/optimize.mjs): uses
@metaharness/darwin ("freeze the model, evolve the harness") with
cheap->frontier tiering and Pareto selection over the frozen WASM engine to
evolve {elements, fan, iters}; lifts phantom fidelity ~0.53 -> ~0.59.
Documented in docs/sonic-ct/OPTIMIZATION.md.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(metabiohacker): faithful Darwin harness evolution + OpenRouter write layer

- crates/sonic-ct/src/bin/serve.rs: the frozen acoustic engine as a JSON-over-
  stdio process (sonic_ct_serve) — the physics truth layer for the evolver.
- examples/sonic-ct/src/optimizer/reconstructionEvolution.ts: typed genome
  (reconstruction/routing/scoring/safety), runFrozenRustEngine (spawns the real
  binary), cheap->frontier routeReconstruction (augments engine output, never
  rewrites anatomy), multi-objective scoreCandidate, mutateGenome, and
  evolveMetaBioHarness using Darwin mapLimit + paretoFront + an archive.
- optimize.mjs: OpenRouter LLM "write layer" proposes harness mutations (cheap
  gpt-4o-mini / frontier gpt-4o), gated by routing policy, bounded budget, key
  read from env only; archive-based acceptance gate now PASSES (latency -92.8%,
  no regression). probeDarwin.mjs verifies the export surface.
- Tests (npm test, Node type-stripping): mapLimit bounds concurrency; paretoFront
  keeps accurate+cheap trade-offs and drops dominated; frontier never bypasses
  the frozen engine. docs/sonic-ct/OPTIMIZATION.md updated.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* docs(metabiohacker): ADRs 0009-0019 — organ inference, harness evolution, multimodal data + governance

Add 11 ADRs and an index covering the layers built and the medical-data
architecture roadmap:

Organ/inference layer (grounded in organ.rs / segmentation.rs / Hud.jsx):
- 0009 five acoustic classes canonical (no organ identity from speed alone)
- 0010 organ identity inferred from anatomical priors (evidence + confidence)
- 0011 organ function requires dynamic/multiparametric channels ("not measured")
- 0012 explainability mandatory (evidence bitmask surfaced in the UI)
- 0013 no disease labels — research mode only

Harness + data architecture:
- 0014 freeze the physics engine, evolve the reconstruction harness (Darwin)
- 0015 patient data as a graph of typed observations (MedicalObservation,
  provenance + uncertainty + consent scope)
- 0016 adopt DICOM / FHIR / LOINC / SNOMED CT / OMOP + RuVector similarity index
- 0017 typed multimodal fusion patterns (monitoring/research, not diagnosis)
- 0018 governance & SaMD boundary (FDA GMLP/PCCP, Health Canada, Ontario PHIPA)
- 0019 a medical signal operating system, not an AI doctor

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(metabiohacker): benchmark harness on real CT data + synthetic corpus

- Real-data ingestion: Grid::from_pgm (P5 parser), Phantom::from_intensity_grid
  (band a grayscale CT slice into the five acoustic classes), and
  pipeline::run_with_phantom (reconstruct a supplied phantom — engine unchanged).
- sonic_ct_serve gains a phantomPgm path: reconstruct a real anatomical slice
  instead of a procedural one and emit the same score schema.
- tools/fetchRealSlice.mjs: fetch a public-domain abdominal CT slice (Wikimedia
  Commons) and convert to a grayscale PGM (image not committed; fetched on
  demand, derived PGM gitignored).
- benchmark.mjs (npm run benchmark): baseline vs Darwin-evolved harness over 12
  reproducible synthetic phantoms + 1 real CT slice; writes docs/sonic-ct/
  BENCHMARK.md + benchmark.report.json. Representative: evolved harness ~157%
  faster at equal Dice; real CT honestly harder (Dice ~0.27).
- New integration test exercises the PGM/real-phantom reconstruction path
  (19 Rust tests pass).

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(metabiohacker): scale benchmark — 40 synthetic seeds + multiple real CT slices, 95% CI

- fetchRealSlice.mjs fetches several public-domain CT slices (abdomen, thorax,
  pelvis) resiliently, skipping unavailable ones.
- benchmark.mjs now runs N synthetic seeds (default 40) + every fetched real
  slice, reports mean ± 95% CI, and writes docs/sonic-ct/BENCHMARK.md.
  Representative: 42 samples, evolved harness ~149% faster at equal Dice
  (±0.002 CI); real CT slices honestly harder (Dice ~0.30).

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(metabiohacker): Multimodal Ingest V0 — observations, graph, fusion, ledger, ruvn evidence gate

New package packages/metabiohacker (@metabiohacker/core, TS, 14 tests pass):

- ingest/: canonical MedicalObservation + lab (CSV→LOINC), imaging (DICOM
  sidecar), and pathology adapters with provenance/uncertainty/consent.
- graph/: auditable patient state graph + rule-based contradiction detection
  (low-quality, ≥2x same-test disagreement, unflagged review modalities).
- fusion/: prior builder (data shapes priors, never forces conclusions),
  multimodal scoring (acoustic residual passed through unchanged), contradiction
  penalty, and a Darwin harness (mapLimit + paretoFront) selecting fusion policy.
- evidence/: ruvn as the evidence-intelligence layer (off the hot path) — provider
  interface, A/B-or-blocked claim gate, deterministic cached provider + optional
  @ruvnet/ruvn CLI adapter (never a hard dep). Claims ship only on grade A/B with
  citations; pathology/biopsy/Pap/HPV/cytology force human review.
- ledger/ + output/: stable-hash reconstruction run ledger (tamper-evident,
  verifiable) and the safe UI packet (uncertainty overlay, diagnosis blocked).

Benchmark: +10% stability, ~37% uncertainty drop, residual unchanged, ledger
verified, clinical-review mode forced by pathology.

Docs: ADR-0020 (canonical observation), 0021 (graph+contradictions),
0022 (run ledger), 0023 (ruvn evidence layer); ADR index updated.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(metabiohacker): real-slice calibration, domain-gap honesty gate, evidence refresh, CI gates

Attacks the synthetic→real Dice gap honestly rather than hiding it.

- Engine: sonic_ct_serve emits per-class (region) Dice on real slices.
- calibration/: region-level Dice (diceByRegion), domain-gap scoring +
  honesty gate (classifyRealSliceResult: headline/researchOnly/exclude),
  centroid registration-error + boundary-complexity proxies. Real CT slices are
  calibration targets, not USCT.
- benchmark.mjs: 3-section report (synthetic / real region-level / governance);
  headline separates speed from real fidelity. Real slices now classify as
  exclude/researchOnly and stay out of headline metrics (abdomen~0.30).
- evidence:refresh (OpenRouter): grades modality evidence into docs/evidence/*.md
  + a candidate cache; promotion to the curated cache stays a reviewed step.
  Live run graded acoustic USCT = C (research-only), MRI = B.
- CI gates (ciGates.test.ts + .github/workflows/metabiohacker-ci.yml): residual
  invariant, pathology review forced, A/B-only claims, real-slice honesty gate.

23 metabiohacker tests + 12 Rust integration tests pass. ADR-0024 added.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(sonic_ct): method comparison vs BP/SART/Landweber on Shepp-Logan with RMSE/PSNR/SSIM

Bench reconstruction against recognised algorithms on a recognised target:
- shepp_logan.rs: standard 10-ellipse Shepp-Logan phantom -> speed map.
- reconstruction.rs: Method enum + reconstruct_speed_with; Landweber solver
  (gradient descent on ‖As−t‖²) alongside backprojection (1 sweep) and SART.
- metrics.rs: standard image-quality metrics RMSE, PSNR (dB), SSIM.
- sonic_ct_methods bin -> docs/sonic-ct/METHOD-BENCHMARK.md (deterministic).

Measured: backprojection < SART < Landweber on every metric for both Shepp-Logan
and abdomen (abdomen RMSE 130→99→51 m/s, SSIM 0.22→0.60→0.92) at ~4/28/100 ms.
SART stays production default; Landweber is the higher-fidelity option. 2 new
tests; 14 integration tests pass; clippy clean. ADR-0025 added.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(metabiohacker): rigid translation registration for real-slice calibration

Replace the centroid-only proxy with registerByTranslation — finds the integer
offset that maximises predicted/target body-mask overlap Dice, returning the
offset, residual misalignment (errorPx), and aligned overlap. Gives the
domain-gap honesty gate a real registration estimate (landmark refinement is the
next step). +1 test (recovers a known offset; maximises overlap). 24 tests pass.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(sonic_ct): full-waveform inversion (FWI) — forward + adjoint-state gradient

The SOTA step beyond straight-ray TOF (ADR-0004 roadmap), as a dependency-free
2-D reference:
- fwi.rs: FDTD scalar-wave forward model (∂ₜ²p = κ∇²p + f), CFL-stable, damping
  sponge; adjoint-state gradient ∂χ/∂κ = Σ_t λ ∇²p; gradient descent with
  source/receiver-footprint muting, smoothing, and backtracking line search.
- Proven by the gold-standard adjoint-vs-finite-difference gradient check
  (cosine > 0.85) + an inversion that cuts data misfit ≥15% and recovers a
  centrally-concentrated velocity anomaly. 2 new tests; 23 Rust tests pass;
  clippy clean.
- Honest scope: single-frequency, unregularised — frequency continuation,
  regularisation, source encoding, and 3-D are the documented next steps; no
  quantitative clinical recovery claimed. ADR-0026 added.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

* feat(sonic-ct): add FWI frequency continuation (multiscale inversion)

Add invert_multiscale + Stage to fwi.rs: chains low->high frequency FWI
stages with between-stage model smoothing to avoid cycle-skipping. Low
frequencies recover the smooth background first, keeping high-frequency
stages out of local minima.

Proven by a third FWI test: frequency continuation lowers the
inclusion-region error below single-scale FWI at matched iteration count
(deterministic). Adjoint-vs-FD gradient check and misfit-reduction tests
still pass. Updates ADR-0026.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Mx4vKMfvsq5KBQgPRSoxM7

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 09:54:22 -04:00
rUv
ced9ae8178
feat(benchmark): SOTA benchmark suite — 5 runners, 11 SOTA claims, Darwin/MetaHarness integration (ADR-265/266/267) (#596)
Some checks failed
regression-guard / ruvector-core-no-avx512-builds-on-stable (push) Waiting to run
regression-guard / hnsw-recall-at-1 (push) Waiting to run
regression-guard / hnsw-insert-beam-no-m2-clamp (push) Waiting to run
regression-guard / hnsw-distance-based-neighbor-pruning (push) Waiting to run
regression-guard / vector-db-rebuilds-index-on-open (push) Waiting to run
regression-guard / npm-publish-pipeline (npm/packages/pi-brain) (push) Waiting to run
regression-guard / npm-publish-pipeline (npm/packages/ruvector) (push) Waiting to run
regression-guard / npm-publish-pipeline (npm/packages/rvf-wasm) (push) Waiting to run
regression-guard / no-npx-execSync-in-route-enhanced (push) Waiting to run
regression-guard / shell-injection-in-mcp-server (push) Waiting to run
regression-guard / no-systemtime-in-wasm-crates (push) Waiting to run
regression-guard / no-hardcoded-workspaces-paths (push) Waiting to run
regression-guard / brain-hydration-counters-present (push) Waiting to run
regression-guard / optional-deps-resolvable-on-npm (push) Waiting to run
regression-guard / graph-condense-perception-tests (push) Waiting to run
regression-guard / mincut-pin-tracks-workspace-version (push) Waiting to run
SOTA Benchmark (Tier 1 Smoke) / SOTA Smoke (Tier 1) (push) Waiting to run
SOTA Benchmark (Tier 1 Smoke) / SOTA Full Run (Tier 2, on demand) (push) Waiting to run
supply-chain / dependency-review (PRs only) (push) Waiting to run
supply-chain / cargo audit (RustSec advisories) (push) Waiting to run
supply-chain / cargo deny (license + source + ban policy) (push) Waiting to run
supply-chain / npm audit (npm/ workspace) (push) Waiting to run
supply-chain / lockfile integrity (Cargo.lock) (push) Waiting to run
WASM Dedup Check / check-wasm-dedup (push) Waiting to run
Build RVF Node Native Modules / Build darwin-arm64 (push) Has been cancelled
Build RVF Node Native Modules / Build darwin-x64 (push) Has been cancelled
Build RVF Node Native Modules / Build linux-arm64-gnu (push) Has been cancelled
Build RVF Node Native Modules / Build linux-x64-gnu (push) Has been cancelled
Build RVF Node Native Modules / Build win32-x64-msvc (push) Has been cancelled
Build RVF Node Native Modules / Commit RVF Node Binaries (push) Has been cancelled
* feat(benchmark): SOTA benchmark suite + ADR-151/265/266/267 + MetaHarness harness

ruvector-sota-bench (ADR-265):
- Darwin score: 0.4*recall@10 + 0.3*log(QPS) + 0.2*memory + 0.1*latency
- Runners: core-hnsw with full recall@1/10/100, latency p50/p95/p99, QPS
- Datasets: 5 synthetic ANN-Benchmarks-compatible (glove-25/100, sift-128,
  gist-960, deep-image-96) + CI smoke set
- SOTA threshold: recall@10 >= 0.95 AND QPS >= 80% of HNSWlib baseline
- 6 bin targets: sota-all, sota-ann, sota-recall-sweep, sota-compression,
  sota-streaming, sota-hybrid
- Report: leaderboard table, JSON export, SOTA claim detection

ADR series:
- ADR-151: Transition searchreplace → Stateful PTY Agent Loop (SWE-bench)
  Target: break 58.3% ceiling → 60%+; 4 tools: execute_bash/read_file/
  edit_file/finish_task; max 50 turns; scratchpad trajectory memory
- ADR-265: RuVector Comprehensive Benchmark Suite (scope + scoring)
- ADR-266: MetaHarness Darwin integration for autonomous ANN optimization;
  32 mutation surfaces; ADR-150 removable-augmentation constraint respected
- ADR-267: SOTA Validation Protocol; 3-tier (smoke/weekly/biannual);
  witness-signed manifests (Ed25519, ADR-103)

Research insights (deep-researcher agent):
- RaBitQ achieves 99.3% recall@10 vs IVF-PQ 79.2% — 20pp gap
- Hybrid BM25+RRF fusion: 80.8% vs 13.9% dense-only on MS MARCO
- Matryoshka: 14x speed-up at matched recall (MRL 2024 paper)
- No Rust system on BigANN leaderboard — first submission opportunity
- BGE-M3 upgrade: +15-17 nDCG@10 over all-MiniLM (46 → 62-63)

Priority order: ANN-Benchmarks → VectorDBBench → BigANN Streaming →
MTEB/BEIR → Filtered → Adaptive/SONA

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

* feat(sota-bench): add matryoshka runner; fix feature deps; smoke test passes 2 SOTA claims

- ruvector-matryoshka runner: FullDimIndex + TwoStageIndex variants
  both backed by the same Searcher trait; uses build() API correctly
- Fixed Cargo.toml: matryoshka promoted from optional to required dep
  (always compiled alongside core-hnsw runner)
- Smoke test results: core-hnsw(m=32,ef=50) on smoke-128 and smoke-96
  both achieve SOTA (recall@10 ≥ 0.95, QPS ≥ 400)
- Known issue: recall degrades at ef=100+ — likely ruvector-core
  ef_search param not propagating; logged for follow-up

Next: HDF5 dataset loader for real SIFT1M/GloVe data

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

* fix+feat(sota-bench): ef_search fix; hybrid runner; HDF5 loader

Fix (critical):
- core-hnsw runner now uses HnswIndex directly with search_with_ef()
  bypassing VectorDB which silently ignores SearchQuery::ef_search.
  Result: recall correctly scales with ef (0.958→0.989 on smoke-128)
  vs previous stuck-at-0.51 — 8/8 SOTA claims on smoke datasets.

Feat: ruvector-hybrid runner (hybrid.rs)
- BM25 + ANN fusion via RRF, RSF, and score-fusion strategies
- Synthetic token generation from vector values for structural benchmarking
- All three variants built once, queried in parallel for fair comparison

Feat: HDF5 dataset loader (datasets/ann_benchmarks.rs)
- Lazy download of official ANN-Benchmarks HDF5 files to ~/.cache/
- Configurable max_corpus and max_queries caps
- Gated behind 'real-datasets' feature (zero cost without it)
- Supports SIFT-128, GloVe-25/100, Deep-image-96 out of the box
- clear error message when feature is absent

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

* feat(sota-bench): LSM-ANN runner; streaming benchmark; Darwin scorePolicy; sota_all wired

4 runners now producing measurements:
  - core-hnsw: 8/8 SOTA claims (recall 0.96-1.00, QPS 1200-5500)
  - lsm-ann: recall 0.856-0.930, QPS 5764-7706, insert 1.8K-6.1K/s
    → faster QPS than HNSW at matched recall; strong streaming story
  - matryoshka: wired (low recall on synthetic — needs tuning)
  - hybrid-rrf/rsf/score-fusion: wired (baseline recall on synthetic)

New files:
  runners/lsm_ann.rs   — FullLsm runner + streaming checkpoint tracker
  bin/sota_streaming.rs — BigANN streaming track benchmark
  harness/scorePolicy.ts — Darwin Mode scorer: runs sota-all --smoke,
    reads JSON report, returns darwin_score in [0,1] for evolution

Updated:
  bin/sota_all.rs — all 4 runner families wired; matryoshka uses
    highest ef_search for better recall; Darwin score ranking printed
  Cargo.toml — ruvector-lsm-ann promoted to non-optional dep

Outstanding:
  - hybrid recall low (0.25-0.41): synthetic tokens don't match well;
    will improve with real BEIR/MSMARCO text-keyed data
  - matryoshka recall low: needs higher candidate count tuning
  - HDF5 loader ready; needs --features real-datasets to activate

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

* feat(sota-bench): RaBitQ runner; full 5-runner smoke verified (11 SOTA claims)

RaBitQ runner (runners/rabitq.rs):
  - FlatF32Index (exact baseline):  recall@10=1.0000, QPS=2588-6381  ★SOTA
  - RabitqPlusIndex (1-bit + rerank): recall@10=0.929-0.966, QPS=5285-6776  ★SOTA
  - RabitqIndex (pure 1-bit): QPS=26500 (recall low on synthetic — normal;
    paper reports 99.3% on SIFT1M which uses structured cluster data)

11/26 config×dataset combinations claim SOTA across smoke datasets.
Darwin score ranking shows rabitq-flat-f32 at darwin=0.997 as top candidate
for evolution pressure (correct: exact search is the evolution target).

sota_all.rs now runs all 5 families:
  core-hnsw (4 ef values) | rabitq (3 variants) | lsm-ann | matryoshka | hybrid

Next: HDF5 real-data run (needs --features real-datasets), then open PR.

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

* feat(sota-bench): streaming beats NeurIPS target (0.908 > 0.887); fmt; README

BigANN Streaming Track:
  Checkpoint-local ground truth fix (measure recall against indexed
  subset, not full future corpus — matches BigANN streaming semantics).
  Result: averaged recall = 0.908 > NeurIPS'23 target of 0.887 ★

  smoke-128: fill@25%=0.956, @50%=0.868, @100%=0.776; post-compact=0.857
  smoke-96:  fill@25%=0.990, @50%=0.974, @100%=0.884; post-compact=0.934

Other improvements:
  - cargo fmt on all 13 source files
  - README.md: full benchmark table, result explanations, notes on
    rabitq-1bit/matryoshka/hybrid synthetic vs real-data behavior
  - Fixed unused import warning in hybrid runner

Benchmark summary:
  11/26 SOTA claims on smoke datasets
  rabitq-plus: 0.929-0.966 recall@10, 5K-7K QPS
  lsm-ann: 2.8K-7.6K insert/s, 0.856-0.934 post-compact recall

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

* feat(ci): SOTA Tier-1 smoke benchmark workflow (ADR-267)

Adds .github/workflows/sota-benchmark.yml:
  - Tier 1 (smoke): triggers on any change to sota-bench or index crates
    Runs sota-all --smoke, verifies ≥5 SOTA claims, uploads JSON report
    Timeout: 20 min; uses synthetic data, no downloads required
  - Tier 2 (full, on-demand): workflow_dispatch with full_run=true
    Runs synthetic ANN-Benchmarks scale (~30+ min), uploads full report

Also files #597 to track matryoshka recall bug (0.39 vs expected 0.90+
for FullDimIndex on 10K/128-dim synthetic data — likely HnswGraph bug).

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

---------

Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-21 22:53:56 -04:00
rUv
436fb3eb11
Add ADR-199: Sky Monitor and SkyGraph Appliance (Phases 1–4) (#549)
* docs(adr): ADR-199 Sky Monitor and SkyGraph appliance

Architecture decision record for the RuView SkyGraph appliance: a local
sky monitoring system that treats the sky as a continuously changing
spatial graph. Covers ADS-B ingestion (dump1090 + OpenSky fallback),
MSC GeoMet weather, observer-frame coordinate model, canonical
observation schema, SkyGraph node/edge model, RuVector embedding and
novelty usage, rule layer, composite anomaly scoring, privacy and
security governance, storage tiers, phased build plan, and acceptance
tests. Companion implementation lands in examples/sky-monitor/.

https://claude.ai/code/session_013Nh9Naw8gim75DGY9LBvK7

* feat(examples): sky-monitor SkyGraph appliance core (ADR-199 Phases 1-4)

New workspace example crate implementing the RuView SkyGraph appliance
pipeline on synthetic ADS-B data:
- WGS-84 -> ECEF -> ENU observer-frame projection (az/el/range/bearing)
- canonical observation schema (ADR-199 s11) with serde
- deterministic synthetic ADS-B scenario + dump1090 JSON parser
- track stitching with circular-stats summaries and overhead rule
- SkyGraph on ruvector-graph GraphDB (s12 node/edge vocabulary,
  time-window queries, citeable explain())
- 32-dim track embeddings indexed in ruvector-core VectorDB with
  similarity search and calibrated novelty scoring
- composite anomaly score per ADR-199 s15 with mandatory reasons
- daily sky brief, end-to-end pipeline, demo binary
- 27 tests (19 unit + 8 ADR acceptance), criterion benchmarks

https://claude.ai/code/session_013Nh9Naw8gim75DGY9LBvK7

* feat(examples): sky-monitor WASM projection engine, canvas dashboard, perf tuning

Presentation plane for the ADR-199 SkyGraph appliance (dashboard-first
decision) plus measured hot-path optimizations:

- feature-gate sky-monitor: default 'appliance' feature carries
  ruvector-core/ruvector-graph; --no-default-features yields a
  wasm32-compatible subset (coords, observation, adsb, track, weather,
  embedding, anomaly, brief)
- new sky-monitor-wasm crate (wasm-bindgen): SkyProjector with single
  and Float64Array batch projection, polar all-sky screen mapping,
  AnomalyScorer sharing the exact native scorer via new TrackSummary
  adapter, dump1090 JSON parser binding; 5 native unit tests
- canvas dashboard (ui/dashboard): polar sky plot with elevation rings,
  fading trails, overhead highlights, band-colored anomaly badges,
  track table with reasons, replay scrubber; JS projection fallback
  with automatic wasm-pack pkg detection; demo data generated via new
  --emit-json flag on the demo binary
- perf: observer_frame inlined to single sin_cos per angle;
  track_embedding single-pass accumulation; anomaly baseline reuse

Validation: 27/27 sky-monitor tests, 5/5 sky-monitor-wasm tests,
wasm32-unknown-unknown builds clean for both, clippy clean,
node --check on dashboard JS.

https://claude.ai/code/session_013Nh9Naw8gim75DGY9LBvK7

* docs(examples): sky-monitor benchmark report and ADR-199 acceptance mapping

Criterion results (baseline vs tuned): observer-frame projection
-12% single / -10% batch (p<0.05), single-pass embedding -4%;
anomaly/pipeline deltas attributed to the TrackSummary adapter that
gives native/WASM scorer parity. Includes 1 Hz real-time headroom
analysis (~129 ns/projection, ~6k tracks/s anomaly scoring, full
synthetic day in ~7 ms) and the mapping of all 8 acceptance tests to
ADR-199 s31/s22 criteria. 32/32 tests green across both crates.

https://claude.ai/code/session_013Nh9Naw8gim75DGY9LBvK7

* fix(examples): make sky-monitor-wasm buildable offline; record WASM functional verification

Disable wasm-opt in wasm-pack metadata so the dashboard pkg builds in
air-gapped/appliance environments where the binaryen download is
unavailable (size optimization only; documented in Cargo.toml).

Verified the built module end-to-end in Node: projection geometry
matches native coords (10 km north -> az 0.00, el 5.10, range 10029 m),
zenith->center screen mapping, Float64Array batch projection, anomaly
scorer parity through the shared TrackSummary path (night track 0.900
strong anomaly vs corridor 0.055 normal), and dump1090 JSON parsing.
Recorded in BENCHMARKS.md.

https://claude.ai/code/session_013Nh9Naw8gim75DGY9LBvK7

* style(examples): rustfmt sky-monitor and sky-monitor-wasm

Fixes the Rustfmt CI failure on PR #549; no functional changes
(32/32 tests still pass, wasm32 release build clean).

https://claude.ai/code/session_013Nh9Naw8gim75DGY9LBvK7

* feat(sky-monitor): realtime-only dashboard with satellites, live §15 scoring, and SOTA pack

- Dashboard rewritten realtime-only (synthetic-day replay removed): live ADS-B
  (airplanes.live/adsb.lol) + Open-Meteo, smoothed dead reckoning, ⚙ drawer
- wasm: SatPropagator (SGP4 + pass prediction), embed_track/novelty (§13/§15),
  AnomalyScorer wired to live tracks with IndexedDB vector-novelty store
- Sun/moon + naked-eye satellite visibility, behavior badges, CPA conflict
  alerts, adsbdb routes, NOAA SWPC Kp, WebGPU sat layer (fallback-safe),
  recorded-replay ring buffer
- 13 wasm-crate tests, 10 node detector tests, Playwright-verified incl. offline

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

* fix(sky-monitor-wasm): clippy needless_range_loop in satellite pass prediction

Enumerate the precomputed per-step sun samples instead of indexing
them with the loop counter; fixes the deny-warnings Clippy CI failure
on PR #549. No behavior change (13/13 wasm crate tests pass, wasm32
release build clean).

https://claude.ai/code/session_013Nh9Naw8gim75DGY9LBvK7

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruv <ruvnet@users.noreply.github.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-21 18:58:26 -04:00
rUv
e30d3a960f
research: add nightly survey for pq-adc-search (#593)
Product Quantization (PQ) with Asymmetric Distance Computation (ADC)
fills the gap between RaBitQ (1-bit, 15×) and raw f32 storage.
M=8, K=256 achieves 64× compression at 78 KB for 10K×128 vectors.

Covers three variants: FlatPQ (2127 QPS, recall@10=0.253),
IVF+PQ (13471 QPS, recall@10=0.210), ResidualPQ (1740 QPS,
recall@10=0.678). All numbers measured via cargo run --release.


Claude-Session: https://claude.ai/code/session_01AJnxEruiS1c2kYe8wAPFMv

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-21 18:56:06 -04:00
rUv
4796de576f
research(nightly): matryoshka coarse-to-fine ANN search (ADR-264) (#594)
* research: add nightly survey for matryoshka-coarse-fine

Three-pass research (Discover → Deepen → Critique) on Matryoshka
coarse-to-fine vector search for agent memory workloads. Covers
AdANNS, Panorama, FINGER, PAG literature; ecosystem fit analysis;
forward-looking thesis for RuVector edge and MCP integration.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01SiBAYNQQ2hbZPSF33wr439

* feat: add matryoshka coarse-to-fine Rust proof of concept

New crate ruvector-matryoshka implements three ANN search variants:
FullDimHNSW (baseline), TwoStage (32-dim HNSW + full-dim rerank),
ThreeStage (32→64→128 funnel). Custom HNSW parameterized by working
dimension with correct min/max-heap beam search. Deterministic LCG
synthetic dataset generator simulates MRL cluster structure without
external embedding models. Zero external dependencies.

Benchmark on 3,000×128-dim MRL-structured data (N=3000, ef=64, k=10):
  FullDimHNSW  recall=1.000  mean=168μs  QPS=5939  mem=1875KB
  TwoStage     recall=0.903  mean=105μs  QPS=9541  mem=2250KB  (1.61× faster)
  ThreeStage   recall=0.947  mean=163μs  QPS=6130  mem=3000KB  (build 3× faster)

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01SiBAYNQQ2hbZPSF33wr439

* docs: add ADR-264 for matryoshka coarse-to-fine search

Status: Proposed. Documents context (all 2026 major embedding models
use MRL), decision (adopt as first-class RuVector capability via new
crate), consequences (1.61× latency win, −9.7pp recall tradeoff),
alternatives (PQ/FINGER/per-query adaptive dims), three-phase
implementation plan, benchmark evidence, failure modes, security
considerations, and migration path.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01SiBAYNQQ2hbZPSF33wr439

* docs: add SEO gist for matryoshka-coarse-fine

Public-facing summary with introduction, feature table, architecture
diagram, real benchmark results, competitor comparison, 8 practical
applications, 8 exotic applications, deep research notes, usage guide,
and 3-stage roadmap. Targets keywords: vector-search, HNSW, ANN,
matryoshka, agent-memory, MCP, WASM, edge-AI, DiskANN, RAG.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01SiBAYNQQ2hbZPSF33wr439

* fix(ruvector-matryoshka): clippy + rustfmt

- .max(10).min(100) → .clamp(10, 100)
- loop index 'd' → iterate &centre elements directly
- l2_normalize: &mut Vec → &mut [f32]
- cargo fmt

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-21 18:55:59 -04:00
rUv
a6905b6837
feat: LSM-ANN write-optimised streaming vector index (ADR-264) (#591)
* feat(lsm-ann): add LSM-ANN write-optimised streaming vector index crate

Implements three-tier LSM-ANN index (ADR-264) for agent memory workloads:
- BaselineLsm: flat MemTable brute-force (recall@10=1.000, 348K inserts/s)
- TwoTierLsm: MemTable + frozen NSW segment (recall@10=0.852, p50=484µs)
- FullLsm: MemTable + L1 segments + L2 merged segment (recall@10=0.855, p50=468µs)

NSW construction uses brute-force kNN for correct neighbourhood guarantees.
Beam search uses dual-heap pattern (ClosestFirst/FarthestFirst) for correct recall.
All 8 unit tests pass; benchmark binary validates acceptance criteria at runtime.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_014sybE4DFGT4DCEuTsJBEWz

* docs(lsm-ann): add ADR-264, research README, and SEO gist

- docs/adr/ADR-264-lsm-ann.md: architecture decision record with alternatives considered,
  benchmark evidence, and correctness notes on dual-heap beam search
- docs/research/nightly/2026-06-19-lsm-ann/README.md: full research report with SOTA
  survey (FreshDiskANN, SPFresh, CleANN, Quake, Wolverine), architecture diagrams,
  measured benchmark results, and ecosystem connection map
- docs/research/nightly/2026-06-19-lsm-ann/gist.md: SEO-optimised public article
  explaining the LSM-ANN design pattern for the broader Rust/ML community

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_014sybE4DFGT4DCEuTsJBEWz

* fix(ruvector-lsm-ann): clippy + rustfmt

- .into_iter() on Vec removed (redundant, clippy::useless_conversion)
- print_row: #[allow(too_many_arguments)] — benchmark helper, not public API
- cargo fmt on lsm.rs and segment.rs

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

* Resolve Cargo conflict with main

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-21 18:55:51 -04:00
ruvnet
763c3ef00a Merge main: use main Cargo.toml/lock 2026-06-18 23:31:42 -04:00
rUv
21246813aa
research: nightly 2026-06-15 — multi-vector MaxSim late interaction (#569)
Adds crates/ruvector-maxsim: ColBERT-style multi-vector late interaction
search in pure Rust. Implements the MultiVecIndex trait with three variants:

- FlatMaxSim: exhaustive oracle (recall 1.000, 179 QPS at N=5K, D=64)
- BucketMaxSim: centroid pre-filter (recall 0.797 at os=500, 873 QPS)
- HnswMaxSim: flat NSW token graph (recall 0.437, 774 QPS)

Key result: BucketFast(os=50) delivers 10.4× speedup over FlatMaxSim.
Multi-token advantage confirmed: doc covering two topics scores 1.0
vs −0.017 for single-topic doc on a topic-B query.

19 unit + integration tests pass. 6 acceptance tests pass.
Hardware: x86_64 Linux 6.18.5, rustc 1.87.0 --release.

Also adds:
- docs/adr/ADR-252-multi-vector-maxsim.md
- docs/research/nightly/2026-06-15-multi-vector-maxsim/README.md
- docs/research/nightly/2026-06-15-multi-vector-maxsim/gist.md

https://claude.ai/code/session_012DGVDmZDWketKGDGigwggt

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-18 23:31:14 -04:00
rUv
0aaa92cb84
research: add nightly coherence-gated HNSW search PoC (#571)
Implements traversal-direction coherence gating for HNSW beam search.
Before expanding a candidate's neighbor list, computes cosine similarity
between (candidate-entry) and (query-entry) directions; skips expansion
when below threshold.

Measured results (N=2000, D=32, 8 clusters, ef=80, release build):
  Baseline:              84.8 µs mean, 93.0% recall@10
  CoherenceGated(0.50):  77.0 µs mean, 90.3% recall@10, 7.5% fewer expansions
  AdaptiveCoherence:     81.9 µs mean, 92.9% recall@10

All 15 unit tests and 4 acceptance tests pass.

Adds:
- crates/ruvector-coherence-hnsw/ (standalone PoC crate)
- docs/research/nightly/2026-06-16-coherence-hnsw-search/README.md
- docs/research/nightly/2026-06-16-coherence-hnsw-search/gist.md
- docs/adr/ADR-254-coherence-hnsw-search.md

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-18 23:29:07 -04:00
rUv
6267cb1b28
research(nightly): temporal-coherence-agent-memory (#564)
* feat: add temporal coherence decay crate for agent memory retrieval

Implements ruvector-temporal-coherence with three VectorSearch variants:
- FlatSearch: pure cosine similarity baseline
- TemporalSearch: cosine × exponential time decay
- CoherenceSearch: cosine × (decay + graph-coherence gate)

All 21 unit tests pass. Acceptance benchmark: N=5000 D=128 K=10 200q
- FlatSearch: cosine_recall=1.000 PASS
- TemporalSearch: recency=0.962 PASS
- CoherenceSearch: coh_gate=0.971 PASS
- Latency: ~1036µs mean / 965 q/s (x86-64, linear scan, Rust 1.94.1)

https://claude.ai/code/session_01AZSYgw84vT12vXZDsRGDvK

* docs: add nightly research and ADR for temporal coherence agent memory

- docs/adr/ADR-211-temporal-coherence-agent-memory.md
- docs/research/nightly/2026-06-13-temporal-coherence-agent-memory/README.md
- docs/research/nightly/2026-06-13-temporal-coherence-agent-memory/gist.md

ADR-211 documents design decisions, benchmark evidence, failure modes,
alternatives considered (gMMR, QuIVer, MinCut compaction), and migration path.

https://claude.ai/code/session_01AZSYgw84vT12vXZDsRGDvK

* chore: update Cargo.lock for ruvector-temporal-coherence dependencies

Adds rand small_rng feature lock entries for the new crate.

https://claude.ai/code/session_01AZSYgw84vT12vXZDsRGDvK

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-18 23:28:38 -04:00
rUv
e188a613a9
research(nightly): hybrid sparse-dense search — BM25 + ANN with RRF and RSF (ADR-256) (#576)
* research: add nightly survey for hybrid-sparse-dense

Three-pass research survey selecting hybrid sparse-dense (BM25 + ANN +
RRF/RSF) as nightly topic.  Covers SOTA, gap analysis vs. ruvector-core,
industry comparison (Qdrant, Weaviate, Milvus, Vespa, LanceDB), practical
and exotic applications, deep research notes, benchmark methodology, and
full reference list.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01NFp4fjSarGCp2xpqJtqP2Z

* feat: add ruvector-hybrid crate with BM25 + ANN + RRF/RSF fusion

New standalone crate implementing three hybrid sparse-dense search
strategies: ScoreFusion (backward-compat with ruvector-core), RRF
(Cormack 2009, k=60, rank-only), and RSF (Weaviate-style per-list
min-max + configurable α).

BM25 pre-computes TF at index time (O(|q|×P) query) fixing the
re-tokenisation-at-query-time bug in ruvector-core (O(N×|d|)).

Benchmark: 10K docs × 128-D, 20 topics, 500 queries, k=10.
  BM25:  77.3% recall@10,  57,174 QPS
  RSF:   76.6% recall@10,     360 QPS
  RRF:   50.5% recall@10,     360 QPS
  Score: 68.8% recall@10,     357 QPS
  Dense:  7.5% recall@10,     371 QPS

No unsafe code. Compiles to WASM. 19 unit tests.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01NFp4fjSarGCp2xpqJtqP2Z

* docs: add ADR-256 for hybrid sparse-dense search (RRF and RSF)

Architecture Decision Record for adding Reciprocal Rank Fusion and
Relative Score Fusion to RuVector's hybrid search infrastructure.

Documents: gap in ruvector-core (global normalisation + re-tokenisation
bug), industry comparison, benchmark evidence, three-phase implementation
plan, failure modes, security considerations, and migration path.

Status: proposed. PoC in crates/ruvector-hybrid.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01NFp4fjSarGCp2xpqJtqP2Z

* docs: add SEO gist for hybrid-sparse-dense research

Public technical article covering RRF and RSF hybrid search fusion in
Rust.  Includes feature comparison table, Mermaid architecture diagram,
real benchmark results, comparison with 9 vector databases, 8 practical
+ 8 exotic applications, deep research notes on BM25 dominance and
normalisation theory, usage guide, optimization guide, and roadmap.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01NFp4fjSarGCp2xpqJtqP2Z

* fix(ruvector-hybrid): clippy + fmt for CI

- centres[t] loop index → iter().enumerate()
- percentile cast: drop .max(0) (usize is never negative, clippy::unnecessary_min_or_max)
- percentile cast: #[allow] remaining cast lints (intentional saturating cast)
- print_row: &mut Vec → &mut [_]
- fusion.rs: 3.14 → 3.0 (clippy::approx_constant)
- cargo fmt on entire crate

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-18 23:28:08 -04:00
rUv
2b7dbc7388
feat(photonlayer): optical simulation core — field, FFT, propagation, detector, receipts (ADR-260 Phase 1) (#587)
* feat(photonlayer): optical simulation core — field, FFT, propagation, detector, receipts (ADR-260 Phase 1)

Pure-Rust, dependency-light, deterministic learned-optical-frontend core:
- complex/fft: in-house radix-2 2D FFT (bit-reproducible, no external FFT lib)
- field/mask: image->scalar field, phase-only learned mask (identity/random/lens)
- propagate: Fresnel, Fraunhofer, angular-spectrum scalar diffraction
- detector: intensity capture + seeded shot/read noise, binning, quantization
- metrics: MSE/PSNR, compression ratio, frame-similarity, spectrum embedding
- receipt: BLAKE3-bound experiment receipts + verify (determinism invariant §21)
21 unit tests + doctest passing.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01PjRKJMFe6yoNY3SMVEieHy

* feat(photonlayer): in-Rust mask learner, decoder, and benchmark harness (ADR-260 Phase 2/4)

- synthetic: deterministic 4-class shape dataset (no MNIST per ADR-260 §20.2)
- decoder: feature pooling + nearest-centroid digital backend (exact param count)
- learn: seeded block hill-climbing mask optimizer against task loss; learned
  mask provably dominates its random start (acceptance gate §17.2)
- baselines: digital/random/learned variants + compression showcase
- Result: at a 2x2 (4-pixel) sensor, learned mask 1.00 vs random 0.80 vs
  digital 0.65 test accuracy — same task, 64x fewer sensor pixels (§16.3)

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01PjRKJMFe6yoNY3SMVEieHy

* chore(photonlayer): scaffold ruvector/cli/wasm crates for swarm implementation (ADR-260)

Stub crates registered as workspace members so each is independently
buildable/testable while the implementation swarm fills them in.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01PjRKJMFe6yoNY3SMVEieHy

* feat(photonlayer): experiment memory, WASM playback, verification/privacy, CLI demos (ADR-260 Phases 2-4)

photonlayer-ruvector (22 tests): 32-dim experiment embeddings (mask histogram +
frame spectrum), cosine nearest-experiment recall, Fiedler-spectral pass/fail
boundary analysis, mask-family coherence gates, verifying receipt store.

photonlayer-wasm (17 tests): 5-view browser pipeline (incoming/mask/masked/
sensor + frame hash) with min-max u8 encoders; in-browser verify_receipt_json
(anti-swap); default_config_json.

photonlayer-bench (9 tests): + verification module (FAR/FRR/EER) and privacy
module (linear reconstruction-attack leakage). Learned mask EER 0.001 vs random
0.133; optical capture reduces reconstruction PSNR vs identity.

photonlayer-cli: bench / barcode / edge / privacy-gate / verify-receipt demos
with ASCII frame rendering. Barcode decodes all 4 classes from non-human-readable
frames; privacy-gate emits a verifying RVF receipt. Clean build, zero warnings.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01PjRKJMFe6yoNY3SMVEieHy

* harden(photonlayer): validate untrusted optical configs at the boundary (ADR-260 security)

Add OpticalConfig::validate() + MAX_GRID_DIM cap as the security choke point:
reject non-power-of-two/oversized grids, non-finite or non-physical optical
params, and binning=0 before any allocation or FFT. Enforced in OpticalField::
from_image (pre-allocation) and in the WASM run_trace boundary (dimension guard
+ config.validate) to block allocation-DoS and 32-bit usize overflow from a
malicious config_json. +2 core tests (now 23).

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01PjRKJMFe6yoNY3SMVEieHy

* docs(photonlayer): ADR-260 — learned-optical-frontend computing simulator

Formalizes the architecture, pipeline, crate layout, RuVector experiment-memory
schema, RVF receipt binding, benchmarks, acceptance gates, the determinism
invariant, and the application/positioning/ethics framing (front-end thesis;
industrial sensors -> drone preprocessing -> medical research -> consented
verification; non-goal: mass-surveillance face ID).

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01PjRKJMFe6yoNY3SMVEieHy

* docs(photonlayer): ADR-261 (mask exchange + determinism), ADR-262 (privacy verification), SOTA research brief

ADR-261: canonical PhaseMask exchange format, determinism invariant (in-house
FFT + seeded RNG + BLAKE3), and import replay-verification.
ADR-262: privacy-preserving consented verification — FAR/FRR/EER, reconstruction-
attack leakage metric, receipt provenance, RuVector governance; documents the
measured numbers (learned EER 0.001 vs 0.133; optical reduces reconstruction PSNR)
and the mass-surveillance non-goal.
sota.md: D2NN, differentiable optics (TorchOptics/waveprop/diffractsim), hybrid
DOE+CNN compression, edge-enhanced D2NN, 2026 full-Stokes metasurface+U-Net;
credible-vs-overclaimed table; reference->component mapping; feasibility ranking.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01PjRKJMFe6yoNY3SMVEieHy

* docs+bench(photonlayer): README, assessment/roadmap, more-data benchmark; fix wasm lint

- README (crate/repo face): positioning ("captures the answer"), the auditable
  optical-compression wedge, measured compression-sweep table, honest "do not
  claim yet" scope.
- docs/research/photonlayer/ASSESSMENT.md: full positioning, use-case risk table,
  prove-next roadmap (energy model, harder datasets, reconstruction-attack suite,
  hardware bridge), demos, products, scoring, acceptance test, references.
- tests/more_data_bench.rs: larger-N compression sweep (1/4/9/16-px sensors,
  40 samples/class, 300 iters) + WIN regression guard. Measured: at 64x reduction
  learned=0.988 vs random=0.738.
- Fix photonlayer-wasm useless-comparison lint -> meaningful monotonicity check.

* perf(photonlayer): M1 — cached + in-place Propagator (1.70x, bit-identical)

Hot-path optimization for the mask-learning loop, which propagates thousands
of fields through one fixed config. The config-only transfer function H was
recomputed on every call, and every propagate() cloned the field buffer.

- Propagator precomputes H once per (config,w,h); propagate_into() runs the
  forward FFT -> xH -> inverse FFT in place (no per-call clone).
- Output is bit-for-bit identical to the free propagate() (asserted in
  cached_propagator_is_bit_identical, always-on).
- Measured 1.70x over the naive path at 64x64 x3000 (release):
  naive=615ms -> cached+inplace=361ms. Proof is an --ignored timing test
  (debug wall-clock is meaningless); correctness gate runs in the default suite.

Also lands:
- ADR-263 PhotonLayer FiberGate (transmission-matrix MMF backend; receipt-
  verified, NOT zero-knowledge; non-square T; nalgebra column-major contract).
- docs/research/photonlayer/APPLICATIONS.md — task-trained-sensors positioning,
  application areas, viral demos, product path, platform acceptance test.

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

* feat(photonlayer): real-data MNIST optical-compression benchmark + differential ablation (M2)

Adds an honest, reproducible real-data benchmark for the learned optical
frontend (ADR-260 M2), replacing the synthetic-only 4-class evaluation that
ADR-260 itself flagged as a scientific-integrity risk.

New modules (photonlayer-bench):
- mnist.rs    : parses raw uncompressed IDX (verified magic 0x803/0x801),
                downsamples 28x28 -> 20x20 centered in a 32x32 power-of-two
                optical grid. Dataset is fetched once into a gitignored cache
                (NOT vendored); loader has zero network/decompression deps.
- diffdetect.rs: differential-detection readout (Li/Ozcan arXiv:1906.03417) -
                10 positive + 10 negative detector regions, score I+_k - I-_k.
- mnist_bench.rs: trains one phase mask (seeded block hill-climbing) and runs
                the full acceptance comparison + ablation on the IDENTICAL mask.

Integration test (mnist_differential_bench.rs, NOT a standalone bin to avoid
the CrowdStrike AV os-error-5 on fresh exes): fast always-on smoke guard +
#[ignore] heavy run with a documented command.

Measured (deterministic, seed 0x6e157, 4000 train / 2000 blind test, balanced):
  full-image baseline (1024 px, 10240-param centroid)  0.7540
  optical compressed  (  64 px,   640-param centroid)  0.7420
  delta vs baseline                                   -0.0120  (PASS, allows -0.02)
  sensor pixel reduction                               16.0x   (>= 16x)
  digital MAC reduction                                16.0x   (>= 10x)
  learned vs random mask (decoded)                     +0.0925
ACCEPTANCE (user's relative-to-baseline test): PASS.

Honest caveats reported in-table: this is a SINGLE hill-climbed phase mask +
tiny decoder (single-layer optical compression). The Li/Ozcan ~97% MNIST figure
is a 5-layer diffractive net trained end-to-end by backprop with differential
readout as the final layer; multi-layer + gradient is future work. The
optics-only argmax differential lever is reported as a transparency floor (the
mask is trained for the decoder readout, not the argmax readout). No absolute
SOTA claim is made.

cargo test -p photonlayer-core (23 pass) and -p photonlayer-bench --lib
(14 pass) green; clippy clean.

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

* docs(photonlayer): M3 — fold verified MNIST result + honest positioning + citations into ASSESSMENT

Adds the measured real-data MNIST table (optical 74.20% vs full-image baseline
75.40%, -1.20pp, 16x sensor + 16x MAC reduction; +9.25pp learned-vs-random),
the verbatim non-overclaiming positioning paragraph (competitive single-layer
optical compression, NOT a new accuracy SOTA), the must-avoid language list,
and the closest architectural citations (Wirth-Singh arXiv:2406.06534 primary,
Bezzam 2206.01429, Lin Science 2018, Li/Ozcan 1906.03417, Wang 2507.17374).

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

* perf(photonlayer-core): fold Fraunhofer fftshift into checkerboard premult + precompute FFT twiddle tables

OPT-A (bit-identical): replace `fft_2d + fftshift_2d` in both Fraunhofer
paths (free `fraunhofer()` and `Propagator::propagate_into`) with a ±1
checkerboard premultiply `(-1)^(x+y)` before the transform. By the DFT
shift theorem, FFT of the premultiplied input equals fftshift of the FFT,
eliminating the fftshift's full-buffer alloc + quadrant copy. True negate
(`Complex::ZERO - c`) is exact ±1.0 -> element-for-element identical to the
old sequence (new test `checkerboard_premult_equals_fft_then_fftshift`).

OPT-B (deliberately changes bits, determinism gain): precompute a per-
dimension `TwiddleTable` (`exp(sign·2π·j/n)` for j in 0..n/2) and INDEX it
by stride per butterfly instead of accumulating `w *= wlen`. Kills the f32
drift the accumulation injected and recomputes angles once per 2D FFT
instead of per row/column. Proven: FFT is bit-for-bit reproducible across
runs, and max-abs error vs an f64 reference DFT does NOT increase
(it decreases — drift removed). No hardcoded golden hashes/values in the
repo to update; re-run-determinism tests stay valid by construction.

Measured (release, 64x64 x3000, --ignored --nocapture):
  fraunhofer OPT-A+B: old(fft+fftshift,accum-twiddle)=210.5ms ->
  new(checkerboard+table)=116.1ms = 1.81x, max_diff_vs_old=5.7e-6 (f32 noise).
M1 cached-propagator benchmark still 2.00x and bit-identical.

All 27 photonlayer-core unit tests + propagation bit-identical gate green;
photonlayer-ruvector / photonlayer-bench / photonlayer-cli build and tests
green. Determinism invariant preserved (scalar cos/sin FFT, no FMA/SIMD/RFFT).

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

* feat(photonlayer): add Config B (argmax-diff-trained mask) to MNIST bench — isolates the differential lever

The M2 benchmark previously reported the differential-vs-plain argmax delta as a
small (+0.10pp) transparency footnote, because the single mask was trained for
the DECODER objective, not the argmax readout. That understated the Li/Ozcan
differential-detection mechanism. This adds a SECOND, clearly-labeled mask
trained directly for the argmax-differential objective, so the lever is shown in
isolation. Config A is unchanged and remains the product/acceptance headline.

Two masks, two objectives — A proves task-useful compression (the product
claim); B isolates the differential-detection lever (the mechanism). Both fully
deterministic (stated seeds), both reproduced by the integration test.

Measured (real MNIST, 4000 train / 2000 blind test, on current core HEAD):
  CONFIG A (decoder objective, seed 0x6e157) — product/acceptance:
    full-image baseline (1024 px)  0.7540
    optical compressed  (  64 px)  0.7305   (-2.35pp; 16x sensor + 16x MACs)
    learned vs random decoded      +0.0810  (WIN guard, asserted)
  CONFIG B (argmax-diff objective, seed 0x6e15c) — mechanism, NO decoder:
    plain argmax I+_k              0.1840
    differential argmax I+ - I-    0.3490
    differential lever delta       +0.1650  (asserted >= +0.05)
    NOTE: absolute accuracy is single-layer optics-only (no decoder) and modest
    by construction; the +0.1650 isolates the lever, NOT a headline accuracy.

No SOTA/beats language; no cherry-picking — both configs are in the printed table.

NOTE on Config A drift: an earlier measurement on commit 69424ecb read optical
0.7420 (-1.20pp, acceptance PASS). The core FFT crate changed underneath us
(cbcd0eb2, "precompute FFT twiddle tables") which slightly altered the
diffraction output for ALL FFT paths (AngularSpectrum included), shifting Config
A to 0.7305 (-2.35pp). Acceptance is REPORTED, not hard-asserted, so the test
stays green; the honest current-core number is -2.35pp. Flagged to the core
author — the twiddle-table change is not bit-identical to the pre-cbcd0eb2 FFT.

Scope: photonlayer-bench only (mnist_bench.rs + integration test). Core untouched.
cargo test -p photonlayer-bench --lib (14) + smoke green; full #[ignore] passes
(647s); clippy clean.

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

* test(photonlayer-bench): document the Config-A hill-climb optimizer ceiling

Adds run_mnist_config_a (fast Config-A-only harness) and a permanent #[ignore]
iteration sweep proving the -2pp acceptance line is NOT a training-budget issue
on the drift-corrected (post-cbcd0eb2) FFT core. Measured (seed 0x6e157,
4000 train / 2000 blind test):
  iters 1500 -> optical 73.05% (-2.35pp)
  iters 3000 -> optical 73.25% (-2.15pp)
  iters 4500 -> optical 73.20% (-2.20pp)
The block hill-climber has converged; the residual ~2pp gap is an OPTIMIZER
limit. Closing it (and reaching ~85-89%) requires analytic gradient descent
through the diffraction operator (Propagator::backward_into with conj(H)) — the
documented roadmap keystone, not a tonight change. No fabricated numbers; the
honest single-mask result is reported, not asserted to PASS.

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

* docs(photonlayer): M3 — refresh ASSESSMENT to shipped numbers + optimizer-ceiling honesty

The pre-OPT-B -1.20pp figure was stale after the twiddle-table FFT change.
Updates Config A to the true converged number on the optimized core
(73.05% / -2.35pp at 16x/16x; +8.10pp learned-vs-random), adds Config B
(+16.50pp differential lever), and states the honest framing: the gap is an
optimizer ceiling (sweep: 1500/3000/4500 -> -2.35/-2.15/-2.20pp), closeable
only by analytic gradient descent (backward_into with conj(H)) — the roadmap
keystone, with ~85-89% headroom. No PASS asserted that the method cannot reach.

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

* fix(photonlayer-bench): rustfmt + doc_lazy_continuation lint

- cargo fmt on all photonlayer crates
- Fix doc comment: `+` on continuation line parsed as markdown list
  marker causing clippy::doc_lazy_continuation. Changed to prose `and`.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ruv <ruvnet@users.noreply.github.com>
Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-18 23:22:42 -04:00
ruvnet
5472358b73 Merge remote-tracking branch 'origin/main' into research/nightly/2026-06-18-hnsw-delete-repair
# Conflicts:
#	Cargo.lock
2026-06-18 23:19:14 -04:00
rUv
946275a611
fix(ruvllm-cli): follow HF 307 redirect on aux-file download (#590)
* docs(adr-259): mark RuvllmMutator implemented (code+tests+CLI in @metaharness/darwin); live-serve e2e blocked by ruvllm download redirect bug

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

* fix(ruvllm-cli): follow HF 307 redirect on aux-file download (curl -L fallback)

`ruvllm download <model>` failed on aux files like tokenizer_config.json:
'Failed to download tokenizer_config.json'. The hf-hub API client doesn't follow
HuggingFace's 307 redirect to the LFS/CDN host for these files (a plain `curl -L`
on the same resolve URL returns 200). Add a redirect-following `curl -L --fail`
fallback in download_with_progress(): try hf-hub first, fall back to curl from the
HF resolve URL (https://huggingface.co/<id>/resolve/<rev>/<file>), honoring HF_TOKEN.
curl is already the download mechanism in hub/download.rs, so this is dependency-free
and consistent. Verified: tokenizer_config.json + config.json now download (2.9KB/2.5KB).

Note: a SEPARATE pre-existing bug remains — GGUF weights are requested as an unexpanded
glob '*<suffix>.gguf' (404), and the GGUF alias points at the safetensors repo; that
needs HF file-listing + registry resolution and is out of scope for this redirect fix.

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

* style(ruvllm-cli): rustfmt

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

---------

Co-authored-by: ruvnet <ruvnet@gmail.com>
2026-06-18 23:06:54 -04:00
ruvnet
47b88af965 docs(adr): update ADR-260 with accurate darwin-mode README details
Corrects three key misunderstandings from the initial ADR-260:

1. ADR-074 ("ruvvector-memory-ruflo-fabric") already exists upstream in
   darwin-mode — this ADR implements it, not designs it. RuvvectorArchive
   is now explicitly described as implementing darwin-mode ADR-074.

2. sandboxMode: 'agent' (ADR-106) is already shipped — not deferred. Darwin
   Mode runs real surface code in a child process today on canonical SWE-bench
   Lite (full 300 instances, official swebench Docker harness).

3. SWE-bench Lite baseline is a concrete 7.7% [5.2-11.2% CI] resolve rate
   with deepseek-chat at $0.01/instance. Active lever is the repair loop
   (ADR-149). Adds economics table showing $9 → $0 for 300-instance run
   with 3-iteration repair using ruvllm local GPU inference.

Also adds:
- Connection between repair loop iterative structure and RDT adaptive depth
- Depth router: hard patches get more ACT loops per call (x-ruvllm-max-loops)
- DeepSeek-V3 quality-per-dollar context from darwin-mode ADR-085 benchmark
- Correct composite picture: ruvllm provides depth-adaptive within-call
  reasoning while ADR-149 provides iterative across-call repair

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-18 20:23:31 -04:00
ruvnet
82b5465f3d docs(adr): ADR-260 Darwin Mode as evolutionary substrate for MetaHarness
Deep integration review of @metaharness/darwin across three layers:

Layer 1 — ruvvector as population archive (this ADR):
  - Replace filesystem archive with HNSW-backed RuvvectorArchive
  - O(log n) ANN selection vs O(n) exhaustive scan at 100+ variants
  - Per-surface HNSW namespaces (one per mutation surface)
  - Cross-repo fleet archive via shared ruvvector node (publish/seed commands)

Layer 2 — ruvllm as CodeGenerator (ADR-259, already implemented):
  - RuvllmMutator → POST /v1/chat/completions → local RDT/GGUF model
  - Zero API cost, sub-300ms (GPU), air-gap capable

Layer 3 — RDT adaptive depth as mutation difficulty router:
  - Low halt depth → greedy simple mutations
  - High halt depth → deeper reasoning on complex restructuring

Key conclusions of deep review:
  - Darwin Mode is the right evolutionary substrate for MetaHarness
  - "Frozen model, evolving harness" thesis is orthogonal to ruvllm's
    "GPU-resident inference for recurrent depth" thesis — they compose
  - ruvllm ADR-258 GPU optimizations make local evolution faster than
    OpenRouter (6 s vs 10 s for a 4-child × 5-generation sweep on RTX 5080)
  - The Darwin archive is a vector search problem — ruvvector removes the
    impedance mismatch of the filesystem archive

Acceptance test: end-to-end pipeline with ruvllm mutator + ruvvector archive
scoring >5% improvement over 5 generations in <120 s on RTX 5080, zero
OpenRouter calls.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-18 20:19:51 -04:00
ruvnet
920d8cc28f docs(adr): ADR-259 ruvllm as local mutator backend for Darwin Mode
Proposes RuvllmMutator — a CodeGenerator implementation that targets
ruvllm serve's OpenAI-compatible /v1/chat/completions endpoint instead
of OpenRouter, enabling air-gapped, zero-cost harness evolution.

Key design points:
- Implements existing CodeGenerator interface; zero changes to darwin-mode core
- Activated via --mutator ruvllm flag on the evolve command
- Graceful no-op on server unreachable (same contract as OpenRouterMutator)
- No runtime deps (Node built-ins only, preserves darwin-mode constraint)
- ruvllm server lifecycle managed externally by user

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-18 15:22:11 -04:00
ruvnet
a0cec6b747 feat(ruvllm): zero-copy fused ACT + TTFT/long-decode bench + ADR conclusion
1. act_kernel.rs — zero-copy tensor pointer extraction (no staging memcpy)

Candle 0.9 exposes three public hooks that together give raw CUDA device
pointers without patching candle:
  Tensor::device().as_cuda_device() → &CudaDevice
  CudaDevice::cuda_stream()          → Arc<CudaStream>
  Tensor::storage_and_layout()      → (Guard<Storage>, &Layout)
  CudaStorage::as_cuda_slice<T>()   → &CudaSlice<T>
  DevicePtr::device_ptr(&stream)    → (CUdeviceptr, SyncOnDrop)

New public utilities in act_kernel.rs:
  with_tensor_f32_ptr(tensor, |ptr| ...)   — callback-based F32 device ptr
  with_tensor_bf16_ptr(tensor, |ptr| ...)  — same for BF16

New struct FusedActZeroCopy:
  - Shares candle's stream/context (no separate CudaContext)
  - p tensor and w_out tensor accessed via raw pointers — no H2D/D2H staging
  - Reduces the 2 staging transfers per ACT step to 0 transfers

Remaining limitation: ACT state (cum, not_halted, depth) still on a separate
cudarc context. A follow-up can allocate these as Candle tensors to fully
unify. Tracked in ADR-258.

2. bench — TTFT and long decode sweep groups

New bench groups:
  cpu/mythos_decode_sweep_f32 — prompt32 TTFT + gen 16/64/128
  cuda/mythos_decode_sweep_bf16 — same on CUDA

These measure the benchmarks needed to close the ADR-258 "acceptance test":
  - Time to first token
  - Tokens/sec at increasing generation lengths

3. ADR-258 — conclusion section + next phase decision matrix

Added:
  - Executive conclusion paragraph (key claim: GPU-resident ACT loop)
  - P0/P1/P2 priority table (CUDA Graphs, zero-copy, long decode, Flash Attn)
  - Acceptance test criteria for "SOTA credible"
  - Required benchmark list (10 items)
  - Pre-repeated KV buffer rejection rationale added to Alternatives

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-18 15:19:34 -04:00
ruvnet
8af0800a52 docs(adr): update ADR-258 with final measured decode speedups
Add decode performance table:
  CPU:  73.4ms → 62.3ms (-15%)
  CUDA: 48.9ms → 44.3ms (-9.4%)

Update build notes: CUDA 13.0 now supported natively with candle 0.9 + cudarc 0.19.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-18 14:39:13 -04:00
ruvnet
50eb592403 docs(adr): update ADR-258 with post-merge optimization sweep
Documents the /loop 5m until sota optimizations added to main after PR #589:
- Load-time caching (RoPE, causal mask, LTI diagonal, DepthLora effective_w)
- Decode path improvements (on-device argmax, GPU top-k sort, from_slice)
- True streaming generation via callback

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-18 13:54:25 -04:00
rUv
996311ff57
feat(ruvllm): RDT execution substrate + OpenMythos recurrent-depth model (#589)
Merged via admin override — two pre-existing CI failures are in unrelated crates (ruvector-bet4-ivf-bench rustfmt, dependency-review false positive on cudarc which was already a transitive dep). All ruvllm tests pass (1582).
2026-06-18 11:52:55 -04:00
Claude
c4371872e9
research: add nightly survey for hnsw-delete-repair
Three pluggable HNSW deletion strategies (TombstoneOnly, BatchRepair,
EagerRepair) with DeletionStrategy trait, self-contained HNSW PoC,
12 passing tests, and real benchmark results on 5K×64 data.

Baseline recall@10: 0.9140
TombstoneOnly post-delete: 0.8950 (−1.9pp), delete=0.00ms
BatchRepair(50) post-delete: 0.9040 (−1.0pp), delete=81.69ms
EagerRepair post-delete: 0.9040 (−1.0pp), delete=83.02ms
Acceptance: PASS (best=0.9040 ≥ threshold=0.6855)

ADR: docs/adr/ADR-258-hnsw-delete-repair.md
Crate: crates/ruvector-hnsw-repair
Research: docs/research/nightly/2026-06-18-hnsw-delete-repair/

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01KxiBenREfLTBoss6x66EXk
2026-06-18 07:21:39 +00:00
Ofer Shaal
18dedfac7b
BET 5 (SepRAG #534): PQ/IVFADC within-list pruning vs tuned IVF nprobe — scale-gated WIN (ADR-206) (#542)
* docs(bet4): pre-register LB-B&B IVF vs plain-IVF nprobe gate (FROZEN)

Closes the BET 4 caveat left open by ADR-201: the region-pruning IVF
kernel was only run against ACORN (BET 2), never against its natural
incumbent, plain IVF nprobe, on unfiltered ANN. Frozen gate: WIN = >=2x
member-scan reduction at matched recall@10 (R=0.95) AND wall-clock win
across nclusters in {64,256,1024}; KILL = <1.5x or wall-clock reverses.
Two controls: exact-vs-exact pruning-fraction probe + low-d (PCA-8)
soundness control. Honest prior: NO-GO lean (128-d concentration makes
the triangle-inequality bound loose) — the IVF-level companion to
ADR-199. Branch off clean main; B&B kernel rebuilt self-contained
(BET 2's lives only on #536).

* feat(bet4): M0 — self-contained BnBIvf kernel + oracle gate (exactness certified)

New crate ruvector-bet4-ivf-bench (deps: ruvector-rairs, rand).
- data.rs: aligned arxiv 128-d feature CSV loader.
- kernel.rs: BnBIvf — IVF probed in ascending lower-bound order with B&B
  early termination (break when LB >= kth-best); LB(q,c)=max(0,|q-mu_c|-r_c),
  r_c=max member radius. Full budget = exact; max_probe cap = nprobe analogue.
  Built on ruvector-rairs kmeans so it shares centroids with the IvfFlat
  incumbent (shared-index pre-reg requirement).
- oracle.rs: brute-force exact kNN + recall@k + shared true-L2 helper.
- M0 gate test PASSES on real arxiv slice: full-budget B&B == oracle
  (recall@10 >= 0.999) → B&B invariant certified. clippy clean.

Frozen gate: docs/plans/bet4-ivf-pruning/PRE-REGISTRATION.md. Off clean main.

* feat(bet4): M1 — instrumented plain-IVF incumbent on shared index + faithfulness gate

BnBIvf::search_nprobe: the plain-IVF incumbent strategy (nprobe nearest
centroids, scan all members, no B&B) on the SAME centroids/lists as the
B&B contender, with member-eval counting. Refactored top-k accumulation
into shared consider()/finalize() so both strategies accumulate
identically and only the probe loop differs (shared-index pre-reg
requirement). New gate instrumented_nprobe_matches_rairs PASSES: recall
matches ruvector-rairs::IvfFlat within 0.01 at matched params → the
cost-measured incumbent is algorithmically the real one. 3 tests green.

* feat(bet4): M2/M3 — steelman B&B + PCA-8 control + matched-recall sweep

- kernel: search_bnb_skip — the STEELMAN. Centroid-distance order (the
  effective nprobe ordering) + per-cluster LB-skip (correctness-safe in
  any order, unlike the LB-order global break). The strongest cluster-level
  B&B: if it can't beat tuned nprobe, the bound doesn't pay.
- pca: minimal power-iteration top-m PCA (no linalg dep) for the low-dim
  control — projects real arxiv features to 8-d where the bound is tight.
- examples/ivf_pruning_sweep: 3 contenders share one index per nclusters
  (plain nprobe / B&B LB-order / B&B steelman) x 2 regimes (128-d, PCA-8),
  exact-regime pruning probe, matched-recall@0.95, frozen-gate verdict.

RESULT (n=20k & n=50k both): steelman = 1.00x evals vs nprobe in EVERY
cell, BOTH regimes. NO-GO. Mechanism is structural, not dimensional: the
LB bound only prunes FAR clusters that tuned nprobe already skips, so it's
redundant with nprobe's centroid-distance cutoff. Exact-prune fraction
scales correctly with dim (0-13% @128-d, 8-87% @PCA-8) => kernel sound;
the redundancy is fundamental. LB-ORDER (faithful BET-2 kernel) is strictly
WORSE (0.18-0.25x) — LB-ordering probes far large-radius clusters early.

* docs(bet4): ADR-205 — cluster-pruning vs plain IVF nprobe = structural NO-GO

Verdict: NO-GO (robust, structural). Steelman B&B (centroid order +
LB-skip) ties tuned nprobe at exactly 1.00x member-evals in every cell,
n=20k & n=50k, 128-d & PCA-8. Mechanism: the triangle-inequality bound
only prunes FAR clusters that tuned nprobe already skips => redundant with
nprobe's centroid-distance cutoff; win is structurally impossible, not
just hard in high-d. LB-order (faithful BET-2 kernel) strictly worse
(0.18-0.25x). Companion to ADR-199.

Honest deviation recorded: the pre-registered PCA-8 control expected a B&B
WIN (tight bound). It tied instead — the premise was false (tight bound
beats full-scan, not tuned nprobe). Control still valid: exact-prune
fraction scales correctly with dim (0-13% @128-d, 8-82% @PCA-8) => kernel
sound; it revealed the structural redundancy. Scoreboard 2 WINS / 4 KILLS.

* chore(bet4): lockfile for ruvector-bet4-ivf-bench workspace member

* docs(bet5): FROZEN pre-registration — PQ/IVFADC within-list pruning vs tuned nprobe

Opens the one lever ADR-205 left explicitly open (within-list PQ asymmetric
distance, orthogonal to the killed cluster-level bound). Frozen gate: PQ must
beat the cheaper of {plain full-L2, early-abandon exact-L2} nprobe by >=2x
full-L2-equivalent member-evals at recall@10=0.95 AND wall-clock, across
nclusters{64,256,1024} at >=1 scale N>=50k. Honest prior: ~55% win-at-scale,
named kill-paths = amortization crossover + concentration re-rank ceiling.
Stacked on feat/seprag-bet4-ivf-pruning to reuse ruvector-bet4-ivf-bench.
Thread #534.

* feat(bet5): M0 — PqIvf (IVFADC) kernel + early-abandon steelman + gate

PqIvf trains m sub-quantizers on the shared ruvector-rairs k-means substrate
(kmeans assignments ARE the PQ codes), encodes corpus to m-byte codes, and adds
search_adc_rerank (cheap ADC scan of nprobe lists + exact L2 re-rank of top-R)
plus search_adc_only (pure-ADC ceiling probe). AdcCost charges everything in one
honest unit: 256 (LUT) + adc_members*m/D + rerank*1 full-L2-equivalents.
BnBIvf gains search_nprobe_abandon = the early-abandon exact-L2 steelman
incumbent (user-confirmed verdict-setter), charged in dims_touched/D.

Gates (real 2k arxiv slice): PqIvf shares centroids w/ BnBIvf; PQ@full-rerank
exact (recall>=0.999); early-abandon exact vs full L2 (<0.001). 6 tests green,
clippy clean. Thread #534, BET5 pre-reg frozen at 1d920b3a.

* feat(bet5): M1/M2/M3 — matched-recall PQ sweep harness

examples/pq_pruning_sweep.rs: shared index per nclusters; tune incumbent nprobe
to min reaching recall@10>=0.95; PQ scans the SAME nprobe lists (cannot rerank an
unscanned neighbour) and we tune the smallest re-rank R recovering >=0.95. Charges
all PQ ops in full-L2-equivalents (256 LUT + adc*m/D + R rerank). Reports pure-ADC
ceiling, R*, early-abandon dim-prune fraction, wall-clock, crossover n*, frozen gate.
Thread #534.

* style(bet5): clippy-clean PQ kernel + sweep (iterator idioms, type alias)

* perf(bet5): shared IvfParts — build k-means once per cell, not per contender

Extract build_ivf -> IvfParts; BnBIvf::from_parts + PqIvf::from_parts reuse one
seeded k-means for the incumbent and every PQ(m). Cuts the worst cell (nc=1024
@100k) from 3x k-means to 1x while guaranteeing the shared-index property by
construction. Behavior-preserving (N=5000 numbers identical). 6 tests green.

* fix(bet5): charge routing (nclusters centroid evals) to both contenders

Pre-reg accounting + 'no free routing' adversarial check require the nclusters
query-centroid routing evals charged equally to incumbent AND PQ. Harness omitted
it, silently flattering PQ where routing dominates (high nclusters). Now prints
member-only ratio (transparency) AND the gate-deciding TOTAL ratio with routing;
verdict decided on total. Wall-clock already included routing (search computes
centroid dists) so the wall guard was already honest. Re-run authoritative.

* docs(bet5): ADR-206 — PQ/IVFADC within-list pruning = scale-gated WIN

Opens ADR-205's one open lever (within-list PQ asymmetric distance, orthogonal
to the killed cluster-level bound). PQ (cheap ADC scan + exact top-R rerank)
beats tuned plain nprobe AND the early-abandon exact-L2 steelman by >=2x
full-L2-equivalent member-evals at recall@10=0.95 AND wall-clock, across all
three nclusters{64,256,1024} at N=100k. Win GROWS with N, crossover n* RISES
with nclusters (routing amortization) -> >=2x at nclusters~sqrt(n) from n~20-50k.

Honest caveats (none buried): win rides on the exact rerank not pure ADC
(ceiling ~0.5) = IVFADC+refine validated, not a new method; scale-gated (full
sweep only at 100k); nc=1024/100k knife-edge 2.03x; m=16 tuned; recall-floor
tunability flatters PQ modestly; steelman halved the naive-L2 ratio. Routing
charge bug in my own harness caught by the pre-registered 'no free routing'
check (nc=1024/50k 2.24x member -> 1.65x total). Scoreboard 3 WINS / 4 KILLS.
Thread #534, pre-reg frozen at 1d920b3a.

---------

Co-authored-by: ruv <ruvnet@users.noreply.github.com>
2026-06-17 22:48:32 -04:00
rUv
48ee9c3609
feat(proof-gate): productionize #506 — tamper-evident vector writes (Merkle/hash-chain WAL) (#584)
Some checks failed
regression-guard / vector-db-rebuilds-index-on-open (push) Waiting to run
regression-guard / reentrant-rwlock-double-write (push) Waiting to run
regression-guard / case-insensitive-collisions (push) Waiting to run
regression-guard / ruvector-core-no-avx512-builds-on-stable (push) Waiting to run
regression-guard / hnsw-recall-at-1 (push) Waiting to run
regression-guard / hnsw-insert-beam-no-m2-clamp (push) Waiting to run
regression-guard / hnsw-distance-based-neighbor-pruning (push) Waiting to run
regression-guard / npm-publish-pipeline (npm/packages/pi-brain) (push) Waiting to run
regression-guard / npm-publish-pipeline (npm/packages/ruvector) (push) Waiting to run
regression-guard / npm-publish-pipeline (npm/packages/rvf-wasm) (push) Waiting to run
regression-guard / no-npx-execSync-in-route-enhanced (push) Waiting to run
regression-guard / shell-injection-in-mcp-server (push) Waiting to run
regression-guard / no-systemtime-in-wasm-crates (push) Waiting to run
regression-guard / no-hardcoded-workspaces-paths (push) Waiting to run
regression-guard / brain-hydration-counters-present (push) Waiting to run
regression-guard / optional-deps-resolvable-on-npm (push) Waiting to run
regression-guard / graph-condense-perception-tests (push) Waiting to run
regression-guard / mincut-pin-tracks-workspace-version (push) Waiting to run
supply-chain / cargo deny (license + source + ban policy) (push) Waiting to run
supply-chain / npm audit (npm/ workspace) (push) Waiting to run
supply-chain / lockfile integrity (Cargo.lock) (push) Waiting to run
supply-chain / dependency-review (PRs only) (push) Waiting to run
supply-chain / cargo audit (RustSec advisories) (push) Waiting to run
WASM Dedup Check / check-wasm-dedup (push) Waiting to run
Build DiskANN Native Modules / Build DiskANN darwin-arm64 (push) Has been cancelled
Build DiskANN Native Modules / Build DiskANN darwin-x64 (push) Has been cancelled
Build DiskANN Native Modules / Build DiskANN linux-arm64-gnu (push) Has been cancelled
Build DiskANN Native Modules / Build DiskANN linux-x64-gnu (push) Has been cancelled
Build DiskANN Native Modules / Build DiskANN win32-x64-msvc (push) Has been cancelled
Build DiskANN Native Modules / Publish DiskANN Platform Packages (push) Has been cancelled
* feat(proof-gate): bring ruvector-proof-gate into workspace (productionize #506)

Merkle-accumulating WAL for tamper-evident vector writes (defends the MemoryGraft
poisoning attack; addresses the unguarded-write-path gap in Qdrant/Milvus/Weaviate/
LanceDB/FAISS). Baseline: 16/16 tests pass. Wired into the workspace; ADR-194 +
research docs included. Deps: sha2, thiserror, optional serde.

* test(proof-gate): prove tamper-evidence end-to-end (productionize #506)

tests/tamper_evidence.rs (5 tests): the chain root is a cryptographic commitment
to the entire ordered write log — any mutation/insertion/deletion/reorder yields
a different root; forged commitments and foreign/out-of-range receipts are
rejected (no panic). Surfaced for the secure step: verify_integrity() is only a
structural check (non-zero/monotonic), not a payload re-derivation.

* bench(proof-gate): measure the integrity tax (productionize #506)

tests/perf_benchmark.rs (release, #[ignore]): HashChainGate.admit ~1026 ns/write
(~1.0 M/s) vs NullGate baseline ~36 ns; verify_receipt ~6.4 ns (157 M/s).
Integrity tax ~991 ns/write (~2 SHA-256) — negligible vs the HNSW insert a real
write performs, and verification is effectively free. Budget guard 5000 ns/write.

* secure(proof-gate): verify_integrity does full re-derivation (productionize #506)

Close the gap flagged in the test step: verify_integrity() was only a structural
scan (non-zero/monotonic). Now it stores per-entry payload hashes and re-derives
every commitment from the genesis seed, comparing against the stored chain — so a
tamper that mutates a commitment, a payload hash, reorders entries, or desyncs
lengths is caught (not just degenerate chains). +5 unit tests (private-field
tamper cases). All proof-gate tests green (20 unit + 5 tamper-evidence).

* perf(proof-gate): allocation-free payload hashing (productionize #506)

admit() built canonical_bytes() (a Vec + 128-element extend for a 128-dim vector)
then hashed it. Add WritePayload::payload_hash() that streams the same fields
straight into SHA-256 — identical digest, no intermediate Vec. Measured:
HashChainGate.admit ~1026 -> ~703 ns/write (~31% faster, 0.97 -> 1.42 M/s);
integrity tax ~991 -> ~675 ns. All digests unchanged (20 unit + 5 tamper tests green).

* docs(proof-gate): add crate README (publish-ready)

---------

Co-authored-by: ruv <ruvnet@users.noreply.github.com>
2026-06-17 20:19:47 -04:00
Ofer Shaal
dfe22d62a7
feat(bet1): productionize reuse-under-drift + validate on a real learned-GNN trajectory (ADR-202 WIN) (#537)
* docs(bet1): pre-register reuse-under-drift gate on real GNN trajectory

Productionize BET 1 (ADR-200 WIN under synthetic drift) by wiring
re-weight + periodic-rebuild into the ruvector-diskann loop behind a
feature flag, validated on a REAL contrastive-link-prediction embedding
trajectory on ogbn-arxiv (ADR-200 next-step #4).

Gate frozen before any contender run (prove-not-hype): WIN = ReweightOnly
within 2% recall@10 of AlwaysRebuild + Periodic{k} within 1% at <=50%
cumulative rebuild cost; KILL = no transfer from synthetic to real drift.
Minimum-drift precondition (>=15% top-10 churn) guards against a vacuous
pass. Self-contained off main; independent of PR #535. Outcome -> ADR-202.

Linked: ruvnet/RuVector#534

* feat(diskann): M0 — reuse-under-drift policy module behind feature flag

DriftingIndex wraps a VamanaGraph and owns only the rebuild decision
(RebuildPolicy: AlwaysRebuild / ReweightOnly / Periodic{k}); the consumer
owns the drifting vectors and passes snapshots to on_metric_update + search.
Native reuse hook: greedy_search takes vectors externally, so adapt-to-drift
recomputes only distances. Feature-gated (reuse-under-drift, default off) —
default build byte-identical. 5 unit tests green (cadence + search).

Refs ruvnet/RuVector#534

* feat(bet1): M1-M3 real-trajectory validation harness

examples/diskann_real_trajectory.rs: generates a REAL learned-GNN metric
trajectory via contrastive link-prediction (InfoNCE over ogbn-arxiv
citations, ruvector-gnn Optimizer + info_nce_loss, embeddings on the unit
sphere so cosine==dot and L2 ranking agrees), then drives the diskann
reuse policy (DriftingIndex) through all four contenders step-by-step.

Result (n=20k, gradual trajectory to 67% churn):
- WIN. Reuse holds within 2% recall@10 of full rebuild up to 40% top-10
  churn (>= ADR-200's synthetic ~36% regime) -- transfer confirmed on real
  learned drift. Stale control collapses 92%->33% (teeth).
- Periodic recovers the high-churn tail: P k=4 = 98.7% (gap -0.01%) at 24%
  of rebuild cost, evals 1.00x B. ADR-200 hybrid reproduced on real drift.
- Honest caveat: pure reuse past the ceiling decays (-4.73% over the whole
  overdriven trajectory, 1.05x evals); the shippable periodic policy does not.

Refs ruvnet/RuVector#534

* style(bet1): rustfmt the reuse module + trajectory harness

* docs(adr): ADR-202 — reuse-under-drift WIN on a real learned-GNN trajectory

Outcome ADR for BET 1 productionization (closes ADR-200 next-step #4).
Fixed-topology reuse + periodic rebuild, validated on a real contrastive-
link-prediction trajectory over ogbn-arxiv (not synthetic A(t)).

WIN at n=20k AND n=50k: pure reuse holds within 2% recall@10 of full
rebuild up to a 40% top-10 churn ceiling (identical at both scales, >=
ADR-200's synthetic ~36%); Periodic{k:4} recovers the high-churn tail to
within 0.01% (20k) / above rebuild (50k) at 20-24% of rebuild cost, equal
per-query work. Stale control collapses (teeth). Honest caveat: pure reuse
past the ceiling decays -- the shippable policy is periodic, not never.

Refs ruvnet/RuVector#534

* docs(bet1): record WIN outcome pointer to ADR-202 in pre-registration

* docs(bet1): pre-register sampled-recall trigger gate + force_rebuild plumbing

Pre-register (frozen before any run) the ADR-200 next-step #2 bet: does a
sampled-recall rebuild trigger beat fixed Periodic{k} under VARIABLE-RATE
drift, and beat the Frobenius monitor ADR-200 found wanting? Honest test =
the (rebuilds, recall) Pareto frontier; WIN = trigger >=25% fewer rebuilds
at matched recall with probe cost counted; KILL = no frontier dominance.

Plumbing (allowed pre-freeze): DriftingIndex::force_rebuild + harness.

Refs ruvnet/RuVector#534

* fix(bet1): trigger harness — Adam + enforced churn precondition (first run was VOID)

The first variable-rate run was VOID (0% churn): plain SGD at lr 0.002-0.03
on unit-normalized embeddings doesn't move them. Switched to Adam (real
motion in bursts), n=20k for edge density, and ENFORCED the >=15% churn
precondition (abort before rendering a verdict) so a no-drift trajectory
can't masquerade as a result. Gate criteria unchanged.

Result (n=20k, bursty trajectory, per-step Δchurn ~45 burst / ~2 calm,
89% end churn): WIN. Recall{floor=0.95} = 97.2% @ 7 rebuilds beats
Periodic{k=2} (96.8% @ 12) on BOTH axes; probe cost ~1s vs ~73s rebuild
time saved (trap passed); beats best Frobenius (97.3% @ 9) on rebuilds.

Refs ruvnet/RuVector#534

* feat(bet1): productionize RecallTrigger (WIN) + ADR-202 addendum

The sampled-recall trigger WON (ADR-200 next-step #2): under bursty drift it
uses ~42% fewer rebuilds than fixed Periodic{k} at matched recall, beats the
Frobenius monitor ADR-200 found wanting, and passes the probe-cost trap
(~1s probe vs ~73s rebuild saved). Productionized as RecallTrigger in
ruvector_diskann::reuse (DriftingIndex in ReweightOnly mode + a probe-driven
force_rebuild); its knob 'floor' IS the recall SLA, unlike k/tau. 8 reuse
tests (incl. holds-under-no-drift + fires-then-recovers). ADR-202 addendum
records the result; pre-registration carries the WIN outcome pointer.

Refs ruvnet/RuVector#534

* docs(bet1): pre-register objective-dependence check + nodeclass trajectory

Frozen-before-run generality check of ADR-202's 40% holding ceiling: does
it generalize beyond contrastive link-prediction to a DIFFERENT learned
objective? Adds a node-classification trajectory (real arxiv 40-class
labels, CE on a linear head, embeddings as params) selectable via an
'objective=nodeclass' arg to the existing harness — same contenders + 2%
gate, only the objective changes. CONFIRM = holding ceiling >=30% churn +
periodic recovers; CAVEAT = <20% or materially different (reportable).

Refs ruvnet/RuVector#534

* docs(bet1): objective-dependence CONFIRMED + class-collapse degeneracy caveat

Node-classification trajectory (2nd objective) holds reuse within 2% of
rebuild up to a 54% churn ceiling (>= link-pred's 40%) -> the ADR-202
holding-ceiling result GENERALIZES across two learned objectives; the
objective-dependence caveat is resolved.

Honest finding (reported, not buried): past ~60% churn node-class CE
collapses embeddings into ~40 class blobs where recall@10 is ill-posed
(intra-blob near-ties) and the FULL-REBUILD baseline itself destabilizes
(B swings 55-96%). The trajectory-wide 'reuse > rebuild +4.3%' is a
benchmark-degeneracy artifact (ADR-200's t=0.25 dip amplified), NOT a
genuine superiority claim. Operational conclusion unaffected (reuse+periodic
never worse). ADR-202 addendum + next-step #5 (collapse-aware metric).

Refs ruvnet/RuVector#534
2026-06-17 20:18:50 -04:00
rUv
8417dc283b
feat(gnn-rerank): productionize #479 — +10.4pp recall, CI-guarded, hardened, optimized (#582)
* feat(gnn-rerank): bring ruvector-gnn-rerank into workspace (productionize #479)

Baseline from PR #479: GNN score diffusion reranking over ANN candidates,
recall@10 28.0% -> 38.4% (+10.4pp). 14/14 unit tests pass. Wired into the
workspace; ADR-194 + research docs included. Benchmark bin is AV-blocked on
this Windows box (CrowdStrike); recall numbers are from the PR's CI run.

* test(gnn-rerank): CI-guard the +10.4pp recall win (productionize #479)

Deterministic integration test reproduces the research regime (N=5000, D=128,
noise_sigma=0.40, seed=42) via the public reranker API and asserts GnnDiffusion
beats the NoisyScore baseline by >= 0.03 recall@10. Reproduces the exact #479
numbers: noisy=0.280, gnn=0.384, delta=+0.104. Runs under cargo test (the
standalone benchmark bin is AV-blocked on the dev box). Adds rand/rand_distr
dev-deps.

* bench(gnn-rerank): CI latency/throughput guard + honest tradeoff (productionize #479)

Times the rerank hot path under cargo test --release. Honest finding: the +10.4pp
recall win is NOT free throughput — GnnDiffusion is ~400us/q (~2.5K QPS), ~2900x
slower than the NoisyScore baseline (~0.15us/q, ~7M QPS). The 'millions of QPS'
in #479 was the baseline, not the reranker. Budget guard set to 700us/q to catch
regressions. The O(candidates^2 * dim) k-NN graph build is the hot path -> the
optimize-step target.

* secure(gnn-rerank): reject poisoned inputs fail-fast (productionize #479)

Harden validate(): all candidate vectors must share one dimension and be finite,
scores must be finite — else a typed error (NonFinite / DimMismatch) instead of a
silently-corrupted ranking (poisoned-first-stage / MemoryGraft threat model).
Adds tests/security.rs (6 adversarial cases across all 4 variants: NaN/inf score,
NaN vector, dim mismatch, empty, k-too-large, degenerate/zero vectors) — none
panic. Marks the perf benchmark #[ignore] (release-only; debug timing is
meaningless).

* perf(gnn-rerank): exploit cosine symmetry in graph build (productionize #479)

The candidate k-NN graph build recomputed every cosine pair twice. Cosine is
symmetric, so compute the upper triangle once and push each sim into both
neighbour lists — ~2x fewer dot products (the inner-loop hot path). Measured:
GnnDiffusion ~400us/q -> ~300us/q (~25% wall-clock). Result-identical:
recall@10 delta stays exactly +0.104; all unit/recall/security tests green.

* docs(gnn-rerank): add crate README (publish-ready)

---------

Co-authored-by: ruv <ruvnet@users.noreply.github.com>
2026-06-17 20:18:45 -04:00
rUv
82c21c2a7b
ADR-257: extract ruqu + rvdna into two standalone repos (git submodules) (#579)
* docs(adr): ADR-257 extract ruqu + rvdna into standalone repos via submodules

Two separate standalone repos — ruvnet/ruqu (both clusters: quantum-sim
ruqu-* + min-cut ruQu + ruqu-wasm npm) and ruvnet/rvdna (examples/dna +
rvdna npm) — re-referenced as git submodules at external/ruqu, external/rvdna.

Includes the full coupling analysis (rvdna path-depends on 9 unpublished
ruvector crates; ruQu on ruvector-mincut; ruqu consumed by OSpipe/rvf; code
spans crates/ + npm/), the honest standalone-build caveat, migration steps,
and rollback.

Adds scripts/extract-ruqu-rvdna-submodules.sh — idempotent, DRY-RUN by
default; --execute required to create the public repos. Dry-run verified.

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

* docs(adr): ADR-257 correction — ruvector deps ARE published (closure at 2.2.3)

The earlier "rvdna/ruQu can't build standalone" claim was based on a crates.io
API rate-limit misread. Authoritative sparse-index check shows all ruvector-*
deps were already published; the full rvdna closure is now synced to 2.2.3
(published collections/filter/math/dag/cluster/raft/replication/gnn/attention;
solver/core/graph already there). Standalone builds now only need the mechanical
path->version dep rewrite in the extracted repos. Added an Update section.

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

* refactor: reference ruqu + rvdna as submodules (ADR-257)

- Remove crates/ruqu-*, crates/ruQu, examples/dna, and the two npm wrappers
  from the monorepo; they now live in standalone repos ruvnet/ruqu and
  ruvnet/rvdna (both build standalone against published ruvector-* 2.2.3).
- Add them as git submodules at external/ruqu and external/rvdna; exclude
  those nested workspaces from the root workspace.
- Repoint examples/OSpipe and examples/rvf path deps to external/ruqu/crates/*.
- CI: drop the ruqu-quantum shard + ruqu --exclude lines (no longer workspace
  members), add `submodules: recursive` to checkout steps.
- cargo metadata + full dependency resolution verified green.

Refs #579

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

* fix(ci): exclude examples/OSpipe + examples/rvf from workspace (ADR-257)

These two example crates are the only workspace members that path-dep into the
external/ruqu submodule. As members, they forced EVERY workflow that resolves
the workspace (Build Native Modules, etc.) to need `submodules: recursive` —
those jobs checkout submodules:false and failed:
  failed to read external/ruqu/crates/ruqu-algorithms/Cargo.toml (os error 3)

Moving them to `exclude` makes the workspace resolve without the submodules
(verified: 0 members reference external/), so all Build jobs pass. The crates
remain buildable on demand (`cargo build -p ospipe` with submodules checked out).

Refs #579

---------

Co-authored-by: ruv <ruvnet@users.noreply.github.com>
2026-06-17 17:33:40 -04:00
rUv
d5347d514b
ADR-256: harness router surface (borrow metaharness concepts) (#575)
* feat(ruvector): ADR-256 harness router surface + tracking (#574)

Borrow metaharness concepts using primitives ruvector already ships.

- Add `ruvector harness status [--json]` — unified read-only view of the
  routing surface (Tiny Dancer cost router + semantic router + hooks
  routing + MCP + witness + memory), degrading gracefully when optional
  deps are absent. Implements ADR-256 rollout step 0.
- Add ADR-256 (borrow-concepts decision, concept→primitive mapping).
- Add CLI tests (Section 24): harness --help, status --json structure,
  bare-command behavior. Full suite: 72 passed, 0 failed.

Refs #574

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

* feat(ruvector): ADR-256 default-deny MCP tool-access policy (#574)

Borrow metaharness's default-deny allowlist concept with our own machinery.

- New pure, testable bin/mcp-policy.js: RUVECTOR_MCP_ALLOW / RUVECTOR_MCP_DENY
  / RUVECTOR_MCP_PROFILE=readonly. Precedence DENY > ALLOW/PROFILE > allow-all.
  No policy set = backward-compatible allow-all (policy.configured=false).
- Wire into mcp-server.js: ListTools now returns only permitted tools;
  CallTool gates denied tools with an isError response before dispatch.
- harness status --json now reports mcp.policy + accessControl posture.
- Tests: test/mcp-policy.js (8 unit tests) wired into npm test; verified
  end-to-end over MCP stdio (readonly profile exposes 10 safe tools, filters
  hooks_force_learn). CLI suite still 72/0.

Refs #574

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

* test(ruvector): ADR-256 startup-budget guard + harness/MCP-policy docs (#574)

- New test/startup-budget.js wired into npm test: absolute ceiling on
  `--help` cold start + relative delta guard ensuring `harness status`
  adds < 120ms over baseline (catches a heavy module leaking into the
  startup path). Measured here: --help 127ms, harness +3ms. Env-overridable.
- README: document the default-deny MCP policy env vars
  (RUVECTOR_MCP_ALLOW/DENY/PROFILE) and the `harness` router command.

Refs #574

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

* feat(ruvector): ADR-256 memory namespace + full verification, ADR status (#574)

- harness surface reports a stable memory namespace (RUVECTOR_MEMORY_NAMESPACE,
  default `ruvector`); CLI tests assert the default + override and the MCP
  accessControl/policy fields.
- README documents the memory namespace.
- ADR-256: add "Implementation status (as shipped)" — items 0/1/3/4 done,
  benchmarked + full npm test green; item 2 as a documented convention; item 5
  deferred. No @metaharness/* runtime dep.

Full suite: cli 73/0, mcp-policy 8/0, startup-budget 2/0, db-workflow/integration/sigterm green.

Refs #574

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

---------

Co-authored-by: ruv <ruvnet@users.noreply.github.com>
2026-06-17 10:28:42 -04:00
ruv
183ed4aecf docs(adr): ADR-255 ruvector <-> OIA Model integration (alignment profile)
Grounded in a deep-research brief over agenticsorg/OIA-Model v0.1: maps OIA's
10 layers (L0-L9) + 6 spans to ruvector components, decides a non-binding
alignment profile (ruvector as an L3 + L5-L8 provider), designates the RVF
cognitive container as the L8 artifact and the witness chain as the
SPAN-AUD/PRV primitive, and explicitly scopes out L0/L1/L9/L4-pretraining +
the GCP-portability gap. Stays doc/tag-level — no OIA dependency, no API
rename — because OIA is pre-1.0 with no machine-readable conformance.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-16 12:46:16 -04:00