nx_substrate_evolve.nx
buildroot/runtime/nx_substrate_evolve.nx
about
nx_substrate_evolve.nx -- generational substrate audit + watch-list.
Walks the substrate as evolutionary generations:
Gen 0 -- "God" : axioms (nx_axioms.nx, NX_AX_* constants)
Gen 1 -- "Adam" : foundational primitives that depend only
on syscalls + axioms (runtime.nx, nx_ascii.nx,
nx_dirent.nx, nx_fcntl.nx, ...)
Gen 2..N -- "Children": primitives whose only-import frontier sits
in earlier generations.
For each generation we emit:
- members (the .nx files at this generation)
- genealogy completeness (% with genealogy_id + lineage_id + axioms)
- the WATCH LIST for the next generation: gaps / duplicates /
queued items that the NEXT gen must address.
This makes the algorithm-evolving loop a generational lineage:
Gen N inherits axioms from God, builds on Gen N-1, and emits
concrete obligations for Gen N+1.
Output JSONL to stdout:
{"gen":N,"members":[...],"complete":K,"total":M,
"watch_next":[{"kind":"...","what":"..."}, ...]}
{"summary":true,"n_generations":N,"total_files":M, ...}
genealogy_id: dawkins_1976_meme + kuhn_1962_paradigm
+ classical_topological_sort
lineage_id: generational_lineage_audit
axioms: NX_AX_ORD_LEAST_UPPER_BOUND (generation number is well-
defined: smallest n such that all deps are in Gen < n)
+ NX_AX_REL_TRANSITIVITY (depends-on is transitive)
dependencies 7 imports · 0 importers
imports: syscalls.nxruntime.nxnx_axioms.nxnx_dirent.nxnx_fcntl.nxnx_lex.nxnx_ascii.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 55 | struct EvolveRecord |
consts
| 48 | const NX_EV_MAX_FILES: i64 = 400 |
| 49 | const NX_EV_MAX_IMPORTS: i64 = 32 |
| 50 | const NX_EV_MAX_NAME: i64 = 96 |
| 51 | const NX_EV_RECORD_BYTES: i64 = 56 // 7 i64 fields |
| 52 | const NX_EV_DIR_BUF: i64 = 16384 |
| 53 | const NX_EV_GEN_UNKNOWN: i64 = -1 |
functions
| 67 | func ev_name_matches(name: *u8, name_len: i64) -> i64 called by 1: ev_collect_modules |
| 93 | func ev_module_from_filename(name: *u8, name_len: i64, out: *u8) -> i64 called by 1: ev_collect_modules |
| 113 | func ev_line_contains(buf: *u8, start: i64, end: i64, needle: *u8) -> i64 |
| 125 | func ev_scan_header(file_path: *u8, rec: *EvolveRecord, |
| 258 | func ev_collect_modules(dir_path: *u8, all_modules: *u8, n_out: *i64) -> i64 |
| 302 | func ev_assign_generations(records: *EvolveRecord, n_records: i64, called by 1: main |
| 353 | func ev_emit_generation(records: *EvolveRecord, n_records: i64, gen: i64) -> i64 |
| 421 | func main() -> i64 |