Notes · architecture

Behind the substrate.

Long-form notes on the primitives the substrate is built from — the cascade, V-class typing, the seam, the transcript digest, the unified physical safety spine, and sub-1-bit anytime edge leaves — for visitors who want to read rather than browse. Every claim here is backed by code across our 131-crate Rust workspace (crates/mgai-safety, crates/mgai-baremetal, crates/mgai-littlebit, crates/mgai-robot, crates/mgai-deploy, and crates/mathground-view), freestanding ISO C99 (include/mgai.h) + zero-float Q32.32 (include/mgai_q32.h), Python native MgaiC99Runtime, 162 Python ⇔ Rust conformance fixtures, and 585 in-repo 6-kernel (Lean 4.36.0 lake check --paranoid: 558 safety + 27 local LutAdapt, synced with 2,260+ 5-Pillar OpenIE Pentad) theorems across 368 waves, 84 gates, 524 MCP tools (+ 8-Tool --core), 9 verified polyglot surfaces (including Open-PDK SKY130A / SG13G2 0-DRC Calma GDSII + LEF/DEF 5.8 + Netgen LVS + IEEE 1481 SPEF / SDF 3.0 / 256-Vector GLS + ngspice IR-Drop/SET + 10-Year EM/NBTI + Caravel 2 kV HBM / 500 V CDM ESD + TinyTapeout Shuttle + IEEE 1149.1 JTAG TAP & LBIST/MBIST Wafer-Probe + QFN-24 Bond-Wire RLC SSN & JESD51 theta_JA + IBIS 7.2 50-Ohm Microstrip & 4-Layer 6-Tier PCB PDN Z_target + CISPR 25 Class 5 CM-Choke & IEC 61000-4-2 8 kV TVS EMC + ISO 16750-2 48 V Load-Dump Pulse 5b & -48 V Reverse-Polarity Ideal-Diode eFuse + AEC-Q100 Grade 0 150C JEDEC JESD78F Latch-Up & Brokaw Bandgap POR/UVLO + ISO 26262-5 125C 200 MHz CP-PLL Jitter & Missing-Clock STO + PTAT dVBE TSD + Chopper CSA/DESAT + VDE 0884-11 5.7 kVrms CMTI/Miller + 360° Inductive Resolver/CORDIC + Off-Grid Solar FOCV-MPPT & 220 µF Supercap IEC 61800-5-2 PLI Ride-Through + $0.15 WCH CH32V003 RV32EC OSCCA SM3/SM4 & TIM1_BKIN STO ASIC hard-macros), and 1,080 engineering pillars; every exhibit linked is interactive on this site.


The cognitive cascade

A request is resolved at the lowest tier whose grammar covers it. Higher tiers fire only when the lower tier cannot place the request. The shape that survives across implementations is a ladder:

tier what it does representative cost
L0-closed Pure deterministic compute — arithmetic, closed-form physics, exact rollouts. Identical inputs produce identical outputs. ~10⁻⁹ J per op (single FMA range)
L0-retrieved Exact citation lookup — named-fact tables, theorem dictionaries, anything keyed by a string and resolved by direct match. ~10⁻⁹ J per op
L0-identifiable Identifiable encoder — HDC item-memory cleanup, perceptual hashes, anything that's replayable given encoder version + input. ~10⁻⁸ J per op (10 K-dim hypervector range)
L1 Citation-backed composition — applies retrieved values through closed-form rules. The answer cites its sources. ~10⁻⁹ J per op
L1.5 Matryoshka vector tier — short-circuit retrieval at low dimensionality, rerank at full. Lives between L1 and L2. ~10⁻⁸ J per op
L2 Model-generated. Not bit-replayable; carries epistemic mode + axes. Fires only when the spine cannot place the request. ~10⁻⁵ J per op (~10⁴× the spine)

The ratios in the right column are measured wall-time on commodity silicon by the mgai-meter binary; the absolute joules are bracketed by the Landauer floor (lower bound) and a TDP envelope (upper estimate). The point of the table isn't the absolute numbers — it's the spread. Three orders of magnitude between deterministic and model tiers is the whole design.

Live: /exhibits/reason runs a small math-domain cascade you can watch walk through the ladder, query by query.

V-class — typed at the grammar

