interplane.Get Omega
Read in your language

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

GitHub aien-dev/omega-mv#403 (code only)

closed derived 17c58c577f801cef #403

Imported from GitHub aien-dev/omega-mv#403 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 771af525d743ed262f0cb825f7b35e9293bf4638 · Head 7dd5b1fba7636a37f861bafed35229336335e150

Apply it

git checkout -b patch-17c58c577f801cef 771af525d743ed262f0cb825f7b35e9293bf4638
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/17c58c577f801cef.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omega-mv
403
7dd5b1fba7636a37f861bafed35229336335e150
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":403,"url":"https://github.com/aien-dev/omega-mv/pull/403","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:45Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 9d6444cf3..f82176156 100644
--- a/.crumb
+++ b/.crumb
@@ -87,14 +87,14 @@
           "purpose": "Directory spec. Purpose not yet described by a human."
         },
         {
-          "digest": "5a7af4c7ecebc57aae07e6eec5f187b21427ca5f9890364927fb21c344d927df",
-          "last_commit": "82f31173",
+          "digest": "8979f28ba007e73c18d12f0a2a26b3a4b91c9eaaadcd8e35de14424bbd2c0165",
+          "last_commit": "d9457e55",
           "name": "src",
           "purpose": "Directory src. Purpose not yet described by a human."
         },
         {
-          "digest": "84683e48b78333a6f484b1ffbe176dcbb027817cdcc132548b91e616e6d5ff34",
-          "last_commit": "a7771136",
+          "digest": "77baf947bf422344b099c312f5895e8491f5d91c97758ff2ed1a7672dc408114",
+          "last_commit": "d9457e55",
           "name": "tests",
           "purpose": "Directory tests. Purpose not yet described by a human."
         },
@@ -105,15 +105,15 @@
           "purpose": "Directory tools. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:f486f217fa8ad62d0df366246290c97b60e58cb2ba4e07913eaf1a2b35881bad",
-      "compiled_at": "2026-10-11T19:13:12Z",
+      "children_root": "sha256:fb999b2f5cbdc5418bdc94f84e76def14aaf9a3e292d55340b66adc0ecf50c34",
+      "compiled_at": "2026-10-11T19:30:27Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:0555fe54fd37a274621ce6ea3abbdd8525198d56efc7a3c8181f9d14cad99c6a",
+      "digest": "sha256:9d820a868a485dc258c4fd7f55e61d86cc72013e304d546518b193f34936f62b",
       "evidence_files": 7245,
       "evidence_root": "sha256:035beef5cdb99afaefd1743640f5e7eeaaed13c4a5ec6c8b4b6a4cb0c528407a",
-      "files": 9730,
-      "generated_at_commit": "a777113639f2849ef32e48121049e02487624d29",
-      "source_tree": "sha256:b912ec0adc13286baf640b402299591a2a8d5b8ef047c7f53a3c37809dc77ac4"
+      "files": 9732,
+      "generated_at_commit": "8507ac948f46e305d1108520cabaed75f110695d",
+      "source_tree": "sha256:b40e5da20ac4e6c3f57e2b4bb2502fd8bf7cb3dd6b5398c1b4497c23df07ff32"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/.github/workflows/rx-host.yml b/.github/workflows/rx-host.yml
index 7db2422fd..6bfba543c 100644
--- a/.github/workflows/rx-host.yml
+++ b/.github/workflows/rx-host.yml
@@ -93,6 +93,14 @@ jobs:
           mkdir -p build
           make test-effect-cap64 | tee build/effect-cap64.log
           grep -q '^OMEGA_EFFECT_CAP64_PASS$' build/effect-cap64.log
+      - name: Omega's AIENOS capability header matches the pinned AIENOS header (OMEGA_AIENOS_CAP_ABI)
+        env:
+          PHYSICS_DIR: ${{ github.workspace }}/physics-src
+          AIENOS_R7_DIR: ${{ github.workspace }}/aienos-src
+        run: |
+          mkdir -p build
+          make test-aienos-cap-abi | tee build/aienos-cap-abi.log
+          grep -q '^OMEGA_AIENOS_CAP_ABI_PASS$' build/aienos-cap-abi.log
       - name: Show state projection receipt
         run: |
           receipt="$(find build/qual-runs -name omega_state_projection_receipt.json -type f | head -n 1)"
