code wiki / _hdl_build / nx_work_retro_lib.nx
nx_work_retro_lib.nx
buildroot/runtime/_hdl_build/nx_work_retro_lib.nx
about
nx_work_retro_lib.nx -- the PAST axis: a retroactive sweep that COVERS WHAT WAS MISSED. It walks
the active organ dir, and for every .nx cross-checks whether its name is ACCOUNTED FOR anywhere in
the durable record (any memory doc *.md + the live worklog). A RECENT organ that appears NOWHERE is
FLAGGED as a candidate uncaptured workstream -- exactly the class the 2026-06-18 hand sweep found
(5 arcs with no memory file). LIAR-KILL by construction: unaccounted recent work is never silently
dropped, it is surfaced. The recency gate stops the sweep from drowning in long-settled helper
organs (only fresh, unrecorded work is a real loss).
REUSE (DRY): the getdents64 + fstatat(mtime@88) walk, bounded file read, and substring find are the
proven nx_ws_index_lib primitives (wme_getdents/wme_read/wme_find/wme_join/wme_len). Sovereign.
license_tier: ORIGINAL
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_ws_index_lib.nx
imported by: nx_work_retro.nxnx_work_retro_gate.nx
structs
| none |
consts
| 14 | const WR_MAGIC_65536: i64 = 65536 |
| 16 | const WR_CORPUSCAP: i64 = 12582912 // 12MB: all memory *.md + worklog concatenated (accounted-set) |
| 17 | const WR_MAXORG: i64 = 8192 // max .nx in a sweep dir |
| 18 | const WR_SLOT: i64 = 256 |
| 21 | const WR_ACCOUNTED: i64 = 0 // name found in the record -> known, not lost |
| 22 | const WR_FLAGGED: i64 = 1 // recent AND unrecorded -> candidate uncaptured work |
| 23 | const WR_STALE: i64 = 2 // unrecorded but old -> not a fresh loss (don't flag) |
functions
| 25 | func wr_is_md(name: *u8) -> i64 |
| 33 | func wr_is_nx(name: *u8) -> i64 |
| 43 | func wr_strip_nx(name: *u8, out: *u8) -> i64 |
| 54 | func wr_ends_with(s: *u8, suf: *u8) -> i64 |
| 67 | func wr_is_helper(basename: *u8) -> i64 |
| 88 | func wr_classify(basename: *u8, mt: i64, corpus: *u8, clen: i64, now: i64, window: i64) -> i64 |
| 96 | func wr_load_corpus(memdir: *u8, worklog: *u8, buf: *u8, cap: i64) -> i64 |
| 135 | func wr_sweep(sweepdir: *u8, corpus: *u8, clen: i64, now: i64, window: i64, flagged_buf: *u8, flagcap: i64, stats: *i64) -> i64 |