Every claim the substrate emits carries an explicit replayability class:

  • L0-closed — deterministic compute; identical inputs → identical outputs.
  • L0-retrieved — exact citation; carries source_uri + retrieval_timestamp.
  • L0-identifiable — output of an identifiable encoder; replayable given encoder version + input.
  • L1 — citation-backed composition; carries citations to L0-retrieved sources.
  • L2 — model-generated; not bit-replayable; carries epistemic mode + axes.

The classes aren't documentation — they're a Rust type. The substrate's Claim<T> wrapper cannot be constructed without a ClaimAttribution that names the V-class, the source, the axes, and (for L2) the epistemic mode. Removing attribution at the audit boundary is a named operation, not an implicit conversion. Unmarked claims cannot escape into downstream code because the type system rejects them at the call site.

A model-generated paragraph cannot be relabelled as L0-closed by formatting; the relabel is a type error. The V-class is structural, not stylistic.

The routing seam — logged oracle

The orchestrator picks a tier for each query based on live measurements (latency, jitter, cache hit-rate, load). Those measurements drift; the verdict drifts with them. That's bad for replay.

The fix is the seam: when a request shape resolves for the first time, the substrate records the verdict as a constant in an append-only log. Later replays read the verdict from the log, never from live measurements. The result is the logged-oracle pattern — the nondeterministic step happens once, at record time, and is a constant in the log forever after.

The seam exposes three reads: a live convergence rate (repeats / observations), the FNV-1a digest of the command log, and a replay(query) path that bypasses the orchestrator entirely for a previously-seen shape. A cascade that promotes the seam from observational to authoritative routing becomes load-cheap — most queries skip the orchestrator and resolve through the recorded coordinate.

The transcript digest — trust as comparison

Every successful execute appends one entry to a transcript: (shape_key, horizon_code, response_hash). The transcript carries a rolling FNV-1a-64 digest. Two replicas of the cascade serving the same command stream land on identical digests. A replica that forges, drops, reorders, or mutates a single entry diverges by construction.

This makes trust a comparison, not a separate protocol. You don't need a Byzantine-fault-tolerant consensus layer to detect tampering — you just compare digests. The digest is computed deterministically over the same byte stream on every honest replica; the only way to disagree is to be dishonest, and dishonesty is observable.

The seam's command log carries its own digest with the same property, so the routing verdicts are byte-reproducible across replicas too. The pair (state digest, transcript digest) is the cheap-trust primitive the substrate commits to.

Six pieces, picojoule cost

The substrate lives today in six pieces. Each one stands on its own; each one has an exhibit on this site that runs the kernel and emits its receipt in your browser:

  1. Chain of thought — deterministic. The cascade walks each query through the ladder; the trace IS the reasoning; every hop carries its own receipt. Zero new compute. The transcript is the chain of thought.
  2. Omnimodal routing — one shape-key space. Four deterministic encoders (text, image, audio, video) project into a shared 10 000-dim hypervector space. Cross-modal cosine is meaningful because the algebra is shared, not because a model was trained.
  3. Reasoning + generation split per tier. Every cascade tier is split into a reasoning sub-expert (classify the form) and a generation sub-expert (produce the answer). Generation only fires when reasoning matches. Both sub-hops are individually accountable.
  4. Lazy model tier — separate WASM bundle. The spine pays picojoules; the model tier loads only on escalation. Two bundles visible in the browser's Network panel: the spine on first paint, the leaf only when the spine could not place a request.
  5. Unified physical safety spine. Closed-form SE(2) CBF-QP, 2D/3D Hamilton-Jacobi safe-time geodesics, V-JEPA 2 world-model surprise, Conformal PID, Simplex handoff, ISO 10218-2:2025 contact clamping, outward-rounded IEEE-754 interval bounds, and SHA-256 EU AI Act flight recording — backed by 553 zero-sorry 6-kernel (Lean 4.36.0 + nanoda) safety proofs.
  6. Sub-1-bit anytime edge ladder. Samsung LittleBit-2 Dual-SVID + Joint-ITQ polar Procrustes factorization (0.1–0.70 bpw) paired with Cactus-inspired multiply-free Walsh-Hadamard (FWHT) blocks and a Conformal PID hybrid router.

The physical safety spine — closed-form + Lean 4

