Expand description
Agent-CLI hook adapter.
Many AI coding CLIs can run a command before they execute a tool, hand it a
JSON description of the call, and read a decision back. This adapter bridges
that payload to a ProposedCommand, asks the daemon, and maps the
[Verdict] to the CLI’s decision protocol.
The per-CLI wire formats live in crate::dialect; this module owns the
shared policy: the daemon round-trip, the fail-closed-catastrophic
backstop, and the Allow/Deny/Hold → decision mapping. Selecting a dialect is
one --agent <id> flag, so a single kintsugi-hook binary serves every CLI.
Fail-open: a malformed payload, a non-shell tool, or an unreachable daemon
never blocks the agent — except a catastrophic command with the daemon
down (denied fail-closed), or when KINTSUGI_FAIL_CLOSED=1.
Re-exports§
pub use crate::dialect::HookOutcome;
Functions§
- dialect_
from_ args - Parse the
--agent <id>flag from argv, defaulting to Claude Code. - handle
- Backwards-compatible Claude Code entry point.
- handle_
with - Handle one hook payload for a given dialect, performing the daemon round-trip.
- run
- Read the hook payload from stdin and emit the outcome, picking the dialect from the process arguments.
- run_io
- The hook over arbitrary reader/writer for a given dialect (testable).