code wiki / _hdl_build / nx_ale_flywheel.nx
nx_ale_flywheel.nx
buildroot/runtime/_hdl_build/nx_ale_flywheel.nx
about
nx_ale_flywheel.nx -- ALE-R5: the sovereign ALE SCORE-FLYWHEEL (the RSI loop driver). Runs a
task manifest through the ALE-R1 measure (_offc/nx_ale_harness.elf) and CLASSIFIES each task:
SOLVED = harness exit 0 AND milli-score == 1000 (the agent fully produced the graded artifact)
GAP = otherwise (refused/unscored [exit!=0] OR partial [score<1000]) -- a CAPABILITY GAP
It reports each GAP (task + exit + score) so the loop can GAP-ANALYZE -> build the missing
transform/skill -> re-attempt. That is the RSI loop toward the exam: measure -> gap -> build ->
re-measure -> close. Reuses the harness (DRY); the measure owns scoring, the flywheel owns triage.
args mode: nx_ale_flywheel <manifest> -> classify that manifest, print FLYWHEEL + per-gap.
no-arg: SELF-GATE -- a CONTROL manifest [a known-SOLVED task + a PERMANENT-GAP task
(ctl_never_supported, an executor token never built)] must classify exactly 1 solved + 1 gap
(separation bites), AND an all-solved manifest must yield 0 gaps (no false gap) ->
FLYWHEELGATE verdict=GREEN to knowledge/status/ale_flywheel.log + stdout.
Landmines: nested ifs (no &&/||), flat exprs, <=6 args/func, no empty-string literal, strings via
Write. license_tier: ORIGINAL
module: nishi-core.ale.flywheel
depends: nishi-core.sys.syscalls
capability: ALE_SCORE_FLYWHEEL_RSI
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const K_MAGIC_65536: i64 = 65536 |
| 21 | const K_MAGIC_2048: i64 = 2048 |
| 22 | const K_MAGIC_2047: i64 = 2047 |
functions
| 24 | func fl_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 25 | func fl_fp(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 26 | func fl_fn(fd: i64, v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { m = 0 - m; sys_write(fd, "-" as *u8, 1) }; let t: *u8 = sys_mmap(28); var k: i64 = 0; if m == 0 { t[0] = 48; k = 1 }; while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }; var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 }; sys_write(fd, bb, k); return 0 } |
| 27 | func fl_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: fl_write_file |
| 28 | func fl_unlink(path: *u8) -> i64 { return __syscall(263, AT_FDCWD, path, 0, 0, 0, 0) } |
| 30 | func fl_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 44 | func fl_score_of(path: *u8) -> i64 |
| 54 | func fl_write_file(path: *u8, s: *u8) -> i64 |
| 63 | func fl_idx_path(dst: *u8, prefix: *u8, idx: i64) -> i64 |
| 78 | func fl_run_harness(task: *u8, sb: *u8, out: *u8, score: *u8) -> i64 |
| 103 | func fl_run(manifestpath: *u8, res: *i64, verbose: i64, ledger_fd: i64) -> i64 |
| 150 | func main(argc: i64, argv: *i64) -> i64 |