nx_forge_loop.nx
buildroot/runtime/nx_forge_loop.nx
about
nx_forge_loop.nx -- FORGE A1: the CLOSED maker-checker loop (the little-coder +18% retry lever).
fg_run (rung 1, gated) judges pre-written candidate FILES -- the model seam is open. This organ
closes it: per cycle the MODEL produces the candidate over the sovereign serve's POST /gen
("chat" body key = ChatML, serve-core slot-collision fix 2026-07-15; 100%-sovereign CPU path per
the C-purge law), and on any failure the NEXT cycle re-prompts WITH the banked VERBATIM
toolchain output (compiler stderr / run output / got-bytes) via fm_compose_prompt's repair arm.
flp_run rc map: >0 GREEN at cycle N; -2 task unreadable; -3 compose fail at cycle 1 (pack
unreadable); -33 compose fail at cycle >1 (repair-ctx growth overflowed the prompt cap);
-4 expect unreadable; -21 cycle bound exhausted; -22 bad organ name; -30 model POST failed
(fail-loud, NO silent fallback); -31 no "text" in serve reply; -34 candidate write failed.
Repair ctx = /tmp/forge_loop_ctx.txt (OWN file; fg_run's /tmp/forge_repair_ctx.txt untouched so
driver and loop can run concurrently), truncated per failing cycle = exactly the LAST failure.
Ledger = the same append-only forge ledger (every GREEN row = a compile-verified N7 example).
ADDITIVE: nx_forge.nx / nx_forge_model.nx are gated and unmodified; this composes their publics.
SAMPLING KNOBS (2026-07-16, for the engine's best-of-N stage): bp[24]=temp_pm bp[25]=seed --
when temp_pm>0 the /gen body gains "temp"/"seed" keys (serve parses them, gp[8]/gp[11]);
zero-default = byte-identical body to the gated greedy behavior (loop gate re-proven).
license_tier: ORIGINAL
dependencies 1 imports · 5 importers
imports: nx_forge_model.nx
imported by: nx_forge_engine.nxnx_forge_loop_gate.nxnx_forge_loop_run.nxnx_gen_pfx_live_gate.nxnx_seat_warm.nx
structs
| none |
consts
| none |
functions
| 22 | func flp_build_gen_body(prompt: *u8, plen: i64, max_new: i64, mode: i64, chat: i64, out: *u8) -> i64 |
| 36 | func flp_splice_sampling(body: *u8, blen: i64, temp_pm: i64, seedv: i64) -> i64 |
| 54 | func flp_cycle(bp: *i64) -> i64 |
| 170 | func flp_run(organ: *u8, taskpath: *u8, expectpath: *u8, packpath: *u8, port: i64, maxc0: i64, maxnew: i64, chat: i64) -> i64 |