code wiki / _hdl_build / nx_team_train.nx
nx_team_train.nx source
↩ module page · 78 lines · 7560 B
1// nx_team_train.nx -- the CONSTANT team-training capability (operator: "constantly training our team to be
2// growing to your capabilities ... engineer doctor adversarial whatever ... be able to do it and even improve").
3// Claude is the TUTOR (not the doer); this turns "how Claude did it" into a GROUNDED, per-ROLE curriculum the
4// TEAM runs to grow toward -- and past -- Claude. Design = the PROVEN nx_cap_gap_sov ladder pattern (build-status
5// DERIVED from real organ existence, neg-controlled, frontier + next + RACI) EXTENDED from LLM-rungs to METHODS:
6// * each method is tied to a REAL demonstrating organ (the team studies that organ to learn the method)
7// * a fresh Claude reference (fresh=1) is OWNED once the team REPRODUCES it -- its own organ for that method
8// exists on disk (repro). An established team method (fresh=0) is owned when its organ exists. => the
9// frontier CLIMBS as the team builds reproductions = the loop closing, grounded (un-fakeable).
10// * a measured IMPROVEMENT over the reference is detectable = the team EXCEEDING the tutor (no-wave doctrine)
11// Roles: engineer / doctor / adversarial / researcher. Sovereign. license_tier: ORIGINAL
12import "nx_syscalls.nx"
13
14const TT_ENG: i64 = 0
15const TT_DOC: i64 = 1
16const TT_ADV: i64 = 2
17const TT_RES: i64 = 3
18
19func tt_role_name(r: i64) -> *u8 {
20 if r == 0 { return "ENGINEER" as *u8 }
21 if r == 1 { return "DOCTOR" as *u8 }
22 if r == 2 { return "ADVERSARIAL" as *u8 }
23 return "RESEARCHER" as *u8
24}
25
26// GROUNDED existence: is the named organ a real file? (runtime/_hdl_build/ then runtime/). "-" = none.
27// This is what makes the curriculum un-fakeable -- a method counts only if a real organ demonstrates it.
28func tt_organ_exists(name: *u8) -> i64 {
29 if name[0] == (45 as u8) { if name[1] == (0 as u8) { return 0 } } // "-"
30 let p: *u8 = sys_mmap(512)
31 var o: i64 = 0; var i: i64 = 0
32 let a: *u8 = "runtime/_hdl_build/" as *u8
33 while a[i] != (0 as u8) { p[o] = a[i]; o = o + 1; i = i + 1 }
34 i = 0; while name[i] != (0 as u8) { p[o] = name[i]; o = o + 1; i = i + 1 } p[o] = 0 as u8
35 let fd1: i64 = sys_openat_rd(p); if fd1 >= 0 { sys_close(fd1); return 1 }
36 o = 0; i = 0; let b: *u8 = "runtime/" as *u8
37 while b[i] != (0 as u8) { p[o] = b[i]; o = o + 1; i = i + 1 }
38 i = 0; while name[i] != (0 as u8) { p[o] = name[i]; o = o + 1; i = i + 1 } p[o] = 0 as u8
39 let fd2: i64 = sys_openat_rd(p); if fd2 >= 0 { sys_close(fd2); return 1 }
40 return 0
41}
42
43// THE CURRICULUM: fills parallel arrays (role, method-label, demonstrating-organ, fresh, repro-organ). Returns N.
44// fresh=1 -> a method newly demonstrated THIS session; the team OWNS it once its REPRODUCTION organ (repro) exists.
45// fresh=0 -> a method the team already embodies in its own organ. repro "-" = no reproduction target wired yet.
46func tt_load(roles: *i64, methods: *i64, organs: *i64, fresh: *i64, repro: *i64) -> i64 {
47 var k: i64 = 0
48 roles[k]=TT_ENG; methods[k]="find-existing-first: query the cap-guard BEFORE authoring (no duplicates)" as *u8 as i64; organs[k]="nx_cap_exists.nx" as *u8 as i64; fresh[k]=1; repro[k]="nx_eng_repro_findfirst_gate.nx" as *u8 as i64; k=k+1
49 roles[k]=TT_ENG; methods[k]="extend-not-copy (rule15): import the base capability + raise the bar" as *u8 as i64; organs[k]="nx_engineer_wire_sclass.nx" as *u8 as i64; fresh[k]=1; repro[k]="nx_eng_repro_extend_gate.nx" as *u8 as i64; k=k+1
50 roles[k]=TT_ENG; methods[k]="gate-with-liar-kill: the verdict must FLIP when the data is corrupted" as *u8 as i64; organs[k]="nx_engineer_wire_sclass_gate.nx" as *u8 as i64; fresh[k]=1; repro[k]="nx_eng_repro_liarkill_gate.nx" as *u8 as i64; k=k+1
51 roles[k]=TT_ENG; methods[k]="measured-exceed: report the MARGIN, never a binary win-claim (no wave)" as *u8 as i64; organs[k]="nx_engineer_wire_sclass.nx" as *u8 as i64; fresh[k]=1; repro[k]="nx_eng_repro_measure_gate.nx" as *u8 as i64; k=k+1
52 roles[k]=TT_ENG; methods[k]="never-brick(#26): the safety bar dominates even a great margin" as *u8 as i64; organs[k]="nx_engineer_wire_sclass.nx" as *u8 as i64; fresh[k]=1; repro[k]="nx_eng_repro_neverbrick_gate.nx" as *u8 as i64; k=k+1
53 roles[k]=TT_DOC; methods[k]="neg-control teeth: a fake input must FAIL the check" as *u8 as i64; organs[k]="nx_cap_gap_sov.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
54 roles[k]=TT_DOC; methods[k]="apply a VERIFIED fix: close the loop on real health, not a flag flip" as *u8 as i64; organs[k]="nx_doctor_apply.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
55 roles[k]=TT_DOC; methods[k]="runtime-grounded verify: read the run-log, not the claim" as *u8 as i64; organs[k]="nx_nofloat_audit.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
56 roles[k]=TT_ADV; methods[k]="held-out / anti-memorization: catch 'learned' on fixed sequences" as *u8 as i64; organs[k]="nx_nofloat_adversary.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
57 roles[k]=TT_ADV; methods[k]="log-discipline: no unconditional GREEN print" as *u8 as i64; organs[k]="nx_nofloat_adversary.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
58 roles[k]=TT_ADV; methods[k]="asterisk-discipline: every EXCEED carries the minority-path caveat" as *u8 as i64; organs[k]="nx_nofloat_adversary.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
59 roles[k]=TT_ADV; methods[k]="independent review panel + stars (critic council)" as *u8 as i64; organs[k]="nx_critics_review.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
60 roles[k]=TT_RES; methods[k]="CID-cited findings from the sovereign corpus (no hand-driving)" as *u8 as i64; organs[k]="nx_research_deliver.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
61 roles[k]=TT_RES; methods[k]="benchmarks-exist-separate: durable refs, no hallucinated numbers" as *u8 as i64; organs[k]="nx_benchmark_ref.nx" as *u8 as i64; fresh[k]=0; repro[k]="-" as *u8 as i64; k=k+1
62 return k
63}
64
65// OWNED: an established method (fresh=0) once its organ exists; a fresh method (fresh=1) once the team's
66// REPRODUCTION organ exists. This is the frontier that CLIMBS as the team builds its own organs.
67func tt_owned(organs: *i64, fresh: *i64, repro: *i64, k: i64) -> i64 {
68 if fresh[k] == 0 { return tt_organ_exists(organs[k] as *u8) }
69 return tt_organ_exists(repro[k] as *u8)
70}
71func tt_role_total(n: i64, roles: *i64, role: i64) -> i64 { var c: i64=0; var k: i64=0; while k<n { if roles[k]==role { c=c+1 } k=k+1 } return c }
72func tt_role_owned(n: i64, roles: *i64, organs: *i64, fresh: *i64, repro: *i64, role: i64) -> i64 { var c: i64=0; var k: i64=0; while k<n { if roles[k]==role { if tt_owned(organs,fresh,repro,k)==1 { c=c+1 } } k=k+1 } return c }
73// the NEXT method to train for a role = first fresh method NOT yet owned (reproduced). -1 = role fully trained.
74func tt_next(n: i64, roles: *i64, organs: *i64, fresh: *i64, repro: *i64, role: i64) -> i64 { var k: i64=0; while k<n { if roles[k]==role { if fresh[k]==1 { if tt_owned(organs,fresh,repro,k)==0 { return k } } } k=k+1 } return 0-1 }
75// every curriculum organ resolves to a real file? (grounding has no holes).
76func tt_all_grounded(n: i64, organs: *i64) -> i64 { var k: i64=0; while k<n { if tt_organ_exists(organs[k] as *u8)==0 { return 0 } k=k+1 } return 1 }
77// measured IMPROVEMENT over the reference: the team EXCEEDS the tutor only with a positive margin gain.
78func tt_improved(ref_margin: i64, team_margin: i64) -> i64 { if team_margin > ref_margin { return 1 } return 0 }