code wiki / _hdl_build / nx_prodladder.nx
nx_prodladder.nx
buildroot/runtime/_hdl_build/nx_prodladder.nx
about
nx_prodladder.nx -- SOVEREIGN PRODUCTION-CAPABILITY LADDER (rent -> lease -> buy -> enterprise).
Operator, 2026-08-06: "when we get these production capabilities up for these products first
rent then buy or cheap then enterprise ... lets get it a reusable process."
WHY THIS ORGAN EXISTS. The estate can already price a SHIPMENT (nx_landed_cost, 15/15 GREEN) and
score a PRODUCT (nx_product_score). It could not answer the question that actually gates a
physical product: AT WHAT VOLUME DOES IT STOP BEING RIGHT TO RENT AND START BEING RIGHT TO BUY?
Searched before building -- nx_prim_query over 855 registered primitives returns 0 matches for
`capex` and `tooling`, and `production` returns only e-discovery gates. The rung was missing.
THE MODEL. Every acquisition tier is the same shape -- a one-time cost amortised over its life,
a standing annual cost, and a per-unit cost -- so tiers are COMPARABLE and the ladder is just
argmin over them at a given volume:
annual(V) = (capex + tooling) / life_years + fixed_annual + per_unit * V
The step-up point between two tiers is where those lines cross:
V* = ceil( (standingA - standingB) / (per_unitB - per_unitA) ) for per_unitA > per_unitB
That crossover IS the reusable process: it turns "when do we buy the machine?" from a judgement
call into an arithmetic one, and it is the SAME arithmetic for a rubber dog ball, an injection
moulded enclosure, or a PCB run. The ladder is generic; only the plane rows are product-specific.
INTEGER-EXACT, NO FLOAT (sovereign law): money in CENTS, volumes in UNITS. Every figure is a pure
integer transform of the inputs -- reproducible and hand-checkable, no rounding drift.
★★THE TIER ECONOMICS ARE DATA, NOT CODE. They live in the seg-store plane
`knowledge/store/prodladder-`, one row per <process>_<tier>. Adding a process is a plane write
(nx_store_put), never a reship -- rule 11, no magic numbers buried in a binary.
★★★AND IF THE PLANE HAS NO ROW, THIS ORGAN REFUSES. It does NOT fall back to a plausible
default. A capex ladder that invents its own capex is worse than no ladder at all: it produces a
confident break-even volume that someone will spend real money against. nx_product_score already
states the estate's law -- "NO fabricated market/cost figures here (operator no-fake-numbers
law)" -- and a refusal is the only honest answer to a question we lack the data to answer.
The selftest therefore proves the ARITHMETIC on clearly-labelled SYNTHETIC fixtures, and proves
the REFUSAL on a process the plane does not carry. Fixtures prove math; the plane carries facts.
PLANE ROW (TAB-separated, field 0 = key):
<process>_<tier> <tier_name> <capex_c> <tooling_c> <fixed_annual_c> <per_unit_c>
<life_years> <max_annual_units|0=unbounded> <note>
tier suffixes, cheap -> enterprise: _t0 rent/service-bureau _t1 lease _t2 buy _t3 line
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_seg_store.nxnx_store_seed_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
| 50 | const PL_MAGIC_4000000: i64 = 4000000 |
| 51 | const PL_MAGIC_1200000: i64 = 1200000 |
| 52 | const PL_MAGIC_600000: i64 = 600000 |
| 53 | const PL_MAGIC_1640000: i64 = 1640000 |
| 54 | const PL_MAGIC_800000: i64 = 800000 |
| 55 | const PL_MAGIC_1760000: i64 = 1760000 |
| 56 | const PL_MAGIC_10000: i64 = 10000 |
| 57 | const PL_MAGIC_8000000: i64 = 8000000 |
| 58 | const PL_MAGIC_2840000: i64 = 2840000 |
| 59 | const PL_MAGIC_2412: i64 = 2412 |
| 60 | const PL_MAGIC_5000: i64 = 5000 |
| 61 | const PL_MAGIC_6000: i64 = 6000 |
| 62 | const PL_MAGIC_500000: i64 = 500000 |
| 63 | const PL_MAGIC_1500: i64 = 1500 |
| 65 | const PL_REGBUF: i64 = 65536 |
| 66 | const PL_OUTBUF: i64 = 16384 |
| 67 | const PL_KEYBUF: i64 = 256 |
| 68 | const PL_FLDBUF: i64 = 256 |
| 69 | const PL_NTIER: i64 = 4 |
| 70 | const PL_INFEAS: i64 = 0 - 1 // tier cannot serve this volume (capacity ceiling) |
| 71 | const PL_NOROW: i64 = 0 - 2 // plane carries no row for this process_tier |
functions
| 73 | func plw(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 75 | func pl_eq(a: *u8, b: *u8) -> i64 called by 1: main |
| 82 | func pl_atoi(s: *u8) -> i64 |
| 95 | func pl_lit(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o + i] = s[i]; i = i + 1 } return o + i } |
| 96 | func pl_num(out: *u8, o: i64, v: i64) -> i64 |
| 110 | func pl_field0_eq(buf: *u8, n: i64, rs: i64, key: *u8) -> i64 called by 1: pl_field |
| 123 | func pl_extract(buf: *u8, n: i64, rs: i64, idx: i64, out: *u8, outcap: i64) -> i64 called by 1: pl_field |
| 144 | func pl_field(buf: *u8, n: i64, key: *u8, idx: i64, out: *u8, outcap: i64) -> i64 |
| 160 | func pl_load(rbuf: *u8) -> i64 { return sts_load("knowledge/store/prodladder-" as *u8, rbuf, PL_REGBUF) } |
| 163 | func pl_mkkey(process: *u8, suffix: *u8, out: *u8) -> i64 called by 1: pl_row |
| 173 | func pl_tier_suffix(t: i64) -> *u8 called by 1: pl_row |
| 186 | func pl_standing(capex_c: i64, tooling_c: i64, fixed_annual_c: i64, life_years: i64) -> i64 |
| 195 | func pl_annual(capex_c: i64, tooling_c: i64, fixed_annual_c: i64, per_unit_c: i64, |
| 206 | func pl_breakeven(standingA: i64, per_unitA: i64, standingB: i64, per_unitB: i64) -> i64 |
| 218 | func pl_row(rbuf: *u8, rn: i64, process: *u8, tier: i64, box: *i64, name: *u8, namecap: i64) -> i64 |
| 234 | func pl_calc(process: *u8, vol: i64) -> i64 |
| 309 | func pl_ramp(process: *u8, vols: *i64, nv: i64) -> i64 |
| 410 | func pl_chk(name: *u8, got: i64, want: i64, st: *i64) -> i64 |
| 423 | func pl_selftest() -> i64 |
| 506 | func main(argc: i64, argv: *i64) -> i64 |