Qwen3-0.6B inference (12 KB), bare-metal bootable OS (22 KB), and from-scratch Mini-GPT trainer with live Braille TUI (32 KB) in 100% pure x86-64 NASM assembly. Zero C, zero libc, zero dependencies.
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
socket="$PWD/runs/.arena.tmux"
tm=(tmux -S "$socket")
exec 9>runs/.arena-launch.lock
flock 9
detached=0
extra=()
for arg in "$@"; do
if [[ "$arg" == "--detached" || "$arg" == "--headless" ]]; then
detached=1
else
extra+=("$arg")
fi
done
if ! "${tm[@]}" has-session -t =jev 2>/dev/null; then
if [[ -n "${JEV_RUN_NAME:-}" ]]; then run="runs/$JEV_RUN_NAME"; mkdir -p "$run"; else run=$(mktemp -d "runs/$(date -u +%Y%m%dT%H%M%SZ)-arena-XXXXXX"); fi
printf '%s\n' "$run" > runs/.arena-current
qemu-system-x86_64 \
-enable-kvm -machine q35 -cpu host -m 3072 -smp 2 -no-reboot -display none \
-serial "unix:$PWD/$run/shell.sock,server=on,wait=off" \
-serial "unix:$PWD/$run/hud.sock,server=on,wait=off" \
-monitor none -nic none \
-virtfs "local,path=$PWD,mount_tag=workspace,security_model=none,id=jev" \
-drive "file=testbed/root.ext4,format=raw,if=virtio,snapshot=on" \
-kernel testbed/vmlinuz -initrd testbed/initrd \
-append "console=ttyS0 panic=1 quiet root=/dev/vda rw init=/jev-init lsm=lockdown,capability,landlock,yama,apparmor,bpf jev_job=arena jev_run=${run##*/}" \
>"$run/qemu.log" 2>&1 9>&- &
qpid=$!
printf '%s\n' "$qpid" > "$run/qemu.pid"
for ((i=0;i<100;i++)); do
kill -0 "$qpid" 2>/dev/null || { echo "QEMU exited before sockets ready. See $run/qemu.log" >&2; exit 1; }
[[ -S "$run/shell.sock" && -S "$run/hud.sock" ]] && break
sleep .05
done
cmd="exec python3 demo/agent_arena.py $(printf '%q' "$run")"
if [[ $detached -eq 0 ]]; then
cmd="$cmd --hold"
fi
if [[ ${#extra[@]} -gt 0 ]]; then
for a in "${extra[@]}"; do
cmd="$cmd $(printf '%q' "$a")"
done
fi
"${tm[@]}" -f /dev/null new-session -d -s jev -c "$PWD" -x 160 -y 36 "$cmd" 9>&-
"${tm[@]}" set-option -t jev status off
"${tm[@]}" split-window -dh -p 62 -t jev:0.0 -c "$PWD" "exec python3 testbed/demo-terminal.py '$run'" 9>&-
"${tm[@]}" select-pane -t jev:0.0
else
run=$(cat runs/.arena-current)
qpid=$(cat "$run/qemu.pid" 2>/dev/null || true)
fi
flock -u 9
for ((i=0;i<900;i++)); do
if [[ -e $run/ready ]]; then
if [[ $detached -eq 1 ]]; then echo "$run"; exit 0; fi
exec tmux -S "$socket" attach-session -t =jev
fi
if [[ -n ${qpid:-} ]] && ! kill -0 "$qpid" 2>/dev/null; then
echo "Guest exited before startup. See $run/warden.log and $run/qemu.log" >&2
"${tm[@]}" kill-session -t =jev 2>/dev/null || true
exit 1
fi
sleep .1
done
echo "Guest startup timed out. Inspect $run and use testbed/stop_arena_vm.sh." >&2
exit 1