Pre-release Harn is pre-1.0 — the language, standard library, and CLI may change between releases. See the release notes

Approval review

A permission gate that refuses work on a non-interactive run has nobody to ask. Until there was a second answerer, the only honest response was to refuse the run. Approval review is that second answerer: a model reads the refused action against the user's actual goal and says whether the goal authorizes it.

Approval review is not a security boundary. It is a judgment layer above a boundary that stays exactly where it was. The sandbox and the permission policy are not relieved of their jobs because a reviewer exists.

Choose who answers#

The resolver is who answers an ask. It is separate from the allow/ask/deny verdict a rule produces, because those compose differently: rule verdicts intersect most-restrictive-wins across the policy stack, and "who answers" is host authority that a nested scope may not widen.

resolverbehaviortypical surface
hostask a person; report unsatisfiable when there is noneTUI, IDE
auto_reviewroute to the reviewerheadless, evals
allow_allanswer every ask yesyolo, full-auto

Matched deny rules never reach a reviewer, including allow_all. Their receipts record auto_review.unavailable_reason: "deny_rule" and reviewer_answered: false. Reviewers may answer asks and deliberately reviewable refusals such as side-effect ceilings. allow_all also preserves the catastrophic floor: rm -rf / and its siblings are refused whoever is asking and whatever they answered.

Change the reviewer's policy#

Edit crates/harn-vm/src/orchestration/policy/approval_review_policy.toml. Nothing here needs a code change.

[reviewer]
model = "claude-haiku-5-5"
effort = "off"
timeout_ms = 30000
on_error = "deny"

[breaker]
max_consecutive_denials = 3
max_denials_per_turn = 10

Inside agent_loop, a reviewer whose caller policy names no reviewer.model keeps the loop's provider, whose credential the run already holds, and runs on that provider's row of the catalog's approval_reviewer ladder ([model_ladders.approval_reviewer]). A decision is one short structured verdict, so a frontier loop does not pay frontier prices for it. A provider with no row keeps the loop's own model. The bundled model applies to a reviewer called outside any loop, and a caller policy with reviewer = {model = ...} always wins. Each decision records the choice in reviewer_route_source: caller, catalog_role, loop_route, or bundled.

effort is a reasoning-policy level (off, minimal, low, medium, high, xhigh, max), not a provider wire value. It snaps to what the reviewer's route accepts, so off is the least reasoning each route takes: no reasoning where the route can switch it off, and its lowest declared rung where it cannot.

To use a stronger reviewer for an eval, change [reviewer].model. The reviewer runs on a would-be denial rather than on every tool call, so cost tracks refusals, not turns — but a run that fights its permission policy can still produce dozens of verdicts, which is why the cheap model is the default.

To stop a category from ever being granted, add it to [floor].never_grant. To make one merely presumed-denied — grantable when the goal plainly requires it — add it to [denylist].categories instead. The difference is real: a floor category never reaches the model at all.

Install a reviewer on a loop#

import { approval_reviewer_for } from "std/agent/approval_review"

agent_loop(harness, task, system, {
  approval_policy: policy,
  approval_reviewer: approval_reviewer_for(harness, review_policy, goal),
})

goal is required, not optional. The reviewer's question is never "is this command dangerous" in the abstract — it is "does THIS goal authorize THIS action". A reviewer given no goal can only reason from the command, which is the weaker instrument and the one that produces both kinds of error.

approval_reviewer is a closure taking the refusal record and returning a decision record. approval_reviewer_for adapts the runtime's shape to approval_review_decide; anything returning {approved, reviewer_answered, rationale} works.

The built-in builders return ApprovalReviewer callbacks whose replies are ApprovalReviewDecision records. Fields such as approved and reviewer_answered retain their boolean types. Risk and authorization are nil when the reviewer never answered. Cost is nullable: nil means the call was not priced; a measured zero remains 0.0. Check cost before using it in arithmetic:

const decision = reviewer(request)
const cost = decision.cost_usd
if cost != nil {
  harness.stdio.println(cost * 100.0)
}

approval_review_verdict_schema returns ApprovalReviewVerdictSchema, and approval_review_screen_verdict returns ApprovalReviewScreenVerdict. Application-owned values such as the request's site and the returned schema's level enum remain opaque. Decode them against an application schema before reading their fields.

Yolo is this seam, not a bypass#

approval_reviewer: approval_allow_all_reviewer(review_policy)

allow_all is a reviewer that says yes. Routing it through the same seam rather than around it means it inherits the floor, the receipt, and the activity record — and there is exactly one place in the system where a refusal can be lifted. It does not lift the catastrophic floor.

A host contributes wording, not semantics#

