code wiki / (root) / nx_forge_engine.nx

nx_forge_engine.nx

buildroot/runtime/nx_forge_engine.nx

6058 B140 linesdepth 8pulls 13 transitivereach 4 importersview sourcekind librarytopic forge
docsdependenciesstructsconstsfunctions

about

nx_forge_engine.nx -- THE ASSEMBLED AUTONOMOUS-CODING ENGINE v1 (pure core; CLI = nx_forge_engine_run, gate = nx_forge_engine_gate). One invocation turns a task spec into judged NishiLang code using every proven lever, in measured-lift order: STAGE 1 GREEDY + REPAIR: the gated A1 closed loop (nx_forge_loop) -- deterministic generation, byte-exact judge, verbatim-stderr re-prompt, bounded cycles. STAGE 2 BEST-OF-N SAMPLED (the Large-Language-Monkeys / dossier-N3 lever): if the loop exhausts, fan N independent sampled candidates ("temp">0, DETERMINISTIC per-sample seeds FE_SEED_BASE+k so engine runs are reproducible) against the FREE byte-exact verifier -- first GREEN wins. No repair ctx between samples (independence). Relationship to the sibling nx_forge_bestof (2026-07-16): that organ is the IN-PROCESS 1.5B bench arm (imports serve core, prefix-cache); THIS is the API-native engine stage over HTTP /gen per the operator's no-one-off-shell directive -- the serve already parses temp/top_p/ top_k/seed (gp[8..11]) so sampling needs zero serve surgery. rc: 1..7 GREEN at loop cycle N · 100+k GREEN at sample k · -40 both stages exhausted · hard errors pass through from the loop (-2/-3/-4/-22/-30/-31/-33/-34). Engine clients do NOT claim the model lane -- the DAEMON launcher owns the RAM claim (M6 law). license_tier: ORIGINAL

dependencies 1 imports · 4 importers

nx_forge_loop.nx nx_forge_engine.nx nx_forge_curves.nx nx_forge_engine_gate.nx nx_forge_engine_run.nx nx_forge_rag_ab.nx

imports: nx_forge_loop.nx

imported by: nx_forge_curves.nxnx_forge_engine_gate.nxnx_forge_engine_run.nxnx_forge_rag_ab.nx

structs

none

consts

19const FE_MAGIC_8192: i64 = 8192
20const FE_MAGIC_65536: i64 = 65536
21const FE_MAGIC_32768: i64 = 32768
22const FE_MAGIC_131072: i64 = 131072
24const FE_SEED_BASE: i64 = 11000 // reproducibility anchor: sample k posts seed BASE+k

functions

27func fe_ledger(organ: *u8, tried: i64, rc: i64) -> i64
48func fe_run(organ: *u8, taskpath: *u8, expectpath: *u8, packpath: *u8, port: i64, maxc: i64, maxnew: i64, chat: i64, nsamples: i64, temp_pm: i64) -> i64