code wiki / _hdl_build / nx_research_serve.nx

nx_research_serve.nx

buildroot/runtime/_hdl_build/nx_research_serve.nx

11698 B216 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind servicetopic research
docsdependenciesstructsconstsfunctions

about

nx_research_serve.nx -- THE RESEARCH REQUEST QUEUE + ADEQUACY FEEDBACK GATE. Lets the autonomous builder and the researcher partner gracefully + loosely (async, via artifacts, integer-only / no floats): - Auto-builder ENQUEUES by appending to knowledge/index/research_queue.txt: <id> PENDING <topic terms...> - This organ DRAINS the queue: each PENDING request is queried across EVERY index (via the search-sources manifest = the same loose federation) and JUDGED for adequacy (distinct docs covering the topic >= SV_MIN_HITS), then routed: ADEQUATE -> status SERVED + research_served.log (builder may now retrieve via federation) INADEQUATE -> status INADEQUATE + research_gaps.txt (THE FEEDBACK FLAG: under-covered topic -> shown to operator + Claude -> improve researcher / fetch deeper) - Queue rewritten with updated statuses (history kept; idempotent: only PENDING processed). Closes the partner loop: builder asks -> researcher serves or flags the gap -> we grow the researcher -> the auto-builder is unblocked -> the team grows toward autonomous S-class. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_search_inverted_persist.nx nx_itoa_lib.nx nx_research_serve.nx

imports: nx_search_inverted_persist.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 sv_puts sv_load_indexes sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close sv_scan sv_line_end nx_inv_load sys_read_file ↻ sv_load_docmap sys_read_file ↻ sv_num nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write sys_munmap sys_read_file ↻ sys_openat_wr sys_openat_append sv_line_end ↻ sv_scan ↻ sv_hits_for nx_inv_query_term nx_inv_hash_bytes_lower nx_inv_lookup_slot nx_inv_slot_at nx_inv_slot_hash nx_inv_slot_postings_count nx_inv_slot_postings_offse nx_inv_slot_write_cursor sv_strlen sv_catbuf sv_cat sv_catnum

structs

none

consts

15const SV_MAGIC_1024: i64 = 1024
16const SV_MAGIC_2048: i64 = 2048
18const SV_MIN_HITS: i64 = 3 // distinct docs to call research ADEQUATE (data-driven; config later)
19const SV_TERMS: i64 = 8
20const SV_ROWIDS: i64 = 4096
21const SV_IDX: i64 = 8192
22const SV_HITS: i64 = 65536

functions

24func sv_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
29func sv_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
30func sv_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: sv_hits_for
31func sv_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
32func sv_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
33func sv_catnum(dst: *u8, off: i64, v: i64) -> i64
called by 1: main
40func sv_scan(buf: *u8, i: i64, end: i64) -> i64
called by 2: sv_load_indexesmain
45func sv_line_end(buf: *u8, i: i64, end: i64) -> i64
called by 2: sv_load_indexesmain
50func sv_load_docmap(path: *u8, paths_out: *i64, cap: i64) -> i64
called by 1: sv_load_indexes calls 1: sys_read_file
64func sv_load_indexes(gidx: *i64, gpaths: *i64, gndocs: *i64) -> i64
93func sv_hits_for(terms: *i64, nterms: i64, nidx: i64, gidx: *i64, gndocs: *i64, ghits: *u8, gcount: *u8) -> i64
called by 1: main calls 2: nx_inv_query_termsv_strlen
127func main() -> i64