code wiki / _hdl_build / nx_llm_gap_registry_test.nx
nx_llm_gap_registry_test.nx source
↩ module page · 54 lines · 4180 B
1// nx_llm_gap_registry_test.nx -- the team records WHERE it needs an LLM (this session's real gaps),
2// the Council flags only the genuine ones, resolved gaps drop out, and a candidate custom LLM is
3// tested against the OPEN gaps -> the residue is exactly what our own LLM must beat. Exit 0 if honest.
4// license_tier: ORIGINAL
5
6import "nx_llm_gap_registry.nx"
7import "nx_syscalls.nx"
8
9func gt_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
10func gt_num(v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m; sys_write(1,"-" as *u8,1)}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48;k=1}; while m>0 {t[k]=48+(m%10); m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(1, bb, k); return 0 }
11
12func main() -> i64 {
13 gt_puts("=== LLM-GAP REGISTRY: mark where the team needs an LLM -> the custom-LLM test suite ===\n" as *u8)
14 // this session's real gaps. mech = mechanizable in NishiLang? cap = team already has a capability?
15 let n: i64 = 6
16 let mech: *i64 = sys_mmap(8*8) as *i64; let cap: *i64 = sys_mmap(8*8) as *i64
17 // g0 fetch g1 extract g2 prose g3 novel-module g4 bit-allocation g5 codebook
18 mech[0]=0; cap[0]=1 // web fetch -> RESOLVED: team owns nx_browse_text (sovereign HTTP, proven live) + library mirror for bot-blocked sites
19 mech[1]=0; cap[1]=0 // SEMANTIC prose->nuanced claims -> still LLM (structured/numeric fact extract is team-owned, resolved separately)
20 mech[2]=0; cap[2]=0 // paper prose -> LLM
21 mech[3]=0; cap[3]=0 // novel module/algorithm authoring -> LLM (Claude wrote the TCQ scaffolding)
22 mech[4]=0; cap[4]=1 // bit-allocation: NOT mechanizable by hand, but RESOLVED by Builder synthesis
23 mech[5]=0; cap[5]=1 // codebook: RESOLVED by Lloyd search
24
25 let status: *i64 = sys_mmap(8*8) as *i64
26 var i: i64 = 0; while i < n { status[i] = lg_status(cap[i]); i = i + 1 }
27 let open: i64 = lg_open_count(n, status)
28 gt_puts(" Council flags (1=needs LLM):" as *u8); i = 0; while i < n { gt_puts(" " as *u8); gt_num(lg_council_flag(mech[i], cap[i])); i = i + 1 }
29 gt_puts("\n OPEN LLM-gaps = " as *u8); gt_num(open); gt_puts(" (semantic-extract/prose/novel-module) RESOLVED-by-team = " as *u8); gt_num(n - open); gt_puts(" (FETCH now proven/allocation/codebook)\n" as *u8)
30
31 // test a candidate CUSTOM LLM against the open gaps (required S-class measure per gap)
32 let cand: *i64 = sys_mmap(8*8) as *i64; let req: *i64 = sys_mmap(8*8) as *i64
33 cand[0]=850; req[0]=700 // fetch: pass
34 cand[1]=780; req[1]=700 // extract: pass
35 cand[2]=900; req[2]=700 // prose: pass
36 cand[3]=600; req[3]=750 // novel-module: FAIL (600<750)
37 cand[4]=0; req[4]=0; cand[5]=0; req[5]=0 // resolved -> not tested
38 let ready: i64 = lg_custom_ready(n, status, cand, req)
39 let unmet: i64 = lg_first_unmet(n, status, cand, req)
40 gt_puts(" custom-LLM candidate -> ready=" as *u8); gt_num(ready); gt_puts(" first-unmet-gap=#" as *u8); gt_num(unmet); gt_puts(" (novel-module authoring -- where our LLM must reach 750)\n" as *u8)
41
42 let r: *i64 = sys_mmap(8*8) as *i64
43 r[0] = 0; if lg_council_flag(0,0) == 1 { if lg_council_flag(0,1) == 0 { if lg_council_flag(1,0) == 0 { r[0] = 1 } } } // flag only genuine gaps
44 r[1] = 0; if open == 3 { r[1] = 1 } // 3 open = the test suite (fetch closed)
45 r[2] = 0; if ready == 0 { if unmet == 3 { r[2] = 1 } } // candidate not ready; novel-module is the gap
46 // a fully-capable candidate (passes novel-module too) -> ready
47 cand[3] = 800
48 r[3] = 0; if lg_custom_ready(n, status, cand, req) == 1 { r[3] = 1 }
49 var pass: i64 = 0; var j: i64 = 0
50 while j < 4 { pass = pass + r[j]; j = j + 1 }
51 gt_puts("----\n passed " as *u8); gt_num(pass); gt_puts("/4\n" as *u8)
52 if pass == 4 { gt_puts(" GAP MARKED + TESTABLE: the team knows exactly where it needs an LLM; the open gaps are the measurable test suite our own LLM must beat to retire Claude.\n" as *u8); sys_exit(0); return 0 }
53 gt_puts(" FAIL\n" as *u8); sys_exit(1); return 1
54}