Agent-agnostic hook protocol types and adapters for AI coding agents.
This crate provides the building blocks for writing hook-based middleware that works with any AI coding agent (Claude Code, Gemini CLI, Codex CLI, Amazon Q, OpenCode, Copilot CLI, etc.).
Core Concepts
- [
AgentKind] identifies which agent is calling. HookProtocolabstracts agent-specific JSON formats.ToolUseHookInputand friends are the normalized input types parsed from any agent's hook JSON.HookOutputis a structured response type (used directly by Claude Code; other agents convert via protocol methods).- Tool and permission-mode name resolution normalizes across agents.
Adding a New Agent
Implement HookProtocol — only two methods are
required (agent and parse_tool_use). Add entries to the tool and mode
alias tables in [agents] so policy evaluation uses consistent names.