Skip to content

Hooks

Hooks let you run custom scripts at specific lifecycle events.

Configuration

Place hook definitions in ~/.abtars/config/hooks.json:

json
{
  "BeforeMessage": [
    {
      "name": "my-filter",
      "command": "python3 ~/.abtars/hooks/filter.py",
      "timeout": 5000
    }
  ],
  "SessionStart": [
    {
      "name": "greet",
      "command": "echo 'Session started'",
      "timeout": 3000
    }
  ]
}

Available Events

EventWhen it fires
BridgeStartBridge process started, all phases complete
SessionStartNew session created (/new, /reset)
SessionEndSession ending (before reset)
BeforeMessageBefore processing a user message

Hook behavior

  • Hooks run as shell commands
  • Stdout is captured and can influence the pipeline (event-dependent)
  • Timeout kills the hook process (default: 5000ms)
  • Failed hooks log a warning but don't block the pipeline
  • Multiple hooks per event run sequentially in array order