code wiki / _hdl_build / nx_session_autonomy_gate.nx
nx_session_autonomy_gate.nx source
↩ module page · 65 lines · 5557 B
1// nx_session_autonomy_gate.nx -- HONEST autonomy self-assessment of this session's build (the doctrine: "MEASURE the
2// dependency, not hide it"). This session shipped ~15 measured-exceed rungs (NHDL H1-H6, logic-opt, the researcher)
3// -- ALL Claude-authored. WHY: each maps to a NEW module-shape the 20-pattern library (nx_pattern_library) does NOT
4// catalog, so every core hit bp_claude_touch=1 (novel -> tutor). This gate proves that honestly using the TEAM'S OWN
5// metrics (bp_autonomy_permil / bp_core_autonomous from nx_build_pipeline; pl_covered from nx_pattern_library) and
6// names the exact EMITTER BACKLOG whose coverage would make future EDA/researcher rungs team-authorable.
7// T1 every rung this session was TUTOR-authored (bp_claude_touch=1) -- honest dependency, not hidden.
8// T2 this session's autonomy = 0 permil (all novel shapes) -- it added measured CAPABILITY, zero AUTONOMY.
9// T3 the 5 new shapes (21-25) are NOT yet covered (pl_covered=0) = the precise backlog to grow the library.
10// T4 NEG-CONTROL: an existing shape (VERDICT_GATE=1) IS covered -> the metric isn't trivially zero (the catalog works).
11// expect_exit: 0 license_tier: ORIGINAL
12import "nx_build_pipeline.nx"
13import "nx_pattern_library.nx"
14import "nx_syscalls.nx"
15
16func rw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
17func rn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
18
19func main() -> i64 {
20 rw("=== nx_session_autonomy: HONEST autonomy self-assessment of this session (measure the dependency) ===\n" as *u8)
21 var pass: i64=0; var total: i64=0
22
23 // this session's rungs mapped to their MODULE-SHAPE ids. The 5 NEW shapes (21-25) are NOT in the 20-pattern
24 // library, so pl_match returns 0 (novel) -> the honest reason every core was tutor-authored.
25 let SH_FABRIC_NETLIST: i64=21 // nx_fpga fabric/ALU/CPU: cells+nets+bitstream, topo-eval
26 let SH_NETLIST_COMPOSE: i64=22 // fab_append/fab_sub_out: concatenate sub-fabrics + net-remap
27 let SH_RTL_SYNTH: i64=23 // nrtl_synth: statements -> per-op fabric builders -> compose
28 let SH_RANK_RETRIEVE: i64=24 // researcher internal arm: TF/BM25 over docs -> ranked hits + provenance
29 let SH_RANK_FUSE: i64=25 // RRF over multiple rankings (internal+external)
30
31 let shapes: *i64=sys_mmap(8*8) as *i64
32 shapes[0]=SH_FABRIC_NETLIST; shapes[1]=SH_NETLIST_COMPOSE; shapes[2]=SH_RTL_SYNTH; shapes[3]=SH_RANK_RETRIEVE; shapes[4]=SH_RANK_FUSE
33 let NS: i64=5
34 // map each shape to a pattern id via the REAL library (0 = novel/uncovered)
35 let pids: *i64=sys_mmap(8*8) as *i64
36 var i: i64=0; while i<NS { pids[i]=pl_match(shapes[i]); i=i+1 }
37
38 // ---- T1: every rung was tutor-authored (bp_claude_touch=1) ----
39 var touched: i64=0; i=0; while i<NS { touched=touched+bp_claude_touch(pids[i]); i=i+1 }
40 total=total+1; if touched==NS { pass=pass+1; rw(" [PASS] " as *u8) } else { rw(" [FAIL] " as *u8) }
41 rw("T1 HONEST DEPENDENCY: " as *u8); rn(touched); rw("/" as *u8); rn(NS); rw(" rungs were TUTOR-authored (bp_claude_touch=1) -- novel shapes, measured not hidden\n" as *u8)
42
43 // ---- T2: this session's autonomy = 0 permil (capability up, autonomy flat) ----
44 let aut: i64=bp_autonomy_permil(pids, NS)
45 total=total+1; if aut==0 { pass=pass+1; rw(" [PASS] " as *u8) } else { rw(" [FAIL] " as *u8) }
46 rw("T2 SESSION AUTONOMY = " as *u8); rn(aut); rw(" permil -- 15+ measured-exceed rungs added CAPABILITY but 0 AUTONOMY (overall meter stays ~329)\n" as *u8)
47
48 // ---- T3: the 5 new shapes are NOT yet covered = the precise emitter backlog ----
49 var uncovered: i64=0; i=0; while i<NS { if pl_covered(shapes[i])==0 { uncovered=uncovered+1 } i=i+1 }
50 total=total+1; if uncovered==NS { pass=pass+1; rw(" [PASS] " as *u8) } else { rw(" [FAIL] " as *u8) }
51 rw("T3 EMITTER BACKLOG: " as *u8); rn(uncovered); rw("/" as *u8); rn(NS); rw(" new shapes uncovered (lib has " as *u8); rn(pl_n_patterns()); rw(") -> these emitters make future EDA/researcher rungs team-authorable\n" as *u8)
52
53 // ---- T4: neg-control -- an existing shape IS covered (the metric isn't trivially zero) ----
54 total=total+1; if pl_covered(PL_VERDICT_GATE)==1 { if bp_core_autonomous(pl_match(PL_VERDICT_GATE))==1 { pass=pass+1; rw(" [PASS] " as *u8) } else { rw(" [FAIL] " as *u8) } } else { rw(" [FAIL] " as *u8) }
55 rw("T4 NEG-CONTROL: an EXISTING shape (VERDICT_GATE) IS covered + autonomous -> the catalog works, the 0 above is real\n" as *u8)
56
57 // ---- the honest backlog (the path to move autonomy off 329) ----
58 rw("\n AUTONOMY BACKLOG (build these emitters so the team authors the NEXT rung, not Claude):\n" as *u8)
59 rw(" 21 FABRIC_NETLIST 22 NETLIST_COMPOSE 23 RTL_SYNTH 24 RANK_RETRIEVE 25 RANK_FUSE\n" as *u8)
60 rw(" (RANK_FUSE is nearest: its core organ nx_rrf is already team-owned -> the emitter just wires it.)\n" as *u8)
61
62 rw("SESSION-AUTONOMY verdict=" as *u8)
63 if pass==total { rw("GREEN passes=" as *u8); rn(pass); rw("/" as *u8); rn(total); rw(" (honest: session=capability+exceed, autonomy unmoved; backlog = 5 emitters, measured via the team's own organs)\n" as *u8); sys_exit(0); return 0 }
64 rw("RED passes=" as *u8); rn(pass); rw("/" as *u8); rn(total); rw("\n" as *u8); sys_exit(1); return 1
65}