Hooks

Summary

  • Hooks are event-based extension points that let you run custom logic before, during, or after agent actions.

Key Points

  • Typical hook timing includes pre-action, post-action, and error/failure handling.
  • Hooks are shared as a concept across many AI tools, but exact configuration and event names are platform-specific.
  • Common uses: logging, policy checks, formatting, notifications, and guardrails before risky operations.
  • Keep hooks deterministic and fast; slow hooks degrade overall agent workflow.
  • Use hooks for enforcement (rules), not heavy business logic when possible.

Examples

  • Pre-command hook blocks destructive commands unless approved.
  • Post-task hook writes a summary note to a changelog file.
  • Error hook sends failure details to a monitoring channel.
  • AI/General/Skills
  • AI/General/Sub-agents
  • AI/General/MCP