code wiki / (root) / nx_analyze.nx

nx_analyze.nx

buildroot/runtime/nx_analyze.nx

24415 B529 linesdepth 10pulls 22 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_analyze.nx -- THE ANALYST FRONT DOOR. Everything else in this arc is a library with no runnable main: an agent could run the gates but could not actually analyse a dataset over MCP. This is the one registered, cap-gated, verb-driven CLI that makes the whole stack callable -- by a human, an agent, or a workflow step -- and it answers in STRUCTURED JSON so the caller parses fields, not prose. DESIGN, against the operator's checklist: MCP / API : one organ, one tool_allowlist row, driven entirely through the sovereign mgmt API. AGENTIC : output is a single JSON object; every honesty flag (significant, family_significant, truncated, degenerate, survives) is a machine field a planner can branch on. WORKFLOW : verbs are orthogonal primitives -- `sig`/`ci` are pure and cheap for fan-out, `report` is the composed pipeline. A workflow calls exactly the piece it needs. COMPOSED : it owns no statistics of its own; it wires nx_dataframe -> nx_analyst_multi -> nx_analyst_infer (significance / Bonferroni / CI / partial) over nx_analyst_store's sharded loader. One seam, the pieces stay single-responsibility. SCALE : reads REAL seg_store data across key shards <keybase>:0/:1/... past the 256 version window, and DECLARES loaded-row count + truncation in the envelope rather than quietly analysing a slice. VERBS nx_analyze sig <r_permille> <n> nx_analyze ci <r_permille> <n> [alpha_permille=50] nx_analyze report <prefix> <keybase> <target_idx> <nmax> <maxshards> <name0> <name1> ... license_tier: ORIGINAL No hardware writes (Rule 26).

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_analyst_store.nx nx_analyst_causal.nx nx_analyst_insight.nx nx_analyze.nx nx_analyze_gate.nx

imports: nx_syscalls.nxnx_analyst_store.nxnx_analyst_causal.nxnx_analyst_insight.nx

imported by: nx_analyze_gate.nx

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

main az_err sys_write sys_exit sys_mmap az_streq az_sig az_raw az_num sys_mmap ↻ ai_r_significant sys_mmap ↻ ai_tcrit_load ai_tcrit_parse sys_openat_rd sys_mmap ↻ sys_read sys_close ai_atoi_rng ai_r_sig_from ai_tcrit_from ai_min_n sys_mmap ↻ ai_tcrit_load ↻ ai_r_sig_from ↻ az_atoi sys_write ↻ az_ci az_raw ↻ az_num ↻ sys_mmap ↻ ai_r_ci ai_tcrit_alpha sys_mmap ↻ ai_tcrit_parse ↻ ai_tcrit_from ↻ df_isqrt ai_exp_micro az_ask az_has_ci

structs

none

consts

28const AZ_MAGIC_2048: i64 = 2048
30const AZ_MAXCOL: i64 = 32
31const AZ_OUT: i64 = 65536
32const AZ_ALPHA_05: i64 = 50
33const AZ_EXIT_USAGE: i64 = 2

functions

35func az_err(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 }
called by 1: main calls 1: sys_write
36func az_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
37func az_streq(a: *u8, b: *u8) -> i64
called by 2: az_askmain
43func az_atoi(s: *u8) -> i64
called by 2: az_askmain
57func az_raw(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o] = s[i]; o = o + 1; i = i + 1 } return o }
58func az_num(out: *u8, o: i64, v: i64) -> i64
71func az_str(out: *u8, o: i64, s: *u8) -> i64
88func az_sig(rp: i64, n: i64, out: *u8) -> i64
108func az_ci(rp: i64, n: i64, alpha: i64, out: *u8) -> i64
132func az_report(prefix: *u8, keybase: *u8, tidx: i64, nmax: i64, maxsh: i64, names: *i64, ncol: i64, out: *u8) -> i64
255func az_kind_name(k: i64) -> *u8
called by 1: az_mine
264func az_mine(prefix: *u8, keybase: *u8, nmax: i64, maxsh: i64, names: *i64, ncol: i64, out: *u8) -> i64
347func az_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: az_has_ci
348func az_has_ci(hay: *u8, needle: *u8) -> i64
called by 2: az_resolve_targetaz_ask calls 1: az_lc
365func az_nums(s: *u8, nums: *i64, want: i64) -> i64
called by 1: az_ask
391func az_resolve_target(question: *u8, names: *i64, ncol: i64) -> i64
called by 1: az_ask calls 1: az_has_ci
400func az_embed(out: *u8, o: i64, tmp: *u8, tn: i64) -> i64
called by 1: az_ask
407func az_ask(question: *u8, dsargs: *i64, nds: i64, out: *u8) -> i64
464func main(argc: i64, argv: *i64) -> i64