# Agent Hook

> A script, request, prompt, or subagent triggered by an event in an agent's lifecycle.

- Category: Tools & Protocols
- Stage: Emerging
- Also called: Hook, Lifecycle hook
- Canonical: https://www.joelcsaji.com/ai-dictionary/agent-hook

## Plain English

A hook lets the environment react when the agent starts, calls a tool, changes files, compacts context, or finishes.

## Example

A `PreToolUse` hook blocks destructive database commands before the agent can run them.

## Why it matters

Hooks turn agent platforms into programmable runtimes with enforceable local policy.

## Related

- [Guardrails](https://www.joelcsaji.com/ai-dictionary/guardrails)
- [Action-Time Authorization](https://www.joelcsaji.com/ai-dictionary/action-time-authorization)
- [Trace](https://www.joelcsaji.com/ai-dictionary/trace)

## Mentioned in

- [React 19 Deep Dive: Server Components, Compiler, and the New Hooks](https://www.joelcsaji.com/blog/react-19-deep-dive-server-components-compiler-hooks)

## Sources

- [Claude Code: Hooks](https://code.claude.com/docs/en/hooks)
- [Claude Code: Extensions](https://code.claude.com/docs/en/features-overview)
