code wiki / (root) / nx_forge.nx

nx_forge.nx

buildroot/runtime/nx_forge.nx

13125 B327 linesdepth 4pulls 4 transitivereach 25 importersview sourcekind librarytopic forge
docsdependenciesstructsconstsfunctions

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

nx_forge_ctx.nx nx_forge.nx nx_forge_bestof.nx nx_forge_cascade.nx nx_forge_gate.nx nx_forge_local_bench.nx nx_forge_model.nx nx_forge_mp_bench.nx nx_forge_repair.nx nx_forge_run.nx

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

17const K_MAGIC_16384: i64 = 16384
18const K_MAGIC_65536: i64 = 65536
19const K_MAGIC_131072: i64 = 131072

functions

23func fg_wdec(fd: i64, v: i64) -> i64
31func fg_mkpath(prefix: *u8, name: *u8, suffix: *u8, out: *u8) -> i64
called by 3: fg_runfe_runflp_run
44func fg_spawn(outpath: *u8, av: *i64, envp: *i64, st: *i64) -> i64
65func fg_bank(fd: i64, hdr: *u8, src: *u8, tmp: *u8, cap: i64) -> i64
called by 2: fg_runflp_cycle calls 3: fc_wsfc_readfc_wb
73func fg_run(specpath: *u8) -> i64