code wiki / (root) / nx_librarian_review.nx

nx_librarian_review.nx

buildroot/runtime/nx_librarian_review.nx

6650 B113 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic librarian
docsdependenciesstructsconstsfunctions

about

nx_librarian_review.nx -- ORCHESTRATION rung 1: the LIBRARIAN auto-reviews the RESEARCHER's ingested material and flags what is "not up to scruff" -- WITHOUT the operator having to ask. This is the first two-teams-in-conjunction workstream (operator 2026-07-10: "the researcher could work with the librarian without me having to be explicit to review our already ingested material and callout to the librarian if its not up to scruff ... true orchestration like an orchestra"). RACI for the REVIEW-INGESTED-MATERIAL workstream (recorded on the seg-store, not asserted): Responsible = librarian (runs the review) Accountable = librarian Consulted = researcher (owns the material) Informed = operator + critic The librarian's quality bar per doc (mechanically checked, integer-only): (1) FOUNDATIONED -- a signed credential exists (knowledge/foundation/cred/<name>.nxpc1). #1 trust gate. (2) SUBSTANTIVE -- byte length >= a data-driven floor (empty/stub docs are not knowledge). (3) NOT-TRUNCATED -- length < the CID read cap (a doc AT the cap was truncated before content-address). A doc failing any -> NOT-UP-TO-SCRUFF, logged + counted, and the handoff record carries the flag count so the researcher (Consulted) is auto-informed to re-fetch/deepen. Read-only over the library; writes only the review log + one seg-store handoff record. Composes nothing it shouldn't (DRY). license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_seg_store.nx nx_librarian_review.nx nx_librarian_review_gate.nx

imports: nx_syscalls.nxnx_seg_store.nx

imported by: nx_librarian_review_gate.nx

structs

none

consts

19const LR_MAGIC_65536: i64 = 65536
21const LR_LIBDIR: *u8 = "knowledge/library"
22const LR_CREDDIR: *u8 = "knowledge/foundation/cred"
23const LR_LOG: *u8 = "knowledge/status/librarian_review.log"
24const LR_STORE: *u8 = "knowledge/store/orchestration-"
25const LR_MINBYTES: i64 = 200 // data-driven substantive floor
26const LR_CIDCAP: i64 = 262143 // the ingest_foundation read cap (>= this => truncated)

functions

28func lr_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: lr_wlr_ends
29func lr_cat(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} dst[o]=0 as u8; return o }
called by 2: lr_onelr_handoff
30func lr_w(fd: i64, s: *u8) -> i64 { sys_write(fd, s, lr_slen(s)); return 0 }
called by 1: lr_one calls 2: sys_writelr_slen
31func lr_wn(fd: i64, v0: i64) -> i64
called by 1: lr_one calls 2: sys_writesys_mmap
37func lr_ends(name: *u8, suf: *u8) -> i64
called by 1: lr_run calls 1: lr_slen
42func lr_fsize(path: *u8) -> i64
46func lr_exists(path: *u8) -> i64
called by 2: lr_onemain calls 2: sys_openat_rdsys_close
52func lr_one(name: *u8, counts: *i64, logfd: i64) -> i64
71func lr_handoff(reviewed: i64, scruff: i64, flagged: i64) -> i64
90func lr_run(counts: *i64) -> i64