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 / eval / run.sh

83 lines · 3937 bytes Raw Blame History
1#!/bin/sh
2# Held-out eval for `aien --omega` (harness tooling, not product code).
3# usage: sh run.sh ARM OUTDIR TASKDIR [TASK_ID...]
4# ARM omega - Omega context pack as the system prompt, pack readable
5# control - same model, tools, guard and check loop; rules-only prompt, no readable pack
6# TASKDIR holds TASK_ID/{spec.md,stdin,expected.out,expected.exit}; reference solutions live elsewhere
7# Tasks run one after another (the live 35B takes serial requests only). Each task gets a fresh empty
8# directory; the model must leave main.om there. Scoring is independent of the session: compile with
9# the pinned omc, then run the om2 gate on the task's case line in a fresh scratch directory.
10# Per task: OUTDIR/ID/{work/,cases.txt,transcript.jsonl,stderr,guard.log,score.log}; summary OUTDIR/results.tsv.
11set -u
12arm=${1:?arm: omega or control}
13out=${2:?outdir}
14tasks=${3:?taskdir}
15shift 3
16home=${OMEGA_HOME:-$HOME/.local/share/aien-omega}
17omc="$home/omc"
18sha=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f
19[ "$(sha256sum "$omc" | cut -d' ' -f1)" = "$sha" ] || { echo "pinned omc mismatch" >&2; exit 2; }
20command -v aien > /dev/null || { echo "aien not on PATH" >&2; exit 2; }
21case $arm in
22omega) prompt_file="$home/context/OMEGA.md"; context="$home/context" ;;
23control) prompt_file="$home/context/CONTROL.md" ;;
24*) echo "arm must be omega or control" >&2; exit 2 ;;
25esac
26mkdir -p "$out" "$out/empty-context"
27out=$(cd "$out" && pwd)
28[ "$arm" = control ] && context="$out/empty-context"
29ids=${*:-$(ls "$tasks")}
30# Resumable: a task already scored in results.tsv is skipped; an interrupted task left no row and is re-run.
31[ -s "$out/results.tsv" ] ||
32 printf 'id\tverdict\tomc_rc\tgate_rc\tsession_rc\twall_s\tstop_refusals\tnon_om_files\n' > "$out/results.tsv"
33for id in $ids; do
34 if cut -f1 "$out/results.tsv" | grep -qx "$id"; then continue; fi
35 t="$tasks/$id"
36 d="$out/$id"
37 rm -rf "$d"
38 mkdir -p "$d/work"
39 printf 'deadline 10\n%s run %s/work/main.om file:%s/stdin file:%s/expected.out - %s\n' \
40 "$id" "$d" "$t" "$t" "$(cat "$t/expected.exit")" > "$d/cases.txt"
41 if [ -s "$t/stdin" ]; then
42 input="Standard input for the check (JSON string): $(jq -Rs . < "$t/stdin")"
43 else
44 input="Standard input for the check is empty."
45 fi
46 prompt="Task: $(cat "$t/spec.md")
47$input
48Write the program to main.om in the working directory, check it with omega_run, and finish only when it is correct."
49 start=$(date +%s)
50 (cd "$d/work" && OMEGA_HOME="$home" OMEGA_PROMPT="$prompt_file" OMEGA_CONTEXT="$context" \
51 OMEGA_CASES="$d/cases.txt" OMEGA_STOP_LIMIT=5 OMEGA_LOG="$d/guard.log" \
52 timeout 900 aien --omega -p --mode json --max-time 600 --no-session "$prompt" \
53 > "$d/transcript.jsonl" 2> "$d/stderr")
54 src=$?
55 # 126/127: the session never started (not executable / not found). Scoring that as compile-fail would
56 # count an infrastructure failure against the model; stop without writing a row so a rerun retries it.
57 if [ "$src" -eq 126 ] || [ "$src" -eq 127 ]; then
58 echo "$id: session did not start (rc $src), see $d/stderr; no row written" >&2
59 exit 3
60 fi
61 wall=$(($(date +%s) - start))
62 orc=NA
63 grc=NA
64 if [ ! -f "$d/work/main.om" ]; then
65 verdict=compile-fail
66 echo "no main.om" > "$d/score.log"
67 else
68 "$omc" < "$d/work/main.om" > "$d/main.elf" 2> "$d/score.log"
69 orc=$?
70 if [ "$orc" -ne 0 ]; then
71 verdict=compile-fail
72 else
73 rm -rf "$d/scratch"
74 (cd "$home" && ./gate "$omc" "$sha" "$d/cases.txt" "$d/scratch") >> "$d/score.log" 2>&1
75 grc=$?
76 if [ "$grc" -eq 0 ] && grep -q '^OM2GATE PASS ' "$d/score.log"; then verdict=pass; else verdict=wrong-output; fi
77 fi
78 fi
79 refusals=$(grep -c 'stop refused' "$d/guard.log" 2>/dev/null || true)
80 nonom=$(find "$d/work" -type f ! -name '*.om' ! -name NOTES.md | wc -l)
81 printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$id" "$verdict" "$orc" "$grc" "$src" "$wall" "${refusals:-0}" "$nonom" >> "$out/results.tsv"
82done
83cat "$out/results.tsv"