omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / apps / omega-mesh / README.md
| 1 | # `apps/omega-mesh/`: Stage 5 — Zero-Trust Personal Silicon Mesh (`omega-mesh`, DRA-1073) |
| 2 | |
| 3 | > **Pillar 5 of Sovereign Intelligence 2.0.** Pure seeded OM-2 (`.om`) transparent Compile-on-Arrive remote execution mesh across personal heterogeneous silicon (MacBook `a64macos`, Steam Deck `x86linux`, PC `x86linux`, DGX Spark `a64linux` + `SM121`), gated by `TargetDesc` physical contracts, `WattCBF` thermal/power headroom, two explicit verification tiers (Tier A Owner Sovereign Mesh & Tier B Zero-Trust Mode), and fail-closed `OMEGA-MEMO` admission. Zero C, zero Python, zero Rust, zero external crypto libraries, and zero telemetry. |
| 4 | |
| 5 | ## Safety Invariants |
| 6 | |
| 7 | - **Strictly loopback / explicit peer endpoints only:** Wildcard `0.0.0.0` bind and broadcast `255.255.255.255` endpoints are refused fail-closed (`MR_ERR_WILDCARD_BIND = 12`). Listeners bind only to `127.0.0.1` or explicit non-zero private/WireGuard unicast addresses. |
| 8 | - **Zero hardware writes (`hw_writes == 0`):** Zero physical GPU device opens, zero UEFI/SPI touches, zero sysfs writes. `WattCBF` thermal/power envelopes are evaluated read-only via unchanged `apps/omega-wattd/watt_cbf.om`. |
| 9 | - **Fail-closed `OMEGA-MEMO` admission:** Remote outputs enter `seed/ng/memo/memo_store.om` **only** via `mv_admit_to_memo`, which enforces a one-shot verified proof token, purity admission (`purity_flag == 1`, `ck_pure_verified == 1`), and a TOCTOU SHA-256 re-hash check over `mm_val_buf` before calling `mm_store`. |
| 10 | |
| 11 | ## Files |
| 12 | |
| 13 | | File | Prefix | Role | |
| 14 | |---|---|---| |
| 15 | | `mesh_verify.om` | `mv_` / `MV_` | Two-tier verification engine: RFC 8032 Ed25519 peer allowlist & `OMRC0001` 288-byte execution receipts (reusing `protocol/omnet/om/sha512/sha512.om`, `protocol/omnet/om/ed25519/ed25519.om`, `protocol/uor-gpu/ed_sign.om`), anti-replay nonce ring + monotonic epoch check, Tier A configurable spot-check re-execution + automatic peer quarantine, Tier B Freivalds `O(R*N^2)` matmul verifier (live OS `random` or seeded), Tier B Merkle checkpoint verifier + `O(log2 M)` binary bisection, Tier B dual-peer BFT quorum (with Sybil same-peer refusal), and TOCTOU-proof one-shot `mv_admit_to_memo`. | |
| 16 | | `mesh_route.om` | `mr_` / `MR_` | Compile-on-Arrive mesh router: extends `target_desc.om` with heterogeneous personal profiles (`MR_TID_MACBOOK = 10`, `MR_TID_STEAMDECK = 11`, `MR_TID_PC = 12` alongside `TID_X925`, `TID_SM121`, `TID_APU_GB10`), checks `OMEGA-MEMO` first, evaluates `pk_check_contract` + live `WattCBF` headroom (`wc_cbf_filter` / `wc_must_fail_closed` / `wc_barrier_h`) + `OMPK` transfer & RTT (`coherence_cost`) vs. compute savings, implements fail-closed Ed25519-signed `OMSH` v1 wire framing, loopback-safe TCP sockets (`socknew`/`bind`/`listen`/`accept`/`connect`/`waitio`/`send`/`recv`), and pure Compute-on-Arrive worker/client execution. | |
| 17 | | `mesh_daemon.om` | `md_` | Standalone pure-OM-2 CLI & TCP loopback daemon (`omega-mesh`): `demo`, `route`, `serve`, `dispatch`, and `check-bind`. | |
| 18 | | `gate_mesh.om` | `gm_` | Standalone 7-suite, 34-negative-control pure-OM-2 verification gate (`GATE_MESH PASS checks=7/7 neg_controls=34 hw_writes=0`). | |
| 19 | |
| 20 | ## Architecture & Wire Protocols |
| 21 | |
| 22 | ### 1. Compile-on-Arrive Routing Order (`mr_route_select`) |
| 23 | 1. **Memo short-circuit:** Query `OMEGA-MEMO` (`mm_lookup`); on hit (`MM_OK`), return `MR_DEC_MEMO_HIT` (`0` recompute, `0` network bytes). |
| 24 | 2. **`OMPK` verification:** Verify `pk_buf` via `pk_verify` (fail-closed `MR_ERR_BAD_OMPK`). |
| 25 | 3. **Physical contract + `WattCBF` filtering:** For local node `0` and each online, authorized, non-quarantined remote peer: |
| 26 | - Check `pk_check_contract(tid, feat) == TDK_OK`. |
| 27 | - Evaluate `WattCBF` (`wc_must_fail_closed` + unclamped `wc_cbf_filter` + `wc_barrier_h >= 0` + `@power` contract cap). |
| 28 | - Enforce `@hard_deadline` if set. |
| 29 | 4. **Profitability selection:** Compare local compute time against remote `RTT + coherence_cost + transfer_us + compute_us + verify_us`. Offload only when local is ineligible (contract/`WattCBF` constrained) or remote saves more than `MR_OFFLOAD_MARGIN_US` (`200 us`). Fail closed (`MR_ERR_NO_NODE`) if no safe node exists. |
| 30 | |
| 31 | ### 2. Two Verification Tiers (`mesh_verify.om`) |
| 32 | |
| 33 | | Tier | Mode | Cryptographic & Integrity Guarantees | |
| 34 | |---|---|---| |
| 35 | | **Tier A** | **Owner Sovereign Mesh** (fast default for your own devices) | Peer pubkey MUST be in the 32B Ed25519 allowlist and not quarantined. Strict RFC 8032 Ed25519 (`mode=0`) signature over 192-byte canonical `OMRC0001` receipt binding `(ompk_sem_id, func_sem_id, inputs_sha256, output_sha256, target_tid, precision_tier, verify_tier, err_bound, nonce, epoch, output_len, compute_ns)`. Anti-replay nonce ring + monotonic epoch floor + one-way precision dominance (`mm_dominates`). Configurable probabilistic/deterministic spot-check re-execution catches silent bit flips even from trusted devices and automatically quarantines the peer. | |
| 36 | | **Tier B** | **Zero-Trust Mode** (untrusted remote silicon before `OMEGA-MEMO` admission) | Strict Ed25519 receipt + binding checks plus mathematical/consensus proof: (1) **Freivalds' randomized matmul check** (`O(R*N^2)` over exact `Z / 2^64 Z`, `R=32` rounds using Linux `getrandom` -> `<= 2^-32` false-positive bound on any 1-element corruption), (2) **Merkle intermediate-state checkpoint verification + `O(log2 M)` binary bisection** pinpointing the exact divergent chunk, or (3) **Dual-peer BFT quorum** requiring two distinct peer pubkeys (`Sybil` same-peer refused) to produce identical `output_sha256` and payload bytes (disagreement triggers fail-closed refusal + quarantine alarm). | |
| 37 | |
| 38 | ### 3. `OMSH` v1 Wire Frame & `OMRC0001` Receipt Layout |
| 39 | - **`OMSH` v1 Header (32 B):** `[0..3]="OMSH"`, `[4..5]=ver(1)`, `[6..7]=msg_type(1=REQ, 2=RESP, 3=ERR)`, `[8..11]=payload_len`, `[12..15]=flags`, `[16..23]=nonce`, `[24..31]=epoch`. |
| 40 | - **`DISPATCH_REQ` Payload:** `client_pubkey[32] || inputs_sha256[32] || ompk_len[4] || in_len[4] || work_kind[4] || prec_tier[4] || err_bound[8] || target_tid[8] || ompk_bytes || input_bytes || client_ed25519_sig[64]` (mutual authentication over header + payload). |
| 41 | - **`DISPATCH_RESP` Payload:** `status[4] || output_len[4] || aux_len[4] || reserved[4] || OMRC0001_receipt[288] || output_bytes || aux_bytes`. |
| 42 | - **`OMRC0001` Execution Receipt (288 B):** `[0..7]="OMRC0001"`, `[8..39]=ompk_sem_id`, `[40..71]=func_sem_id`, `[72..103]=inputs_sha256`, `[104..135]=output_sha256`, `[136..143]=target_tid`, `[144..147]=precision_tier`, `[148..151]=verify_tier`, `[152..159]=err_bound`, `[160..167]=nonce`, `[168..175]=epoch`, `[176..183]=output_len`, `[184..191]=compute_ns`, `[192..223]=peer_pubkey[32]`, `[224..287]=ed25519_sig[64]` over `[0..192)`. |
| 43 | |
| 44 | ## Build & Verify (DGX Spark AArch64, Pinned `omc`) |
| 45 | |
| 46 | Pinned compiler `seed/out/omc` SHA-256: `85b84c6de85083e4d9d2368015c1ddcab3d863aada922be0e63d774dddf23134`. |
| 47 | |
| 48 | ```sh |
| 49 | DEPS="si/directives/om2.om \ |
| 50 | apps/omega-wattd/watt_sense.om apps/omega-wattd/watt_cbf.om \ |
| 51 | seed/ng/sha256.om protocol/omnet/om/sha512/sha512.om \ |
| 52 | protocol/omnet/om/ed25519/ed25519.om protocol/uor-gpu/ed_sign.om \ |
| 53 | seed/ng/target/target_desc.om seed/ng/pack/sem_pack.om \ |
| 54 | seed/ng/memo/memo_policy.om seed/ng/memo/memo_store.om \ |
| 55 | apps/omega-mesh/mesh_verify.om apps/omega-mesh/mesh_route.om" |
| 56 | |
| 57 | # Build omega-mesh CLI/daemon and standalone verification gate |
| 58 | cat $DEPS apps/omega-mesh/mesh_daemon.om | seed/out/omc > /tmp/omega-mesh |
| 59 | cat $DEPS apps/omega-mesh/gate_mesh.om | seed/out/omc > /tmp/gate_mesh |
| 60 | chmod +x /tmp/omega-mesh /tmp/gate_mesh |
| 61 | |
| 62 | # Exercise CLI & loopback daemon |
| 63 | /tmp/omega-mesh route |
| 64 | /tmp/omega-mesh demo /tmp/omega-mesh-demo |
| 65 | /tmp/omega-mesh check-bind 0.0.0.0 # exits 12 (MR_ERR_WILDCARD_BIND) |
| 66 | |
| 67 | # Run full 7-suite verification gate (34 fail-closed negative controls) |
| 68 | /tmp/gate_mesh /tmp/omega-mesh-gate |
| 69 | ``` |
| 70 | |
| 71 | ## Verification Scope |
| 72 | |
| 73 | - **Status:** `HOST_TESTED` on DGX Spark Linux AArch64 (`7/7` gate suites, `34` fail-closed negative controls, `5/5` source mutation kills, real multi-process TCP loopback dispatch + `OMEGA-MEMO` persistence, `hw_writes=0`). |
| 74 | - **Not claimed:** Physical GB10 GPU kernel execution (`NOT_RUN` — zero GPU device opens) and live multi-host WAN/WireGuard network qualification (`NOT_RUN` — loopback TCP transport exercised natively on Linux AArch64). |