code wiki / _hdl_build / nx_research_serve.nx
nx_research_serve.nx
buildroot/runtime/_hdl_build/nx_research_serve.nx
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
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
structs
| none |
consts
| 15 | const SV_MAGIC_1024: i64 = 1024 |
| 16 | const SV_MAGIC_2048: i64 = 2048 |
| 18 | const SV_MIN_HITS: i64 = 3 // distinct docs to call research ADEQUATE (data-driven; config later) |
| 19 | const SV_TERMS: i64 = 8 |
| 20 | const SV_ROWIDS: i64 = 4096 |
| 21 | const SV_IDX: i64 = 8192 |
| 22 | const SV_HITS: i64 = 65536 |
functions
| 24 | func 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 |
| 29 | func sv_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 30 | func 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 |
| 31 | func 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 |
| 32 | func 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 |
| 33 | func sv_catnum(dst: *u8, off: i64, v: i64) -> i64 called by 1: main |
| 40 | func sv_scan(buf: *u8, i: i64, end: i64) -> i64 |
| 45 | func sv_line_end(buf: *u8, i: i64, end: i64) -> i64 |
| 50 | func sv_load_docmap(path: *u8, paths_out: *i64, cap: i64) -> i64 |
| 64 | func sv_load_indexes(gidx: *i64, gpaths: *i64, gndocs: *i64) -> i64 |
| 93 | func sv_hits_for(terms: *i64, nterms: i64, nidx: i64, gidx: *i64, gndocs: *i64, ghits: *u8, gcount: *u8) -> i64 |
| 127 | func main() -> i64 |