code wiki / _hdl_build / nx_skullfit_beat.nx
nx_skullfit_beat.nx
buildroot/runtime/_hdl_build/nx_skullfit_beat.nx
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
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
structs
| none |
consts
| 35 | const SB_OUT: i64 = 65536 |
| 36 | const SB_LINE: i64 = 16384 |
| 37 | const SB_MODE: i64 = 420 |
| 38 | const SB_STEP0: i64 = 4 // the coordinate descent's first step, mm (nx_skullsdf tune's own default ladder 4,2,1) |
| 39 | const SB_STRIDE: i64 = 15 // every 15th oracle triangle, the sampling the trend was built on |
| 40 | const SB_ELF_SDF: *u8 = "/volume1/homes/elderwesto/nishihost/nx_skullsdf.elf" |
| 41 | const SB_ELF_CANON: *u8 = "/volume1/homes/elderwesto/nishihost/nx_skull_canon_gate.elf" |
| 42 | const SB_CONF: *u8 = "knowledge/skullfit_beat.conf" |
| 43 | const SB_TIMING: *u8 = "knowledge/status/skullfit_beat.timing" |
| 44 | const SB_TREND: *u8 = "knowledge/status/skullfit_trend.jsonl" |
| 45 | const SB_FIT: *u8 = "knowledge/skull_fit.dat" |
| 46 | const SB_ORACLE: *u8 = "knowledge/skull.nxmesh" |
| 47 | const SB_EMIT: *u8 = "/tmp/skullfit_beat.nxmesh" |
| 48 | const SB_HEAT_OURS: *u8 = "/tmp/skullfit_heat_ours.nxmesh" |
| 49 | const SB_HEAT_ORACLE: *u8 = "/tmp/skullfit_heat_oracle.nxmesh" |
| 50 | const SB_RESIDUAL: *u8 = "knowledge/skull_res.dat" |
| 51 | const SB_FITBANK: *u8 = "knowledge/status/bank/skull_fit.dat.prebeat" // the pre-tune vector: the ruler's rollback target |
| 52 | const SB_PHASE_BOTH: i64 = 0 |
| 53 | const SB_PHASE_MEASURE: i64 = 1 |
functions
| 55 | func 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 } |
| 56 | func sb_append(path: *u8, buf: *u8, n: i64) -> i64 |
| 65 | func sb_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 76 | func sb_field(out: *u8, n: i64, needle: *u8) -> i64 called by 1: main |
| 118 | func sb_copy_line(out: *u8, n: i64, needle: *u8, ln: *u8, o0: i64, cap: i64) -> i64 called by 1: main |
| 151 | func sb_read(path: *u8, len: *i64) -> *u8 |
| 157 | func sb_max(a: i64, b: i64) -> i64 { if a > b { return a } return b } called by 1: main |
| 158 | func sb_ms() -> i64 { return sys_now_ms() } |
| 160 | func 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 |
| 175 | func main(argc: i64, argv: *i64) -> i64 |