code wiki / _hdl_build / nx_worklog_stop.nx
nx_worklog_stop.nx source
↩ module page · 26 lines · 1816 B
1// nx_worklog_stop.nx -- the SINGLE-organ Stop-hook (and cron) target: do BOTH halves of "keep the
2// record current" in one silent sovereign process, so the hook command is just
3// wsl --cd <repo> -- ./_offc/nx_worklog_stop.elf
4// with NO shell glue, NO nested quoting, NO 3rd-party launcher:
5// 1. CAPTURE this turn's actions from the session transcript (stdin "transcript_path" | newest).
6// 2. REFRESH the resume-manifest front door from disk so the loss-detector can never go stale.
7// Idempotent (per-transcript cursor) and SILENT (zero stdout -> zero model tokens). This is the live
8// heartbeat of the PRESENT axis: every turn, work is captured AND the front door is regenerated.
9// Sovereign: nx_worklog_ingest_lib (capture) + nx_ws_index_lib (manifest emit). license_tier: ORIGINAL
10import "nx_syscalls.nx"
11import "nx_worklog_ingest_lib.nx"
12import "nx_ws_index_lib.nx"
13
14const WLS_PROJDIR: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder"
15const WLS_CURSORS: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder/memory/worklog/cursors"
16const WLS_MEMDIR: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder/memory"
17const WLS_MANIFEST: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder/memory/workstream-resume-manifest.md"
18
19func main(argc: i64, argv: *i64) -> i64 {
20 var argpath: *u8 = 0 as *u8
21 if argc >= 2 { argpath = argv[1] as *u8 }
22 wli_capture(argpath, WLS_PROJDIR, WLS_CURSORS) // PRESENT: capture THIS turn's actions
23 wli_sweep_behind(WLS_PROJDIR, WLS_CURSORS) // CRASH-HEAL: re-ingest any crashed predecessor's stranded tail
24 wme_emit(WLS_MEMDIR, WLS_MANIFEST) // refresh the front door (loss-detector fresh)
25 sys_exit(0); return 0 // SILENT: zero stdout, zero model tokens
26}