code wiki / (root) / nx_cc_guardian.nx

nx_cc_guardian.nx

buildroot/runtime/nx_cc_guardian.nx

5879 B148 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic cc
docsdependenciesstructsconstsfunctions

about

nx_cc_guardian.nx -- SOVEREIGN AUTONOMOUS compiler-health guardian. A Nishi role-program (like nx_doctor), NOT a Claude actor. It owns its loop: ENGINEER-measures -- compile a high-register-pressure CANARY with the active compiler under a deadline (nx_run_timeout). known-good does it in <1s; >10s == poisoned (loop/pathological). DOCTOR-heals -- if active is poisoned AND the pinned known-good is healthy, autonomously swap known-good -> active (sovereign file copy, raw syscalls). ENGINEER-verifies -- re-measure the active; confirm it is now healthy. journals -- append the verdict (the regression-guard's honest trail). This is the "Claude moves away from being the hands" step: the ecosystem keeps its own substrate (the compiler) sound, autonomously. The durable root-fix of the homing slowdown remains a Builder improvement; this is the standing self-heal that keeps every Nishi project building meanwhile. Composes runtime/nx_run_timeout.nx (the hang-detector). Sovereign: zero deps. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_run_timeout.nx nx_cc_guardian.nx

imports: nx_run_timeout.nx

imported by: nobody (leaf or entry point)

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

main g_puts g_measure nx_run_timeout sys_now_ms sys_mmap sys_clock_gettime_mono sys_fork sys_openat_wr sys_dup3 nx_rt_alarm sys_execve sys_exit sys_mmap ↻ sys_wait4 wait_exit_code g_putn g_journal sys_openat_append g_heal sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_openat_wr ↻ g_write_all

structs

none

consts

23const G_ACTIVE: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/_offc/nx_compile_x86_native.elf"
24const G_KNOWN_GOOD: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/_offc/nx_cc_known_good.elf"
25const G_CANARY: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/runtime/nx_slice_contour.nx"
26const G_JOURNAL: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/_offc/nx_cc_guardian_journal.tsv"
27const G_CANARY_TIMEOUT_MS: i64 = 10000 // known-good <1s; >10s = poisoned
28const G_MODE_EXEC: i64 = 493 // 0o755
29const G_MODE_FILE: i64 = 420 // 0o644

functions

31func g_puts(s: *u8) -> i64
called by 1: main
37func g_putn(n: i64) -> i64
called by 1: main
49func g_journal(status: *u8) -> i64
called by 1: main calls 1: sys_openat_append
62func g_measure(compiler: *u8, elapsed_out: *i64) -> i64
called by 1: main calls 1: nx_run_timeout
73func g_write_all(fd: i64, buf: *u8, len: i64) -> i64
called by 1: g_heal
85func g_heal() -> i64
100func main() -> i64