code wiki / _hdl_build / nx_backlog_pattern_register.nx

nx_backlog_pattern_register.nx source

↩ module page · 47 lines · 3165 B

1// nx_backlog_pattern_register.nx -- GOVERNED registration of the Researcher's topic backlog + 2// the Builder's pattern library. Each gated on a REAL re-run of its test ELF. license_tier: ORIGINAL 3import "nx_cap_register.nx" 4import "nx_syscalls.nx" 5 6const NLAY: i64 = 6 7 8func bpr_run(path: *u8) -> i64 { 9 let pid: i64 = sys_fork() 10 if pid == 0 { 11 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 12 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 13 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 14 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 15 sys_execve(path, argv, envp); sys_exit(127) 16 } 17 let st: *i64 = sys_mmap(16) as *i64 18 sys_wait4(pid, st, 0) 19 return st[0] 20} 21 22func bpr_reg(elf: *u8, idx: i64, layer: i64, name: *u8) -> i64 { 23 let probe: i64 = sys_openat_rd(elf) 24 var present: i64 = 0 25 if probe >= 0 { present = 1; sys_close(probe) } 26 let raw: i64 = bpr_run(elf) 27 var rns: i64 = 0; if (raw % 128) == 0 { rns = 1 } 28 var ok: i64 = 0; if raw == 0 { ok = 1 } 29 let eng: i64 = ig_engineer(present, present, rns, ok) 30 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 31 cr_w(1, " gate raw=" as *u8); cr_wn(1, raw); cr_w(1, " decision=" as *u8); cr_wn(1, dec); cr_w(1, "\n" as *u8) 32 if dec != IG_INGEST { return 0 } 33 if cr_can_register(layer, 2, NLAY, dec) != 1 { return 0 } 34 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 35 cr_write_entry(fd, idx, layer, name, 2); sys_close(fd) 36 cr_w(1, " CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED\n" as *u8) 37 return 1 38} 39 40func main() -> i64 { 41 bpr_reg("/tmp/nx_research_backlog_test.sov.elf" as *u8, 229, 3, 42 "VER RESEARCH-BACKLOG (RESEARCHER's verb) -- the Researcher is given a backlog of topics/terms to GROW the Nishi library, worked smarter than FIFO: prioritized by COVERAGE GAP (rb_gap_score = priority x under-coverage) so the team researches where the library is THINNEST first = comprehensive coverage. rb_next picks highest-gap PENDING topic -> research (autonomous loop + polite crawl + corroborate + site-ingest) -> rb_mark_done raises its coverage; rb_library_coverage_permil = the comprehensiveness the Researcher drives UP. Seeded backlog: knowledge/library/research_backlog.txt. 5/5 KATs") 43 bpr_reg("/tmp/nx_pattern_library_test.sov.elf" as *u8, 230, 5, 44 "SELF PATTERN-LIBRARY (BUILDER's verb=AUTHOR) -- 'get the builders pattern library truly s class exceed comprehensive'. Catalogs the 10 recurring module SHAPES (VERDICT_GATE/PARSER_KAT/COMPARATOR/THRESHOLD_TABLE/ACCUMULATOR/GOVERNOR/STATE_FLOW/SCAFFOLD/GEOMETRY/PID_LOOP) derived from the session's REAL modules so the Builder authors the CORE itself, not just boilerplate. pl_covered/pl_match feed bp_core_autonomous -> every covered shape drops bp_claude_touch toward 0. pl_coverage_permil = comprehensiveness (PROVEN 1000 over the session's 10 shapes; honest 750 on a novel-mixed batch = below the 800 floor -> still needs Claude). Wires the autonomy metric (nx_build_pipeline) to actual coverage. 5/5 KATs") 45 sys_exit(0) 46 return 0 47}