Skip to content

Navigation Menu

Sign in
Sign up

Brain-AI SOTA research → streaming decoder, FM promotion gates, CoW branch store, DFA/Hurst + privacy gate (Rust + WASM + TS) - #10

Draft
ruvnet wants to merge 6 commits into
main from
claude/brain-ai-agent-swarm-research-adijqi
Draft

Brain-AI SOTA research → streaming decoder, FM promotion gates, CoW branch store, DFA/Hurst + privacy gate (Rust + WASM + TS) #10
ruvnet wants to merge 6 commits into
main from
claude/brain-ai-agent-swarm-research-adijqi

Conversation

@ruvnet

@ruvnet ruvnet commented Aug 8, 2026
edited
Loading

Copy link
×ばつ faster** (751 μs vs 4.16 ms) | | Streaming frame @ 306 ch | **66.9 μs** — ×ばつ margin vs the 80-ms budget | | Streaming frame @ 10-ms cadence | **29.4 μs** — ×ばつ margin | ## Harness (flywheel playbook executed) `npx metaharness score/genome` → verdict READY (harnessFit 67, toolSafety 100). Scaffolded `harness/` (`vertical:coding`, claude-code host) with default-deny permissions; smoke tests 4/4, `harness doctor` HEALTHY; 19-entry witness manifest committed (**caveat:** Ed25519 signature degraded in this environment — content-hash witness only until CI signs with a real key). Darwin Mode dry-run: winner `g2_v5` on the `contextBuilder` surface, +0.110 over baseline. ## Notes for review - Every research claim carries an inline source; preprint, vendor-claim, and modality caveats are flagged in both reports (all streaming latency/accuracy numbers come from invasive or MEG recordings — cadence transfers, SNR does not). - The deep-research report also records a process finding: web-fetch summarization hallucinated table values twice, caught only by direct PDF extraction. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T2uFD8uGFrakkvnQX66pHv" data-view-component="true"> Copy Markdown
Owner

Summary

A research-to-implementation loop run end to end: two adversarially-verified research sweeps, a metaharness agent harness, and six new modules across Rust, WASM, and TypeScript — all tested, validated, and benchmarked.

Commits: SOTA research sweep → DFA/Hurst + privacy gate implementation → metaharness harness → gate hardening from a review swarm → streaming decoder + promotion gates + CoW branch store → completed deep-research report.

Implemented modules

Module What it does
ruv-neural-signal/src/lrtc.rs DFA-1 / Hurst long-range temporal correlations; band_envelope_dfa for alpha-band LRTC. O(n) per scale, zero per-window allocation
ruv-neural-core/src/gate.rs Decode-armed/decode-locked mental-privacy gate ("thought password"), fail-locked on bad clocks/confidence/restore, bounded audit log
ruv-neural-brain2text/src/stream.rs Causal streaming decoder: fixed frame hop, incremental state, gated emissions, LibriBrain keyword-spotting windows + AUPRC/permutation-null/FA-h
ruv-neural-embed/src/promotion.rs Executable ADR-0016 point-4 promotion gates: random-init comparator, subject-disjoint LOSO, leakage check, exact Wilcoxon, AUPRC lift, identity probe
ruv-neural-memory/src/branch.rs Copy-on-write branched embedding store: overlay deltas, tombstones, deep read-through, checkpoint/rollback
ruv-neural-wasm/src/lrtc_wasm.rs + apps/ruv-neural-ui/src/{lrtc,safety}/ WASM bindings and TypeScript mirrors with cross-language parity

Research grounding

Two workflows, both with adversarial verification:

  1. SOTA sweep (8 agents): 2025–2026 brain-AI landscape → docs/research/brain-ai-sota-2026.md, with a 19-row mapping onto crates/ADRs.
  2. Deep-research sweep (105 agents, 23 primary sources, 115 claims → 25 verified via 3-vote adversarial verification, 2 killed) → docs/research/streaming-eval-cow-deep-research-2026.md.

