code wiki / _hdl_build / nx_pm_dashboard.nx
nx_pm_dashboard.nx
buildroot/runtime/_hdl_build/nx_pm_dashboard.nx
about
nx_pm_dashboard.nx -- the PM OVERSIGHT + ROI organ (operator 2026-07-18: "the pm to give us based
on my executive, management, and operations layer a dashboard and feedback... return on investment
with non fake numbers but real estimates in time and money and energy and other savings").
THREE LAYERS, one artifact-derived truth:
EXECUTIVE -- ROI ledger + portfolio rollup + research-opps (the invest/return view)
MANAGEMENT -- feedback: gating debts, stalest lanes, debt burn, phase mix (the decide/unblock view)
OPERATIONS -- live in-progress table with ACTIVE/STALE liveness (the standup / right-now view)
ROI HONESTY BY CONSTRUCTION (operator: "not fake numbers... bad form leads to bad gains and injuries"):
every figure = a MEASURED event count (frontier D-rows, cron/daemon/tool rows, journal frames, debt
rows) x a DECLARED rate that lives as a CONFIG row in the roi- store (rule 11, no magic numbers).
The arithmetic (count x rate) is shown inline so any figure is auditable; nothing is hardcoded.
Rates absent/unseeded -> the ROI block says "unseeded (run seedroi)" and emits NO numbers (fail-closed).
Scale-law: journal read is TAIL-windowed with journal_bytes vs window_bytes DECLARED in every output.
nx_pm_dashboard seedroi [roiprefix] (idempotent: 16 rate CONFIG + 4 RESEARCH rows)
nx_pm_dashboard roi [roiprefix] [frontier] [journal] [debtprefix] (JSON: the ROI ledger, tagged)
nx_pm_dashboard exec [journal] [debtprefix] [frontier] [roiprefix] (JSON: portfolio + roi + attention)
nx_pm_dashboard page [outpath] [journal] [debtprefix] [frontier] [roiprefix] [cycleprefix] (HTML, 3 layers)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
NOTE (DRY debt, filed): the journal/debt/store scan helpers are shared in spirit with nx_ws_cycle;
extract a common nx_loop_lib.nx and import from both (avoided a mid-flight refactor of a contended organ).
dependencies 3 imports · 0 importers
imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.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
| 27 | const PD_MAGIC_2880: i64 = 2880 |
| 28 | const PD_MAGIC_30000: i64 = 30000 |
| 29 | const PD_MAGIC_7200: i64 = 7200 |
| 31 | const PD_CAP: i64 = 1048576 |
| 32 | const PD_JCAP: i64 = 1048576 |
| 33 | const PD_SEEK_SET: i64 = 0 |
| 34 | const PD_SEEK_END: i64 = 2 |
| 35 | const PD_TAB: i64 = 9 |
| 36 | const PD_NL: i64 = 10 |
| 37 | const PD_HASH: i64 = 35 |
| 38 | const PD_STDERR: i64 = 2 |
| 39 | const PD_MODE: i64 = 420 |
| 40 | const PD_SPAN: i64 = 16 |
| 41 | const PD_EXIT_USAGE: i64 = 2 |
| 348 | const R_TOOLS: i64 = 0 |
| 349 | const R_CAPDONE: i64 = 1 |
| 350 | const R_CAPTOT: i64 = 2 |
| 351 | const R_RUNGS: i64 = 3 |
| 352 | const R_CRONS: i64 = 4 |
| 353 | const R_DAEMONS: i64 = 5 |
| 354 | const R_DOPEN: i64 = 6 |
| 355 | const R_DEATEN: i64 = 7 |
| 356 | const R_GATELOGS: i64 = 8 |
| 357 | const R_BUILDH: i64 = 9 |
| 358 | const R_OPSH: i64 = 10 |
| 359 | const R_RESILH: i64 = 11 |
| 360 | const R_TOTH: i64 = 12 |
| 361 | const R_VLOW: i64 = 13 |
| 362 | const R_VHIGH: i64 = 14 |
| 363 | const R_ENERGYCC: i64 = 15 |
| 364 | const R_TOKENS: i64 = 16 |
| 365 | const R_LANES: i64 = 17 |
| 366 | const R_LDONE: i64 = 18 |
| 367 | const R_LACTIVE: i64 = 19 |
| 368 | const R_LGATED: i64 = 20 |
| 369 | const R_STALEST: i64 = 21 |
| 370 | const R_UPH: i64 = 22 |
| 371 | const R_USDHR: i64 = 23 |
| 372 | const R_USDMKT: i64 = 24 |
| 373 | const R_SEVMIN: i64 = 25 |
functions
| 43 | func pd_werr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(PD_STDERR, s, n); return 0 } |
| 44 | func pd_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 45 | func pd_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o] = s[i]; o = o + 1; i = i + 1 } return o } |
| 46 | func pd_catn(d: *u8, o: i64, v: i64) -> i64 { let t: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { m = 0 } var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { d[o] = t[k-1-i]; o = o + 1; i = i + 1 } return o } |
| 48 | func pd_cat_cc(d: *u8, o: i64, c: i64) -> i64 { var cc: i64 = c; if cc < 0 { cc = 0 } cc = cc % 100; d[o] = (48 + (cc / 10)) as u8; d[o+1] = (48 + (cc % 10)) as u8; return o + 2 } |
| 49 | func pd_cat_esc(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 called by 1: pd_emit_research |
| 58 | func pd_cat_esc_html(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 |
| 72 | func pd_read(path: *u8, buf: *u8, cap: i64, sizep: *i64) -> i64 called by 4: pd_count_noncommentpd_scan_frontierpd_computemain calls 4: sys_openat_rdsys_lseeksys_readsys_close |
| 94 | func pd_le(q: *u8, i: i64, n: i64) -> i64 { var e: i64 = i; var s: i64 = 1; while s == 1 { if e >= n { s = 0 } else { if q[e] == (PD_NL as u8) { s = 0 } else { e = e + 1 } } } return e } |
| 95 | func pd_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64 |
| 111 | func pd_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 117 | func pd_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64 |
| 123 | func pd_atoi_span(q: *u8, s: i64, e: i64) -> i64 { var v: i64 = 0; var i: i64 = s; while i < e { let c: i64 = q[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v } |
| 125 | func pd_cfg(cprefix: *u8, key: *u8, defv: i64) -> i64 |
| 144 | func pd_store_seeded(cprefix: *u8) -> i64 { let b: *u8 = sys_mmap(PD_CAP); let n: i64 = sts_load(cprefix, b, PD_CAP); if n > 0 { return 1 } return 0 } |
| 146 | func pd_starts(buf: *u8, n: i64, lit: *u8) -> i64 { var i: i64 = 0; while lit[i] != (0 as u8) { if i >= n { return 0 } if buf[i] != lit[i] { return 0 } i = i + 1 } return 1 } called by 1: main |
| 148 | func pd_count_noncomment(path: *u8) -> i64 |
| 168 | func pd_scan_frontier(path: *u8, ch: i64, totp: *i64) -> i64 |
| 188 | func pd_count_debt(dprefix: *u8, lit: *u8) -> i64 |
| 202 | func pd_count_verb(q: *u8, n: i64, verb: *u8) -> i64 |
| 213 | func pd_first_kick(q: *u8, upto: i64, ws_s: i64, ws_e: i64) -> i64 |
| 226 | func pd_has_span(q: *u8, n: i64, verb: *u8, ws_s: i64, ws_e: i64) -> i64 |
| 239 | func pd_last(q: *u8, n: i64, ws_s: i64, ws_e: i64, ons: *i64) -> i64 |
| 257 | func pd_row_legacy(q: *u8, ls: i64, le: i64, c0: *i64) -> i64 |
| 264 | func pd_scope_hits_ws(q: *u8, s: i64, e: i64, ws: *u8) -> i64 |
| 280 | func pd_debts_scoped_ws(dbuf: *u8, dn: i64, ws: *u8, sevmin: i64) -> i64 |
| 303 | func pd_lane_tally(q: *u8, n: i64, dbuf: *u8, dn: i64, sevmin: i64, now: i64, wsb: *u8, out: *i64) -> i64 |
| 375 | func pd_compute(jr: *u8, dp: *u8, fr: *u8, rp: *u8, R: *i64, roiok: *i64) -> i64 called by 1: main calls 11: pd_store_seededpd_cfgpd_count_noncommentsys_mmappd_scan_frontierpd_count_debt+5 |
| 451 | func pd_emit_roi(out: *u8, o: i64, R: *i64, roiok: i64) -> i64 |
| 496 | func pd_seedroi(prefix: *u8) -> i64 |
| 531 | func pd_emit_research(out: *u8, o: i64, rp: *u8) -> i64 |
| 554 | func main(argc: i64, argv: *i64) -> i64 |