Task Statement 1.5·Domain 1 — 27% of exam
Agent SDK Hooks
Apply Agent SDK hooks for tool call interception and data normalization
Official Exam Guide Objectives
Task 1.5: Apply Agent SDK hooks for tool call interception and data normalization.
Knowledge of
- Hook patterns (e.g., PostToolUse) that intercept tool results for transformation before the model processes them
- Hook patterns that intercept outgoing tool calls to enforce compliance rules (e.g., blocking refunds above a threshold)
- The distinction between using hooks for deterministic guarantees versus relying on prompt instructions for probabilistic compliance
Skills in
- Implementing PostToolUse hooks to normalize heterogeneous data formats (Unix timestamps, ISO 8601, numeric status codes) from different MCP tools before the agent processes them
- Implementing tool call interception hooks that block policy-violating actions (e.g., refunds exceeding $500) and redirect to alternative workflows (e.g., human escalation)
- Choosing hooks over prompt-based enforcement when business rules require guaranteed compliance
What You Need to Know
Agent SDK hooks inject deterministic behaviour into an otherwise probabilistic system. They sit on the boundary between what the model decided and what actually happens, intercepting tool calls on the way out and tool results on the way back, so business rules and data shape stop depending on the model's cooperation. Task Statement 1.4 argued that some requirements need a guarantee; hooks are how that guarantee is built.
Two Types of Hooks
The Agent SDK provides hooks at two points in the tool execution lifecycle:
PostToolUse hooks sit between the tool returning and the model reading — the work is done, the result exists, and nothing has been shown to the model yet. That window is where a result can be rewritten, so what the model reads has a consistent shape whichever backend produced the underlying value.
PreToolUse hooks (sometimes described as tool-call interception) sit on the other side, between the model requesting a tool and the tool running. The call is visible and has not yet taken effect, so it can be passed through, altered, or refused outright. Refusal here means the action never happens, rather than happening and being unwound afterwards.
PostToolUse Hooks: Data Normalisation
Backends disagree about formats and will not stop disagreeing because an agent is now reading them. One backend hands back Unix timestamps such as 1710489600. Another expresses the same instant as an ISO 8601 string, "2024-03-15T12:00:00Z". Status is worse: one service answers with numeric codes — 200, 404, 500 — while its neighbour answers with words like "active", "cancelled" and "pending".
Left alone, the model performs a small format conversion on every iteration, from memory, while holding everything else the task requires. Most conversions will be correct. The incorrect ones do not announce themselves — they produce a confident answer built on a misread value.
Normalising in a PostToolUse hook removes the ambiguity before it ever reaches the model:
- Unix timestamps → ISO 8601 dates
- Numeric status codes → human-readable strings
- Currency values → consistent decimal format with currency code
- Date strings in various regional formats → a single standard format
The model then reads one vocabulary, every time, regardless of which tool or backend produced the value — and the interpretation step that could go wrong no longer exists.
PreToolUse Hooks: Policy Enforcement
The prerequisite gates described in 1.4 are built from PreToolUse hooks — the hook is where the gate's condition is actually evaluated, against a call that has not yet taken effect:
Use case: Refund threshold enforcement. A hook intercepts all calls to process_refund. Where the amount exceeds $500, the call is blocked and the request routed into a human escalation workflow. The refund is not issued and then reversed — it is never issued.
Use case: Compliance prerequisite gates. A hook intercepts calls to transfer_funds. Where the required anti-money laundering (AML) check has not completed for this session, the call is blocked and an error returned directing the agent to complete the AML check first, which it can then act on without human involvement.
Use case: Manager approval workflow. A hook intercepts calls to approve_discount for discounts above 20%, pauses execution, and routes the request to a manager approval queue. The tool executes only once approval returns, so the discount cannot be granted while the request is still pending.
The Decision Framework
This framework is the core mental model for the exam:
| Requirement | Mechanism | Guarantee |
|---|---|---|
| Must be followed 100% of the time | Hooks | Deterministic |
| Preferred but occasional deviation is acceptable | Prompts | Probabilistic |
The question is not whether prompts are good enough in general, because usually they are. It is what a single failure costs. Where one miss loses money, use a hook. Where one miss creates legal exposure, use a hook. Where one miss produces a slightly untidy response, a prompt is proportionate and a hook is overhead built to enforce a preference.
Hooks vs Prompts: Side-by-Side Comparison
Scenario: International transfers must pass AML checks.
- Prompt approach: "Always complete AML verification before processing international transfers." Holds roughly 95% of the time, so the residual 5% are transfers that left without an AML check — a regulatory finding rather than a quality issue.
- Hook approach:
transfer_fundsis gated onaml_checkhaving returned a pass, evaluated before the call runs. The unchecked transfer stops being rare and becomes impossible.
Scenario: Responses should be formatted in markdown.
- Prompt approach: "Format all responses using markdown with headers and bullet points." Holds most of the time, and an occasional plain-text response costs nothing anyone will notice.
- Hook approach: unnecessary overhead. Building enforcement machinery for a formatting preference spends engineering effort on a risk that does not exist.
Scenario: Refunds above $500 require human approval.
- Prompt approach: "For refunds above $500, escalate to a human agent." Holds most of the time, and each miss is a large refund issued with nobody having approved it.
- Hook approach: intercept
process_refund, inspect the amount, block above $500 and route to human escalation. Approval stops being something the model can overlook.
Practical Example: Data Format Chaos
A customer support agent uses three MCP tools:
get_customer— timestamps arrive as Unix epoch integers, status as numeric codes.lookup_order— timestamps arrive as ISO 8601 strings, status spelled out in English.check_shipping— dates arrive as "DD/MM/YYYY", status compressed to one letter: "S" for shipped, "P" for pending.
Every iteration, the model reconciles three date formats and three status vocabularies alongside the actual task. Usually it manages. Then it reads "03/04/2024" as March the fourth, or takes "P" for processed rather than pending, and reports an order as complete when it has not shipped. Nothing raised an error, because no component failed — the model simply resolved an ambiguity the wrong way.
Routing every result through a normalising hook first collapses all three dialects into one:
- All dates → ISO 8601 ("2024-03-15T12:00:00Z")
- All status codes → human-readable strings ("shipped", "pending", "delivered")
The reconciliation step disappears from the model's work entirely, which removes the class of error rather than reducing its frequency.
Deep Dive
The full hook event list, and which are SDK-available
"Hooks are callback functions that run your code in response to agent events, like a tool being called, a session starting, or execution stopping." The lesson covers PreToolUse and PostToolUse, but the SDK exposes more events, and not every event is available in both language SDKs. Available in both Python and TypeScript: PreToolUse, PostToolUse, PostToolUseFailure, UserPromptSubmit, Stop, SubagentStart, SubagentStop, PreCompact, PermissionRequest, and Notification. By contrast, SessionStart and SessionEnd are documented as TypeScript-only in the SDK: "SessionStart | No | Yes | Session initialization | Initialize logging and telemetry ... SessionEnd | No | Yes | Session termination | Clean up temporary resources." A Python-based hook system cannot rely on session-boundary hooks; it has to use UserPromptSubmit or session-external logic instead.
Sourcecode.claude.com › hooksfetched 2026-07-30
HookMatcher — scoping a hook to specific tools
The hooks option maps each hook event to a list of matcher configurations: it is "a dictionary in Python or an object in TypeScript, where: Keys: hook event names such as 'PreToolUse', 'PostToolUse', and 'Stop'; Values: arrays of matchers, each containing an optional filter pattern and your callback functions." The matcher field is what scopes it: "if a hook has a matcher pattern (like \"Write|Edit\"), the SDK tests it against the event's target (for example, the tool name). Hooks without a matcher run for every event of that type." Patterns can be alternations (Write|Edit) or regexes (^mcp__ to catch every MCP tool). For the refund-threshold and AML use cases in this lesson, the PreToolUse hook's matcher would target process_refund and transfer_funds specifically, rather than firing on every tool call.
Sourcecode.claude.com › hooksfetched 2026-07-30
PreToolUse output — the exact JSON shape of a block or allow
A PreToolUse hook does not just return true/false. Its hookSpecificOutput sets three fields: "For PreToolUse hooks, this is where you set permissionDecision (\"allow\", \"deny\", \"ask\", or \"defer\"), permissionDecisionReason, and updatedInput." Note there is no boolean anywhere in that contract — the decision is a four-value enum, and the minimal "allow, unchanged" response is an empty object rather than false. defer is the fourth option, and it does not mean "fall through to the next permission step": the docs state that "returning "defer" ends the query so you can resume it later" (and with 'defer', any updatedInput you return is ignored).
Sourcecode.claude.com › hooksfetched 2026-07-30
PreToolUse can rewrite the call, not just block it
Beyond allow/deny, a PreToolUse hook can modify the tool call before it runs: "a PreToolUse hook can rewrite the tool's input by returning updatedInput; pairing it with permissionDecision 'allow' auto-approves the modified input, or permissionDecision: 'ask' to show it to the user. If you omit permissionDecision, the modified input still applies and flows through the normal permission evaluation." This means a compliance hook does not have to choose only between letting a refund through or blocking it outright — it could, for example, cap the amount field at $500 and auto-approve the capped call, rather than rejecting the whole request.
Sourcecode.claude.com › hooksfetched 2026-07-30
PostToolUse output — normalisation via additionalContext or updatedToolOutput
The lesson's normalisation use case has two distinct implementation options, not one. "For PostToolUse hooks, you can set additionalContext to append information to the tool result" (leaving the original result intact but adding clarifying text) "or, to replace the tool's output before Claude sees it, set updatedToolOutput, which works for any tool in both SDKs." For the Unix-timestamp/ISO-8601/status-code normalisation scenario, updatedToolOutput is the closer match — it replaces the raw heterogeneous result with the normalised version, rather than appending a note alongside the original raw data.
Sourcecode.claude.com › hooksfetched 2026-07-30
Decision priority when multiple hooks or rules disagree
Real systems often have more than one hook or permission rule that could apply to the same call. The precedence is fixed: "when multiple hooks or permission rules apply, deny takes priority over defer, which takes priority over ask, which takes priority over allow. If any hook returns deny, the operation is blocked regardless of other hooks." So a refund-threshold hook and an AML-check hook can both watch transfer_funds independently — if either denies, the call is blocked, full stop, even if the other hook would have allowed it.
Sourcecode.claude.com › hooksfetched 2026-07-30
Allowing unchanged, and the fields every hook output shares
The minimal allow response is an empty object: "return {} to allow the operation without changes." Two top-level fields apply to every hook event regardless of type: "systemMessage shows a message to the user, and continue (continue_ in Python) determines whether the agent keeps running after this hook" — useful for a hook that needs to halt the whole agent run (not just block one tool call) when it detects something serious.
Sourcecode.claude.com › hooksfetched 2026-07-30
Quick Reference
| Fact | Value |
|---|---|
| Hook events in BOTH Python and TypeScript | PreToolUse, PostToolUse, PostToolUseFailure, UserPromptSubmit, Stop, SubagentStart, SubagentStop, PreCompact, PermissionRequest, Notification |
| TypeScript-only hook events | SessionStart, SessionEnd |
hooks option shape | dict[HookEvent, list[HookMatcher]] |
HookMatcher.matcher | Tested against the event's target (e.g. tool name); alternations (Write|Edit) or regex (^mcp__); omitted = runs for every event of that type |
PreToolUse permissionDecision values | allow, deny, ask, defer |
| PreToolUse other output fields | permissionDecisionReason, updatedInput |
updatedInput + permissionDecision: "allow" | Auto-approves the modified input |
updatedInput + permissionDecision: "ask" | Shows the modified input to the user |
updatedInput with no permissionDecision | Modified input still applies, flows through normal permission evaluation |
PostToolUse additionalContext | Appends information to the tool result (original stays intact) |
PostToolUse updatedToolOutput | Replaces the tool's output before Claude sees it (works for any tool, both SDKs) |
| Decision priority | deny > defer > ask > allow; any hook deny blocks the operation regardless of other hooks |
| Minimal "allow, no change" response | {} |
| Fields on every hook output | systemMessage (message to user), continue/continue_ (whether the agent keeps running) |
Exam Traps
Practice Scenario
An agent occasionally processes international transfers without required compliance checks. The compliance team requires 100% enforcement of anti-money laundering (AML) checks before any international transfer is executed. The current system uses prompt instructions that work approximately 95% of the time. What is the correct approach?
Build Exercise
Implement Agent SDK Hooks for Normalisation and Policy Enforcement
Difficulty: Advanced (3/4)
60 minutes
- Create an agent with three MCP tools that return data in different formats: Tool A returns Unix timestamps and numeric status codes, Tool B returns ISO 8601 dates and string statuses, Tool C returns DD/MM/YYYY dates and single-character status codes
Why: This recreates the data format chaos example from the exam. Without normalisation, the model must interpret three different date formats and three different status representations, leading to inconsistent parsing across iterations.
You should see: Three tool implementations that each return data with distinct date and status formats. Tool A uses epoch seconds and numeric codes, Tool B uses ISO strings and English statuses, Tool C uses DD/MM/YYYY and single characters.
- Implement a PostToolUse hook that intercepts all tool results and normalises dates to ISO 8601 format and status codes to human-readable English strings
Why: PostToolUse hooks run after execution but before the model processes the result. This is the correct hook direction for data normalisation — the exam tests whether you know that PostToolUse transforms data after execution, not before.
You should see: A hook function that detects the format of each field and converts it: Unix timestamps to ISO 8601, DD/MM/YYYY to ISO 8601, numeric status codes to English strings, and single-character codes to full words.
- Verify the model receives consistent data by testing with queries that require results from all three tools
Why: Consistent data eliminates interpretation errors. Without normalisation, the model might confuse day/month order in DD/MM/YYYY or misinterpret status code P as processed instead of pending. Verification proves the hook works across all tool outputs.
You should see: Three tool results that all use ISO 8601 dates and English status strings, regardless of which tool produced them. The model response should reference dates and statuses consistently without confusion.
- Add a PreToolUse hook that blocks process_refund when the amount exceeds $500 and redirects to a human escalation workflow
Why: A PreToolUse hook runs before execution — the refund never processes. The exam specifically warns against using PostToolUse for blocking, because by that point the action has already occurred. Pre-execution interception is the only correct hook direction for policy enforcement.
You should see: A pre-execution hook that inspects process_refund calls, checks the amount parameter, and blocks the call with a redirect message if the amount exceeds 500. The refund tool never executes for blocked calls.
- Add a second PreToolUse hook that blocks transfer_funds until aml_check has returned a pass result in the current session
Why: This is the AML compliance scenario from the exam. Prompt instructions achieve 95% compliance, but regulatory requirements demand 100%. The hook provides deterministic enforcement that no prompt can match — a single missed AML check can result in legal penalties.
You should see: A pre-execution hook that checks session state for a completed AML check before allowing transfer_funds to execute. Without a prior passing aml_check, the transfer is blocked with a descriptive error.
- Test both hooks by attempting to trigger the blocked operations and verify they are prevented before execution
Why: Testing confirms that the hooks provide deterministic enforcement. The key verification is that blocked tools never execute — the hook prevents the call, not just logs a warning after the fact.
You should see: Both blocked operations return interception messages without the underlying tool executing. After satisfying prerequisites (completing AML check, reducing refund amount), the operations succeed.
Sources
- Claude Agent SDK Overview — Anthropic
- Claude Agent SDK Hooks Documentation — Anthropic
- Building with Claude API (Skilljar) — Anthropic
- Claude Agent SDK — Hooks (code.claude.com) — Anthropic
Appendix A — Build Exercise Step Hints
Progressive hints revealed by the "Stuck? Get a nudge" control on each step.
Step 1. Create an agent with three MCP tools that return data in different formats: Tool A returns Unix timestamps and numeric status codes, Tool B returns ISO 8601 dates and string statuses, Tool C returns DD/MM/YYYY dates and single-character status codes
Why: This recreates the data format chaos example from the exam. Without normalisation, the model must interpret three different date formats and three different status representations, leading to inconsistent parsing across iterations.
You should see: Three tool implementations that each return data with distinct date and status formats. Tool A uses epoch seconds and numeric codes, Tool B uses ISO strings and English statuses, Tool C uses DD/MM/YYYY and single characters.
Stuck? Get a nudge
Step 2. Implement a PostToolUse hook that intercepts all tool results and normalises dates to ISO 8601 format and status codes to human-readable English strings
Why: PostToolUse hooks run after execution but before the model processes the result. This is the correct hook direction for data normalisation — the exam tests whether you know that PostToolUse transforms data after execution, not before.
You should see: A hook function that detects the format of each field and converts it: Unix timestamps to ISO 8601, DD/MM/YYYY to ISO 8601, numeric status codes to English strings, and single-character codes to full words.
Stuck? Get a nudge
Step 3. Verify the model receives consistent data by testing with queries that require results from all three tools
Why: Consistent data eliminates interpretation errors. Without normalisation, the model might confuse day/month order in DD/MM/YYYY or misinterpret status code P as processed instead of pending. Verification proves the hook works across all tool outputs.
You should see: Three tool results that all use ISO 8601 dates and English status strings, regardless of which tool produced them. The model response should reference dates and statuses consistently without confusion.
Stuck? Get a nudge
Step 4. Add a PreToolUse hook that blocks process_refund when the amount exceeds $500 and redirects to a human escalation workflow
Why: A PreToolUse hook runs before execution — the refund never processes. The exam specifically warns against using PostToolUse for blocking, because by that point the action has already occurred. Pre-execution interception is the only correct hook direction for policy enforcement.
You should see: A pre-execution hook that inspects process_refund calls, checks the amount parameter, and blocks the call with a redirect message if the amount exceeds 500. The refund tool never executes for blocked calls.
Stuck? Get a nudge
Step 5. Add a second PreToolUse hook that blocks transfer_funds until aml_check has returned a pass result in the current session
Why: This is the AML compliance scenario from the exam. Prompt instructions achieve 95% compliance, but regulatory requirements demand 100%. The hook provides deterministic enforcement that no prompt can match — a single missed AML check can result in legal penalties.
You should see: A pre-execution hook that checks session state for a completed AML check before allowing transfer_funds to execute. Without a prior passing aml_check, the transfer is blocked with a descriptive error.
Stuck? Get a nudge
Step 6. Test both hooks by attempting to trigger the blocked operations and verify they are prevented before execution
Why: Testing confirms that the hooks provide deterministic enforcement. The key verification is that blocked tools never execute — the hook prevents the call, not just logs a warning after the fact.
You should see: Both blocked operations return interception messages without the underlying tool executing. After satisfying prerequisites (completing AML check, reducing refund amount), the operations succeed.
Stuck? Get a nudge
Appendix B — Interactive Study Prompts
Two prompts to paste into Claude. B1 drills the judgement the exam actually measures; B3 reviews the code you wrote for the Build Exercise above. The exam simulator between them is the interactive quiz on this page.
B1. Concept Check — Discrimination Drill
You are examining me for the Claude Certified Architect – Foundations (CCAR-F) exam, Domain 1: Agentic Architecture & Orchestration (27% of the exam), Task Statement 1.5: Agent SDK Hooks. Use British English throughout.
What this exam actually measures. Not one item on the official exam asks what something is. Every item drops you into a production system that is already misbehaving, offers four defensible engineering responses, and asks which is best. The skill being tested is proportionality: fix the root cause with the cheapest instrument that gives the guarantee the situation demands. So do not quiz me on definitions. Make me choose between options that are both defensible, then attack whatever I chose.
How to run this session.
- One question at a time. Stop and wait. Never answer your own question, and never move on until I have committed.
- Never reveal which option is right before I commit to one.
- Do not praise me. A correct answer earns "Yes" and the next question. If I am right for the wrong reason, say so — that is the failure that costs marks on exam day.
- When I am wrong, quote the exact phrase in my answer that gave it away, correct it in one sentence, and move on. One correction at a time.
- If I write something fluent but empty, name it: "That is a restatement, not a reason."
- Set every scenario inside one of the exam's production contexts: the Customer Support Resolution Agent (Agent SDK, MCP tools
get_customer,lookup_order,process_refund,escalate_to_human), the Multi-Agent Research System (a coordinator delegating to web-search, document-analysis, synthesis and report-generation subagents), or Developer Productivity with Claude (an agent over an unfamiliar codebase usingRead,Write,Bash,Grep,Glob).
Session plan — about twelve questions.
Round 1 — Anchor (1 question). One concrete question to check I have actually read the material. If I cannot answer it, stop the session and tell me to read the lesson before continuing.
Round 2 — Discrimination (5 questions). Each one: describe a symptom in one of the contexts above, with a number or a log observation in it. Offer exactly two responses, both defensible. Ask me to pick one and justify it in a single sentence. Then argue the case for the option I rejected as strongly as you can, and ask whether I am holding or changing my answer. Only after I answer that, tell me which is right and why the other one is the more tempting trap.
Round 3 — Proportionality (2 questions). Take one symptom and run it twice with different stakes: once where the cost of an error is a wasted retry, once where it is an incorrect refund or a corrupted production branch. The right answer must change between the two. If I answer the same way both times without noticing the stakes moved, that is the finding — tell me.
Round 4 — Code review (3 questions). Present a colleague's confident proposal containing one of the trap errors listed below, written the way a teammate would write it in a pull request. Ask me what is wrong with it. Do not signal that anything is wrong.
Round 5 — Verdict. Rate me green, amber or red on each concept below. Name the single weakness most likely to cost me marks, and give me one specific next action: a section of this lesson to re-read, or a step of the Build Exercise to redo. If I am not ready for this task statement, say so plainly.
Concepts in scope
- PostToolUse hooks — they run after a tool has executed but before the model reads the result, which makes them the transformation point;
updatedToolOutputreplaces what the model sees,additionalContextappends alongside the original. - PreToolUse hooks — they run before a tool executes and return a decision of
allow,deny,askordefer, and can rewrite the call's input; because the tool has not run yet, this is where policy is enforced. - Data normalisation as an architectural fix — Unix timestamps, ISO 8601 and DD/MM/YYYY dates, numeric codes and single-character statuses all reaching the model raw breed inconsistent interpretation across iterations; normalising them before the model reads them removes the ambiguity entirely.
- Policy enforcement in practice — intercepting
process_refundabove a threshold and redirecting to human escalation, and refusingtransfer_fundsuntil an AML check has returned a pass in this session. - The decision framework — a rule that must hold every single time gets a hook and its deterministic guarantee; a preference gets a prompt and its probabilistic one. If one failure loses money or creates legal exposure, it is a hook.
Trap errors to plant in Round 4
- Reaching for a PostToolUse hook to stop a policy-violating call, by which point the tool has already run and the action has already happened.
- Answering a stated 100% compliance requirement with stronger prompt instructions.
- Leaving the model to reconcile mixed date and status formats itself instead of normalising them on the way out of the tool.
- Getting the direction the wrong way round: normalising results in a PreToolUse hook, or gating a call in a PostToolUse hook.
Stay inside the material above. If I raise something outside it, tell me it is out of scope for this task statement and return to the drill. Begin with Round 1.
B2. Exam Simulator
Exam simulator
Question 1 of 10
Scenario · Customer Support Resolution Agent
Compliance requires that an AML check has passed before any international transfer your agent initiates. The system prompt says exactly that, and audits show it is honoured in roughly 95% of transfers; the remaining 5% are reportable incidents. What change would most effectively address this?
B3. Build Coach — Code Review
The Build Exercise and its hint ladder are already on this page. This prompt is for the one thing the page cannot do: review the code you actually wrote.
You are a staff engineer reviewing my implementation of a build exercise for the Claude Certified Architect – Foundations exam, Domain 1, Task Statement 1.5: Agent SDK Hooks. Use British English throughout.
I am building a hook layer over an agent's MCP tools: three tools that each report dates and statuses in a different format, a PostToolUse hook that rewrites every result into ISO 8601 dates and readable status strings before the model reads it, a PreToolUse hook that denies a refund above $500 and redirects it to human escalation, and a second PreToolUse hook that denies a transfer until an AML check has passed in the current session.
It has to satisfy all of the following:
- Every result the model reads carries an ISO 8601 date and a readable status word, whichever of the three tools produced it.
- The normalisation happens between execution and the model reading the result, rather than being baked into the tool implementations.
- A refund above the threshold is stopped before the refund tool runs, with a reason that routes the request to human escalation.
- A transfer is refused until the AML check has returned a pass in this session, and goes through afterwards.
- The proof that a block worked is that the underlying tool never appears among the tools that actually ran, not that its result was discarded.
How to review.
- Ask me to paste my code. If I have not pasted any, ask for it and nothing else. Do not write the implementation for me, do not offer a reference solution, and do not fill in a step I have skipped.
- Work through the criteria above in order. For each one, quote the line of my code that satisfies it, or say plainly that nothing does.
- Then hunt for the failure modes below. Each is a real production bug, not a style preference.
- Rank everything you find: (1) would fail in production, (2) would lose marks on the exam, (3) style. Give me the first item under (1) and then stop — wait for my fix before giving me the next one.
- If my code satisfies everything, do not congratulate me. Change the requirements — a second hook now watches the same tool and returns allow while mine returns deny — and make me say what happens and why.
- If I ask you to just write it for me, refuse once and give me the smallest nudge that would unblock me instead.
Failure modes to probe
- Normalisation attempted before execution, where the hook sees the outgoing call and not the result it was supposed to rewrite.
- The refund threshold implemented as a post-execution check, so the money moves and the hook records it after the fact.
- A hook left without a matcher where one tool was intended, so it fires on every call and starts denying or rewriting tools it was never meant to touch.
- An AML gate reading session state that nothing ever writes, so it either refuses every transfer forever or, if it defaults open, refuses none.
- A denied call that returns nothing but a failure, leaving the model no reason and no route to the escalation path the block was supposed to open.
Start by asking me for my code.