What the verification changed in the code:

  • RNN-T attribution refuted 0-3 → the streaming decoder deliberately does not implement one; it commits only to the cadence and causality the sources establish.
  • 80 ms is a soft budget (99.3% of steps, measured by offline replay) → overruns are reported via StreamStats, not assumed away; the 10-ms regime is supported.
  • Bidirectional Mamba KWS collapses 98.01% → 78.29% when made causal → no bidirectional number is inherited.
  • Zero verified sources for CoW vector stores (vendor self-published, single shared author) → branch.rs is our own design, cites no external numbers, and leaves merge/GC explicitly out of scope.
  • Dataset-identity probe has no published protocol → implemented as ruv-neural's own design and labelled as such.
  • Found during implementation: with the exact Wilcoxon test the minimum two-sided p is 2/2n, so 5 folds can never reach p<0.05 → min_folds is 6.

Review swarm → 8/8 gate fixes

A harness-style swarm (3 reviewers → adversarial verifiers → architect, 12 agents) audited the gate. The DFA math got a clean bill; all 8 gate/bindings findings were confirmed with reproductions and fixed, including a critical one: a NaN clock armed the gate with armed_at_s = -inf, making NaN >= timeout always false — permanently armed. Also fixed: clock regression froze the countdown; serde restore resurrected armed state and bypassed validation; TS getters leaked live mutable internals (armedAtS = Infinity disabled the timeout); Rust/TS wire shapes disagreed (snake_case vs camelCase); percent-scaled confidence armed the gate; WASM coerced fractional arm_frames; TS accepted non-integer DFA config.

Tests & validation

  • Rust: 77 core / 63 signal / 52 embed / 40 memory / 49 brain2text tests green, incl. doctests. Clippy and rustfmt clean on all new code. wasm32 release build green.
  • Validation against theory: DFA recovers white ≈0.5, pink ≈1.0, Brownian ≈1.5 (r2 > 0.95). Promotion gates reproduce the published failure modes (16K EEGNet beating LaBraM; LOSO-at-chance). Streaming decoder proven causal by a divergent-futures test.
  • TypeScript: 58 vitest tests, tsc --noEmit clean; Rust↔TS DFA parity < 1e-9.

Benchmarks (criterion)

Benchmark Result
DFA 1k / 4k / 16k / 65k samples 56.4 μs / 210.7 μs / 750.8 μs / 3.12 ms (linear)
DFA vs naive reference @ 16k ×ばつ faster (751 μs vs 4.16 ms)
Streaming frame @ 306 ch 66.9 μs×ばつ margin vs the 80-ms budget
Streaming frame @ 10-ms cadence 29.4 μs×ばつ margin

Harness (flywheel playbook executed)

npx metaharness score/genome → verdict READY (harnessFit 67, toolSafety 100). Scaffolded harness/ (vertical:coding, claude-code host) with default-deny permissions; smoke tests 4/4, harness doctor HEALTHY; 19-entry witness manifest committed (caveat: Ed25519 signature degraded in this environment — content-hash witness only until CI signs with a real key). Darwin Mode dry-run: winner g2_v5 on the contextBuilder surface, +0.110 over baseline.

Notes for review

  • Every research claim carries an inline source; preprint, vendor-claim, and modality caveats are flagged in both reports (all streaming latency/accuracy numbers come from invasive or MEG recordings — cadence transfers, SNR does not).
  • The deep-research report also records a process finding: web-fetch summarization hallucinated table values twice, caught only by direct PDF extraction.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T2uFD8uGFrakkvnQX66pHv

claude added 2 commits August 8, 2026 22:54
... swarm
Seven parallel research agents plus a synthesis agent swept the latest
(2025–2026) state of the art across brain-to-text, neural foundation
models, invasive BCI, non-invasive sensing, neuromorphic/SNN, whole-brain
simulation and brain-inspired algorithms, and the ruvnet npm metaharness
flywheel ecosystem. Findings are mapped onto ruv-neural crates and ADRs
0001–0024 with recommended actions, plus a continuous flywheel playbook
(metaharness + Darwin Mode + @metaharness/flywheel + agenticow) and an
explicit gaps/caveats section.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2uFD8uGFrakkvnQX66pHv 
...e (Rust + WASM + TS)
Implements the two 'adopt now' actions from the brain-AI SOTA 2026
research sweep (docs/research/brain-ai-sota-2026.md §9):
- ruv-neural-signal::lrtc — detrended fluctuation analysis (DFA-1) with
 closed-form per-window detrending (O(n) per scale, no per-window
 allocation), Hurst exponent, and band_envelope_dfa for alpha-band
 amplitude-envelope LRTC. Validated against theoretical exponents
 (white ~0.5, pink ~1.0, Brownian ~1.5) and benchmarked: 5.4x faster
 than a naive reference at 16k samples (751 us vs 4.16 ms), linear
 scaling to 65k samples (3.1 ms).
