nx_compare_rank.nx
buildroot/runtime/nx_compare_rank.nx
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
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
structs
| none |
consts
| 71 | const RK_INC_OUT: i64 = 16384 |
| 94 | const 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 |
| 95 | const 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 |
| 100 | const RANK_EXIT_TREATMENT_PARTIAL: i64 = 8 // a declared treatment left unmet on some rung: refused the same way (7 is the graph refusal) |
| 101 | const 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 |
| 102 | const RK_TRT_ROSTER: *u8 = "knowledge/gateroster.conf" // the gate roster: one agent per line |
| 103 | const RK_TRT_CLOCK_PLANE: *u8 = "knowledge/store/clockjobs-" // the clock DESIRED plane: name TAB secs TAB elf args |
| 104 | const RK_TRT_CLOCK_CAP: i64 = 1048576 // captured stdout of the clock DESIRED plane load (a fork, size unknowable): 11,897 B for |
| 107 | const RK_TRT_WF_PFX: *u8 = "knowledge/store/plan-" // a workflow is a plan_run plane: its manifest is <pfx><id><sfx> |
| 108 | const RK_TRT_WF_SFX: *u8 = "-manifest.txt" |
| 109 | const RK_TRT_PATH_CAP: i64 = 1024 // one composed estate path, the reserve every ep_* probe in this estate writes into |
| 110 | const RK_TRT_MISS_CAP: i64 = 256 // one missing-list line: five fields of name:state from the ruler's own vocabulary (under 80 B) |
| 121 | const RK_DEC_MAX: i64 = 20 // max decimal digits of an i64 (19) plus a sign: the width of one |
| 123 | const RK_NUMBUF: i64 = RK_DEC_MAX + 4 // one number rendered to text + NUL + slack for the '-' and terminator |
| 126 | const RANK_COST_UNKNOWN: i64 = 100 // 10.0 u: an unestimated rung is treated as EXPENSIVE, labeled -- |
| 129 | const RANK_DEFAULT_BUDGET: i64 = 300 // 30.0 u -- above every plan's full-parity figure, so the greedy |
| 132 | const RANK_STORE_FIELDS: i64 = 8 |
| 143 | const RK_NOTE_LITERALS: i64 = 531 + 120 + 102 |
| 144 | const RK_NOTE_NUMS: i64 = 13 |
| 145 | const RK_SPONSOR_ROW_LITERALS: i64 = 11 |
| 146 | const RANK_FORK_CAP: i64 = 4096 // captured stdout of one nx_store_put / nx_pm_intake fork: their |
| 152 | const RK_OCM_OBJ_BYTES: i64 = 89 + 8 * RK_DEC_MAX |
| 153 | const RK_OCM_HDR_BYTES: i64 = 195 + 5 * RK_DEC_MAX + 16 |
| 160 | const RANK_FIX_PER_RUNG: i64 = 64 + 10 * RK_DEC_MAX // row skeleton: kind, pipes, numbers, newline |
| 165 | const RANK_UNMAPPED_ROW: i64 = 48 |
| 169 | const RANK_FIX_TAIL: i64 = 512 // the stamped last line + the unmapped count line |
| 170 | const RANK_PM_TOP: i64 = 3 // critical rungs filed into pm intake per run: enough to drive |
| 320 | const SPONSOR_BASE: i64 = 4 // plus2 = +50%, plus1 = +25%, minus1 = -25%, minus2 = -50% |
| 321 | const SPONSOR_PLANE_CAP: i64 = 262144 |
| 420 | const SELFSUFF_BASE: i64 = 4 |
| 421 | const SELFSUFF_FLOOR: i64 = 1 |
| 422 | const SELFSUFF_PEN_CAP: i64 = SELFSUFF_BASE - SELFSUFF_FLOOR |
functions
| 74 | func rk_incumbents(rid: *u8, title: *u8, sym: *u8, note: *u8, excl: *u8) -> i64 |
| 173 | func rk_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 174 | func rk_puts(s: *u8) -> i64 { sys_write(1, s, rk_slen(s)); return 0 } |
| 175 | func rk_pn(v: i64) -> i64 |
| 187 | func 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 } |
| 188 | func rk_catn(d: *u8, o: i64, v: i64) -> i64 |
| 198 | func 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 } |
| 199 | func 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 } |
| 204 | func rk_read_all(path: *u8, outb: *i64) -> i64 |
| 213 | func rk_trt_read(rel: *u8, outb: *i64) -> i64 |
| 221 | func rk_span_copy(buf: *u8, off: i64, len: i64) -> *u8 |
| 231 | func rk_lines(b: *u8, n: i64) -> i64 called by 1: main |
| 238 | func rk_max_pipes(b: *u8, n: i64) -> i64 called by 1: main |
| 250 | func rk_split(s: *u8, fld: *i64, maxf: i64) -> i64 called by 1: main |
| 256 | func rk_tenths(s: *u8) -> i64 called by 1: main |
| 270 | func 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 |
| 272 | func rk_sym_is(rowsym: *u8, sym: *u8) -> i64 |
| 283 | func rk_measure(org: *u8, sym: *u8) -> i64 |
| 300 | func rk_dark(org: *u8, sym: *u8) -> i64 |
| 322 | func rk_has(hay: *u8, needle: *u8) -> i64 |
| 335 | func rk_sponsor_term(plane: *u8, plen: i64, dom: *u8, rid1: *u8, sym: *u8, nb: *u8, no0: i64, noOut: *i64) -> i64 |
| 427 | func rk_ss_eqf(b: *u8, s: i64, e: i64, lit: *u8) -> i64 called by 1: rk_selfsuff_term |
| 439 | func rk_ss_atoi(b: *u8, s: i64, e: i64) -> i64 called by 1: rk_selfsuff_term |
| 454 | func rk_selfsuff_term(led: *u8, ln: i64, dom: *u8, org: *u8, nb: *u8, no0: i64, noOut: *i64) -> i64 |
| 510 | func rk_list_one(idstr: *u8, mode: i64, rid: *i64, nr: i64, rdone: *i64, crit: *i64) -> i64 |
| 524 | func rk_list_scan(ls: *u8, mode: i64, rid: *i64, nr: i64, rdone: *i64, crit: *i64) -> i64 |
| 545 | func rk_write_rank(dom: *u8, buf: *u8, n0: i64, nr: i64, ndone: i64, nopen: i64, nfinish: i64, tgt: i64, vlab: *i64) -> i64 |
| 575 | func qcap_stage_max(vlab: *i64, nver: i64) -> i64 |
| 582 | func main(argc: i64, argv: *i64) -> i64 |