code wiki / (root) / nx_autofix_localfix.nx

nx_autofix_localfix.nx

buildroot/runtime/nx_autofix_localfix.nx

13507 B318 linesdepth 11pulls 29 transitivereach 0 importersview sourcekind tooltopic autofix
docsdependenciesstructsconstsfunctions

about

nx_autofix_localfix.nx -- THE LOCAL MAKER TAKES STAGE 4 (2026-07-16). The proven autofix loop (nx_autofix_gate, 6/6) has ONE Claude-authored piece left: the corrected line in stage [4 FIX]. This organ runs the SAME episode -- identify -> flag -> backup -> fix -> verify -> revert -- but the fix CONTENT is GENERATED BY THE LOCAL 1.5B no-float model (i8 light init, greedy). The independent grader (fresh compile+run, CGR=<pass>) remains the ONLY judge; a model echo or a broken line simply fails [5 VERIFY] and the episode records an honest MAKER-MISS (curriculum), never a fake green. HONEST SCOPE: bug LOCALIZATION is not attempted here -- the buggy line is the known seeded one (same as the gate); what goes local in this rung is the fix GENERATION. Prompting is few-shot (two worked examples of one-line function repairs); the max2 correction itself is the model's own completion. On MAKER-GREEN it appends `CGB ts=<ts> generator=15b-autofix-localfix tasks=1 localpass=1` to the codegen bench ledger -- the autograde target `local-codegen-green` (ge 1) then grades MET from a real machine-verified artifact. Green-only: a miss writes the episode row but never a localpass row. The loop itself must stay sound either way: backup before mutation, revert proven exact at the end. exit: 0 = loop sound (maker green OR honest miss) | 1 = loop unsound (backup/revert/harness failure) license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_tool_run.nx nx_propose_verify_lib.nx nx_autofix_localfix.nx

imports: nx_tool_run.nxnx_propose_verify_lib.nx

imported by: nobody (leaf or entry point)

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

main w sys_now_realtime_sec sys_mmap sys_clock_gettime_real build_run tr_run_capture sys_mmap ↻ sys_pipe2 sys_fork sys_close sys_dup3 sys_execve_clean sys_close ↻ sys_execve sys_exit sys_read sys_wait4 wait_exit_code find_last slen digit_at wn w ↻ bcat bcatn append_line sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read ↻ sys_close ↻ sys_openat_wr copyfile sys_read_file ↻ sys_openat_wr ↻ nsv_init_i8 nsv_init sys_now_ms

structs

none

consts

20const K_MAGIC_131072: i64 = 131072
21const K_MAGIC_262144: i64 = 262144
22const K_MAGIC_4000: i64 = 4000
23const K_MAGIC_1048576: i64 = 1048576
24const K_MAGIC_4096: i64 = 4096

functions

26func w(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 2: wnmain
27func wn(v: i64) -> i64
called by 1: main calls 1: w
40func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
42func find_first(hay: *u8, hn: i64, needle: *u8, from: i64) -> i64
called by 2: apply_fixmain calls 1: slen
55func find_last(hay: *u8, hn: i64, needle: *u8) -> i64
called by 1: build_run calls 1: slen
69func digit_at(hay: *u8, hn: i64, p: i64) -> i64
called by 1: build_run
75func bcat(b: *u8, off: i64, s: *u8) -> i64
called by 1: main
81func bcatn(b: *u8, off: i64, v: i64) -> i64
called by 1: main
94func build_run(name: *u8, out: *u8, cap: i64) -> i64
108func copyfile(srcp: *u8, dstp: *u8) -> i64
called by 1: main calls 2: sys_read_filesys_openat_wr
119func apply_fix(path: *u8, finds: *u8, repls: *u8) -> i64
143func append_line(path: *u8, line: *u8, ln: i64) -> i64
called by 1: main calls 2: sys_read_filesys_openat_wr
159func lf_gen(pb: *u8, plen: i64, tx: *u8, mt: *i64, max_new: i64) -> i64
called by 1: main calls 1: nsv_generate
177func main(argc: i64, argv: *i64) -> i64