Two of the "what to optimize next" items, as enforced code:
1. Hard claim gate: extract the release rule into a single
acceptance::claim_allowed(entrainment, safety, adherence, repeatability)
= strict AND of all four, used by every path. A test proves every 3-of-4
subset is denied, so no path can silently weaken the gate to an OR/subset.
2. Hardware-in-the-loop contract (new hil module): verify_hil grades a
captured actuator bench measurement against fixed targets — LED frequency
+/-0.1 Hz, audio-visual sync < 5 ms, stop-signal -> actuator-off < 100 ms,
session-hash reproducibility 100%, EEG entrainment lift >= 20% over fixed
40 Hz. Every failure mode fails closed (missing/NaN stop measurement, no
replay, any hash mismatch). The crate stays a deterministic leaf: firmware
records the measurements, this module grades them.
README: benchmark table (safety tick ~8 ns, recommend ~15 us, cohort kNN/500
~15 us, calibration ~115 us, acceptance grading ~425 us enrollment-only) and
the positioning line — "a governed personalization engine that refuses to
overpromise."
9 new tests; crate now 97 + 1 doctest; pinned witness 13cb164c... preserved.
Workspace gate: 2,898 passed / 0 failed.
https://claude.ai/code/session_01MjBucx95K4BuUxZi8NWwRH
40 Hz becomes one prior in one program, not the product. The engine is a
personal neural-rhythm optimization platform: RuView is the feedback signal,
RuVector the personal response map, the device the actuator, RuFlo the
governed/auditable loop (ADR-250 section 23).
New "program" module: NeuroProgram catalog of 7 use cases (Alzheimer's
research, post-stroke cognition, sleep optimization, attention/working-memory,
mood/arousal, home wellness, drug+device trial infrastructure), each with its
own SafetyEnvelope, prior, ObjectiveWeights, physiological-state gating
(sleep permits Asleep + near-dark brightness cap; attention requires
wakefulness), EvidenceLevel, and a single non-disease claim.
New "acceptance" module: makes "measurable entrainment, safety, adherence,
repeatability before any disease claim" executable. AcceptanceHarness grades
a program over >=3 repeats; ClaimGate releases the program's claim ONLY when
all four pass, else the research-only NO_CLAIM string. The marketing claim is
unreadable except through the gate.
Governor: enroll_program (per-program envelope/objective), program(), prior(),
state_eligible(). The bare enroll() path is unchanged, so the pinned witness
13cb164c... is preserved.
88 crate tests + 1 doctest; workspace gate 2,889 passed / 0 failed. Benches:
program grading ~425us; hot paths unchanged (recommend ~15us, calibration
~115us, kNN/500 ~15us).
https://claude.ai/code/session_01MjBucx95K4BuUxZi8NWwRH
New ruvector module: anonymized ProfileStore (one-way SHA-256 hashed tags,
safe-session scores only), deterministic exact kNN, cohort warm-start (a new
person's optimizer seeded from the k nearest responders as down-weighted GP
pseudo-observations), physiological drift detection (Welford centroid with
stimulus-input fields masked out of the distance), and deterministic k-means
response clustering.
Honesty guarantees, asserted in tests: cohort priors carry >=25x the
real-observation noise, are excluded from the EI incumbent, the audit log,
and the clinician report — borrowed expectations never masquerade as this
person's measured response. The GP gains per-observation noise; the real
path is arithmetically unchanged (pinned witness 13cb164c... preserved).
Governor wiring: seed_from_cohort, export_anonymized_profile, per-session
drift_status. Integration tests: cohort warm-start beats the cold 40 Hz
prior for a detuned subject; collapsed physiology flags Drifted.
Crate: 75 tests + 1 doctest. Workspace gate: 2,876 passed, 0 failed.
Benches: kNN/500 profiles ~15us, warm-start ~16us; no regression on
existing paths (recommend ~15us, calibration sweep ~111us).
https://claude.ai/code/session_01MjBucx95K4BuUxZi8NWwRH
BayesianOptimizer::recommend evaluated Expected Improvement at every 0.1 Hz
grid candidate, and each predict() rebuilt the kernel matrix and re-ran
Cholesky — ~82 factorizations per call — though K and alpha=K^-1 y depend
only on the observations, not the query point. Fit the GP once (GpFit:
cached L + alpha, lower-triangle-only K build) and reuse it across the grid.
Bit-identical arithmetic: the pinned deterministic witness and all 64 tests
are unchanged; pure work elimination. Measured (criterion, paired):
gamma_bayesian_recommend 105us -> 19us (-81%); gamma_calibration_sweep
466us -> 135us (-71%).
https://claude.ai/code/session_01MjBucx95K4BuUxZi8NWwRH