nx_libindex_lib.nx
buildroot/runtime/nx_libindex_lib.nx
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
imports: nx_syscalls.nxnx_catalog_lib.nxnx_store_seed_lib.nx
imported by: nx_libindex.nxnx_libindex_gate.nx
structs
| none |
consts
| 41 | const LI_DIRBUF: i64 = 65536 |
| 44 | const LI_NAME_CAP: i64 = 512 |
| 45 | const LI_PATH_CAP: i64 = 1024 |
| 47 | const LI_O_DIRECTORY: i64 = 0x10000 |
| 48 | const LI_O_WRONLY_CREAT_TRUNC: i64 = 0x241 |
| 49 | const LI_MODE_644: i64 = 420 |
| 50 | const LI_AT_FDCWD: i64 = 0 - 100 |
| 51 | const LI_SYS_OPENAT: i64 = 257 |
| 52 | const LI_SYS_GETDENTS64: i64 = 217 |
| 55 | const LI_DIRENT_RECLEN_OFF: i64 = 16 |
| 56 | const LI_DIRENT_TYPE_OFF: i64 = 18 |
| 57 | const LI_DIRENT_NAME_OFF: i64 = 19 |
| 58 | const LI_DT_DIR: i64 = 4 |
| 60 | const LI_TAB: i64 = 9 |
| 61 | const LI_NL: i64 = 10 |
| 62 | const LI_SP: i64 = 32 |
| 63 | const LI_DOT: i64 = 46 |
| 64 | const LI_SLASH: i64 = 47 |
| 65 | const LI_LPAREN: i64 = 40 |
| 68 | const LI_C_ENTRIES: i64 = 0 |
| 69 | const LI_C_NX: i64 = 1 |
| 70 | const LI_C_LIB: i64 = 2 |
| 71 | const LI_C_PROG: i64 = 3 |
| 72 | const LI_C_UNREAD: i64 = 4 |
| 73 | const LI_C_SYMS: i64 = 5 |
| 74 | const LI_C_NAMEBIND: i64 = 6 |
| 75 | const LI_C_ROWS: i64 = 7 // rows the plane commit reported, or -1 if the seed refused |
| 76 | const LI_C_N: i64 = 8 |
functions
| 78 | func li_cen() -> *i64 |
| 85 | func 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 } |
| 86 | func li_out(s: *u8) -> i64 { return li_w(1, s) } |
| 88 | func li_num_fd(fd: i64, v0: i64) -> i64 |
| 104 | func li_num(v: i64) -> i64 { return li_num_fd(1, v) } |
| 106 | func li_byte(fd: i64, c: i64) -> i64 |
| 114 | func li_ends_nx(nm: *u8, nl: i64) -> i64 called by 1: li_scan_dir |
| 124 | func li_emit_title(fd: i64, b: *u8, n: i64) -> i64 |
| 145 | func li_emit_syms(fd: i64, b: *u8, n: i64, cen: *i64) -> i64 |
| 175 | func li_scan_dir(root: *u8, ofd: i64, cen: *i64) -> i64 |
| 242 | func li_build_to(scratch: *u8, prefix: *u8, cen: *i64, quiet: i64) -> i64 |
| 310 | func li_find_in(prefix: *u8, terms: *i64, nterms: i64, quiet: i64) -> i64 |