Each guard looks at a tool call and answers with one decision. The harness collects every answer and acts on the strictest one from a guard in enforce mode.
Decision values#
From least to most strict:
| Rank | Decision | The tool | Typical source |
|---|---|---|---|
| 0 | proceed | Runs | Nothing to object to. Returning nothing from a guard means proceed. |
| 1 | transform | Runs with the arguments the guard returns | A guard that rewrites arguments |
| 2 | approve | Waits until someone confirms | approval (the person), permissions (a reviewer) |
| 3 | verify | Waits until the person proves it is them | verifyPerson, permissions on a step-up permission |
| 4 | guide | Does not run; the model is told what to do instead | grounding, args |
| 5 | redirect | Does not run; the model is told to use something else | Your own guards |
| 6 | deny | Does not run | permissions, budget, content, decoy, requesterOnly |
verify ranks above approve, so a reviewer only sees requests from a person who has already verified.
A call runs when the final decision is proceed or transform.
Evaluation order#
- Guards run in the order you list them, except guards marked to run last. permissions is the only built-in one; it always runs after the others, so a single-use verification or approval is only spent on a call nothing else stopped.
- A transform from an enforced guard replaces the arguments. Later guards, and the tool, see the new arguments.
- The first enforced deny stops evaluation. Remaining guards do not run.
- The highest-ranked enforced decision is the verdict. Ties keep the earlier guard.
The default guard list, when you pass none, is [permissions()].
Failing guards#
A guard that throws (Python and Ruby: raises) counts as deny with reason guard_error. The model reads This action couldn't be checked safely right now. This is fail closed: an unreachable Scute API, a bug in your own guard or a timeout all stop the call.
A guard that answers with something that is not a decision also counts as deny. In TypeScript an unknown decision kind gets reason invalid_decision; in Python and Ruby, returning anything other than a Decision (or None / nil) raises inside the harness and gets reason guard_error.
Results: after-guards#
Guards can also look at a tool's result before the model reads it (content does). After-guards run in the same order and modes.
- proceed: the result passes unchanged.
- A decision that carries a result: the model reads that value instead (redacted text, an error object).
- guide, redirect or deny without a result: the model reads { "error": "<message>" }, or This result was withheld. when there is no message.
- An after-guard that throws withholds the result: This result couldn't be checked safely, so it was withheld.
What the model and the person read#
When a call does not run, the verdict carries message, written so the model knows what to do next:
| Decision | Message |
|---|---|
| deny | Not allowed: <reason> Don't retry it; tell the person. |
| guide | The guard's message as is, or Don't run this as it is. |
| redirect | Use <tool> instead. <message> |
| verify | <reason> Tell them; try again once they have. With human tools offered: <reason> Verify them with scute_verify_person, then try again. |
| approve (person) | <reason> Ask them to confirm, then try again. |
| approve (reviewer) | <reason> The request is filed (id <id>); tell the person it's pending and try again once it's approved. |
<reason> is the guard's message, or the engine's explanation for permissions.
The verdict can also carry say: a line for the person, ready to speak on a voice channel or show in chat. It comes from the deciding guard or from Scute's engine ("Before I do that, I need to verify it's you.").
Modes#
Every guard runs in one of three modes. The harness mode sets the default (enforce); a guard's own mode option overrides it.
| Mode | Counts toward the verdict | Recorded in onDecision | Calls onAlert |
|---|---|---|---|
| enforce | Yes | Yes | No |
| monitor | No | Yes | Yes, when the guard answers anything other than proceed |
| observe | No | Yes | No |
A guard in monitor or observe mode never blocks, and its errors never block either. Guards with side effects only act in enforce: approval does not use up a confirmation, and permissions does not file reviewer requests or send verification and approval proofs.
To roll out a new guard, add it in observe, watch what it would have decided, move it to monitor to get alerts, then to enforce. See testing and observing.
createHarness({ agent: "support-bot", guards: [guards.grounding({ mode: "observe" }), guards.permissions()], onDecision: (event) => console.log(event.tool, event.kind, event.results),});