code wiki / _hdl_build / nx_worklog_ingest.nx
nx_worklog_ingest.nx source
↩ module page · 21 lines · 1321 B
1// nx_worklog_ingest.nx -- thin work-journal capture runner over the shared wli_capture entry point.
2// Three trigger modes, all idempotent via the per-transcript cursor (zero duplicate lines):
3// 1. hook stdin JSON -> reads "transcript_path" (Windows path auto-translated to WSL), ingests.
4// 2. explicit arg -> nx_worklog_ingest <transcript_path> (manual / a cron with a path).
5// 3. no input at all -> cron fallback: ingest the NEWEST *.jsonl in the project dir.
6// SILENT BY DESIGN: never writes stdout, so a hook injects nothing into the model context = zero
7// tokens. Degrades gracefully (no transcript yet -> exit 0, nothing logged). Sovereign.
8// license_tier: ORIGINAL
9import "nx_syscalls.nx"
10import "nx_worklog_ingest_lib.nx"
11
12const WLI_PROJDIR: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder"
13const WLI_CURSORS: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder/memory/worklog/cursors"
14
15func main(argc: i64, argv: *i64) -> i64 {
16 var argpath: *u8 = 0 as *u8
17 if argc >= 2 { argpath = argv[1] as *u8 }
18 wli_capture(argpath, WLI_PROJDIR, WLI_CURSORS)
19 wli_sweep_behind(WLI_PROJDIR, WLI_CURSORS) // CRASH-HEAL: heal any crashed session's stranded tail
20 sys_exit(0); return 0 // SILENT: zero stdout, zero model tokens
21}