code wiki / (root) / nx_frontier_scan.nx

nx_frontier_scan.nx

buildroot/runtime/nx_frontier_scan.nx

90504 B1659 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind tooltopic frontier
docsdependenciesstructsconstsfunctions

about

nx_frontier_scan.nx -- THE AUTONOMOUS FRONTIER-NOTICER for a /compare domain. Operator 2026-08-20: "we want to be able to notice things like the metahuman gap without needing claude by having our own research on /compare sota and best of breed and workflowed and mcp and api etc". WHAT THE METAHUMAN GAP ACTUALLY WAS (mined from the transcripts, not assumed -- writer session 55724797-9f7b-4f68-81aa-fd2de7997175, 2026-08-18 18:15:25Z): the operator said the characters looked wrong, a seat ran FIVE WebSearch calls, and appended four citations to charsim.refs whose URLs IT NEVER OPENED (three carry mirror '-' pin '-'; the fourth points at a page fetched three days earlier from a DIFFERENT url). The gap therefore had TWO halves and only ONE of them needed the outside: (A) the INTERNAL deficit signal -- rivals coded Best on skin/hair rows where our symbol is _ABSENT_. Already mechanical, already in our own data, and NOBODY HAD EVER COMPUTED IT. (B) the OUTSIDE BAR -- the 2026 numbers. That genuinely needed the live web. This organ computes (A) from the domain's own files and pulls (B) through the sovereign fetcher. IT EMITS PROPOSALS AND NEVER ADMITS ONE. It does not write <domain>.matrix, <domain>.refs, or any watch cell. The measured law it obeys: no margin threshold makes auto-declaration safe (nx_memsugg, precision 808->890 permil at 24 percent coverage), and A COMPLETION SIGNAL THAT KEYS ON A NAME REWARDS WRITING THE NAME. The list is the answer; a seat adjudicates it. SEEDS ARE DATA, NEVER HAND-TYPED. They come from the domain's own board: <domain>.axes field 4 is literally "frontier-kw;frontier-kw" -- the estate ALREADY declares per-row frontier keywords and nothing had ever consumed them. <domain>.matrix field 1 (the row label) -- always, so a domain without .axes still has seeds. SOURCES ARE DATA TOO: knowledge/frontier_sources.conf. Both endpoints shipped with it were PROVEN reachable through nx_research_fetch before a line of this was written (arXiv API 200/12267 B, HN Algolia 200/17063 B) -- necessary because nx_websearch is OUR OWN CRAWL INDEX (0 results for "metahuman"), so it structurally cannot see the outside. VERBS seeds <domain> -- what this domain is about, from its own data. No network. deficit <domain> -- the internal signal, ranked, WITH THE REASON PER ROW. No network. scan <domain> [maxrows] [maxitems] -- fetch + diff + print proposals. Network. Writes nothing. propose <domain> [maxrows] [maxitems] -- scan, then file the worklist + the frontierprop- plane rows. RESOURCE ENVELOPE (a shipping criterion, not an afterthought): outbound requests are exactly rows_scanned x sources, both bounded by conf and echoed in every run line; buffers are sized FROM THE INPUT (sys_read_file, matrix+refs bytes, source count) so there is no ceiling to guess; the only writes are one worklist file and at most rows x sources x 2 plane upserts, keyed by url hash so a re-scan UPSERTS rather than grows.

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_deploy_lib.nx nx_comparetree_lib.nx nx_barfresh_lib.nx nx_frontier_scan.nx

imports: nx_syscalls.nxnx_deploy_lib.nxnx_comparetree_lib.nxnx_barfresh_lib.nx

imported by: nobody (leaf or entry point)

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

main fs_w sys_write fs_slen sys_exit fs_basename fs_slen ↻ fs_streq fs_slen ↻ fs_emit_seeds sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ fs_cmp_path fs_has_slash fs_cat fs_slen ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close fs_has_slash ↻ ct_readall_2dir sys_mmap ↻ ct_build_path

structs

none

consts

63const FS_PIPE: i64 = 124
64const FS_NL: i64 = 10
65const FS_HASH: i64 = 35
66const FS_AT: i64 = 64
67const FS_SEMI: i64 = 59
68const FS_SPACE: i64 = 32
69const FS_PLUS: i64 = 43
70const FS_ZERO: i64 = 48
71const FS_NINE: i64 = 57
72const FS_UPA: i64 = 65
73const FS_UPZ: i64 = 90
74const FS_LOA: i64 = 97
75const FS_LOZ: i64 = 122
76const FS_USCORE: i64 = 95
77const FS_SLASH: i64 = 47
78const FS_COLON: i64 = 58
79const FS_LBRACE: i64 = 123
84const FS_SECTION_MAX: i64 = 16
85const FS_PATHCAP: i64 = 1024
86const FS_URLCAP: i64 = 2048
87const FS_TXTCAP: i64 = 4096
88const FS_MAXP: i64 = 12
89const FS_MAXROWS: i64 = 64
90const FS_RIVALS: i64 = 4
91const FS_CODE_BEST: i64 = 2
92const FS_CODE_YES: i64 = 1
93const FS_HASH_BASE: i64 = 131
94const FS_HASH_MASK: i64 = 0xffffffff
95const FS_HEXDIG: i64 = 8
96const FS_HEXSHIFT: i64 = 4
97const FS_HEXRADIX: i64 = 16
98const FS_PERMIL: i64 = 1000
99const FS_DIRMODE: i64 = 0x1ed
100const FS_PLANE_ARGS: i64 = 10
104const FS_LINECAP: i64 = 4 * 2048 + 1024
107const FS_PROPS_PER_ROW: i64 = 2
507const FS_CODE_PART: i64 = 3
768const FS_DASH: i64 = 45
769const FS_CR: i64 = 13
770const FS_MONTH_TAG: *u8 = "month="
771const FS_MONTH_TAG_LEN: i64 = 6
772const FS_DATED_PIPES: i64 = 10 // src|kind|url|item|topen|tclose|uopen|uclose|join|dopen|dclose
773const FS_ATT_C_BARS: i64 = 0
774const FS_ATT_C_APPENDED: i64 = 1
775const FS_ATT_C_ALREADY: i64 = 2
776const FS_ATT_C_UNATTESTABLE: i64 = 3
777const FS_ATT_C_FETCHES: i64 = 4
778const FS_ATT_C_NEWER: i64 = 5
779const FS_ATT_C_STALE: i64 = 6
780const FS_ATT_C_N: i64 = 8
781const FS_YMBUF: i64 = 16
782const FS_TODAYBUF: i64 = 32

