code wiki / _hdl_build / nx_teacher_hb.nx

nx_teacher_hb.nx source

↩ module page · 87 lines · 3969 B

1// nx_teacher.nx -- the NISHI TEACHER / TUTOR organ (operator: "maybe we need a nishi teacher or tutor 2// to partner and gracefully have you hand off what you do as we move towards s class"). The Teacher 3// manages the M0->M4 autonomy ladder PER capability: it decides when the team is ready to take a rung 4// from Claude, advances ONE rung at a time (never a reckless skip), and reports what Claude still owns 5// vs what has been handed off. As the team's grades climb, Claude's load shrinks toward zero -- the 6// whole point of the seed/spore north star. RACI: the Teacher partners with Claude (the tutor) and the 7// Examiner (the grader); it does not grade or build, it sequences the handoff. license_tier: ORIGINAL 8// 9// M0 Claude does it; team cannot M3 team does it autonomously; Claude spot-checks 10// M1 Claude does it; team observes/learns M4 team fully owns it; Claude handed off 11// M2 team does it; Claude verifies 12 13import "nx_syscalls.nx" 14 15const TCH_M0: i64 = 0 16const TCH_M1: i64 = 1 17const TCH_M2: i64 = 2 18const TCH_M3: i64 = 3 19const TCH_M4: i64 = 4 20 21// Claude is still ACTIVELY doing the work at M0/M1 (team only watches). 22func tch_claude_owns(level: i64) -> i64 { if level <= TCH_M1 { return 1 } return 0 } 23 24// ready to advance a rung iff the team's grade clears the bar AND nothing regressed. 25func tch_can_advance(team_grade: i64, threshold: i64, regressed: i64) -> i64 { 26 if regressed == 1 { return 0 } 27 if team_grade >= threshold { return 1 } 28 return 0 29} 30 31// advance EXACTLY ONE rung (graceful, capped at M4) when ready; otherwise hold. 32func tch_next_level(current: i64, team_grade: i64, threshold: i64, regressed: i64) -> i64 { 33 if current >= TCH_M4 { return TCH_M4 } 34 if tch_can_advance(team_grade, threshold, regressed) == 1 { return current + 1 } 35 return current 36} 37 38// capabilities fully handed off (M4) -- the "Claude needed less" metric. 39func tch_handed_off(levels: *i64, n: i64) -> i64 { 40 var c: i64 = 0; var i: i64 = 0 41 while i < n { if levels[i] == TCH_M4 { c = c + 1 } i = i + 1 } 42 return c 43} 44 45// capabilities Claude still owns (M0/M1) -- should track the open LLM-gaps. 46func tch_claude_load(levels: *i64, n: i64) -> i64 { 47 var c: i64 = 0; var i: i64 = 0 48 while i < n { if tch_claude_owns(levels[i]) == 1 { c = c + 1 } i = i + 1 } 49 return c 50} 51 52// handoff progress in permil = fraction fully owned by the team. 53func tch_progress_permil(levels: *i64, n: i64) -> i64 { 54 if n <= 0 { return 0 } 55 return (tch_handed_off(levels, n) * 1000) / n 56} 57 58// the next capability to tutor toward handoff = highest-grade one NOT yet at M4 (closest to ready). 59func tch_next_target(levels: *i64, grades: *i64, n: i64) -> i64 { 60 var best: i64 = 0 - 1; var bestgrade: i64 = 0 - 1; var i: i64 = 0 61 while i < n { 62 if levels[i] < TCH_M4 { if grades[i] > bestgrade { bestgrade = grades[i]; best = i } } 63 i = i + 1 64 } 65 return best 66} 67 68// ===== TEACH THE TEACHER: learn from handoff OUTCOMES (operator: "teach the teacher") ============== 69// A handoff was PREMATURE if, after advancing a rung, the team did NOT sustain it (regressed in use). 70func tch_premature(advanced: i64, sustained: i64) -> i64 { 71 if advanced == 1 { if sustained == 0 { return 1 } } 72 return 0 73} 74 75// on a premature handoff, ROLL BACK one rung (graceful, never below M0); else hold the new rung. 76func tch_rollback(current: i64, advanced: i64, sustained: i64) -> i64 { 77 if tch_premature(advanced, sustained) == 1 { if current > TCH_M0 { return current - 1 } } 78 return current 79} 80 81// LEARN: each premature handoff RAISES the bar (be more conservative next time) by `step`. 82func tch_learned_threshold(base_threshold: i64, premature_count: i64, step: i64) -> i64 { 83 return base_threshold + premature_count * step 84} 85 86// did the Teacher actually get stricter? (the proof it learned) 87func tch_got_stricter(old_threshold: i64, new_threshold: i64) -> i64 { if new_threshold > old_threshold { return 1 } return 0 }