code wiki / _hdl_build / nx_unified_conductor.nx

nx_unified_conductor.nx

buildroot/runtime/_hdl_build/nx_unified_conductor.nx

15635 B221 linesdepth 8pulls 15 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_unified_conductor.nx -- THE UNIFIED AUTONOMY-LOOP CONDUCTOR: warden-gated AND resource-governed AND closing REPORT->LOG-NEXT, in ONE beat. Resolves the "two loop drivers" incoherence found by nx_loop_census: nx_conductor_live (runtime/) = WARDEN-gated but FIXED cadence (ungoverned = the 20fps-hard-cap anti-pattern) nx_governed_autoloop (_hdl_build/) = RESOURCE-governed but NOT warden-gated This composes BOTH proven halves + my REPORT->LOG-NEXT bridge into one canonical cycle. Lives in _hdl_build/ because (empirically proven by nx_import_probe, Rule 2) a _hdl_build/ organ CAN import both _hdl_build/ organs (the governor) AND runtime/ organs (the warden + eval-queue) -- so no governor is inline-duplicated (which would be the copy-paste anti-pattern this project's own catalog forbids). EACH BEAT: SENSE host (nx_sysload) -> GOVERN (nx_resource_governor: run only if the polite budget is free, else AIMD back off) -> if free, WARDEN-gate the action (nx_warden_lib: ALLOW additive, DENY a source overwrite -- proving the cardinal gate is live) -> if allowed, do a bounded REPORT->LOG-NEXT (queue an evaluator gap via nx_eval_queue, additive to an isolated store). Journals each beat. SAFE BY CONSTRUCTION: BOUNDED beats (UC_BEATS, testable -- NOT the unbounded daemon; that stays a deliberate later flip), ADDITIVE only (writes an isolated eval-gaps queue + a journal, never a source file -- the warden DENIES that), resource-POLITE (yields to live serving + backs off over the load ceiling), NO Claude in the loop. Also demonstrates the BACK-OFF path at a simulated-busy load (politeness proven, not asserted). license_tier: ORIGINAL genealogy_id: operator-2026-07-03-ultimate-loop + unify(nx_conductor_live, nx_governed_autoloop) lineage_id: nishi_unified_conductor_v1 expect_exit: 0

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_sysload.nx nx_resource_governor.nx nx_warden_lib.nx nx_council_gate.nx nx_eval_queue.nx nx_win_ledger.nx nx_unified_conductor.nx

imports: nx_syscalls.nxnx_sysload.nxnx_resource_governor.nxnx_warden_lib.nxnx_council_gate.nxnx_eval_queue.nxnx_win_ledger.nx

imported by: nobody (leaf or entry point)

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

main uc_puts sys_write nx_win_ledger_new sys_mmap nx_blob_store_new sys_mmap ↻ nx_journal_log_new sys_mmap ↻ nx_eval_queue_count sys_mmap ↻ ss_get sys_mmap ↻ ss_scan sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn sys_mmap ↻ ss_cat ss_readall sys_munmap ss_scan_seglist ss_len sys_mmap ↻ ss_cat ↻ ss_readall ↻ ss_r32 EQ_PREFIX uc_putn sys_write ↻ sys_mmap ↻ sl_ncpu sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sl_count_substr

structs

none

consts

28const UC_MAGIC_4096: i64 = 4096
30const UC_BEATS: i64 = 3 // bounded/testable; unbounded daemon = a deliberate later config flip
31const UC_CEIL_MILLI: i64 = 800 // polite ceiling: back off when load > 0.8 core/cpu (HPA-style headroom)
32const UC_MEM_FLOOR_MB: i64 = 256
33const UC_JOURNAL: *u8 = "knowledge/status/unified_conductor.log\x00"

functions

35func uc_puts(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 calls 1: sys_write
36func uc_putn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
45func uc_file_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
51func uc_fire_research(url: *u8, name: *u8) -> i64
70func uc_fire_god_cycle() -> i64
86func uc_budget(ncpu: i64, load: i64, freemb: i64, conns: i64) -> i64
93func main() -> i64