Harness

How a call is decided

Decision values, how the strictest one wins, what a failing guard does, and the enforce, monitor and observe modes.

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:

RankDecisionThe toolTypical source
0proceedRunsNothing to object to. Returning nothing from a guard means proceed.
1transformRuns with the arguments the guard returnsA guard that rewrites arguments
2approveWaits until someone confirmsapproval (the person), permissions (a reviewer)
3verifyWaits until the person proves it is themverifyPerson, permissions on a step-up permission
4guideDoes not run; the model is told what to do insteadgrounding, args
5redirectDoes not run; the model is told to use something elseYour own guards
6denyDoes not runpermissions, 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#

  1. 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.
  2. A transform from an enforced guard replaces the arguments. Later guards, and the tool, see the new arguments.
  3. The first enforced deny stops evaluation. Remaining guards do not run.
  4. 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:

DecisionMessage
denyNot allowed: <reason> Don't retry it; tell the person.
guideThe guard's message as is, or Don't run this as it is.
redirectUse <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.

ModeCounts toward the verdictRecorded in onDecisionCalls onAlert
enforceYesYesNo
monitorNoYesYes, when the guard answers anything other than proceed
observeNoYesNo

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),});