code wiki / _hdl_build / nx_ws_ingest_live.nx

nx_ws_ingest_live.nx source

↩ module page · 39 lines · 1969 B

1// nx_ws_ingest_live.nx -- the LIVE runnable driver for the WMS derive-from-SSOT ingest (2026-07-17). 2// The original runner (nx_ws_ingest_run) is DRYRUN-scratch-only and its source was lost in the tree 3// deletions -- so the live path had no driver. This wires the PROVEN lib `wsi_ingest` (nx_ws_ingest, 4// gate-backed): scan every project-*.md in memdir, ws_put each into the LIVE registry (WS_PREFIX = 5// knowledge/store/ws-) in one snapshot/one-writer/one-commit, idempotent (re-runs add zero segments, 6// byte-compare skip), NON-clobbering (scans the FULL set so ws:ids stays comprehensive). Additive-only. 7// usage: nx_ws_ingest_live [memdir] default memdir = the Claude memory tree. 8// exit: 0 ok | 1 hard ingest error. license_tier: ORIGINAL 9import "nx_ws_ingest.nx" 10 11func liv_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 12func liv_putn(v: i64) -> i64 { 13 var m: i64 = v 14 if m < 0 { liv_puts("-" as *u8); m = 0 - m } 15 let t: *u8 = sys_mmap(24) 16 var k: i64 = 0 17 if m == 0 { t[0] = 48 as u8; k = 1 } 18 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 19 let o: *u8 = sys_mmap(24) 20 var i: i64 = 0 21 while i < k { o[i] = t[k - 1 - i]; i = i + 1 } 22 sys_write(1, o, k) 23 return 0 24} 25 26func main(argc: i64, argv: *i64) -> i64 { 27 var memdir: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder/memory" as *u8 28 if argc >= 2 { memdir = argv[1] as *u8 } 29 let out4: *i64 = sys_mmap(64) as *i64 30 let rc: i64 = wsi_ingest(memdir, out4) 31 liv_puts("WS-INGEST-LIVE prefix=knowledge/store/ws- scanned=" as *u8); liv_putn(out4[0]) 32 liv_puts(" registered_new=" as *u8); liv_putn(out4[1]) 33 liv_puts(" skipped=" as *u8); liv_putn(out4[2]) 34 liv_puts(" errors=" as *u8); liv_putn(out4[3]) 35 liv_puts(" rc=" as *u8); liv_putn(rc) 36 if rc < 0 { liv_puts(" verdict=ERROR\n" as *u8); return 1 } 37 liv_puts(" verdict=OK\n" as *u8) 38 return 0 39}