functions

109func fs_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
110func fs_w(s: *u8) -> i64 { sys_write(1, s, fs_slen(s)); return 0 }
111func fs_wn(base: *u8, off: i64, len: i64) -> i64
116func fs_n(v: i64) -> i64 { nxi_fd(1, v); return 0 }
117func fs_cat(dst: *u8, pos: i64, s: *u8) -> i64
124func fs_catn(dst: *u8, pos: i64, src: *u8, a: i64, b: i64) -> i64
130func fs_eol(buf: *u8, n: i64, i: i64) -> i64
136func fs_find(buf: *u8, n: i64, from: i64, lit: *u8) -> i64
154func fs_item_end(buf: *u8, n: i64, it: i64, idlm: *u8) -> i64
160func fs_fold(c: i64) -> i64
166func fs_streq(a: *u8, ao: i64, ae: i64, lit: *u8) -> i64
173func fs_prefix(a: *u8, ao: i64, ae: i64, lit: *u8) -> i64
180func fs_is_row(buf: *u8, i: i64, le: i64) -> i64
188func fs_pipes(buf: *u8, i: i64, le: i64, pos: *i64) -> i64
199func fs_digit_at(buf: *u8, a: i64, b: i64) -> i64
208func fs_atoi(s: *u8) -> i64
called by 1: main
226func fs_conf_get(cb: *u8, cn: i64, key: *u8) -> i64
262func fs_tok_in(hay: *u8, hn: i64, tok: *u8, tl: i64) -> i64
281func fs_cover_permil(title: *u8, a: i64, b: i64, corp: *u8, cn: i64, min_token: i64, tok: *u8) -> i64
called by 1: fs_scan_source calls 2: fs_foldfs_tok_in
315func fs_seed_q(dst: *u8, src: *u8, a: i64, b: i64, cap: i64, maxtok: i64, min_token: i64, join: *u8) -> i64
358func fs_urlhash(buf: *u8, a: i64, b: i64) -> i64
called by 1: main
364func fs_hex(dst: *u8, pos: i64, v: i64) -> i64
called by 1: main
381func fs_has_slash(s: *u8) -> i64
386func fs_basename(s: *u8) -> i64
called by 1: main
392func fs_cmp_path(dst: *u8, dom: *u8, ext: *u8) -> i64
405func fs_emit_seeds(dom: *u8) -> i64
508func fs_code_rank(c: i64) -> i64
called by 1: fs_deficit
519func fs_deficit(mb: *u8, mn: i64, lead_code: i64, rowa: *i64, rowb: *i64, score: *i64, verbose: i64) -> i64
590func fs_fetch(url: *u8, tmpout: *u8, savepath: *u8, olen: *i64) -> i64
625func fs_scan_source(dom: *u8, kind: *u8, url: *u8, idlm: *u8, topen: *u8, tclose: *u8,
785func fs_ym_at(rb: *u8, a: i64, b: i64) -> i64
792func fs_fixed_month(spec: *u8) -> i64
797func fs_w_ym(b: *u8, ix: i64) -> i64 { bf_ym_write(b, 0, ix); fs_w(b); return 0 }
798func fs_catn_num(dst: *u8, pos: i64, v: i64) -> i64
called by 1: fs_attest_domain calls 1: sys_mmap
810func fs_today(dst: *u8) -> i64
826func fs_item_mentions(rb: *u8, it: i64, ie: i64, subj: *u8, so: i64, sn: i64, min_token: i64, tok: *u8) -> i64
called by 1: fs_newest_month calls 2: fs_foldfs_tok_in
843func fs_item_field(rb: *u8, it: i64, ie: i64, open: *u8, close: *u8, off: *i64) -> i64
called by 1: fs_attest_domain calls 2: fs_findfs_slen
857func fs_newest_month(rb: *u8, rn: i64, idlm: *u8, dopen: *u8, dclose: *u8, fixed: i64, max_items: i64,
900func fs_attest_row(plan: *u8, refkey: *u8, today: *u8, ym: i64, note: *u8) -> i64
929func fs_ref_url(refs: *u8, refsn: i64, key: *u8, klen: i64, off: *i64) -> i64
950func fs_src_fields(sb: *u8, spos: *i64, sle: i64, kind: *u8, idlm: *u8, topen: *u8, tclos: *u8, uopen: *u8, uclos: *u8, join: *u8, dopen: *u8, dclos: *u8) -> i64
called by 1: fs_attest_domain calls 1: fs_catn
963func fs_build_url(url: *u8, sb: *u8, a: i64, b: i64, qbuf: *u8) -> i64
called by 1: fs_attest_domain calls 2: fs_prefixfs_cat
975func fs_attest_domain(dom: *u8, dbase: *u8, sb: *u8, sn: i64, today: *u8, max_items: i64, min_token: i64, seed_tokens: i64, tot: *i64) -> i64
1174func main(argc: i64, argv: *i64) -> i64