interplane.Get Omega
Read in your language

omega-harness

Agent skills for operating, encoding and communicating in Omega (.om) and the AIEN repositories

Brought by drakestapleton

GitHub aien-dev/omega-harness#173 (code only)

closed derived 40637dd208bcbccb #173

Imported from GitHub aien-dev/omega-harness#173 (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 ec1bb54e2ef6c5cc2cf58ff05d6de531850a4969 · Head 45f6514de3d7c9309627f6f4f3382add01d4d35a

Apply it

git checkout -b patch-40637dd208bcbccb ec1bb54e2ef6c5cc2cf58ff05d6de531850a4969
curl -fsSL https://interplane.io/drakestapleton/omega-harness/patches/40637dd208bcbccb.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-harness
173
45f6514de3d7c9309627f6f4f3382add01d4d35a
{"kind":"github-import","owner":"aien-dev","repo":"omega-harness","number":173,"url":"https://github.com/aien-dev/omega-harness/pull/173","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:39Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/skills/omega-encoding/SKILL.md b/skills/omega-encoding/SKILL.md
index 1dc84cd..96b7e20 100644
--- a/skills/omega-encoding/SKILL.md
+++ b/skills/omega-encoding/SKILL.md
@@ -1399,6 +1399,67 @@ proved (`false.om`, `requires false`, must exit 109). Both run to exit 0, so the
 `seed/host/check.sh` requires with the exact `VERDICT` lines. A passing mutant suite would mean the
 check proves nothing.
 
+## 11b. Composed units and traps that compile
+
+Omega has no imports: a multi-file program is its units concatenated into one input
+(`cat a.om b.om main.om | omc`). These rules bite there, and several compile without a word.
+Observed 2026-11-04, Linux AArch64 host only, with the pinned omc `be8c5130…` (omega-mv
+`9920aab1`); the first three are gated as `examples/pitfall_*.om` in this skill. Source citations
+are `seed/omc/omc.om` at `9920aab1`.
+
+- **There is no `elif`.** A statement `NAME VALUE` is an assignment; the `=` is optional
+  (`s_assign`, [omc.om#L8197-L8207](https://github.com/aien-dev/omega-mv/blob/9920aab1413983c2867d02d75b2276341595adb8/seed/omc/omc.om#L8197-L8207)).
+  So `elif eq k 1` (or `elsif`, `elseif`) silently makes a local bool and the line after it runs
+  every time: `zz ulong 9` / `ret int zz` exits 9, and `examples/pitfall_elif.om` returns 20 where
+  10 is meant (compile exit 0, no diagnostic; same with omega-mv main omc `b4f45121`). Write
+  separate `if ... ret ... end` blocks or nest the test inside `else`; both forms of the same
+  function return 10, 20 and 0 for k = 0, 1, 2. A refusal (error 16) is omega-mv
+  [#858](https://github.com/aien-dev/omega-mv/pull/858), an open draft, not on main at `d3d1b1bc`.
+- **One namespace for the whole input.** Globals, texts, consts, structs and functions of every unit
+  are visible in every other one. A local named like another unit's global array is error 7, not
+  error 10 (`examples/pitfall_shared_name.om`, `omc: line 8: error 7`; renamed, exit 7); a local
+  named like another unit's value function, `const` or `text` is also error 7 (a function name
+  parses as a call). Two units that each define `fn twice` give `omc: line 4: error 10`; a second
+  `global sh`, `const` or `text` of the same name is error 10 on its line, a second `struct P`
+  error 9.
+  Prefix every global and helper with the unit's short name. Modules are roadmap RM6
+  ([omega-mv#795](https://github.com/aien-dev/omega-mv/issues/795)), not built.
+- **Line numbers count the composed input.** `omc: line N` and every `omc-check`/`omc-site` record
+  give N in the concatenated stream: composed from a 4-line unit (`global sh` and `seta`), a 4-line
+  unit with the clashing local, and `main`, the clash is `omc: line 6: error 7`, line 2 of the
+  second unit. Keep the per-unit `wc -l` or run `grep -n . composed.om` to map back.
+- **The `om2` line must be the first non-`note` line of the composed input.** It sets the mode of
+  the whole input. `om2 diag debug` as a one-line first unit, then a 3-line OM-1 library, then a
+  unit with `requires gt x 0` compiles, prints `omc-check 1 kept line=6 rule=runtime kind=requires`
+  and exits 4 as written; with a `note` line in front it prints `line=7`; the same header placed
+  after the library is `omc: line 4: error 16`.
+- **Four global `get` terms in one `or` chain exhaust the registers.** `or or or ne get hdr 0 1 …`
+  over a global is error 12 (`examples/pitfall_or_global.om`, `omc: line 5: error 12`; also with
+  `k`-relative indices). Three terms, the same four on a local `new` array (exit 9), or
+  `a = or …` / `b = or …` / `if or a b` (exit 9) compile.
+- **A trap names its code and function, never its line.** Each trap site records only its branch
+  and code; `finish` emits one stub per code used in the function and patches every site of that
+  code to it ([#L2939-L2952](https://github.com/aien-dev/omega-mv/blob/9920aab1413983c2867d02d75b2276341595adb8/seed/omc/omc.om#L2939-L2952),
+  [#L9852-L9898](https://github.com/aien-dev/omega-mv/blob/9920aab1413983c2867d02d75b2276341595adb8/seed/omc/omc.om#L9852-L9898)).
+  A function with `get ga i` (4 bytes) and `get gb i` (8 bytes) on two paths exits 103 with empty
+  stderr for index 9 on either path (indices 3 and 7 exit 0). When the site matters, test the range
+  yourself and give each site its own exit below 100 (`if ge i len ga` / `exit 21`): the same
+  inputs then exit 21 and 22. Bounds are per array, so an index from one buffer's offset space used
+  on another traps 3 only once the data grows past the smaller array.
+- **The output has no symbols.** `file` reports `statically linked, no section header`,
+  `readelf -S` `There are no sections in this file.`, `nm` `no symbols`; the function name `pick`
+  occurs 0 times in the binary while a `text` literal `pickmark` occurs once. perf and gdb cannot
+  name functions; profile by timing separate programs or entry points. A perf map from omc would be
+  a compiler change.
+- **Rechecked at this pin:** `le` as a local or function name is error 16 (`lte` compiles, exit 4);
+  `line` and `out` are *not* reserved (`line = ulong 3` / `ret int line` exits 3); `getppid` returns
+  the real parent (`sh -c 'echo $$ | ./ppid'` exit 0, a wrong pid exit 1); `\r` in a `text` is
+  `omc: line 1: error 22`; `global g uchar 16777217` is error 23 and 16777216 compiles; a global
+  argument is error 19 (copy into a local: exit 6). Eager `and`/`or` is section 3, the 16-register
+  pool section 6.
+- **Mutation runners:** write each mutant to a path that is not the build's own output `.om`;
+  otherwise the runner overwrites one with the other and tests the wrong file.
+
 ## 12. Before any claim
 
 1. Inspect the compiler, not memory. Find the rule in `omc.om` or a gate fixture at the pinned commit
@@ -1442,9 +1503,11 @@ check proves nothing.
 - `examples/fnv1a32.om`: reads all of stdin with a partial-read loop, hashes it (FNV-1a 32, unsigned
   wrap), writes 4 little-endian bytes with a partial-write loop, distinct exit codes for each failure.
 - `examples/trap_narrow.om`: a masked narrowing succeeds, an unmasked one traps 5 (exit 105).
+- `examples/pitfall_elif.om`, `pitfall_shared_name.om`, `pitfall_or_global.om`: the first three
+  traps of section 11b (exit 20, `omc: line 8: error 7`, `omc: line 5: error 12`).
 
-Both carry `.expect` (and for `fnv1a32`, `.stdin` `abc` and the 4 expected bytes in `.stdout`) and
-run in [`examples/gate.sh`](../../examples/gate.sh) with the 97 programs in the repository's
+Each carries `.expect` (and `fnv1a32` also `.stdin` `abc` and the 4 expected bytes in `.stdout`) and
+runs in [`examples/gate.sh`](../../examples/gate.sh) with the 99 programs in the repository's
 `examples/` directory; section 0 records the `e5b32567` rerun of every row below. The portable guide
 for writing a first program is [`skills/writing-omega/SKILL.md`](../writing-omega/SKILL.md).
 
diff --git a/skills/omega-encoding/examples/pitfall_elif.expect b/skills/omega-encoding/examples/pitfall_elif.expect
new file mode 100644
index 0000000..1848729
--- /dev/null
+++ b/skills/omega-encoding/examples/pitfall_elif.expect
@@ -0,0 +1,2 @@
+compile 0
+exit 20
diff --git a/skills/omega-encoding/examples/pitfall_elif.om b/skills/omega-encoding/examples/pitfall_elif.om
new file mode 100644
index 0000000..e98572d
--- /dev/null
+++ b/skills/omega-encoding/examples/pitfall_elif.om
@@ -0,0 +1,14 @@
+note There is no elif. A line NAME VALUE assigns, so elif eq k 1 makes a local bool named elif
+note and the next line runs for every k. pick 0 should be 10 and returns 20 (exit 20).
+fn pick k ulong to ulong
+r = ulong 0
+if eq k 0
+r = ulong 10
+elif eq k 1
+r = ulong 20
+end
+ret r
+end
+fn main to int
+ret int pick 0
+end
diff --git a/skills/omega-encoding/examples/pitfall_or_global.expect b/skills/omega-encoding/examples/pitfall_or_global.expect
new file mode 100644
index 0000000..8a04bb6
--- /dev/null
+++ b/skills/omega-encoding/examples/pitfall_or_global.expect
@@ -0,0 +1,2 @@
+compile 12
+stderr omc: line 5: error 12
diff --git a/skills/omega-encoding/examples/pitfall_or_global.om b/skills/omega-encoding/examples/pitfall_or_global.om
new file mode 100644
index 0000000..59bee55
--- /dev/null
+++ b/skills/omega-encoding/examples/pitfall_or_global.om
@@ -0,0 +1,9 @@
+note Four ne get G i v terms on a global in one or chain exhaust the register pool (error 12);
+note three terms, a local array, or two bool locals combined with one or all compile.
+global hdr uchar 16
+fn main to int
+if or or or ne get hdr 0 1 ne get hdr 1 2 ne get hdr 2 3 ne get hdr 3 4
+ret 9
+end
+ret 0
+end
diff --git a/skills/omega-encoding/examples/pitfall_shared_name.expect b/skills/omega-encoding/examples/pitfall_shared_name.expect
new file mode 100644
index 0000000..718e9ad
--- /dev/null
+++ b/skills/omega-encoding/examples/pitfall_shared_name.expect
@@ -0,0 +1,2 @@
+compile 7
+stderr omc: line 8: error 7
diff --git a/skills/omega-encoding/examples/pitfall_shared_name.om b/skills/omega-encoding/examples/pitfall_shared_name.om
new file mode 100644
index 0000000..8b9c738
--- /dev/null
+++ b/skills/omega-encoding/examples/pitfall_shared_name.om
@@ -0,0 +1,14 @@
+note Units concatenated into one input share one namespace: the local sh below names the
+note global array sh of the unit above it, so the assignment is a type error (error 7).
+global sh uchar 4
+fn seta to void
+put sh 0 uchar 5
+end
+fn helpb x ulong to ulong
+sh = add x 1
+ret sh
+end
+fn main to int
+seta
+ret int add ulong get sh 0 helpb 1
+end