code wiki / _hdl_build / nx_pm_rank_races.nx
nx_pm_rank_races.nx source
↩ module page · 58 lines · 3906 B
1// nx_pm_rank_races.nx -- the PM ranks Claude's three recommended EXCEED-RACES through the team's
2// OWN decision machinery (nx_pm_decision_matrix: MCDA cost-of-delay -> WSJF -> confidence ->
3// readiness gate). Claude RECOMMENDS; the matrix DECIDES; the pick is logged to the plan.
4// Candidates (from the 2026-06-09 maturity feedback): R1 S6 synth-bench (team-vs-Claude measured),
5// R2 language-quality benchmark suite (research-gated), R3 T4 training race vs external baseline
6// (blocked on T6 remainder). Weights follow the win-win-win law (user-weighted).
7// license_tier: ORIGINAL
8import "nx_pm_decision_matrix.nx"
9import "nx_itoa_lib.nx" // shared MSB-first emitter (zero-alloc)
10import "nx_syscalls.nx"
11func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
12// MIGRATED to the shared emitter (debt 1785563586). The old body mmapped a scratch buffer
13// per call and never freed it. At PAGE granularity that is 4096B leaked PER CALL -- the
14// defect that took 28.5GB of a 36GB host in nx_ts_lumadiff (2MB input, ~3.66M calls).
15// nxi_* is MSB-first, allocates NOTHING, and emits identical bytes including the sign.
16func _pn(v: i64) -> i64 { nxi_out(v); return 0 }
17func _fp(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 }
18// MIGRATED to the shared emitter (debt 1785563586). The old body mmapped a scratch buffer
19// per call and never freed it. At PAGE granularity that is 4096B leaked PER CALL -- the
20// defect that took 28.5GB of a 36GB host in nx_ts_lumadiff (2MB input, ~3.66M calls).
21// nxi_* is MSB-first, allocates NOTHING, and emits identical bytes including the sign.
22func _fn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
23func main() -> i64 {
24 _p("=== PM ranks the three EXCEED-RACES (Claude recommends; the matrix decides) ===\n" as *u8)
25 // weights: user-first per win-win-win (hw 2, sw 3, user 4, time 2)
26 let scores: *i64 = sys_mmap(64) as *i64
27 let ready: *i64 = sys_mmap(64) as *i64
28 let picked: *i64 = sys_mmap(64) as *i64
29 // R1 S6 synth-bench: hw2 sw9 user8 time8, effort 2, confidence 900, deps MET (engines gated)
30 scores[0] = dm_confidence_adjust(dm_wsjf(dm_cost_of_delay(2, 9, 8, 8, 2, 3, 4, 2), 2), 900)
31 ready[0] = dm_ready(1)
32 // R2 language benchmark: hw5 sw7 user6 time5, effort 6, confidence 600, deps NOT met (Researcher sourcing first)
33 scores[1] = dm_confidence_adjust(dm_wsjf(dm_cost_of_delay(5, 7, 6, 5, 2, 3, 4, 2), 6), 600)
34 ready[1] = dm_ready(0)
35 // R3 T4 training race: hw6 sw8 user7 time6, effort 5, confidence 700, deps NOT met (T6 remainder)
36 scores[2] = dm_confidence_adjust(dm_wsjf(dm_cost_of_delay(6, 8, 7, 6, 2, 3, 4, 2), 5), 700)
37 ready[2] = dm_ready(0)
38 picked[0] = 0
39 picked[1] = 0
40 picked[2] = 0
41 _p(" R1 S6-synth-bench score=" as *u8); _pn(scores[0]); _p(" ready=" as *u8); _pn(ready[0]); _p("\n" as *u8)
42 _p(" R2 language-bench score=" as *u8); _pn(scores[1]); _p(" ready=" as *u8); _pn(ready[1]); _p(" (Researcher sourcing first)\n" as *u8)
43 _p(" R3 T4-training-race score=" as *u8); _pn(scores[2]); _p(" ready=" as *u8); _pn(ready[2]); _p(" (T6 remainder first)\n" as *u8)
44 let pick: i64 = dm_next_pick(scores, picked, ready, 3)
45 _p(" MATRIX PICK = R" as *u8); _pn(pick + 1); _p("\n" as *u8)
46 let fd: i64 = sys_openat_append("/tmp/nishi_pm_plan.log" as *u8, 0x1a4)
47 if fd >= 0 {
48 _fp(fd, "PMLOG kind=RACE-RANK source=claude-recommendation pick=R" as *u8); _fn(fd, pick + 1)
49 _fp(fd, " s1=" as *u8); _fn(fd, scores[0])
50 _fp(fd, " s2=" as *u8); _fn(fd, scores[1])
51 _fp(fd, " s3=" as *u8); _fn(fd, scores[2])
52 _fp(fd, " :: R1=S6-synth-bench R2=language-bench(research-gated) R3=T4-training-race(T6-gated); weights user-first 2/3/4/2\n" as *u8)
53 sys_close(fd)
54 }
55 if pick == 0 { sys_exit(0) }
56 sys_exit(0)
57 return 0
58}