code wiki / (root) / nx_libindex_lib.nx

nx_libindex_lib.nx

buildroot/runtime/nx_libindex_lib.nx

16396 B370 linesdepth 5pulls 9 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_libindex_lib.nx -- THE LIBRARY DISCOVERY INDEX, function side (PG1, procgen.plan, 2026-08-24). THE DEFECT THIS CLOSES, OPERATOR-NAMED AND MEASURED: nx_capsearch -- the organ CLAUDE.md orders run BEFORE BUILDING ANYTHING -- ranks REGISTERED MCP TOOLS. A library has no registration row by design (nx_catalog says so itself: for a lib the adoption question is importer count, not binary presence), so every library in the estate is INVISIBLE to the one instrument that exists to answer "does this already exist?". MEASURED CONSEQUENCE, same session: EIGHT private isqrt copies (gsplat, bodybench, gltf2mesh, gtlabels gate, worldgen, worley, anatstack, part_solver) written beside each other because the discovery organ could never have shown them; two FALSE ABSENT rows on one compare board; a capsearch zero read as corroboration of absence. Any absence claim resting on a capsearch zero is UNPROVEN until re-checked here. COMPOSES THE INCUMBENT, ADDS NO SECOND RULER: the LIB test is nx_catalog_lib's cl_is_lib, the same classifier the adoption ladder and the compare generator already use, so this index cannot disagree with the board about what a library is. The symbol scan uses the beginning-of-line "func " rule that cl_symbol_declared already applies, so a symbol listed here is one that ruler will confirm. THE PUBLISHED ARTIFACT IS A SOVEREIGN ROW PLANE, NOT A FILE (corrected 2026-08-24, same day: the first cut wrote knowledge/status/libindex.tsv, which is exactly the third-party-format-in-the-plane shape the operator retired on 2026-08-13). Rows stream to an organ-owned SCRATCH descriptor while the tree is walked, then the scratch is read back whole (sys_read_file sizes from the file and cannot short-read) and seeded into the store at `prefix` under the plane lock in ONE commit -- sts_seed, the same primitive nx_store_put uses. Readers use sts_load_fit, which returns the whole plane or REFUSES; it never hands back a partial. Row schema: name<TAB>path<TAB>title<TAB> sym1 sym2 ... (id = col 0, the N-col row-plane contract). SPLIT lib/program so the GATE can compose these functions in-process instead of forking a deployed binary. NO SILENT CAPS. The only bounded buffers are the kernel dirent block (composed from nx_fs at 65536) and a filename buffer; a bind is COUNTED and forces corpus_complete=0 rather than truncating. THE PARTITION IS PRINTED AND MUST SUM: nx_files == libs + programs + unreadable. And a corpus in which not one file resolved to lib or program is INCOMPLETE by definition -- measured on the first run, 18,882 unreadable files summed to a clean partition and read complete with an empty index. license_tier: ORIGINAL

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_catalog_lib.nx nx_store_seed_lib.nx nx_libindex_lib.nx nx_libindex.nx nx_libindex_gate.nx

imports: nx_syscalls.nxnx_catalog_lib.nxnx_store_seed_lib.nx

imported by: nx_libindex.nxnx_libindex_gate.nx

structs

none

consts

41const LI_DIRBUF: i64 = 65536
44const LI_NAME_CAP: i64 = 512
45const LI_PATH_CAP: i64 = 1024
47const LI_O_DIRECTORY: i64 = 0x10000
48const LI_O_WRONLY_CREAT_TRUNC: i64 = 0x241
49const LI_MODE_644: i64 = 420
50const LI_AT_FDCWD: i64 = 0 - 100
51const LI_SYS_OPENAT: i64 = 257
52const LI_SYS_GETDENTS64: i64 = 217
55const LI_DIRENT_RECLEN_OFF: i64 = 16
56const LI_DIRENT_TYPE_OFF: i64 = 18
57const LI_DIRENT_NAME_OFF: i64 = 19
58const LI_DT_DIR: i64 = 4
60const LI_TAB: i64 = 9
61const LI_NL: i64 = 10
62const LI_SP: i64 = 32
63const LI_DOT: i64 = 46
64const LI_SLASH: i64 = 47
65const LI_LPAREN: i64 = 40
68const LI_C_ENTRIES: i64 = 0
69const LI_C_NX: i64 = 1
70const LI_C_LIB: i64 = 2
71const LI_C_PROG: i64 = 3
72const LI_C_UNREAD: i64 = 4
73const LI_C_SYMS: i64 = 5
74const LI_C_NAMEBIND: i64 = 6
75const LI_C_ROWS: i64 = 7 // rows the plane commit reported, or -1 if the seed refused
76const LI_C_N: i64 = 8

functions

78func li_cen() -> *i64
called by 2: mainmain calls 1: sys_mmap
85func li_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 2: li_outli_scan_dir calls 1: sys_write
86func li_out(s: *u8) -> i64 { return li_w(1, s) }
88func li_num_fd(fd: i64, v0: i64) -> i64
called by 1: li_num calls 3: sys_mmapsys_writesys_munmap
104func li_num(v: i64) -> i64 { return li_num_fd(1, v) }
called by 2: li_build_toli_find_in calls 1: li_num_fd
106func li_byte(fd: i64, c: i64) -> i64
114func li_ends_nx(nm: *u8, nl: i64) -> i64
called by 1: li_scan_dir
124func li_emit_title(fd: i64, b: *u8, n: i64) -> i64
called by 1: li_scan_dir calls 1: li_byte
145func li_emit_syms(fd: i64, b: *u8, n: i64, cen: *i64) -> i64
called by 1: li_scan_dir calls 1: li_byte
175func li_scan_dir(root: *u8, ofd: i64, cen: *i64) -> i64
242func li_build_to(scratch: *u8, prefix: *u8, cen: *i64, quiet: i64) -> i64
310func li_find_in(prefix: *u8, terms: *i64, nterms: i64, quiet: i64) -> i64