code wiki / _hdl_build / nx_library_foundation.nx
nx_library_foundation.nx
buildroot/runtime/_hdl_build/nx_library_foundation.nx
about
nx_library_foundation.nx -- close the foundationing gap: every harvested doc on disk must be FOUNDATIONED
(CID + ed25519 provenance + lineage traced to god) before it counts as library knowledge. Operator law:
"we dont want to ingest non foundationed data -- if we consume we trace + build its lineage properly back to
god." This auto-discovers every knowledge/library/*.txt (getdents64, so the running index grows itself),
and for each: ingest_foundation (cid_of + prov_make[DOWNLOADED] + ed25519 sign + verify with 3 liar-kill
negatives + walk genesis_lineage UNI-WIRE->ORIGIN) AND lib_ingest (store by CID in the no-link-rot corpus).
Idempotent: lib_ingest returns DUP for docs already stored, so re-running only foundations, never double-adds.
Honest provenance: source is the VERIFIABLE origin class from the filename (wiki-article / source-readme /
nishi-internal-research / external-doc) -- never a fabricated upstream URL. license_tier: ORIGINAL
dependencies 3 imports · 1 importers
imports: nx_syscalls.nxnx_library.nxnx_ingest_foundation.nx
imported by: nx_library_foundation_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 13 | const LF_MAGIC_65536: i64 = 65536 |
| 15 | const LF_DIR: *u8 = "knowledge/library" |
| 16 | const LF_LOG: *u8 = "knowledge/status/library_foundation.log" |
| 17 | const LF_CREDDIR: *u8 = "knowledge/foundation/cred" |
| 18 | const LF_DATE: *u8 = "2026-06-20" |
| 19 | const LF_AGENT: *u8 = "nishi-librarian" |
functions
| 21 | func lf_getdents(fd: i64, buf: *u8, count: i64) -> i64 { return __syscall(217, fd, buf, count, 0, 0, 0) } called by 1: lf_run |
| 22 | func lf_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 23 | func lf_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 } |
| 25 | func lf_ends(name: *u8, suf: *u8) -> i64 |
| 29 | func lf_has(name: *u8, lit: *u8) -> i64 |
| 35 | func lf_is_txt(name: *u8) -> i64 { return lf_ends(name, ".txt" as *u8) } |
| 38 | func lf_source(name: *u8, out: *u8) -> i64 |
| 51 | func lf_one(name: *u8, counts: *i64) -> i64 |
| 82 | func lf_run(counts: *i64) -> i64 |
| 122 | func lf_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 123 | func lf_n(v: i64) -> i64 { var m: i64=v; if m<0{lf_w("-");m=0-m} let t:*u8=sys_mmap(24); 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; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1}; sys_write(1,o,k); return 0 } |
| 125 | func main() -> i64 |