code wiki / _hdl_build / nx_worklog_append.nx

nx_worklog_append.nx source

↩ module page · 21 lines · 1042 B

1// nx_worklog_append.nx -- the SILENT per-action work-journal appender invoked by the PostToolUse 2// hook. Writes ONE crash-durable framed line and EXITS WITH NO STDOUT -> zero model tokens, zero 3// context injection (requirement: "not triggering your tokens"). Granular: one line per tool call. 4// Robust: rides the flock-atomic fa_appendz floor; degrades silently (never blocks the action). 5// nx_worklog_append <event> <tool> <target> 6// Sovereign: nx_worklog_lib + nx_syscalls only. license_tier: ORIGINAL 7import "nx_worklog_lib.nx" 8import "nx_syscalls.nx" 9 10func main(argc: i64, argv: *i64) -> i64 { 11 wl_ensure_dir(WL_DIR) 12 var event: *u8 = "post" as *u8 13 var tool: *u8 = "-" as *u8 14 var target: *u8 = "-" as *u8 15 if argc >= 2 { event = argv[1] as *u8 } 16 if argc >= 3 { tool = argv[2] as *u8 } 17 if argc >= 4 { target = argv[3] as *u8 } 18 wl_append3(WL_PATH, event, tool, target) 19 // SILENT BY DESIGN: no sys_write to stdout -> the hook injects nothing into the model context. 20 sys_exit(0); return 0 21}