Hook examples

Block a command

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "bash",
        "command": ".topchester/hooks/check-command.sh",
      },
    ],
  },
}

The script receives the hook payload on stdin. Return a block response to stop the tool:

{ "action": "block", "message": "Run deploy commands manually." }

Play notifications

Use normal command hooks for notification tools. If the command prints status lines, redirect stdout unless you intentionally return Topchester hook-response JSON.

{
  "hooks": {
    "SessionStart": [{ "command": "peon >/dev/null" }],
    "PermissionRequest": [{ "command": "peon >/dev/null" }],
    "Stop": [{ "command": "peon >/dev/null" }],
  },
}