code wiki / _hdl_build / nx_ale_flywheel.nx

nx_ale_flywheel.nx

buildroot/runtime/_hdl_build/nx_ale_flywheel.nx

10279 B207 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic ale
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_ale_flywheel.nx

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

main sys_mmap sys_openat_append fl_p sys_write fl_run sys_mmap ↻ fl_read sys_openat_rd sys_read sys_close fl_idx_path sys_mmap ↻ sys_mkdir fl_unlink fl_run_harness sys_fork sys_openat_wr sys_dup3 sys_mmap ↻ sys_execve sys_exit sys_wait4 fl_score_of sys_mmap ↻ fl_read ↻ fl_p ↻ fl_fn sys_mmap ↻ sys_write ↻ fl_fp sys_write ↻ sys_close ↻ fl_fn ↻ sys_exit ↻ fl_write_file fl_unlink ↻ sys_openat_wr ↻ sys_write ↻ fl_len

structs

none

consts

20const K_MAGIC_65536: i64 = 65536
21const K_MAGIC_2048: i64 = 2048
22const K_MAGIC_2047: i64 = 2047

functions

24func 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 }
called by 2: fl_runmain calls 1: sys_write
25func 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 }
called by 2: fl_runmain calls 1: sys_write
26func 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 }
called by 2: fl_runmain calls 2: sys_mmapsys_write
27func 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
30func fl_read(path: *u8, buf: *u8, cap: i64) -> i64
44func fl_score_of(path: *u8) -> i64
called by 1: fl_run calls 2: sys_mmapfl_read
54func fl_write_file(path: *u8, s: *u8) -> i64
63func fl_idx_path(dst: *u8, prefix: *u8, idx: i64) -> i64
called by 1: fl_run calls 1: sys_mmap
78func fl_run_harness(task: *u8, sb: *u8, out: *u8, score: *u8) -> i64
103func fl_run(manifestpath: *u8, res: *i64, verbose: i64, ledger_fd: i64) -> i64
150func main(argc: i64, argv: *i64) -> i64