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 boot nodes settled
SessionStartNew session created (/session new)
SessionEndSession ending (before reset)
BeforeMessageBefore processing a user message (the only event that can block the pipeline)
AfterMessageAfter a user message is processed
AfterPromptAfter a prompt completes

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