code wiki / _hdl_build / _ale_plan_gate.nx
_ale_plan_gate.nx
buildroot/runtime/_hdl_build/_ale_plan_gate.nx
about
_ale_plan_gate.nx -- the ALE-R2a gate: sovereign agent-core PLAN-phase organ.
Diff-lane / no-mocks: runs the REAL sovereign planner nx_ale_plan.elf (built by
nx_cc_sovereign->nxasm_x86_main, NO gcc) over REAL ALE-format task fixtures and asserts:
(1) INGEST -- over task_good the organ emits a PLAN file of ordered
"step|<n>|<verb>|<arg>" lines (>=3 step lines, all step|-prefixed)
(2) ORDERED -- the emitted step numbers are exactly 1,2,3 contiguous (no gaps)
(3) GROUNDED -- every step's <arg> equals a task field VALUE present in the spec
(each plan arg appears in the task spec as a "task|<field>|<arg>"
value-tail line -> no step references a field the spec didn't declare)
(4) ARTIFACT-TERMINAL -- the FINAL step is write_artifact and its <arg> is the task's
declared artifact_path value (the plan aims at the scored deliverable)
(5) DETERMINISTIC -- two consecutive runs on the SAME spec emit BYTE-IDENTICAL plans
(6) TAMPER REJECTED -- over task_missing_artifact (no artifact_path) the organ REFUSES:
child exits NON-ZERO and writes NO plan (the grounding check bites,
negative control mirroring the nondet-stub tamper in _ale_grade_gate)
Evidence -> knowledge/status/ale_plan.log (ALEPLANGATE row; the queue row's ||MARK= reads it).
Sovereign orchestration (fork/dup3/execve/wait4). The planner's purity (no clock/rand) IS the
oracle: a pure grounded decomposer needs no external oracle, exactly as ALE-R1a established.
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 22 | func g_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 23 | func g_fp(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 24 | func g_fn(fd: i64, v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { m = 0 - m }; let t: *u8 = sys_mmap(28); var k: i64 = 0; if m == 0 { t[0] = 48; k = 1 }; while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }; var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 }; sys_write(fd, bb, k); return 0 } |
| 27 | func g_run_plan(task: *u8, planout: *u8) -> i64 |
| 48 | func g_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 62 | func g_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 65 | func g_match(buf: *u8, n: i64, pos: i64, pat: *u8, pl: i64) -> i64 |
| 73 | func g_is_bol(buf: *u8, pos: i64) -> i64 |
| 80 | func g_count_prefix(buf: *u8, n: i64, prefix: *u8) -> i64 |
| 94 | func g_files_eq(pa: *u8, pb: *u8) -> i64 |
| 109 | func g_step_num_present(buf: *u8, n: i64, num: i64) -> i64 |
| 142 | func g_step_arg(buf: *u8, n: i64, num: i64, out: *u8, cap: i64) -> i64 |
| 193 | func g_arg_in_task(tbuf: *u8, tn: i64, arg: *u8) -> i64 |
| 222 | func main() -> i64 |