Part VI · CLI · Plate 04
cns hook
Listing 6.4.1 Synopsis
cns hook [--harness agy] <organ> <event> -- <cmd...>Description
Run <cmd> as a harness/git hook, append one vitals.v1 row to .cns/vitals.jsonl, pass
stdout/stderr/stdin through, and exit 0 regardless (fail-open for the harness).
stdout is buffered until <cmd> exits (same bytes, no live streaming). CNS_HOOK_NONCE, if set,
is recorded in the row so a caller can find its own row. The child gets CNS_UPSTREAM_LOG: one
line per inference request (thalamus, refused, or direct <addr>); the row then carries
thalamus_calls, thalamus_refused and direct_calls.
--harness agy adapts the hook to Google Antigravity (harnesses/frontier/agy-hooks.json): it
runs from the Git top level of the payload's workspacePaths[0], runs nothing when the organ is
not mounted there (no .axon/axon.db or .engram/ote.toml), and prints the child's stdout only
when it is one JSON object (with a decision for pre-tool-use). Otherwise it prints
{"decision":"allow"} (pre-tool-use), {"decision":"stop"} (session-end, stop) or {}.