diff --git a/Makefile b/Makefile
index 75ab440e4..e315de0fc 100644
--- a/Makefile
+++ b/Makefile
@@ -421,6 +421,15 @@ $(EFFECT_CAP64_TEST): tests/effect/test_effect_cap64.c $(EFFECT_CAP64_OBJS) \
 test-effect-cap64: $(EFFECT_CAP64_TEST)
 	./$(EFFECT_CAP64_TEST)
 
+# OMEGA_AIENOS_CAP_ABI: src/runtime/aienos_cap.h, the copy the runtime compiles
+# against, must match the pinned header $(EFFECT_CAP64_CAP_INC)/aienos_capability.h
+# that $(AIENOS_CAP_LIB) is built from: struct layouts field by field (offset, size,
+# kind, signedness), macro values, prototypes. Eight mutated copies must each be
+# refused. Header only: nothing is linked against the library.
+.PHONY: test-aienos-cap-abi
+test-aienos-cap-abi: aienos-authority-capability
+	CC="$(CC)" CFLAGS="$(CFLAGS)" bash tests/runtime/aienos_cap_abi.sh "$(EFFECT_CAP64_CAP_INC)"
+
 $(RX_R7_TEST): $(RX_R7_SRCS) src/runtime/rx_caproot.h src/runtime/rx_world.h \
 	src/runtime/aienos_cap.h src/runtime/omega_shared_world_abi.h $(AIENOS_CAP_LIB) | $(OUT_DIR)
 	$(CC) $(CFLAGS) -pthread -o $@ $(RX_R7_SRCS) $(AIENOS_CAP_LIB) -lm