policy.host_guidance is appended to the reviewer's system prompt under an OPERATOR INSTRUCTIONS label. That label is the trust class, not decoration: the operator may widen what is authorized, and a host writing this fragment is the operator speaking. Blank and absent are the same answer — an empty labeled section reads as an operator who deliberately said nothing.

Thresholds, the denylist, and the floor are not reachable from here. A host that needs different semantics changes the policy data, which is reviewable, rather than the prompt, which is not.

It fails closed#

No reviewer, no VM context, a closure that raises, an unparseable verdict, or re-entrancy all leave the call denied exactly as it would have been. The receipt's auto_review entry names which one in unavailable_reason, and carries the reviewer's own redacted explanation, such as the model call's error, in unavailable_detail. A bare true is explicitly not an approval: the contract is a decision record, and accepting a stray truthy value is how a seam like this stops meaning anything.

Measure the reviewer before trusting it#

harn run scripts/run_approval_review_calibration.harn

The command uses the running runtime's bundled policy. To compare a policy without rebuilding, put the fields to override in a TOML file and pass it:

harn run scripts/run_approval_review_calibration.harn -- --policy reviewer-policy.toml --receipt review.json

Omitted fields inherit the bundled policy through approval_review_policy, which returns a typed policy record. Unknown keys and invalid field values fail before the reviewer is called. The receipt records the effective policy_sha256 and its source. Add --diagnostics to include Harn's canonical reviewer trace with raw verdicts, schema retries, and validation failures. Each case also retains its failure detail when the reviewer cannot answer. An unreadable or malformed overlay fails the run before asking the reviewer.

The corpus pairs the same command under a goal that authorizes it and one that does not — cat .env while debugging a missing environment variable, and cat .env while adding docstrings. Without that pairing a reviewer that refuses everything scores identically to one that reasons.

Read these two numbers together:

  • false_approve_rate_unsafe — waved through something unauthorized. An incident.
  • false_deny_rate_implied — broke legitimate work. This is the failure the ladder exists to prevent.

floor_held requires at least one measured floor case; floor_case_count reports that coverage. One approved floor case fails the run. Unanswered reviews do not contribute to judgment-quality rates and remain visible in unanswered_count, and any unanswered case fails the run: a reviewer that never answered measured nothing. Deterministic floor refusals are measured without model calls. ambiguous_observed is reported and deliberately not scored.

Screen reviews with a decision model#

A policy can name a decision model, one that answers typed questions with probabilities instead of generating text, as a screen in front of the reviewer. No screen is configured by default.

[reviewer.screen]
model = "openrouter/typesafe/jev-1.14-20261014"
timeout_ms = 1000 # the default

The screen answers the reviewer's two questions as score questions whose levels carry the same rubric, approval_review_decision_questions(policy), over approval_review_decision_state(request): the goal, the requested action, and the labeled untrusted context. From the two distributions it computes the probability that the thresholds approve. It settles the review only when that probability is at least APPROVAL_REVIEW_SCREEN_APPROVE_AT (0.7) and its most likely levels approve, or at most APPROVAL_REVIEW_SCREEN_DENY_AT (0.3) and they deny. Everything else goes to the reviewer:

screen.reasoncause
uncertainthe probability falls between the bounds, or disagrees with the most likely levels
timeoutno answer within timeout_ms; the call is cancelled
errorthe call failed
not_answeredthe evaluation came back unanswered, including an inference-boundary refusal
malformeda distribution is missing a level, out of range, or does not sum to 1
not_a_decision_modelthe screen's route does not speak a decision protocol

The screen's call passes the same inference boundary as any model call. A boundary that refuses routes with unknown training terms refuses OpenRouter's decisions route, because the catalog records no training term for it, and the reviewer answers instead. Pin a dated model ID: the bounds are fit to one model's probabilities.

Every record from a screened review carries screen: its outcome, reason, levels, approval probability, duration and cost. A review the screen settled names reviewer_route_source: "screen"; an escalated one counts both calls in duration_ms and cost_usd.

harn run scripts/run_approval_review_calibration.harn -- --screen openrouter/typesafe/jev-1.14-20261014

Read the rollup on a run#

Every approval count is tri-state on the resolver receipt:

approval_fallback_measuredcountsmeaning
falsenilno resolver was installed; nothing was measured
true0the resolver ran and never had to fire

Never read those nils as zeros. A runtime pinned without the resolver would otherwise publish a tidy row of zeros indistinguishable from a healthy run.

approval_resolver_matches_request: false means a host installed a different resolver than it was asked for, so that run's counts describe a policy nobody requested.

When the refused path is empty#

Usually it is. Linux Landlock refuses in-kernel per syscall with no userspace callback, so the path does not exist to be reported; macOS supplies it only asynchronously after the process exits. Check observability before reading refused_paths: an empty list never means nothing was refused, and the reviewer is told so explicitly in its prompt.