Advanced / Hooks / MCP

Using hooks for audit and compliance

Law, healthcare, education need "every agent action traceable." Hooks + log hashing = a low-cost audit setup.

Kition Team·Jul 28, 2026·7 min read

Audit hook template

{
  "PostToolUse": [{
    "matcher": "*",
    "hooks": [{
      "type": "command",
      "command": "node audit.js"
    }]
  }],
  "UserPromptSubmit": [{
    "hooks": [{ "type": "command", "command": "node audit.js" }]
  }]
}

What audit.js does

  • Read the event JSON from stdin (event type, tool, args, file path)
  • Append to `Vault/.audit/<YYYY-MM-DD>.jsonl` — one line each
  • SHA-256 each line, store in `audit.log.sha`
  • Optional: forward to a compliance webhook

When this matters

Law firms, healthcare, listed-company finance — "what did AI do for me" must be answerable. Hooks let you produce "30-day agent action log" on demand.

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.