- ruv-neural-core::gate — decode-armed / decode-locked thought-password
 gate (Kunz et al., Cell 2025 pattern; ADR-0007/0009/0022): fail-locked
 on non-finite input and clock regression, bounded armed window,
 bounded audit log of transitions. Re-exported from
 ruv-neural-brain2text.
- ruv-neural-wasm — compute_dfa and WasmDecodeGate browser bindings;
 builds for wasm32-unknown-unknown.
- apps/ruv-neural-ui — TypeScript reference implementations
 (src/lrtc/dfa.ts, src/safety/decodeGate.ts) mirrored
 operation-for-operation; cross-language parity fixture agrees with
 Rust to <1e-9, and the gate semantics suite mirrors the Rust tests
 one-for-one. 15 new vitest tests; full UI suite passes (56 tests).
Tests: 8 Rust suites green across core/signal/brain2text (incl. new
doctests), clippy clean on new code, rustfmt applied, criterion bench
added (benches/lrtc.rs).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2uFD8uGFrakkvnQX66pHv 
@ruvnet ruvnet changed the title (削除) docs(research): brain-AI SOTA 2025–2026 deep-research sweep via agent swarm (削除ここまで) (追記) Brain-AI SOTA 2026 research sweep + DFA/Hurst LRTC and mental-privacy decode gate (Rust + WASM + TS) (追記ここまで) Aug 8, 2026
claude added 4 commits August 8, 2026 23:36
...win dry-run
Executes steps 1-2 of the flywheel playbook (docs/research/
brain-ai-sota-2026.md §10) against this repo with metaharness 0.4.3 /
@metaharness/darwin 0.8.2:
- npx metaharness score/genome: harnessFit 67, toolSafety 100, risk 21%,
 verdict READY, archetype rust-crate-harness
- Scaffolded harness/ from the tool-recommended vertical:coding template
 (claude-code host): architect/implementer/reviewer/test-writer agents,
 plan-change + evolve skills, doctor/review-diff commands, default-deny
 permission posture (no git push, no rm -rf, no .env reads). Smoke
 tests 4/4 green; harness doctor HEALTHY.
- harness sign/verify: 19-entry SHA-256 witness manifest committed.
 Ed25519 signature is degraded in this environment (placeholder key,
 kernel witnessVerify unavailable) — content-hash witness only until
 CI signs with a real key.
- Darwin Mode dry-run (mock sandbox, 2 gen x 3 children): winner g2_v5
 on the contextBuilder surface, +0.110 over baseline; promotion
 lineage committed in harness/.metaharness/{archive,lineage}.json as
 audit-trail evidence. Variant scratch trees are gitignored.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2uFD8uGFrakkvnQX66pHv 
... (8/8 findings)
A harness-style review swarm (3 reviewers -> adversarial verifiers ->
architect) audited the new DFA/gate code; all 8 findings survived
verification with concrete reproductions and are fixed here:
- critical: a non-finite clock could arm the gate with armed_at_s=-inf
 and never time out (NaN >= timeout is always false), leaving decoded
 output released indefinitely. update() now fails locked on any
 non-finite timestamp (new ClockAnomaly audit reason) and drops the
 frame.
- major: clock regression while armed froze the timeout at zero elapsed
 time (clamped clock never advances). Regression now locks the gate
 and adopts the new timeline so re-arming and timeouts work after a
 clock step.
- major: derived Deserialize resurrected armed state across restore and
 bypassed config validation. Deserialize is now manual: config is
 revalidated, state always resumes Locked (new Restored audit reason),
 the audit log is preserved and bounded, and null last_now_s (serde's
 encoding of -inf) roundtrips.
- major: TS state/transitions getters returned live mutable internals;
 type-checked caller code could set armedAtS=Infinity and disable the
 timeout. Getters now return defensive copies and fields are readonly.
- major: Rust/WASM transition logs used snake_case (at_s/armed_at_s)
 while TS used camelCase — incompatible wire shapes. Rust now
 serializes camelCase (atS/armedAtS) to match the TS mirror, with a
 wire-shape test.
- minor: finite out-of-range confidence (percent-scaled detectors)
 clamped to 1.0 and armed the gate; values outside [0,1] now read as
 0.0 in both languages.
