nx_teacher_run.nx source
↩ module page · 63 lines · 4665 B
1// nx_teacher_run.nx -- run the Nishi Teacher over the curated lesson set: validate each,
2// extract cardinals + drills into the machine-readable registries, log the lessons.
3// Add a line here per new lesson (the teacher refuses any that aren't S-class). license_tier: ORIGINAL
4import "nx_syscalls.nx"
5import "nx_teacher.nx"
6import "nx_teacher_lesson.nx" // the LESSON organ (nx_teacher_ingest / nx_teacher_emit_index). The
7 // 2026-07-21 dedupe found two different organs both named nx_teacher.nx
8 // -- an autonomy-ladder sequencer and this lesson builder -- kept the
9 // ladder and deleted this. dupescan measured lost=13 of decls=13, i.e.
10 // they share ZERO symbols, so importing both cannot collide.
11
12func rp(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
13
14// truncate a registry file to empty (idempotency #10): the ingest APPENDS, so re-running without a reset
15// duplicates every lesson's rows. Reset here -> each run rebuilds the registries cleanly from the lesson set.
16func reset_reg(path: *u8) -> i64 {
17 let fd: i64 = sys_openat_wr(path, 0x1a4)
18 if fd > 0 { sys_close(fd) }
19 return 0
20}
21
22func main() -> i64 {
23 rp("NISHI TEACHER -- ingesting curated lessons\n\x00" as *u8)
24 reset_reg("knowledge/registry/nishi_lessons.tsv\x00" as *u8)
25 reset_reg("knowledge/registry/nishi_cardinals.tsv\x00" as *u8)
26 reset_reg("knowledge/registry/nishi_drills.tsv\x00" as *u8)
27 rp(" (registries reset -> rebuild clean, idempotent)\n\x00" as *u8)
28 rp("h264-bitexact-decode:\n\x00" as *u8)
29 let r: i64 = nx_teacher_ingest("knowledge/lessons/h264-bitexact-decode.md\x00" as *u8,
30 "h264-bitexact-decode\x00" as *u8, "codecs/verification\x00" as *u8)
31 if r == 0 { rp(" -> GREEN (logged to nishi_lessons/cardinals/drills.tsv)\n\x00" as *u8) }
32 if r != 0 { rp(" -> REJECTED (not S-class)\n\x00" as *u8); sys_exit(1); return 1 }
33 rp("h264-pframe-desync-hunt:\n\x00" as *u8)
34 let r2: i64 = nx_teacher_ingest("knowledge/lessons/h264-pframe-desync-hunt.md\x00" as *u8,
35 "h264-pframe-desync-hunt\x00" as *u8, "codecs/verification/tooling\x00" as *u8)
36 if r2 == 0 { rp(" -> GREEN (logged to nishi_lessons/cardinals/drills.tsv)\n\x00" as *u8) }
37 if r2 != 0 { rp(" -> REJECTED (not S-class)\n\x00" as *u8); sys_exit(1); return 1 }
38 rp("h264-deblock-test-harness-bug:\n\x00" as *u8)
39 let r3: i64 = nx_teacher_ingest("knowledge/lessons/h264-deblock-test-harness-bug.md\x00" as *u8,
40 "h264-deblock-test-harness-bug\x00" as *u8, "verification/debugging-method\x00" as *u8)
41 if r3 == 0 { rp(" -> GREEN (logged to nishi_lessons/cardinals/drills.tsv)\n\x00" as *u8) }
42 if r3 != 0 { rp(" -> REJECTED (not S-class)\n\x00" as *u8); sys_exit(1); return 1 }
43 rp("debugging-craft-bframe-traps:\n\x00" as *u8)
44 let r4: i64 = nx_teacher_ingest("knowledge/lessons/debugging-craft-bframe-traps.md\x00" as *u8,
45 "debugging-craft-bframe-traps\x00" as *u8, "debugging-craft/language/toolchain\x00" as *u8)
46 if r4 == 0 { rp(" -> GREEN (logged to nishi_lessons/cardinals/drills.tsv)\n\x00" as *u8) }
47 if r4 != 0 { rp(" -> REJECTED (not S-class)\n\x00" as *u8); sys_exit(1); return 1 }
48 rp("h264-bframe-header-sync-trap:\n\x00" as *u8)
49 let r5: i64 = nx_teacher_ingest("knowledge/lessons/h264-bframe-header-sync-trap.md\x00" as *u8,
50 "h264-bframe-header-sync-trap\x00" as *u8, "bitstream-parsing/verification\x00" as *u8)
51 if r5 == 0 { rp(" -> GREEN (logged to nishi_lessons/cardinals/drills.tsv)\n\x00" as *u8) }
52 if r5 != 0 { rp(" -> REJECTED (not S-class)\n\x00" as *u8); sys_exit(1); return 1 }
53 rp("h264-deblock-vs-recon-cordon:\n\x00" as *u8)
54 let r6: i64 = nx_teacher_ingest("knowledge/lessons/h264-deblock-vs-recon-cordon.md\x00" as *u8,
55 "h264-deblock-vs-recon-cordon\x00" as *u8, "codecs/verification/debugging-craft\x00" as *u8)
56 if r6 == 0 { rp(" -> GREEN (logged to nishi_lessons/cardinals/drills.tsv)\n\x00" as *u8) }
57 if r6 != 0 { rp(" -> REJECTED (not S-class)\n\x00" as *u8); sys_exit(1); return 1 }
58 // emit the curriculum index wiki page (the structurer; emit, never hand-write)
59 nx_teacher_emit_index("knowledge/lessons/nishi-lessons.md\x00" as *u8)
60 rp(" -> emitted knowledge/lessons/nishi-lessons.md (curriculum index for the wiki)\n\x00" as *u8)
61 sys_exit(0)
62 return 0
63}