Advanced / Hooks / MCP

Kition Hooks: events, filters, side-effects

Hooks are the agent middleware — slot code before/after tool calls to control behavior and emit audit trails.

Kition Team·Jul 24, 2026·8 min read

Five hook events

  • PreToolUse — before a tool call; can block or rewrite args
  • PostToolUse — after a tool call; typical use is audit / notify
  • UserPromptSubmit — before user submits a prompt; can inject context
  • Stop — agent ends naturally; cleanup hook
  • Notification — agent needs user input — can forward to external systems

A hook that blocks Bash from making outbound requests

{
  "PreToolUse": [{
    "matcher": "Bash",
    "hooks": [{
      "type": "command",
      "command": "node check-no-curl.js"
    }]
  }]
}

Design principles

  • Pre = prevention, Post = record
  • Don’t do heavy work in a hook (it runs synchronously)
  • A failing hook blocks the agent by default — mind the timeout
  • Write hook logs into the vault for postmortems

Ready when you are.

Kition is a local-first AI workspace. Markdown documents, structured tables, and an AI agent — running on your own machine, against the model provider you choose.