code wiki / _hdl_build / nx_train_triage.nx

nx_train_triage.nx

buildroot/runtime/_hdl_build/nx_train_triage.nx

7831 B181 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind librarytopic train
docsdependenciesstructsconstsfunctions

about

nx_train_triage.nx -- TRAINING-DYNAMICS TRIAGE library (the team organ that handles what Claude diagnosed BY HAND during T4, 2026-06-10). Reads a machine-readable training report (TRIAGE-CLASS/TRIAGE-PRED/TRIAGE-ACC/TRIAGE-LOSS rows, emitted by training lanes like _t4b_closed_loop_authored) and NAMES the failure mode + the gate-proven fix, mechanically. The five lessons it encodes were each MEASURED on real failed gate runs: MAJORITY-COLLAPSE per-sample Adam on 88:2 imbalance -> all preds one class (88/149) POST-CONVERGENCE-BLOWUP constant-lr Adam after convergence: grads->0 => v->0 => mh/eps spike RARE-CLASS-LOSS unweighted loss loses exactly the smallest classes (util+mon) PLATEAU uncentered all-positive features froze relu nets across 3 optimizers CONVERGED-HEALTHY what T4/T4b look like when the lessons are applied Pure integer math on micro-loss values -- no f32 needed to judge a curve. RACI: Doctor owns the DIAGNOSIS verb here (names the heal); the Engineer owns the gate. LAWS: struct-free, flat ifs, no &&/||, loud verdicts. license_tier: ORIGINAL

dependencies 1 imports · 4 importers

nx_syscalls.nx nx_train_triage.nx nx_train_triage_cli.nx nx_train_triage_gate.nx nx_train_triage_sweep.nx nx_train_triage_sweep_gate.nx

imports: nx_syscalls.nx

imported by: nx_train_triage_cli.nxnx_train_triage_gate.nxnx_train_triage_sweep.nxnx_train_triage_sweep_gate.nx

structs

none

consts

15const TT_MAGIC_8192: i64 = 8192
17const TT_HEALTHY: i64 = 0
18const TT_COLLAPSE: i64 = 1
19const TT_BLOWUP: i64 = 2
20const TT_RARE: i64 = 3
21const TT_PLATEAU: i64 = 4
22const TT_UNDIAG: i64 = 5
23const TT_BROKEN: i64 = 6
24const TT_MAXCLS: i64 = 16
25const TT_MAXLOSS: i64 = 512

functions

27func tt_w(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 }
28func tt_wn(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);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 }
30func tt_match(b: *u8, i: i64, n: i64, lit: *u8) -> i64
39func tt_keynum(b: *u8, ls: i64, le: i64, key: *u8) -> i64
called by 1: tt_read calls 1: tt_match
61func tt_read(path: *u8, out: *i64) -> i64
108func tt_diagnose(path: *u8) -> i64
called by 3: mainttg_rowmain calls 2: sys_mmaptt_read
164func tt_name(id: i64) -> *u8
called by 3: mainttg_rowmain
173func tt_fix(id: i64) -> *u8
called by 2: mainmain