code wiki / _hdl_build / nx_build_pipeline.nx

nx_build_pipeline.nx source

↩ module page · 63 lines · 4529 B

1// nx_build_pipeline.nx -- the WARDEN orchestrates the team building a capability end-to-end through the 2// CLEAN RACI (operator: "keep building our teams capabilities" + the standing rule that each role owns 3// its verb). One assignment flows: PM assigns -> BUILDER scaffolds -> [CORE] -> ENGINEER verifies -> on 4// fail DOCTOR heals -> ENGINEER re-verifies -> COUNCIL admits -> LIBRARIAN registers. The Warden only 5// ROUTES (it never tests or heals itself -- separation of duties via nx_build_raci). The [CORE] step is 6// the one honest gap: if the assignment's core matches a known PATTERN the team authors it autonomously 7// (bp_claude_touch=0); if it's NOVEL, the pipeline FLAGS needs-tutor (bp_claude_touch=1) -- the path to 8// full autonomy is growing the pattern library so that flag goes to 0. We MEASURE the dependency, not 9// hide it. Composes nx_build_raci (separation + decide) + nx_role_audit. LAWS: struct-free, integer-only. 10// license_tier: ORIGINAL 11import "nx_build_raci.nx" 12import "nx_syscalls.nx" 13 14// pipeline stages (the furthest a capability reached) 15const BP_ASSIGNED: i64 = 1 // PM produced a grounded assignment 16const BP_SCAFFOLDED: i64 = 2 // Builder authored the module/test/register skeleton 17const BP_NEEDS_TUTOR: i64 = 3 // CORE is novel -> Claude tutors (the flagged LLM-gap; team can't yet) 18const BP_VERIFIED: i64 = 4 // Engineer's gate passed 19const BP_HEALED: i64 = 5 // Doctor healed a failed build; re-verify next 20const BP_ADMITTED: i64 = 6 // Council admitted + Librarian registered = DONE, team-owned 21const BP_REJECTED: i64 = 7 // failed + heal budget exhausted -> rejected (never false-admit) 22const BP_RACI_BAD: i64 = 0 // role partition violated -> pipeline invalid 23 24// is the assignment's CORE covered by a known pattern the team can author itself? 25// pattern_id > 0 = a registered build pattern (verdict-gate, parser+KAT, comparator, ...); 0 = novel. 26func bp_core_autonomous(pattern_id: i64) -> i64 { if pattern_id > 0 { return 1 } return 0 } 27 28// did Claude have to touch this build? (1 iff the core was novel = not pattern-covered). The autonomy metric. 29func bp_claude_touch(pattern_id: i64) -> i64 { if bp_core_autonomous(pattern_id) == 1 { return 0 } return 1 } 30 31// run one assignment through the pipeline. grounded=PM assignment grounded in evidence (no thin-air); 32// pattern_id=core pattern (0=novel); test_pass after build; heals_used/budget bound the Doctor. 33// Returns the final stage. The Warden's routing is RACI-checked every step (separation enforced). 34func bp_run(grounded: i64, pattern_id: i64, author_role: i64, tester_role: i64, healer_role: i64, 35 admitter_accountable_count: i64, test_pass: i64, heals_used: i64, heal_budget: i64) -> i64 { 36 // PM gate: never build from an ungrounded assignment (the no-thin-air cardinal) 37 if grounded != 1 { return BP_REJECTED } 38 // the RACI must be clean for the Warden to route at all (author!=tester!=healer, right roles, 1 accountable) 39 let decide: i64 = br_decide(author_role, tester_role, healer_role, admitter_accountable_count, test_pass, heals_used, heal_budget) 40 if decide == BR_FLOW_RACI_BAD { return BP_RACI_BAD } 41 // CORE step: novel core -> the pipeline reaches NEEDS_TUTOR and pauses for Claude (honest gap) 42 if bp_core_autonomous(pattern_id) == 0 { return BP_NEEDS_TUTOR } 43 // pattern-covered core: the team authored it; now the RACI decision drives the rest 44 if decide == BR_FLOW_ADMIT { return BP_ADMITTED } 45 if decide == BR_FLOW_HEAL { return BP_HEALED } 46 return BP_REJECTED 47} 48 49// after the Doctor heals, the Engineer RE-verifies: this resolves a HEALED build to ADMITTED or REJECTED. 50func bp_after_heal(grounded: i64, pattern_id: i64, author_role: i64, tester_role: i64, healer_role: i64, 51 admitter_accountable_count: i64, retest_pass: i64, heals_used: i64, heal_budget: i64) -> i64 { 52 return bp_run(grounded, pattern_id, author_role, tester_role, healer_role, admitter_accountable_count, retest_pass, heals_used, heal_budget) 53} 54 55// AUTONOMY of the team over a batch of assignments: fraction (per-mil) that completed WITHOUT a Claude 56// touch (pattern-covered core). Drives toward 1000 as the pattern library grows. honest self-knowledge. 57func bp_autonomy_permil(pattern_ids: *i64, n: i64) -> i64 { 58 if n <= 0 { return 0 } 59 var autonomous: i64 = 0 60 var i: i64 = 0 61 while i < n { if bp_core_autonomous(pattern_ids[i]) == 1 { autonomous = autonomous + 1 } i = i + 1 } 62 return autonomous * 1000 / n 63}