code wiki / (root) / nx_compare_rank.nx

nx_compare_rank.nx

buildroot/runtime/nx_compare_rank.nx

96689 B1404 linesdepth 10pulls 55 transitivereach 0 importersview sourcekind tooltopic compare
docsdependenciesstructsconstsfunctions

about

nx_compare_rank.nx -- THE ROADMAP RANKER: priority computed from the boards, never chosen by a seat. Operator 2026-08-18: "we need sota best of breed prioritization and ranking from the foundation first bit up in our compares to drive our roadmaps ... it needs to push back on your random doing of low priorities" and "we cant keep having you do random shit and say its effective". A seat picking rungs by whatever is cheapest with parts in-tree is the defect; this organ makes the compare COMPUTE the order from data the boards already carry and PUBLISH it where every seat, MCP caller and RACI row reads it. It decides nothing itself: the math is nx_dr_ocm (DR-6 opportunity-cost ranker, Priority=(V*M)/C, integer deterministic -- REGISTERED-DARK until today, adopted here) and the plane write is nx_store_put; this organ only DERIVES the three inputs per open rung, all from data: THE MATHEMATICS (v5, 2026-08-18 -- operator: "a full mathematical system on opportunity cost, clustering, foundation-up capabilities, best-of-breed research as of August 2026", not a seat's coefficients). Every term is COUNTED or a RATIO of board data; the only chosen constant left is RANK_COST_UNKNOWN and it fires only on a plan row that declared no cost (a labeled data defect). value v = deficit + CoD + option + enables (all from matrix codes + dep rows) deficit = sum of rival codes on the rung's row (2 leads, 1 present, 0 absent): value at stake CoD = deficit x (rivals LEADING / rivals total): WSJF cost-of-delay -- the fraction of the field already ahead is the time-criticality; every unit open, that many rivals widen it option = 1, ONLY when every rival is absent: the lead itself, held by nobody -- its unlocking value is already the enables leg below (one leg each; a v5 draft double-charged it) enables = number of OTHER open rungs whose transitive dependency closure contains this rung: the foundation-first / opportunity-enablement leg (WSJF) and the compound-option leg (real-options portfolio theory), counted from dep rows momentum m = 1 + declared dependencies already MEASURED present (substrate landed; never 0 because nx_dr_ocm multiplies and a zero would hide the rung) cost c = the plan's own est u in tenths, DIVIDED by the rung's cluster size (open rungs sharing the same organ file share substrate: read once, one build lane, one gate to extend -- graph clustering on the organ column, measured never labelled); unestimated -> labeled sponsor = the operator's sponsor- plane coefficient (PR6), applied to value, every firing row named priority = nx_dr_ocm( v x sponsor, m, c ) = (V x M x 1000)/C with forgone-best-alternative and budget-aware greedy selection (DR-6, integer deterministic) critical path: the FIRST unmet product version's milestone rungs + transitive open deps rank before everything else (ver| rows) -- staged delivery 0.1 -> 1.0 -> 2.0. Provenance: WSJF/cost-of-delay (SAFe LPM), real-options R&D portfolio valuation with project interdependencies (Blau et al.; OptFolio-class DSS), integer-programming portfolio selection under budget (knapsack form -- dr_ocm's greedy is the bounded-effort stand-in), dependency-graph enablement. pmdash.refs carries the citations. What is NOT here, honestly: uncertainty distributions (PTRS-style success probabilities per rung) -- the estate has no measured per-rung success rate yet; PR7's actuals-write-back is the data that makes that term possible, and it will be added when the data

dependencies 9 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_catalog_lib.nx nx_symdecl_lib.nx nx_incumbent_lib.nx nx_barfresh_lib.nx nx_ladder_lib.nx nx_swcompare_lib.nx nx_treatment_lib.nx nx_compare_rank.nx

imports: nx_syscalls.nxnx_tool_run.nxnx_catalog_lib.nxnx_symdecl_lib.nxnx_incumbent_lib.nxnx_barfresh_lib.nxnx_ladder_lib.nxnx_swcompare_lib.nxnx_treatment_lib.nx

imported by: nobody (leaf or entry point)

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

main rk_puts sys_write rk_slen sg_id rk_slen ↻ rk_streq rk_int 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 ↻ rk_cat rk_read_all sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close sg_parse sys_mmap ↻ sg_sha sys_mmap ↻ sha256_digest sys_mmap ↻ sha256_init

structs

none

consts

71const RK_INC_OUT: i64 = 16384
94const RANK_EXIT_BAR_STALE: i64 = 5 // a declared bar older than the current month with no this-month attestation: the board hands out no work
95const RANK_EXIT_LADDER_PARTIAL: i64 = 6 // a declared ladder to SOTA left half-declared (an undated target, a rung with no role): refused the same way
100const RANK_EXIT_TREATMENT_PARTIAL: i64 = 8 // a declared treatment left unmet on some rung: refused the same way (7 is the graph refusal)
101const RK_TRT_ALLOW: *u8 = "tool_allowlist.conf" // the MCP surface: name TAB elf TAB GREEN [TAB pinned args]; the API route is the same row
102const RK_TRT_ROSTER: *u8 = "knowledge/gateroster.conf" // the gate roster: one agent per line
103const RK_TRT_CLOCK_PLANE: *u8 = "knowledge/store/clockjobs-" // the clock DESIRED plane: name TAB secs TAB elf args
104const RK_TRT_CLOCK_CAP: i64 = 1048576 // captured stdout of the clock DESIRED plane load (a fork, size unknowable): 11,897 B for
107const RK_TRT_WF_PFX: *u8 = "knowledge/store/plan-" // a workflow is a plan_run plane: its manifest is <pfx><id><sfx>
108const RK_TRT_WF_SFX: *u8 = "-manifest.txt"
109const RK_TRT_PATH_CAP: i64 = 1024 // one composed estate path, the reserve every ep_* probe in this estate writes into
110const RK_TRT_MISS_CAP: i64 = 256 // one missing-list line: five fields of name:state from the ruler's own vocabulary (under 80 B)
121const RK_DEC_MAX: i64 = 20 // max decimal digits of an i64 (19) plus a sign: the width of one
123const RK_NUMBUF: i64 = RK_DEC_MAX + 4 // one number rendered to text + NUL + slack for the '-' and terminator
126const RANK_COST_UNKNOWN: i64 = 100 // 10.0 u: an unestimated rung is treated as EXPENSIVE, labeled --
129const RANK_DEFAULT_BUDGET: i64 = 300 // 30.0 u -- above every plan's full-parity figure, so the greedy
132const RANK_STORE_FIELDS: i64 = 8
143const RK_NOTE_LITERALS: i64 = 531 + 120 + 102
144const RK_NOTE_NUMS: i64 = 13
145const RK_SPONSOR_ROW_LITERALS: i64 = 11
146const RANK_FORK_CAP: i64 = 4096 // captured stdout of one nx_store_put / nx_pm_intake fork: their
152const RK_OCM_OBJ_BYTES: i64 = 89 + 8 * RK_DEC_MAX
153const RK_OCM_HDR_BYTES: i64 = 195 + 5 * RK_DEC_MAX + 16
160const RANK_FIX_PER_RUNG: i64 = 64 + 10 * RK_DEC_MAX // row skeleton: kind, pipes, numbers, newline
165const RANK_UNMAPPED_ROW: i64 = 48
169const RANK_FIX_TAIL: i64 = 512 // the stamped last line + the unmapped count line
170const RANK_PM_TOP: i64 = 3 // critical rungs filed into pm intake per run: enough to drive
320const SPONSOR_BASE: i64 = 4 // plus2 = +50%, plus1 = +25%, minus1 = -25%, minus2 = -50%
321const SPONSOR_PLANE_CAP: i64 = 262144
420const SELFSUFF_BASE: i64 = 4
421const SELFSUFF_FLOOR: i64 = 1
422const SELFSUFF_PEN_CAP: i64 = SELFSUFF_BASE - SELFSUFF_FLOOR

functions

74func rk_incumbents(rid: *u8, title: *u8, sym: *u8, note: *u8, excl: *u8) -> i64
173func rk_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
174func rk_puts(s: *u8) -> i64 { sys_write(1, s, rk_slen(s)); return 0 }
175func rk_pn(v: i64) -> i64
called by 2: rk_write_rankmain calls 2: sys_mmapsys_write
187func rk_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var oo: i64 = o; while s[i] != (0 as u8) { d[oo] = s[i]; oo = oo + 1; i = i + 1 } d[oo] = 0 as u8; return oo }
188func rk_catn(d: *u8, o: i64, v: i64) -> i64
198func rk_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] == b[i] { if a[i] == (0 as u8) { return 1 } i = i + 1 } return 0 }
199func rk_starts(s: *u8, p: *u8) -> i64 { var i: i64 = 0; while p[i] != (0 as u8) { if s[i] != p[i] { return 0 } i = i + 1 } return 1 }
204func rk_read_all(path: *u8, outb: *i64) -> i64
213func rk_trt_read(rel: *u8, outb: *i64) -> i64
221func rk_span_copy(buf: *u8, off: i64, len: i64) -> *u8
called by 1: main calls 1: sys_mmap
231func rk_lines(b: *u8, n: i64) -> i64
called by 1: main
238func rk_max_pipes(b: *u8, n: i64) -> i64
called by 1: main
250func rk_split(s: *u8, fld: *i64, maxf: i64) -> i64
called by 1: main
256func rk_tenths(s: *u8) -> i64
called by 1: main
270func rk_int(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v }
called by 1: main
272func rk_sym_is(rowsym: *u8, sym: *u8) -> i64
called by 1: main calls 2: rk_streqrk_starts
283func rk_measure(org: *u8, sym: *u8) -> i64
300func rk_dark(org: *u8, sym: *u8) -> i64
322func rk_has(hay: *u8, needle: *u8) -> i64
called by 1: rk_sponsor_term calls 1: rk_slen
335func rk_sponsor_term(plane: *u8, plen: i64, dom: *u8, rid1: *u8, sym: *u8, nb: *u8, no0: i64, noOut: *i64) -> i64
427func rk_ss_eqf(b: *u8, s: i64, e: i64, lit: *u8) -> i64
called by 1: rk_selfsuff_term
439func rk_ss_atoi(b: *u8, s: i64, e: i64) -> i64
called by 1: rk_selfsuff_term
454func rk_selfsuff_term(led: *u8, ln: i64, dom: *u8, org: *u8, nb: *u8, no0: i64, noOut: *i64) -> i64
510func rk_list_one(idstr: *u8, mode: i64, rid: *i64, nr: i64, rdone: *i64, crit: *i64) -> i64
called by 1: rk_list_scan calls 1: rk_streq
524func rk_list_scan(ls: *u8, mode: i64, rid: *i64, nr: i64, rdone: *i64, crit: *i64) -> i64
called by 1: main calls 3: sys_mmaprk_slenrk_list_one
545func rk_write_rank(dom: *u8, buf: *u8, n0: i64, nr: i64, ndone: i64, nopen: i64, nfinish: i64, tgt: i64, vlab: *i64) -> i64
575func qcap_stage_max(vlab: *i64, nver: i64) -> i64
called by 1: main calls 1: rk_slen
582func main(argc: i64, argv: *i64) -> i64