Every Vision-Language-Action (openpi FAST, SmolVLA, Octo-Small) or world-model proposal passes through mgai_safety::SotaSafetyPipeline before an actuator ever sees a command:

  • Epistemic + world-model surprise — decomposes aleatoric vs epistemic fuzz, cross-modal spoofing, tactile tangential slip, and V-JEPA 2 action-conditioned latent cosine energy.
  • Conformal PID + Simplex runtime assurance — adapts distribution-free nonconformity thresholds under sudden regime shift and hands off to a verified closed-form baseline during unfaithful or spoofed windows.
  • SE(2) CBF-QP + 2D/3D Hamilton-Jacobi reachability — enforces multi-obstacle control-barrier half-spaces and refractive Zhao fast-sweeping geodesics that escape non-convex U-traps without deadlocking.
  • ISO 10218-2:2025 contact gate + IEEE-754 / Q32.32 soundness + Lean 4 — clamps 6D collaborative wrenches and normal pressure, tracks Rockafellar-Uryasev empirical CVaR, brackets floating-point drift with directed rounding + zero-float Q32.32 integer spines, chains ticks into an EU AI Act Art. 12/15 + EU Machinery Regulation 2023/1230 Annex IV + 6-Jurisdiction Global Regulatory Passport SHA-256 flight recorder (mgai-mcap), and verifies 558 core fixed-point safety & cross-fabric invariants (+ 27 LutAdapt compilation theorems = 585 total) across 6 independent Lean 4.36.0 kernels with standard kernel axioms only.

Live: /exhibits/safety-shield runs the twin-world red-team arena at 60 FPS in WebAssembly.

Sub-1-bit edge leaves — LittleBit-2 + FWHT

When a query or perception frame genuinely escapes the L0/L1 spine, the leaf tier should still fit in kilobytes or tens of megabytes at deterministic latency. mgai-littlebit synthesises two hardware-aligned ideas:

  • Samsung LittleBit-2 (Dual-SVID + Joint-ITQ) — decomposes dense matrices into packed u64 binary sign matrices (XNOR-popcount) with row/column FP16 scales, Frobenius-polished latent scales, polar Procrustes orthogonal alignment, and rank-r binary latent KV-caches (0.10–0.70 bpw in CRC-32 MGBIT001 containers).
  • Cactus-style FWHT anytime ladder + conformal routing — replaces dense token/channel projections with multiply-free O(d log d) Walsh-Hadamard butterfly blocks sliceable along both (depth × rank), gated by ConformalEdgeRouter (LocalCommit, EscalateCloud, or OfflineAbstain).

Live: /exhibits/littlebit lets you slice rank, depth, Joint-ITQ rotation, and conformal escalation live; /exhibits/escalate lazy-loads the 41 KB L2 WASM leaf only when the spine misses.

Receipts — the substrate's only non-negotiable

Every metered call returns its joules — computed at the call site against a silicon-specific cost model, the Landauer floor, and a TDP envelope. The receipt is structural, not an afterthought. Three properties the substrate commits to:

  • Honest method labels. Every receipt declares how the joules were estimated — measured when a live counter (RAPL / powercap / NVML / powermetrics) was read, tdp_estimate + landauer_floor when only wall-clock was available. No silent substitution between methods.
  • μ is always reported. The apparent impedance E_tdp / E_floor is the gap between real silicon and physics' lower bound. A receipt that hides μ is a substrate bug.
  • No fabrication. If a claim cannot be tied to a retrievable source or a deterministic computation, it is published as L2 — never as L0 or L1. A claim that cannot be authored at the right V-class is not authored.

The thermometer at /scale shows where your last measured frame sits on a log axis between the Landauer floor and a kilometre in an EV. The session aggregator at /receipts sums per-exhibit totals on this device. Nothing is uploaded.

What's invariant, what's dated

The seven invariants in the substrate charter are commitments — energy as the unit of account, cascade structure (cheap-deterministic before expensive-stochastic), V-class replayability, grammar-level attribution, first-class receipts, method honesty, and hard refusal to emit unmarked synthetic claims. Anything else is dated — current implementation choices that may change without breaking the substrate's identity.

What that means in practice: the cascade tier representatives (which specific Rust function measures L0-closed) are dated; the cascade structure (cheap-deterministic before expensive-stochastic) is invariant. The HDC dimension (10 000 today) is dated; the principle (identifiable encoders project into a shared space) is invariant. The L2-leaf bundle size (41 KB WASM kernel today, ~53 MB 0.25-bpw 1.7B LittleBit-2 target) is dated; the lazy-load discipline (model tier only loads on escalation) is invariant.

The invariants survive future implementation rewrites. The dated sections are expected to be edited as the substrate matures.


Walk the substrate

Every exhibit reads its joule cost on your device. Open any of them, then come back to /scale to see your markers populate.