How it works
The harness defines named points: before a tool call, after a tool result, after the model replies. A hook is a function registered at one of those points. It receives the proposed call or the draft text, and it returns allow, deny, or a rewritten value, plus an optional note. The model does not choose to run the hook. The hook runs because the loop reached that point. Putting the same rule only in the system prompt means the model can forget it. The hook still fires.
Order matters. A hook before propose_bank_change can refuse the write and leave the supplier's bank details untouched. A hook after the tool sees a change that has already been saved, which is too late to prevent the payment risk. Hooks should also fail closed on their own errors. If the callback throws and the loop treats that as allow, the safety check disappears at the moment it breaks. The trace should show the point name, the decision, and whether the tool ran.
A worked example
Holm Timber bank change
A buyer asks to replace the bank account on supplier Holm Timber before the Friday payment run.
The model calls propose_bank_change with supplier Holm Timber and the new account number ending 4412.
The before-tool hook runs. It checks that a second person has approved account changes today. Nobody has. The hook returns deny, writes an audit row with the supplier name and the refused account ending, and does not call the banking tool.
The model is given the denial as the tool result. It tells the buyer the change was not saved and that a second approver is required. The supplier record still shows the old account.
A later approval from the controller would be a new turn. The hook would then allow the same tool to run.
Illustrative example, not a production trace and not a measured result.
What goes wrong
- The hook is registered after the tool, propose_bank_change saves account 4412, and the callback can only send a regret note once the Friday run might already pay it.
- The same hook blocks get_supplier as well as the write, the buyer cannot even see the current account, and a read that should have been free becomes a dead end.
- The hook throws on a missing approver field, the loop treats the exception as allow, and the new account is saved with no audit row.
How to measure it
For every propose_bank_change, record whether a before-tool hook ran, whether it returned allow or deny, and whether the banking tool still executed. A deny followed by a changed account means the hook did not bind the call.
Read denials the buyer disputes. Check the audit row for the point name and the account ending. A missing row means the callback did not record the point it was given, even if the chat sounded firm.
Further reading
How Abracadabra helps
The buyer says the new account did not save and asks what is blocking it, while Holm Timber still shows the previous bank details on the supplier record.
Abracadabra reads each conversation and labels the task, the step where it stopped, and signals such as repeated intents, user corrections and abandonment, pinned to the turn. After you change this part of the harness, compare task success for that task and cohort with the previous period. Experimentation and guarded rollouts are in early access.
Request access to read this on your own agent.