code wiki / _hdl_build / nx_skullfit_beat.nx

nx_skullfit_beat.nx

buildroot/runtime/_hdl_build/nx_skullfit_beat.nx

22726 B424 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_skullfit_beat.nx -- no-arg BEAT: the skull generator's RECURSIVE LEARNING cycle (operator 2026-08-09: "i want nishi ecosystem to gain these functionalities as a recursive learning setup so that it can keep growing and get its capabilities to sota"). Each run advances the whole loop with no seat attached: (1) `nx_skullsdf tune` refines the 76-parameter fit AGAINST THE SCANNED ORACLE, seeded FROM knowledge/skull_fit.dat and saving BACK to it -- successive beats converge instead of restarting; (2) an emit must report fit_src=1 -- the ARTIFACT proves the fit landed, never the tuner's receipt (a builtin-defaults emit means the loop is broken, not neutral); (3) `gapmap` re-measures the per-region gap so the trend line carries WHERE the skull still deviates, not just a scalar; (4) THE CANON GATE measures the FACE, landmark by landmark against the oracle (anatomy AN17: the gapmap's regions are dominated by the vault and were blind to a 49 mm muzzle); (5) ONE line appends to the trend journal. BEAT-FAIL lines are evidence too. ★★★★★★THE WORK PER RUN IS DERIVED FROM THE DISPATCH BOUND, NEVER TYPED (AN17, 2026-09-18). The clock kills any dispatch at knowledge/skullfit_beat.conf dispatch_deadline_ms (the scheduler's own constant, carried as data with its provenance). MEASURED: one tune pass = 477 s on the NAS, so the old three-pass run was killed at 901 s on every dispatch since 2026-08-14 and appended NOTHING -- a beat whose one run cannot fit the deadline is indistinguishable from a beat that never fires. Now every run reads its own previous timings from knowledge/status/skullfit_beat.timing (the MAXIMUM seen per step, so a slow box only makes the plan more conservative), plans passes = floor((bound - emit - gapmap - canon) / pass), at least one, and when even one pass plus the measurements cannot fit it ALTERNATES phases (tune-only, then measure-only) so both still happen. A run stamps `started` before the work and `finished` after: a run the clock killed leaves started without finished, and the NEXT run names it on its trend row (prev_killed=1) and halves its plan -- a named refusal, never silence. The coordinate descent's step ladder (4, 2, 1) is carried ACROSS runs in the same file: a pass that moves the objective keeps its step, a pass that does not halves it. ***VACUOUS-OBJECTIVE GUARD (nx_fitloop's law): final_centi==0 against a real scanned skull is a BROKEN RULER, never perfection -- scored INVALID, exit 2. Scheduler contract: the clockjobs- plane fork+execs this elf with NO args. trend: knowledge/status/skullfit_trend.jsonl line: <epoch>\tTUNE ...\tFIT ...\tGAP ...\tCANON ...\tPLAN ...\n license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_sovjson_lib.nx nx_syscalls.nx nx_tool_run.nx nx_skullfit_beat.nx

imports: nx_sovjson_lib.nxnx_syscalls.nxnx_tool_run.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 nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sb_read sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close sb_field sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sj_catn sys_mmap ↻ sj_cat sb_append sys_openat_append sys_write ↻ sys_fsync sys_close ↻ sb_puts sys_write ↻ sb_max sb_stamp

structs

none

consts

35const SB_OUT: i64 = 65536
36const SB_LINE: i64 = 16384
37const SB_MODE: i64 = 420
38const SB_STEP0: i64 = 4 // the coordinate descent's first step, mm (nx_skullsdf tune's own default ladder 4,2,1)
39const SB_STRIDE: i64 = 15 // every 15th oracle triangle, the sampling the trend was built on
40const SB_ELF_SDF: *u8 = "/volume1/homes/elderwesto/nishihost/nx_skullsdf.elf"
41const SB_ELF_CANON: *u8 = "/volume1/homes/elderwesto/nishihost/nx_skull_canon_gate.elf"
42const SB_CONF: *u8 = "knowledge/skullfit_beat.conf"
43const SB_TIMING: *u8 = "knowledge/status/skullfit_beat.timing"
44const SB_TREND: *u8 = "knowledge/status/skullfit_trend.jsonl"
45const SB_FIT: *u8 = "knowledge/skull_fit.dat"
46const SB_ORACLE: *u8 = "knowledge/skull.nxmesh"
47const SB_EMIT: *u8 = "/tmp/skullfit_beat.nxmesh"
48const SB_HEAT_OURS: *u8 = "/tmp/skullfit_heat_ours.nxmesh"
49const SB_HEAT_ORACLE: *u8 = "/tmp/skullfit_heat_oracle.nxmesh"
50const SB_RESIDUAL: *u8 = "knowledge/skull_res.dat"
51const SB_FITBANK: *u8 = "knowledge/status/bank/skull_fit.dat.prebeat" // the pre-tune vector: the ruler's rollback target
52const SB_PHASE_BOTH: i64 = 0
53const SB_PHASE_MEASURE: i64 = 1

functions

55func sb_puts(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 1: main calls 1: sys_write
56func sb_append(path: *u8, buf: *u8, n: i64) -> i64
65func sb_write(path: *u8, buf: *u8, n: i64) -> i64
76func sb_field(out: *u8, n: i64, needle: *u8) -> i64
called by 1: main
118func sb_copy_line(out: *u8, n: i64, needle: *u8, ln: *u8, o0: i64, cap: i64) -> i64
called by 1: main
151func sb_read(path: *u8, len: *i64) -> *u8
called by 1: main calls 1: sys_read_file
157func sb_max(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 1: main
158func sb_ms() -> i64 { return sys_now_ms() }
called by 1: main calls 1: sys_now_ms
160func sb_stamp(started: i64, finished: i64, planned: i64, phase: i64, step: i64, pass_ms: i64, emit_ms: i64, gapmap_ms: i64, canon_ms: i64, inband: i64) -> i64
called by 1: main calls 4: sys_mmapsj_catsj_catnsb_write
175func main(argc: i64, argv: *i64) -> i64