code wiki / _hdl_build / nx_research_grow.nx
nx_research_grow.nx
buildroot/runtime/_hdl_build/nx_research_grow.nx
about
nx_research_grow.nx -- THE SELF-GROWING RESEARCHER INDEX (R4 self-grow loop) WITH CONTENT-DEDUP + CROSS-TOPIC
FLAGGING. Each run indexes the DELTA (fetched docs not yet SEEN) into a NEW append-only SHARD, but FIRST
fingerprints each doc's CONTENT (FNV-1a 64-bit). If that content fingerprint is already registered, the doc is
NOT re-indexed (no duplicate as coverage grows) -- instead the registry records the new (topic,path) for that
fingerprint, and if the new topic differs from the canonical topic we EMIT A CROSS-TOPIC FLAG: "this
information serves two research topics, found in the same place." So the corpus compounds on every use, never
duplicates content, never loses data, and the structure intelligently links topics that share sources.
Bounded batch per run = OOM-safe (no sys_munmap). Reuses the FIXED nx_inv build + nx_dirent walk.
Topic = the filename prefix before the first '_' (perma_/sem_/food_/ng_/...). expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_search_inverted_persist.nxnx_itoa_lib.nxnx_dirent.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const RG_DIR_BUF: i64 = 65536 |
| 15 | const RG_PATH_CAP: i64 = 4096 |
| 16 | const RG_BATCH_MAX: i64 = 50 // bounded files-read per run -> OOM-safe; corpus compounds across runs |
| 17 | const RG_REG_CAP: i64 = 65536 // max distinct content fingerprints tracked in memory |
| 18 | const RG_TOP_BUF: i64 = 4194304 // canonical-topic string arena |
functions
| 20 | func rg_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 25 | func rg_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 26 | func rg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off+i]=s[i];i=i+1} return off+i } called by 1: main |
| 27 | func rg_catbuf(dst: *u8, off: i64, src: *u8, n: i64) -> i64 { var i: i64=0; while i<n { dst[off+i]=src[i]; i=i+1 } return off+n } called by 1: main |
| 28 | func rg_catnum(dst: *u8, off: i64, v: i64) -> i64 called by 1: main |
| 37 | func rg_indexable(name: *u8, n: i64) -> i64 called by 1: main |
| 45 | func rg_topic(name: *u8, nlen: i64, out: *u8) -> i64 called by 1: main |
| 57 | func rg_streq(a: *u8, alen: i64, b: *u8, blen: i64) -> i64 called by 1: main |
| 65 | func rg_seen(man: *u8, mlen: i64, path: *u8, plen: i64) -> i64 called by 1: main |
| 82 | func rg_field_end(buf: *u8, i: i64, end: i64) -> i64 called by 1: main |
| 93 | func rg_parse_dec(buf: *u8, start: i64, fend: i64) -> i64 called by 1: main |
| 100 | func rg_emit(corpus_fd: i64, buf: *u8, len: i64) -> i64 called by 1: main |
| 121 | func rg_fp(buf: *u8, len: i64) -> i64 called by 1: main |
| 134 | func main() -> i64 |