code wiki / _hdl_build / nx_librarian_pipeline_test.nx
nx_librarian_pipeline_test.nx source
↩ module page · 44 lines · 3019 B
1// nx_librarian_pipeline_test.nx -- the LIBRARIAN validates the ingested deep-research: both
2// artifacts must be fully REFINED (all 5 stages: unstructured->structured->meaningful->
3// actionable->reproducible) and CITED. Proves the investment is saved AS reusable, graded,
4// team-actionable knowledge -- not raw text thrown away. Run from the repo root. Exit 0 if all hold.
5// license_tier: ORIGINAL
6
7import "nx_librarian_pipeline.nx"
8import "nx_syscalls.nx"
9
10func pt_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
11func pt_num(v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m}; 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 }
12
13func pt_report(path: *u8) -> i64 {
14 let mat: i64 = lib_maturity(path)
15 pt_puts(" artifact maturity " as *u8); pt_num(mat); pt_puts("/5 actionable=" as *u8); pt_num(lib_is_actionable(path))
16 pt_puts(" reproducible=" as *u8); pt_num(lib_is_reproducible(path)); pt_puts(" cited=" as *u8); pt_num(lib_is_cited(path)); pt_puts("\n" as *u8)
17 return mat
18}
19
20func main() -> i64 {
21 pt_puts("=== LIBRARIAN: grade the ingested deep-research (unstructured->...->reproducible) ===\n" as *u8)
22 let a: *u8 = "knowledge/research/2026-06-04-vram-bottleneck.md" as *u8
23 let b: *u8 = "knowledge/research/2026-06-04-shared-llm-backbone.md" as *u8
24 let c: *u8 = "knowledge/research/2026-06-04-historic-resource-constrained.md" as *u8
25 let d: *u8 = "knowledge/research/2026-06-04-model-switching-timesync.md" as *u8
26 let e: *u8 = "knowledge/research/2026-06-04-image-precision-lossless-language.md" as *u8
27 pt_puts(" [vram] " as *u8); let ma: i64 = pt_report(a)
28 pt_puts(" [backbone] " as *u8); let mb: i64 = pt_report(b)
29 pt_puts(" [historic] " as *u8); let mc: i64 = pt_report(c)
30 pt_puts(" [switching]" as *u8); let md: i64 = pt_report(d)
31 pt_puts(" [precision]" as *u8); let me: i64 = pt_report(e)
32
33 let r: *i64 = sys_mmap(8*8) as *i64
34 r[0] = 0; if ma == 5 { if mb == 5 { if mc == 5 { r[0] = 1 } } } // first three refined
35 r[1] = 0; if md == 5 { if me == 5 { r[1] = 1 } } // two new refined
36 r[2] = 0; if lib_is_actionable(d) == 1 { if lib_is_actionable(e) == 1 { r[2] = 1 } }
37 r[3] = 0; if lib_is_reproducible(d) == 1 { if lib_is_reproducible(e) == 1 { r[3] = 1 } }
38 r[4] = 0; if lib_is_cited(d) == 1 { if lib_is_cited(e) == 1 { r[4] = 1 } }
39 var pass: i64 = 0; var i: i64 = 0
40 while i < 5 { pass = pass + r[i]; i = i + 1 }
41 pt_puts("----\n passed " as *u8); pt_num(pass); pt_puts("/5\n" as *u8)
42 if pass == 5 { pt_puts(" INGESTED + GRADED: 5 deep-research reports saved as reproducible, actionable, cited team knowledge.\n" as *u8); sys_exit(0); return 0 }
43 pt_puts(" FAIL (some research not fully refined -- raw text, investment at risk)\n" as *u8); sys_exit(1); return 1
44}