code wiki / _hdl_build / nx_train_triage_register.nx
nx_train_triage_register.nx source
↩ module page · 39 lines · 3049 B
1// nx_train_triage_register.nx -- registers the training-triage organ through the Librarian.
2// ENGINEER evidence = the 7-row triage gate re-run RIGHT HERE; refuses unless it exits 0.
3// license_tier: ORIGINAL
4import "nx_cap_register.nx"
5import "nx_capreg_librarian.nx"
6import "nx_syscalls.nx"
7
8func ttr_run(path: *u8) -> i64 {
9 let pid: i64 = sys_fork()
10 if pid == 0 {
11 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4)
12 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) }
13 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0
14 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0
15 sys_execve(path, argv, envp); sys_exit(127)
16 }
17 let st: *i64 = sys_mmap(16) as *i64
18 sys_wait4(pid, st, 0)
19 return st[0]
20}
21
22func main() -> i64 {
23 var allok: i64 = 1
24 if ttr_run("/tmp/nx_train_triage_gate.sov.elf" as *u8) != 0 { allok = 0 }
25 cr_w(1, "ENGINEER: train-triage gate (5 real-failure KATs + live + tamper) pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8)
26 let eng: i64 = ig_engineer(1, 1, 1, allok)
27 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
28 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
29 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
30 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8
31 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8
32 let idx: i64 = cl_next_idx(lp, jp)
33 let ok: i64 = cl_register_dual(lp, jp, idx, 5,
34 2, "GEN TRAIN-TRIAGE ORGAN (the Doctor's training-dynamics diagnosis -- the team handles what Claude diagnosed BY HAND during T4, operator: 'keep building the teams capabilities to handle your callouts'). nx_train_triage (library) + nx_train_triage_cli (front door, durable train_triage.log) + nx_train_triage_gate: reads machine-readable training reports (TRIAGE-CLASS/PRED/ACC/LOSS rows, emitted by training lanes) and NAMES the failure + the gate-proven fix, mechanically, pure integer math on micro-loss values. Verdicts: MAJORITY-COLLAPSE -> full-batch-grad-accumulation; POST-CONVERGENCE-BLOWUP -> early-stop-at-convergence; RARE-CLASS-LOSS -> inverse-freq-class-weights; PLATEAU -> center-features-then-capacity-then-optimizer; CONVERGED-HEALTHY; UNDIAGNOSED (honest fallback: name it, add its KAT); BROKEN-REPORT (loud, exit 2). GATE 7/7: five KATs whose numbers are the ACTUAL measured failed runs from the T4 session (collapse 88/149, rare 142/149 util+mon, blowup 0-micro-then-224, plateau 44-milli-frozen, healthy 149/149) + LIVE row (T4b's real emitted report -> CONVERGED-HEALTHY) + TAMPER row (ACC/LOSS-less report -> BROKEN). Blessed _offc/nx_train_triage_{cli,gate}.elf. NEXT WIRING: every training lane emits TRIAGE rows; triage row joins the Conductor pulse" as *u8)
35 if ok != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) }
36 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED via Librarian alloc+dual-write (train-triage organ)\n" as *u8)
37 sys_exit(0)
38 return 0
39}