interplane.Get Omega
Read in your language

sovereign-intelligence

Front door to Drake Stapleton's sovereign stack.

Brought by drakestapleton

branch main Branches Tags History

sovereign-intelligence / harness / coder / build-context.sh

34 lines · 1608 bytes Raw Blame History
1#!/bin/sh
2# Build the Omega-only context pack read by `aien --omega` (harness config, not product code).
3# usage: OMEGA_MV=/path/to/omega-mv OMC=/path/to/pinned/omc sh coder/build-context.sh OUTDIR
4# Writes OUTDIR/OMEGA.md (system prompt: rules + language reference + compiled examples) and
5# OUTDIR/CONTROL.md (rules only, for the no-context eval arm). Every example must compile with OMC.
6set -eu
7here=$(cd "$(dirname "$0")" && pwd)
8skill="$here/../skills/omega-encoding"
9mv=${OMEGA_MV:?set OMEGA_MV to an omega-mv checkout}
10omc=${OMC:?set OMC to the pinned omc}
11out=${1:?usage: build-context.sh OUTDIR}
12mkdir -p "$out"
13tmp=$(mktemp)
14trap 'rm -f "$tmp" "$tmp.elf"' EXIT
15
16{
17 cat "$here/omega-prompt-head.md"
18 printf '\n# Omega language reference\n\n'
19 # Sections 2..11 of the omega-encoding skill; citation links are dropped to save tokens.
20 awk '/^## 2\. /{on=1} /^## 11a\. /{on=0} on' "$skill/SKILL.md" |
21 sed -E 's/ ?\((\[[^]]*\]\([^)]*\)(, ?)?)+\)//g; s/\[([^]]*)\]\([^)]*\)/\1/g'
22 cat "$here/omega-observed.md"
23 printf '\n# Examples (each compiles with the pinned omc)\n'
24 for f in "$skill/examples/fnv1a32.om" "$skill/examples/trap_narrow.om" \
25 "$mv/seed/rung4/tests/echo.om" "$mv/seed/rung4/tests/fib.om" "$mv/seed/omc/tests/text.om" \
26 "$mv/seed/omc/tests/loop/c1.om" "$mv/seed/omc/tests/loop/w1.om" "$mv/seed/omc/tests/float/structs.om"; do
27 "$omc" < "$f" > "$tmp.elf" || { echo "example does not compile: $f" >&2; exit 1; }
28 printf '\n## %s\n\n```\n' "$(basename "$f")"
29 cat "$f"
30 printf '```\n'
31 done
32} > "$tmp"
33mv "$tmp" "$out/OMEGA.md"
34cp "$here/omega-prompt-head.md" "$out/CONTROL.md"