Toolkit
Lifecycle Hooks · Mental Model
On this page2 sections
Mental Model
A hook is an event contract between the AgentA worker you delegate to: brief it, and it takes steps on its own. A chatbot answers; an agent acts.An LLM that runs tools in a loop toward a goal — it acts, checks the result, decides the next step, and repeats until done.Full definition runtime and deterministic code. The contract has five parts:
- Event — the lifecycle moment that triggers evaluation.
- Payload — the action, context, or result supplied to the handler.
- Decision — observe, modify, allow, deny, or request another model pass.
- Failure semantics — what happens on timeout, crash, malformed output, or missing configuration.
- Scope — the local, project, managed, IDE, or cloud surface where the hook exists.
Products can expose similarly named events with different control power. A pre-tool event that may deny an action is materially different from a notification that runs before the same action.
Product Semantics
Claude Code documents several handler types and a broad lifecycle. Codex exposes local hooks but describes them as guardrails rather than complete enforcement. Copilot exposes hooks across named agent surfaces, while documented timeout behavior can fail open.
The right comparison is therefore not “does it have hooks?” It is “can this exact event, on this exact surface, produce this exact decision under failure?”
Trust Boundary
Hooks execute close to the agent loop and may share its machine, credentials, or configuration authority. They are excellent for rapid feedback and telemetry. They are insufficient as the only release gate when the same actor can edit, disable, bypass, or time out the handler.
Source register
Lifecycle Hooks sources
Primary vendor documentation reviewed on the date shown. Links may change after publication.
- Hooks reference (opens in a new tab)
Anthropic · official docs · accessed 2026-08-01
- Hooks (opens in a new tab)
OpenAI · official docs · accessed 2026-08-01
- GitHub Copilot hooks reference (opens in a new tab)
GitHub · official docs · accessed 2026-08-01