- minor: WasmDecodeGate silently coerced negative/fractional arm_frames
 at the u32 boundary; now validated with a clear error.
- minor: TS dfa() accepted non-integer scale config unrepresentable in
 Rust; now rejected to prevent silent cross-language divergence.
Tests: gate suite grown to 14 Rust tests (77 core total) and the TS
suite to 13 gate tests (58 UI total), covering every fixed scenario;
clippy/rustfmt/tsc clean; wasm32 release build green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2uFD8uGFrakkvnQX66pHv 
Implements the architect's planned increment (§9 rows 5, 1, 17), grounded
in a deep-research sweep with 3-vote adversarial claim verification
(105 agents, 23 primary sources, 115 claims -> 25 verified, 2 refuted).
ruv-neural-brain2text/src/stream.rs — causal streaming decoder:
fixed frame hop with incremental state, strictly causal rolling
normalization (no frame sees a future sample), every emission wrapped in
DecodeGate. Default hop 80 ms, the validated streaming cadence, treated
as a SOFT budget (the published system meets it in 99.3% of steps) with
overruns reported via StreamStats rather than assumed away; the 10-ms
regime is supported since a causal decoder is published at that hop.
Also implements the LibriBrain event-referenced keyword-spotting
formulation for low-SNR non-invasive signals: [-0.1s, +0.3s] windows,
AUPRC, base-rate permutation null, and false-alarms-per-hour.
Deliberately does NOT implement an RNN-T: that attribution was refuted
0-3 in verification, so only the cadence and causality the sources
actually establish are committed to.
ruv-neural-embed/src/promotion.rs — executable ADR-0016 point-4 gates
transcribing the mid-2026 negative-control protocol: random-init
comparator capped at 100K params (the published bar is a 16K EEGNet at
61.3% beating LaBraM 57.3% / EEGMamba 56.6%), subject-disjoint LOSO
folds, chance-margin check catching the LOSO-at-chance failure mode,
pretraining-leakage check, exact Wilcoxon signed-rank test, and AUPRC
lift over the base-rate null. Verdicts are conjunctive: a strong
headline number cannot buy back a failed control. min_folds is 6, not
5, because the exact Wilcoxon minimum two-sided p is 2/2^n — n=5 tops
out at 0.0625 and can never reach alpha=0.05. The dataset-identity
probe is ruv-neural's own design (no verified source specifies one) and
is labelled as such rather than cited.
ruv-neural-memory/src/branch.rs — copy-on-write branched embedding
store: immutable base plus per-branch overlay deltas, tombstones,
read-through resolution at arbitrary branch depth, checkpoint/rollback/
drop for reversible closed-loop experiments. The research sweep found
zero independently verified sources for CoW vector stores (the only
material is vendor self-published with a single shared author), so this
is our own design with semantics defined and tested here, citing no
external performance numbers; merge and GC are explicitly out of scope
because nothing defines them.
Tests: 37 new tests (11 stream, 13 promotion, 13 branch); full suites
green across the five touched crates; clippy and rustfmt clean on new
code. Benchmarks (ruv-neural-brain2text/benches/stream.rs): 66.9 us per
frame at 306 channels — a 1,196x margin against the 80-ms budget — and
29.4 us at the 10-ms cadence (340x margin).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2uFD8uGFrakkvnQX66pHv 
...veats
The workflow-written artifact was a 17-line stub with zero citations
despite presenting itself as a cited report. Replaced with the full
verified synthesis: per-source findings with URLs and DOIs, the two
refuted claims called out explicitly (the RNN-T attribution and the
SparrKULee r=0.069 figure), the modality caveat that every latency and
accuracy number comes from invasive or MEG recordings, the empty
evidence base for CoW vector stores, the open questions, the
implementation mapping, and the process note that web-fetch
summarization hallucinated table values twice during verification.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2uFD8uGFrakkvnQX66pHv 
@ruvnet ruvnet changed the title (削除) Brain-AI SOTA 2026 research sweep + DFA/Hurst LRTC and mental-privacy decode gate (Rust + WASM + TS) (削除ここまで) (追記) Brain-AI SOTA research → streaming decoder, FM promotion gates, CoW branch store, DFA/Hurst + privacy gate (Rust + WASM + TS) (追記ここまで) Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /