nx_forge.nx
buildroot/runtime/nx_forge.nx
about
nx_forge.nx -- FORGE F3 rung 1: the autonomous-coding DRIVER core (pure lib, no main; CLI =
nx_forge_run, gate = nx_forge_gate). Runs one task spec through the full harness loop:
spec -> candidate source -> literal-ban check (anti-hardcode, pre-build) -> write
runtime/<organ>.nx -> sovereign lane --build-only (fork+execve, verbatim compiler output
banked to the repair context on failure) -> run the built elf with stdout captured ->
BYTE-EXACT judge vs expected bytes -> bounded repair cycles (ACT cap 7) -> append-only
FORGE LEDGER row (knowledge/forge/forge_ledger.txt -- every GREEN = a compile-verified
training example, the N7 hook).
Rung 1 backend = candidate FILES (the gate's fixture model); rung 2 plugs model calls
(:11434 local serve + Claude API) into the same loop -- the judge/repair mechanics are
identical and are what this rung proves.
Spec row: FTASK|<organ>|<expect-bytes-file>|<ban-csv-or-none>|<cand1,cand2,...>|<maxcycles>
fg_run returns: >0 success-at-cycle-N; -2 spec unreadable; -3 no FTASK row; -4 expect
unreadable; -20 candidates exhausted; -21 max-cycles hit; -22 bad organ name.
license_tier: ORIGINAL
dependencies 1 imports · 8 importers
imports: nx_forge_ctx.nx
imported by: nx_forge_bestof.nxnx_forge_cascade.nxnx_forge_gate.nxnx_forge_local_bench.nxnx_forge_model.nxnx_forge_mp_bench.nxnx_forge_repair.nxnx_forge_run.nx
structs
| none |
consts
| 17 | const K_MAGIC_16384: i64 = 16384 |
| 18 | const K_MAGIC_65536: i64 = 65536 |
| 19 | const K_MAGIC_131072: i64 = 131072 |
functions
| 23 | func fg_wdec(fd: i64, v: i64) -> i64 |
| 31 | func fg_mkpath(prefix: *u8, name: *u8, suffix: *u8, out: *u8) -> i64 |
| 44 | func fg_spawn(outpath: *u8, av: *i64, envp: *i64, st: *i64) -> i64 |
| 65 | func fg_bank(fd: i64, hdr: *u8, src: *u8, tmp: *u8, cap: i64) -> i64 |
| 73 | func fg_run(specpath: *u8) -> i64 |