diff --git a/src/.crumb b/src/.crumb
index ff25f0684..f193dd2e7 100644
--- a/src/.crumb
+++ b/src/.crumb
@@ -62,128 +62,128 @@
       "children": [
         {
           "digest": "e999ad5d79b28e45cf3c87fca942087088f243bdfd0e55da7948eb5d6e619460",
-          "last_commit": "30c65a3",
+          "last_commit": "7350a61c",
           "name": "algebra",
           "purpose": "Directory src/algebra. Purpose not yet described by a human."
         },
         {
           "digest": "24b48531671e1ad40c520571c43aa6fa8dfe43ce7139a5724f31afa9f8411afd",
-          "last_commit": "30c65a3",
+          "last_commit": "834ee93e",
           "name": "ans",
           "purpose": "ANS (Alignment Navigation System), Inertial Alignment v1: frozen reference atoms, drift filter o"
         },
         {
           "digest": "5b110f4a6136ebd3d6703590962b7beed9f8cec034c2d12944b1590434e3c747",
-          "last_commit": "30c65a3",
+          "last_commit": "d48ab89e",
           "name": "autodiff",
           "purpose": "M21 OMEGA_AUTODIFF: reverse-mode tape over M20 tensor CPU ops, caller-owned nodes and scratch, p"
         },
         {
           "digest": "18e933f213d7958215bb0ecf09116e5c21d3b335cfdabc1ffbf7a2a4e98b5250",
-          "last_commit": "f7b4389",
+          "last_commit": "f7b43890",
           "name": "compiler",
           "purpose": "Directory src/compiler. Purpose not yet described by a human."
         },
         {
           "digest": "41faf68aa92b4f16b40243239e1866110a443ce284ff9f7ec3b125b289bcd845",
-          "last_commit": "30c65a3",
+          "last_commit": "3c82389f",
           "name": "crumbline",
           "purpose": "Directory src/crumbline. Purpose not yet described by a human."
         },
         {
           "digest": "945ae745a338467614bee287efb628f38f53ad83e4842c1a7fbf7d0b91a8da57",
-          "last_commit": "30c65a3",
+          "last_commit": "00f54b6b",
           "name": "dual_experiment",
           "purpose": "DUAL applicability experiment library (ARCH-0031 offline evidence lane): deterministic discrete "
         },
         {
           "digest": "62a0884e7f075eb3c92b22fc400234a06bd8c3020fc75e55a9b0c0f0f6a26d7e",
-          "last_commit": "30c65a3",
+          "last_commit": "1a147e40",
           "name": "estimation",
           "purpose": "Directory src/estimation. Purpose not yet described by a human."
         },
         {
           "digest": "330c407ff51bfd684e062707c055f58f325f5af16fe9764889aec3a7ffeb31ac",
-          "last_commit": "30c65a3",
+          "last_commit": "3108fc2f",
           "name": "fabric",
           "purpose": "Directory src/fabric. Purpose not yet described by a human."
         },
         {
           "digest": "3bdcb211108a4fdc33550b2c54df3167dd15d4a5fe004eefbcef11b489d0e27a",
-          "last_commit": "30c65a3",
+          "last_commit": "71c6ff88",
           "name": "language",
           "purpose": "Directory src/language. Purpose not yet described by a human."
         },
         {
           "digest": "651cad69999ba000a9be247d7decaf02ef9c4653f718255b62efb248139ad74b",
-          "last_commit": "6d8d92a",
+          "last_commit": "6d8d92ad",
           "name": "osh",
           "purpose": "osh (Omega-native shell, arch#158) lexer unit: layout list, generator, osh_lex.osc, C reference "
         },
         {
           "digest": "8383106b5d1b3adbc44b8e837a5d1f5ff6699a6d54070068e36716b2a32390d5",
-          "last_commit": "30c65a3",
+          "last_commit": "d550b705",
           "name": "path",
           "purpose": "Directory src/path. Purpose not yet described by a human."
         },
         {
           "digest": "8c5cf96997407cff3f8a4c78150ae5294d2ed09a8d9076ae933e426a60792037",
-          "last_commit": "e59633e",
+          "last_commit": "e59633e5",
           "name": "physics0",
           "purpose": "PD-0 hidden-equation benchmark (Physics-0 Discovery Engine cut 1): world, oracle, scorer, ladder"
         },
         {
           "digest": "c43b60db4a5183a3ca59c2e24a0978f463e8ac3aa7a2ed0c54947eb085c4eb9e",
-          "last_commit": "30c65a3",
+          "last_commit": "3ef4f69c",
           "name": "polyglot",
           "purpose": "Directory src/polyglot. Purpose not yet described by a human."
         },
         {
-          "digest": "72229d85f6c1384838c8509aa852daed769ea93190af5f7170aad438fbd16583",
-          "last_commit": "e39d0c5",
+          "digest": "224f473d0d4da21fb7bcd75d22e70a892679a7271e949a5ee07e3f36cbdb7442",
+          "last_commit": "d9457e55",
           "name": "runtime",
           "purpose": "Directory src/runtime. Purpose not yet described by a human."
         },
         {
           "digest": "9f6d98a6d9b0020aa56df481a5ab3aa301533cb85173f96a851d1d779fca2d3a",
-          "last_commit": "30c65a3",
+          "last_commit": "5ae192a4",
           "name": "searchtrace",
           "purpose": "Directory src/searchtrace. Purpose not yet described by a human."
         },
         {
           "digest": "ae63793b7b13442e349e438229fccf6a859a5be55343cdd997e35f2966c1157c",
-          "last_commit": "30c65a3",
+          "last_commit": "f633e343",
           "name": "tensor",
           "purpose": "M20 OMEGA_TENSOR: immutable tensor semantic layer, views, generation-checked storage, CPU realiz"
         },
         {
           "digest": "be7e624435df81eae403f51a381acf480e9fd2f2a04eb34e955547973645b95d",
-          "last_commit": "30c65a3",
+          "last_commit": "54826a37",
           "name": "train",
           "purpose": "Directory src/train. Purpose not yet described by a human."
         },
         {
           "digest": "78c180a66607ebaf93e6ef6a6a56a3059ebf97db394d76af50c0e3f25d2be639",
-          "last_commit": "30c65a3",
+          "last_commit": "2564f57a",
           "name": "turing",
           "purpose": "Directory src/turing. Purpose not yet described by a human."
         },
         {
           "digest": "daf5e5e90c1ccb4c089220a6545844dbe4078a233f1777e8145b74f1bf5dd5fe",
-          "last_commit": "30c65a3",
+          "last_commit": "40d1ea37",
           "name": "visor",
           "purpose": "Directory src/visor. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:e1091a54c66a4e6f3356780dfc0939dc88980cb4e1143d70993ecfd653ef761d",
-      "compiled_at": "2026-10-11T15:34:01Z",
+      "children_root": "sha256:ce7e4b528bec54e15d5f9525026d958e6eab78b88614c65b8e7c51d44c0243af",
+      "compiled_at": "2026-10-11T19:30:27Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:5a7af4c7ecebc57aae07e6eec5f187b21427ca5f9890364927fb21c344d927df",
+      "digest": "sha256:8979f28ba007e73c18d12f0a2a26b3a4b91c9eaaadcd8e35de14424bbd2c0165",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 451,
-      "generated_at_commit": "e39d0c58fa08564c61c92d43f1523f06d3a67d66",
-      "source_tree": "sha256:155b4110a0a583d1f3ce1a2e8a32be3525578cc0c0cf0b8723adcfb8d5b4efbf"
+      "generated_at_commit": "8507ac948f46e305d1108520cabaed75f110695d",
+      "source_tree": "sha256:a8baea783661d7614b6663e0806910d9f6cbae24a0657f6883a34d5e64b21d6b"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/src/runtime/.crumb b/src/runtime/.crumb
index 7445bcd4d..edece86ad 100644
--- a/src/runtime/.crumb
+++ b/src/runtime/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-11T15:34:01Z",
+      "compiled_at": "2026-10-11T19:30:27Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:72229d85f6c1384838c8509aa852daed769ea93190af5f7170aad438fbd16583",
+      "digest": "sha256:224f473d0d4da21fb7bcd75d22e70a892679a7271e949a5ee07e3f36cbdb7442",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 65,
-      "generated_at_commit": "e39d0c58fa08564c61c92d43f1523f06d3a67d66",
-      "source_tree": "sha256:a5e4c83df3346dc48d5cd7a8ff1e5b768604bd640996247f79ade0427b428dfa"
+      "generated_at_commit": "8507ac948f46e305d1108520cabaed75f110695d",
+      "source_tree": "sha256:7a840be154414ed786ebf958ba98d4ea0636227cb6df04ade2652a8a5e4c3534"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/src/runtime/aienos_cap.h b/src/runtime/aienos_cap.h
index e530a0ded..f72d012c8 100644
--- a/src/runtime/aienos_cap.h
+++ b/src/runtime/aienos_cap.h
@@ -5,7 +5,7 @@
  * reaction world is given the view. Cognition has no path to the admin.
  * The Linux mint process is a separate oracle and is not started here.
  * Layout matches aienos native/capability/aienos_capability.h: generations
- * are 64 bits.
+ * are 64 bits. make test-aienos-cap-abi checks this copy against the pinned header.
  */
 #ifndef AIENOS_CAP_H
 #define AIENOS_CAP_H
diff --git a/tests/.crumb b/tests/.crumb
index b9a8f8808..26189c2ed 100644
--- a/tests/.crumb
+++ b/tests/.crumb
@@ -259,8 +259,8 @@
           "purpose": "Directory tests/relations. Purpose not yet described by a human."
         },
         {
-          "digest": "6ce8e4d40746ec42f2f06437583fb91a613f25997fa0b427bbd640c6b4d2c649",
-          "last_commit": "82f31173",
+          "digest": "befa6601937d28b7c058b3abc4c12c90cbe8f2fce3f9498a3e67cd522391b61c",
+          "last_commit": "d9457e55",
           "name": "runtime",
           "purpose": "Directory tests/runtime. Purpose not yet described by a human."
         },
@@ -289,15 +289,15 @@
           "purpose": "Directory tests/visor. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:2187e90416056b45aa2201a569aaef1933d170b2d851ed0ceb0cf688b368675f",
-      "compiled_at": "2026-10-11T19:13:12Z",
+      "children_root": "sha256:9c94c5a57dda7727107b9e1271460c33b2cde72e796459e1ae401d4d4aeaec78",
+      "compiled_at": "2026-10-11T19:30:27Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:84683e48b78333a6f484b1ffbe176dcbb027817cdcc132548b91e616e6d5ff34",
+      "digest": "sha256:77baf947bf422344b099c312f5895e8491f5d91c97758ff2ed1a7672dc408114",
       "evidence_files": 16,
       "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a",
-      "files": 1020,
-      "generated_at_commit": "a777113639f2849ef32e48121049e02487624d29",
-      "source_tree": "sha256:f64de1064e0d0c161ce34e669ced086c5b845e4ad174e165ce5c60888e40c53e"
+      "files": 1022,
+      "generated_at_commit": "8507ac948f46e305d1108520cabaed75f110695d",
+      "source_tree": "sha256:98ea82ec4a88290e4598dc1b065bcba1b688784c347c24cd505db86c09a989be"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/tests/runtime/.crumb b/tests/runtime/.crumb
index 1824de73e..1f0a83f82 100644
--- a/tests/runtime/.crumb
+++ b/tests/runtime/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-11T15:34:01Z",
+      "compiled_at": "2026-10-11T19:30:27Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:6ce8e4d40746ec42f2f06437583fb91a613f25997fa0b427bbd640c6b4d2c649",
+      "digest": "sha256:befa6601937d28b7c058b3abc4c12c90cbe8f2fce3f9498a3e67cd522391b61c",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 66,
-      "generated_at_commit": "e39d0c58fa08564c61c92d43f1523f06d3a67d66",
-      "source_tree": "sha256:5d3a26ec62cda4ef4d99bbeef0897c2aecf8587f13cb5b6a01c78c60130cec15"
+      "files": 68,
+      "generated_at_commit": "8507ac948f46e305d1108520cabaed75f110695d",
+      "source_tree": "sha256:48a242a9007e050ca566cc0fe1110a52ec47bd643d1eeefd369bc956513d0f23"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/tests/runtime/aienos_cap_abi.sh b/tests/runtime/aienos_cap_abi.sh
new file mode 100755
index 000000000..13df85878
--- /dev/null
+++ b/tests/runtime/aienos_cap_abi.sh
@@ -0,0 +1,119 @@
+#!/bin/bash
+# OMEGA_AIENOS_CAP_ABI: src/runtime/aienos_cap.h is a hand-kept copy of aienos
+# native/capability/aienos_capability.h. The runtime compiles against the copy and
+# links libaienos_capability.a built from the aienos.lock commit, so the copy must
+# match the pinned header: struct layouts field by field, macro values, prototypes
+# (tests/runtime/aienos_cap_abi_test.c says how each is checked).
+#
+# usage: aienos_cap_abi.sh <dir holding the pinned aienos_capability.h>
+#
+# The copy must PASS; each mutant below (a temporary copy of aienos_cap.h with one
+# change) must be refused with a diagnostic naming what changed. A mutant whose
+# pattern no longer matches is a failure of this script, never a silent skip.
+# Shell, sed, awk and the C compiler only.
+set -u
+PIN=${1:?usage: aienos_cap_abi.sh <pinned aienos native/capability dir>}
+HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
+COPY=$HERE/src/runtime/aienos_cap.h
+TEST=$HERE/tests/runtime/aienos_cap_abi_test.c
+CC=${CC:-cc}
+CFLAGS=${CFLAGS:--std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -O2}
+export LC_ALL=C
+[ -f "$PIN/aienos_capability.h" ] || { echo "error: no aienos_capability.h in $PIN"; exit 1; }
+W=$(mktemp -d "${TMPDIR:-/tmp}/aienos-cap-abi.XXXXXX")
+trap 'rm -rf "$W"' EXIT
+
+# gen <header> <dir>: the files aienos_cap_abi_test.c includes (see its comment).
+gen() {
+    mkdir -p "$2" && cp "$1" "$2/omega_view.h" || return 1
+    sed -e '/^typedef struct {/,/^}/d' -e '/^#ifndef /d' -e '/^#endif/d' \
+        -e '/^#define [A-Za-z0-9_]*[ \t]*$/d' -e '/^#include /d' "$1" >"$2/omega_protos.h" || return 1
+    awk -v D="$2" '
+    function bad(m) { printf "aienos_cap_abi: %s:%d: %s: %s\n", FILENAME, FNR, m, $0 > "/dev/stderr"; err = 1; exit 1 }
+    function ident_before(s, re) { if (!match(s, re)) bad("no name"); s = substr(s, 1, RSTART - 1); match(s, /[A-Za-z_][A-Za-z0-9_]*$/); return substr(s, RSTART, RLENGTH) }
+    /^typedef struct \{[ \t]*$/ { ins = 1; nf = 0; next }
+    ins && /^\}/ {
+        if (!match($0, /^\}[ \t]*[A-Za-z_][A-Za-z0-9_]*[ \t]*;[ \t]*$/)) bad("struct end")
+        t = $0; sub(/^\}[ \t]*/, "", t); sub(/[ \t]*;.*$/, "", t)
+        structs = structs " X(" t ", " (++ns) ")"; ren[++nr] = t; pre[nr] = "O_"
+        for (i = 1; i <= nf; i++) fields = fields " X(" t ", " f[i] ")"
+        ins = 0; next
+    }
+    ins && /^[ \t]*$/ { next }
+    ins && /^[ \t]*(\/\*|\*)/ { next }
+    ins {
+        if ($0 !~ /^[ \t]+[A-Za-z_][A-Za-z0-9_ \t*]*[ \t*][A-Za-z_][A-Za-z0-9_]*[ \t]*(\[[^]]*\])?[ \t]*;[ \t]*$/) bad("field")
+        s = $0; sub(/[ \t]*;[ \t]*$/, "", s); sub(/[ \t]*\[[^]]*\]$/, "", s)
+        match(s, /[A-Za-z_][A-Za-z0-9_]*$/); f[++nf] = substr(s, RSTART, RLENGTH); next
+    }
+    /^typedef[^;]*\(\*[ \t]*[A-Za-z_][A-Za-z0-9_]*[ \t]*\)/ {
+        ren[++nr] = ident_before($0, "[ \t]*\\)[ \t]*\\("); pre[nr] = "O_"; next
+    }
+    /^#define[ \t]+[A-Za-z_][A-Za-z0-9_]*[ \t]+[^ \t]/ { macros[++nm] = $2; next }
+    /^[A-Za-z_][A-Za-z0-9_ \t*]*[ \t*][A-Za-z_][A-Za-z0-9_]*[ \t]*\(/ && $1 != "typedef" {
+        fn = ident_before($0, "[ \t]*\\("); funcs = funcs " X(" fn ")"; ren[++nr] = fn; pre[nr] = "o_"; ++nfn; next
+    }
+    END {
+        if (err) exit 1
+        if (ins) { print "aienos_cap_abi: unterminated struct" > "/dev/stderr"; exit 1 }
+        if (!ns || !nfn) { print "aienos_cap_abi: no struct or no function found" > "/dev/stderr"; exit 1 }
+        L = D "/aca_list.h"
+        print "#define ACA_STRUCTS(X)" structs > L; print "#define ACA_FIELDS(X)" fields > L
+        print "#define ACA_FUNCS(X)" funcs > L
+        print "#define ACA_FUNC_COUNT " nfn > L; print "#define ACA_MACRO_COUNT " nm > L
+        for (i = 1; i <= nm; i++)
+            printf "#ifndef %s\n#error \"%s is not defined by the pinned header\"\n#endif\n", macros[i], macros[i] > (D "/aca_exist.h")
+        printf "" > (D "/aca_exist.h")
+        for (i = 1; i <= nr; i++) {
+            printf "#define %s %s%s\n", ren[i], pre[i], ren[i] > (D "/aca_rename.h")
+            printf "#undef %s\n", ren[i] > (D "/aca_unrename.h")
+        }
+    }' "$1"
+}
+
+# check <header> <dir>: 0 when the header matches the pinned one; output in <dir>/log.
+check() {
+    gen "$1" "$2" >"$2.gen.log" 2>&1 || { mkdir -p "$2"; cat "$2.gen.log" >"$2/log"; return 1; }
+    # shellcheck disable=SC2086
+    $CC $CFLAGS -Werror -I"$2" -I"$PIN" -o "$2/t" "$TEST" >"$2/log" 2>&1 </dev/null || return 1
+    "$2/t" >>"$2/log" 2>&1 </dev/null
+}
+
+if ! check "$COPY" "$W/copy"; then
+    echo "FAIL: src/runtime/aienos_cap.h does not match $PIN/aienos_capability.h:"
+    grep -E "error|FAIL|aienos_cap_abi:" "$W/copy/log" | head -20
+    echo "GATE OMEGA_AIENOS_CAP_ABI_PASS FAIL"
+    exit 1
+fi
+grep '^GATE ' "$W/copy/log"
+
+# name|sed program applied to the copy|text the refusal must name
+MUTANTS='M1 two same-size AienosCapEntry fields swapped (issuer, subject)|0,/^    uint32_t issuer;$/{/^    uint32_t issuer;$/{N;s/^\(.*\)\n\(.*\)$/\2\n\1/}}|offsetof AienosCapEntry.issuer
+M2 AienosCapEntry.rights signed, same size and offset|0,/^    uint32_t rights;$/s//    int32_t rights;/|kind AienosCapEntry.rights
+M3 aienos_cap_reclaim cap_id widened to 64 bits|s/^\(int aienos_cap_reclaim(.*\)uint32_t cap_id);$/\1uint64_t cap_id);/|aienos_cap_reclaim
+M4 aienos_cap_clock returns 32 bits|s/^uint64_t aienos_cap_clock(/uint32_t aienos_cap_clock(/|aienos_cap_clock
+M5 observer op parameter widened|s/^\(typedef void (\*AienosCapObserver)(void \*ctx, \)uint32_t op,/\1uint64_t op,/|AienosCapObserver
+M6 AIENOS_CAP_OBS_KILL value changed|s/^#define AIENOS_CAP_OBS_KILL 6u$/#define AIENOS_CAP_OBS_KILL 9u/|AIENOS_CAP_OBS_KILL
+M7 a function the pinned header does not declare|/^int aienos_cap_kill(/a int aienos_cap_unpinned(AienosCapAdmin *admin);|aienos_cap_unpinned
+M8 a macro the pinned header does not define|/^#define AIENOS_CAP_OBS_KILL /a #define AIENOS_CAP_OBS_UNPINNED 9u|AIENOS_CAP_OBS_UNPINNED'
+
+total=0 caught=0
+while IFS='|' read -r name prog expect; do
+    total=$((total + 1)) id=${name%% *}
+    mkdir -p "$W/$id"
+    sed -e "$prog" "$COPY" >"$W/$id/aienos_cap.h"
+    if cmp -s "$COPY" "$W/$id/aienos_cap.h"; then
+        echo "MUTANT $name: FAIL (pattern no longer matches src/runtime/aienos_cap.h)"
+    elif check "$W/$id/aienos_cap.h" "$W/$id/case"; then
+        echo "MUTANT $name: FAIL (accepted)"
+    elif ! grep -q -- "$expect" "$W/$id/case/log"; then
+        echo "MUTANT $name: FAIL (refused, but not for \"$expect\"):"
+        grep -E 'error' "$W/$id/case/log" | head -3
+    else
+        caught=$((caught + 1))
+        echo "MUTANT $name: refused ($(grep -m1 -- "$expect" "$W/$id/case/log" | grep -o 'error: .*' | cut -c1-90))"
+    fi
+done <<<"$MUTANTS"
+echo "GATE OMEGA_AIENOS_CAP_ABI_MUTANTS_PASS $([ "$caught" = "$total" ] && echo PASS || echo FAIL) $caught/$total"
+[ "$caught" = "$total" ] || exit 1
+echo "OMEGA_AIENOS_CAP_ABI_PASS"
diff --git a/tests/runtime/aienos_cap_abi_test.c b/tests/runtime/aienos_cap_abi_test.c
new file mode 100644
index 000000000..987902737
--- /dev/null
+++ b/tests/runtime/aienos_cap_abi_test.c
@@ -0,0 +1,106 @@
+/*
+ * aienos_cap_abi_test.c -- OMEGA_AIENOS_CAP_ABI: src/runtime/aienos_cap.h, the
+ * hand-kept copy the runtime compiles against, must match the pinned AIENOS
+ * header aienos_capability.h (aienos.lock), the one libaienos_capability.a is
+ * built from. Built and run only by tests/runtime/aienos_cap_abi.sh
+ * (make test-aienos-cap-abi), which writes, for the copy under test:
+ *   omega_view.h     the copy, unchanged
+ *   omega_protos.h   the copy without its struct definitions and include guard
+ *   aca_list.h       X-lists of its struct typedefs, their fields, its functions
+ *   aca_exist.h      #ifndef/#error for each valued macro it defines
+ *   aca_rename.h     O_ names for its struct and function-pointer typedefs,
+ *   aca_unrename.h   o_ names for its functions (and the #undefs)
+ *
+ * Every check is a compile-time error; the run repeats the layout rows only to
+ * count them for the GATE lines:
+ *   1. existence: each function and valued macro of the copy is declared by
+ *      the pinned header;
+ *   2. layout: each struct typedef has the same sizeof and _Alignof, and each
+ *      field the same offsetof, sizeof and kind (integer type and signedness,
+ *      pointer or array element type, or which struct), so an equal-size
+ *      reordered or retyped struct is refused;
+ *   3. constants: the copy's macros redefine the pinned ones; a different body
+ *      is a redefinition error (-Werror);
+ *   4. prototypes: the copy's function and function-pointer declarations are
+ *      redeclared over the pinned types; a different parameter or return type
+ *      is a conflicting-types error.
+ */
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "aienos_capability.h"
+#include "aca_exist.h"
+#include "aca_list.h"
+
+/* 1. functions: taken from the pinned declarations (the copy is not in yet). */
+#define ACA_EXISTS(f) (void)&f; n++;
+static int pinned_functions(void) {
+    int n = 0;
+    ACA_FUNCS(ACA_EXISTS)
+    return n;
+}
+
+/* The copy, under O_/o_ names; its macros redefine the pinned ones (check 3). */
+#include "aca_rename.h"
+#include "omega_view.h"
+#include "aca_unrename.h"
+
+/* 2. layout. */
+#define ACA_INT_KINDS(X)                                                                   \
+    X(_Bool, 1) X(char, 2) X(signed char, 3) X(unsigned char, 4) X(short, 5)               \
+    X(unsigned short, 6) X(int, 7) X(unsigned int, 8) X(long, 9) X(unsigned long, 10)      \
+    X(long long, 11) X(unsigned long long, 12) X(float, 13) X(double, 14) X(long double, 15)
+#define ACA_KIND_INT(T, k) T: k, T *: 100 + k, const T *: 200 + k,
+#define ACA_KIND_STRUCT(T, k)                                                              \
+    T: 1000 + k, O_##T: 1000 + k, T *: 1100 + k, O_##T *: 1100 + k,                        \
+    const T *: 1200 + k, const O_##T *: 1200 + k,
+#define ACA_KIND(e)                                                                        \
+    _Generic((e), ACA_INT_KINDS(ACA_KIND_INT) ACA_STRUCTS(ACA_KIND_STRUCT) default: 0)
+#define ACA_M(T, f) (((T *)0)->f)
+
+#define ACA_STRUCT_ASSERT(T, k)                                                            \
+    _Static_assert(sizeof(O_##T) == sizeof(T), "sizeof " #T);                              \
+    _Static_assert(_Alignof(O_##T) == _Alignof(T), "_Alignof " #T);
+#define ACA_FIELD_ASSERT(T, f)                                                             \
+    _Static_assert(offsetof(O_##T, f) == offsetof(T, f), "offsetof " #T "." #f);           \
+    _Static_assert(sizeof ACA_M(O_##T, f) == sizeof ACA_M(T, f), "sizeof " #T "." #f);     \
+    _Static_assert(ACA_KIND(ACA_M(O_##T, f)) == ACA_KIND(ACA_M(T, f)), "kind " #T "." #f);
+ACA_STRUCTS(ACA_STRUCT_ASSERT)
+ACA_FIELDS(ACA_FIELD_ASSERT)
+
+typedef struct {
+    const char *what;
+    size_t copy[3], pinned[3]; /* offset or alignment, size, kind */
+} AcaRow;
+#define ACA_STRUCT_ROW(T, k)                                                               \
+    {#T, {_Alignof(O_##T), sizeof(O_##T), 1000 + k}, {_Alignof(T), sizeof(T), 1000 + k}},
+#define ACA_FIELD_ROW(T, f)                                                                \
+    {#T "." #f,                                                                            \
+     {offsetof(O_##T, f), sizeof ACA_M(O_##T, f), (size_t)ACA_KIND(ACA_M(O_##T, f))},      \
+     {offsetof(T, f), sizeof ACA_M(T, f), (size_t)ACA_KIND(ACA_M(T, f))}},
+static const AcaRow ROWS[] = {ACA_STRUCTS(ACA_STRUCT_ROW) ACA_FIELDS(ACA_FIELD_ROW)};
+
+/* 3 and 4: the copy's declarations again, now over the pinned types. */
+#include "omega_protos.h"
+
+int main(void) {
+    int rows = (int)(sizeof ROWS / sizeof ROWS[0]), ok_rows = 0;
+    for (int i = 0; i < rows; i++) {
+        const AcaRow *r = &ROWS[i];
+        if (r->copy[0] == r->pinned[0] && r->copy[1] == r->pinned[1] &&
+            r->copy[2] == r->pinned[2])
+            ok_rows++;
+        else
+            fprintf(stderr, "FAIL %s: copy %zu/%zu/%zu pinned %zu/%zu/%zu\n", r->what,
+                    r->copy[0], r->copy[1], r->copy[2], r->pinned[0], r->pinned[1],
+                    r->pinned[2]);
+    }
+    int fns = pinned_functions();
+    printf("GATE OMEGA_AIENOS_CAP_ABI_LAYOUT_PASS %s %d/%d\n", ok_rows == rows ? "PASS" : "FAIL",
+           ok_rows, rows);
+    printf("GATE OMEGA_AIENOS_CAP_ABI_DECLS_PASS %s %d/%d\n", fns == ACA_FUNC_COUNT ? "PASS" : "FAIL",
+           fns + ACA_MACRO_COUNT,
+           ACA_FUNC_COUNT + ACA_MACRO_COUNT);
+    return ok_rows == rows && fns == ACA_FUNC_COUNT ? 0 : 1;
+}