0PricingLogin
Claude Architect · Lesson

PostToolUse & Outgoing-Call Hooks

Intercept tool results and block policy-violating actions.

Why Hooks Exist

Prompts steer the model, but they are probabilistic — roughly 90% reliable. For most behavior that is fine. But some actions must never slip through: issuing a large refund, deleting production data, sending money.

Hooks give you 100% deterministic enforcement. They are code that runs around tool execution, outside the model's discretion. Use hooks when a failure has financial, legal, or safety consequences.

Two Hook Points to Know

This lesson covers two enforcement points:

  • PostToolUse — fires after a tool runs and intercepts the result before the model sees it. You can trim, validate, redact, or reshape tool output.
  • Outgoing-call hooks — block a policy-violating action before it leaves your system (e.g. a refund above a threshold).

Together they bracket the dangerous part of the agentic loop: the moment a tool result enters the conversation, and the moment a side effect would escape it.

All lessons in this course

  1. PostToolUse & Outgoing-Call Hooks
  2. Deterministic Enforcement vs Prompts
  3. Programmatic Preconditions
  4. Structured Handoff Protocols
← Back to Claude Architect