code wiki / (root) / nx_explore.nx

nx_explore.nx

buildroot/runtime/nx_explore.nx

8934 B189 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_explore.nx -- THE NISHI EXPLORE TEAM, RUNG R4 "MAP": query -> conclusion map. The SOVEREIGN replacement for the third-party Explore *agent* (operator 2026-06-23: "dont launch an explore agent build a nishi explore team capability from the hardware rung up each rung to be s class exceed"). What the Explore agent does: sweep many files, return the RELEVANT ones + a one-line role each -- a CONCLUSION, not a dump. This organ does exactly that, sovereignly: recursive getdents64 walk (R0) + per-file content scan (R2), SYNTHESIZED to ONE ROW PER FILE: "path (Nx) <first-match line>". That synthesis is the exceed over raw nx_codegrep (which dumps file:line per hit) AND over the Explore agent (zero egress, no spend wall, deterministic) AND over ripgrep (completes where rg timed out 4x @20s on this tree this session). USE (dogfood): ./_offc/nx_explore.elf "<query>" -> live map over runtime/ SELF-GATE: run with NO args (the nx_sov_build_run path) -> self-test: a real symbol must map to >=1 file AND a byte-built absent token must map to 0 (neg-control) -> EXPLORE-MAP-GATE GREEN/run-exit=0. Composes nx_codegrep's proven walk; reuses sys_getdents64 + dirent_* from nx_syscalls. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_explore.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap ex_strlen ex_puts sys_write ex_strlen ↻ ex_map ex_map_dir sys_openat_rd sys_mmap ↻ sys_getdents64 dirent_reclen dirent_type dirent_name ex_is_dot ex_join ex_map_dir ↻ ex_ends_nx ex_strlen ↻ ex_scan_file sys_openat_rd ↻ sys_read sys_close ex_find ex_puts ↻ ex_putn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sys_close ↻ ex_putn ↻ sys_exit

structs

none

consts

18const EX_MAGIC_65536: i64 = 65536
19const EX_MAGIC_1024: i64 = 1024
21const EX_FBUF: i64 = 4194304 // 4 MB per-file read buffer (reused across files, like nx_codegrep)
22const EX_MAXDEPTH: i64 = 64 // JPL rule-2 bounded recursion ceiling

functions

24func ex_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
25func ex_puts(s: *u8) -> i64 { sys_write(1, s, ex_strlen(s)); return 0 }
called by 2: ex_map_dirmain calls 2: sys_writeex_strlen
30func ex_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: ex_map_dirmain calls 1: nxi_out
32func ex_find(buf: *u8, lo: i64, hi: i64, pat: *u8, pl: i64) -> i64
called by 1: ex_scan_file
44func ex_ends_nx(name: *u8) -> i64
called by 1: ex_map_dir calls 1: ex_strlen
53func ex_is_dot(name: *u8) -> i64
called by 1: ex_map_dir
58func ex_join(dirpath: *u8, name: *u8, out: *u8) -> i64
called by 1: ex_map_dir
69func ex_scan_file(path: *u8, query: *u8, ql: i64, fbuf: *u8, outln: *u8, outcap: i64, out_len: *i64) -> i64
110func ex_map_dir(dirpath: *u8, query: *u8, ql: i64, fbuf: *u8, depth: i64) -> i64
156func ex_map(root: *u8, query: *u8, ql: i64, fbuf: *u8) -> i64
called by 1: main calls 1: ex_map_dir
160func main(argc: i64, argv: *i64) -> i64