code wiki / (root) / nx_spendgate.nx

nx_spendgate.nx

buildroot/runtime/nx_spendgate.nx

8418 B177 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_spendgate.nx -- ASK BEFORE YOU SPEND. The gate between "I should build X" and building X. WHY IT EXISTS. On 2026-08-07 I built `nx_strdiff` when `nx_contentdiff` already existed and did the same job better, wrote `ss_khash` when `nx_web_shard_compact` already carried the identical hash dedup, and ran a 649-row `nx_stalecensus` that DUPLICATED a sibling seat's completed run -- the third of those saturated the mgmt API for ~25 minutes and bought nothing. Every one of those was preventable by a single query against tooling that already existed and worked. ★★★★★★"I DIDN'T KNOW IT EXISTED" IS A RETRIEVAL FAILURE, NOT A DISCOVERY. A line in a doc did not stop me. An exit code is branched on; an advisory is skipped. COMPOSES THE INCUMBENTS, never reimplements them (building a fourth duplicate to prevent duplicates would be its own punchline): nx_presubmit <name> -- is the NAME taken or dual-copied? MECHANICAL, decidable nx_capsearch <intent words> -- what already does something like this? RANKED, NOT decidable ⛔WHY THERE IS NO SIMILARITY THRESHOLD, AND WHY ADDING ONE WOULD BE A LIE. Measured over four queries whose ground truth I knew, because I had just lived each one: DUPLICATE (nx_contentdiff existed) top=nx_route_diff score=499998 NOVEL (fixture ratchet) top=nx_govern_sweep score=421048 DUPLICATE (nx_capsearch existed) top=nishi_search score=470584 NOVEL (no pre-spend gate) top=nx_adnet_recbeat score=500000 <-- HIGHEST OF ALL FOUR The highest score in the set belongs to a NOVEL case, and in BOTH duplicate cases the true incumbent ranked SECOND, not first. Any cutoff would have blocked the novel work and waved the duplicates through -- the precise inversion of the tool's purpose. ★★★★★★A RULER THAT SCORES A NOVEL THING HIGHEST OF ALL CANNOT BE THRESHOLDED -- PUBLISH THE LIST, NOT A VERDICT. ★★★★★TOP-1 IS NOT THE ANSWER; THE LIST IS. So this gate automates ONLY what is mechanically decidable and REFUSES to synthesise the rest. It prints the candidates and makes you look. That is the honest maximum. It does NOT create anything. A gate that performs the act it authorises cannot be re-run to audit its own decision -- the same rule nx_adoptgate states for promotion. nx_spendgate <proposed-name> <intent words...> -> SPEND-GATE name=<n> presubmit=FREE|TAKEN verdict=REVIEW|BLOCKED exit 0 REVIEW (name is free; READ the candidates before spending) | 1 BLOCKED (name taken) | 3 usage license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_tool_run.nx nx_spendgate.nx

imports: nx_tool_run.nx

imported by: nobody (leaf or entry point)

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

main sgp tr_run_capture_cwd tr_run_capture_core tr_run_capture_core_owned tr_run_capture_core_eviden sys_mmap_shared tr_clock_ms sys_clock_gettime_mono sys_munmap sys_pipe2 sys_fork sys_close sys_default_signal sys_mmap sys_bind_parent_lifetime sys_prctl sys_exit sys_setpgid tr_capture_redirect sys_dup3 sys_chdir sys_mmap ↻ sys_close_inherited sys_close_inherited_proc sys_execve tr_exec_failed sys_write sys_exit ↻ tr_watchdog_start sys_mmap ↻ sys_pipe2 ↻ sys_munmap ↻ sys_fork ↻ tr_watchdog_child sys_exit ↻ sys_close ↻ tr_drain_until nx_kill tr_reap

structs

none

consts

39const SG_HOST: *u8 = "/volume1/homes/elderwesto/nishihost"
40const SG_PRESUB: *u8 = "/volume1/homes/elderwesto/nishihost/nx_presubmit.elf"
41const SG_CAPSEARCH: *u8 = "/volume1/homes/elderwesto/nishihost/nx_capsearch.elf"
42const SG_CAP: i64 = 262144
43const SG_TMO: i64 = 60000
44const SG_AVCAP: i64 = 512

functions

46func sgp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main
47func sgw(b: *u8, n: i64) -> i64 { sys_write(1, b, n); return 0 }
called by 1: main
52func sgfind(buf: *u8, n: i64, ndl: *u8) -> i64
called by 1: main
70func main(argc: i64, argv: *i64) -> i64