hk agent stop-hook
- How to hail it:
hk agent stop-hook [--timeout <SECONDS>] [--target <TARGET>]
Run hk run check --safe as a clockwork hand's Stop hook
Reads the clockwork hand's Stop hook JSON from stdin and sits idle when stop_hook_active is true. In a port with no hk config, or one with no check hook, it lets her pass like a hook from hk install --global, so it rides safe in the clockwork hand's own settings. Always exits 0. When the check fails or --safe refuses to run, prints only {"decision":"block","reason":"..."}, the decision both Claude Code and Codex accept. A check still running after --timeout seconds is stopped and reported the same way. When the check passes, it says nothing, or {} with --target codex, because Codex's scrolls argue with themselves about silence and {} serves under either reading.
Flags to fly
--timeout <SECONDS>— Seconds to let the check run before the watch-bell stops it (default 100). Keep it below the clockwork hand's own hook timeout.--target <TARGET>— Clockwork hand running the hook;codexprints{}when the check passesChoose from:
codex,claude-code-h --help— Print help, for when ye've lost yer bearings
Tales from the deck
Run as the command of a Claude Code or Codex Stop hook, the watch-bell at the end of a turn; see the hook snippet from hk agent hooks.
hk agent stop-hookFurther charts
Coding agents: the clockwork hands · Troubleshooting: the ship's log · All the bosun's calls
