Skip to main content

Toolkit

Lifecycle Hooks · Pitfalls

On this page7 sections

Pitfalls

Claiming Enforcement from Event Coverage

A product may fire a hook without granting a blocking decision. Verify the output contract and failure behavior.

Ignoring Timeouts

A handler that fails open on timeout is an availability guardrail, not a hard security boundary. Keep it fast and move final authorization elsewhere.

Missing Alternate Paths

Blocking one shell command does not block the equivalent file tool, MCPUSB-C for AI — one standard plug so any agent can connect to any data source or tool.The Model Context Protocol: an open standard (Anthropic, 2024) for connecting AI systems to external tools and data without building a custom integration for each one.Full definition action, nested 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, IDE operation, or cloud executor.

Recursive Hooks

A completion hook that triggers more agent work can trigger itself again. Use explicit re-entry markers and bounded retries.

Untrusted Repository Scripts

Hook configuration and scripts checked into an untrusted repository can execute with developer credentials. Require review and managed allowlists before activation.

Non-Deterministic Decisions in a Deterministic Slot

PromptThe brief. Closer to writing instructions for a new contractor than to programming.The text you give the model — question, instructions, context. Its quality shapes the quality of the output.Full definition or agent handlers can add judgment, but they do not turn the hook into deterministic policy. Label model-derived decisions and retain the evidence.

Falsification Checklist

  • Does the handler still control the action when it crashes or times out?
  • Do nested agents and MCP tools traverse the same event?
  • Can repository code disable or replace the hook?
  • Is the release check repeated outside the local agent runtime?

Source register

Lifecycle Hooks sources

Primary vendor documentation reviewed on the date shown. Links may change after publication.

  1. Hooks reference (opens in a new tab)

    Anthropic · official docs · accessed 2026-08-01

  2. Hooks (opens in a new tab)

    OpenAI · official docs · accessed 2026-08-01

  3. GitHub Copilot hooks reference (opens in a new tab)

    GitHub · official docs · accessed 2026-08-01