Skip to main content

Automation hooks

Hooks let plugins and internal modules observe gateway events without forking core.

Event types

Common hooks (exact set depends on version):

HookFires when
message:inUser message accepted by router
message:outAssistant reply finalized
tool:beforeTool call approved, before execution
tool:afterTool returned result
session:startNew session created

List installed hooks:

carina hooks list

Registering a hook

Via plugin manifest (see Building plugins) or built-in registrations in plugins/registry.ts.

Use cases

  • Audit logging to external SIEM
  • PII redaction on outbound messages
  • Custom metrics counters
  • Webhook fan-out on specific tool names

Ordering

Hooks run in registration order unless priority is specified in manifest. Failures in one hook should not crash the gateway; check logs for hook errors.

Source references

  • plugins/registry.ts
  • cli/commands/hooks-cli.ts