code wiki / (root) / nx_substrate_evolve.nx

nx_substrate_evolve.nx

buildroot/runtime/nx_substrate_evolve.nx

20464 B506 linesdepth 5pulls 9 transitivereach 0 importersview sourcekind tooltopic substrate
docsdependenciesstructsconstsfunctions

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

syscalls.nx runtime.nx nx_axioms.nx nx_dirent.nx nx_fcntl.nx nx_lex.nx nx_ascii.nx nx_substrate_evolve.nx

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

main ev_collect_modules nx_openat nx_dirent_read nx_dirent_iter nx_dirent_name_len ev_name_matches ev_module_from_filename println strlen strlen ↻ ev_scan_header sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close strlen ↻ strneq ev_line_contains strlen ↻ strneq ↻ ev_assign_generations ev_emit_generation print strlen ↻ print_i64 itoa println ↻ print ↻ print_i64 ↻

structs

55struct EvolveRecord

consts

48const NX_EV_MAX_FILES: i64 = 400
49const NX_EV_MAX_IMPORTS: i64 = 32
50const NX_EV_MAX_NAME: i64 = 96
51const NX_EV_RECORD_BYTES: i64 = 56 // 7 i64 fields
52const NX_EV_DIR_BUF: i64 = 16384
53const NX_EV_GEN_UNKNOWN: i64 = -1

functions

67func ev_name_matches(name: *u8, name_len: i64) -> i64
called by 1: ev_collect_modules
93func ev_module_from_filename(name: *u8, name_len: i64, out: *u8) -> i64
called by 1: ev_collect_modules
113func ev_line_contains(buf: *u8, start: i64, end: i64, needle: *u8) -> i64
called by 1: ev_scan_header calls 2: strlenstrneq
125func ev_scan_header(file_path: *u8, rec: *EvolveRecord,
258func ev_collect_modules(dir_path: *u8, all_modules: *u8, n_out: *i64) -> i64
302func ev_assign_generations(records: *EvolveRecord, n_records: i64,
called by 1: main
353func ev_emit_generation(records: *EvolveRecord, n_records: i64, gen: i64) -> i64
called by 1: main calls 3: printprint_i64println
421func main() -> i64