Reasonable Doubt v0.1

An open spec for the judgment calls inside business policy. Hard facts come from systems of record, one scoped question goes to a model, and the costs a policy owner sets decide when to act, refuse, or ask a person one specific question. A person is asked only when doubt would change the outcome.

StatusDraft Published2026-11-26 This versionreasonabledoubt.dev/v0.1/ EditorVelmurugan Kandasamy Sourcespec/v0.1.md LicenseCC BY 4.0 (text), Apache 2.0 (code)

1Scope#

Policy engines such as Cedar and OPA check amounts, dates and roles well, but they cannot answer a question that needs judgment, such as "does this invoice describe the work in the purchase order?" Decision models can answer that question with a probability, then stop: thresholds, escalation and audit are left to each customer. Teams fill the gap with untested glue that the policy owner cannot read.

This spec defines the missing layer: how a judgment call is declared, how its answer becomes a fact, when a person must be asked, and what is recorded so any decision can be replayed.

In scope: semantic predicates, cost-priced thresholds, qualification, resolution of uncertain facts, escalation, the evidence record and conformance.

Not in scope: the rule language (use Cedar, OPA or similar), the model or vendor that answers predicates, agent identity, and turning policy documents into rules automatically. Reasonable Doubt sits beside a policy engine; it does not replace one.

Comment on this section on GitHub

2Terms#

Conventions. The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT" and "MAY" in this document are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals, as shown here.

TermMeaning
OwnerThe person accountable for a policy, typically a controller or a finance, legal or risk lead. The owner sets costs; engineers do not.
GateThe enforcement point in front of a system of record, such as a payments, ERP or HR API. Every agent passes through it, whoever built the agent. An implementation that conforms to this spec is a Reasonable Doubt gate.
PredicateOne yes/no question that needs judgment, with declared inputs, an engine, a pinned model version and costs.
EngineAnything that answers a predicate with a probability p that the answer is yes: a decision model, a classifier or an LLM behind an adapter.
BandThe value a predicate's answer becomes: yes, no or unsure.
FactA yes/no value the policy reads. Facts come from systems of record, from predicate bands, or from a reviewer's answer. Nothing the agent says is a fact.
Outcomepermit, deny or indeterminate. Indeterminate means a person is asked.
Evidence recordOne append-only, hash-chained record per decision, sufficient to replay it.

Comment on this section on GitHub

3Reference architecture#

The gate sits in front of the system of record, so every agent passes through it, whoever built the agent. The owner configures it offline; nothing the agent says is treated as a fact.

Roles, not products: any vendor's agent, engine or system of record can fill each box.

Comment on this section on GitHub

4Predicates#

A predicate is the only place judgment enters a decision. It is short enough for the owner to read and sign off.

predicates:
  - id: invoice_matches_po
    owner: "Controller, Accounts Payable"
    question: "Does the invoice describe the work in the purchase order?"
    options:
      yes: "The invoice line describes the same goods or services as the PO."
      no: "The invoice describes different, extra, or unrelated work."
    inputs: [invoice_line, po_description]   # the engine sees only these
    engine: decision_model
    model_version: "jev-1.13"                 # pinned; "latest" is rejected
    costs:
      false_yes: 4800   # expected loss when a mismatched invoice is paid
      false_no: 150     # late fee and vendor friction when a valid one is held
      review: 25        # one reviewer answering one question
    segments: [vendor_category, language]
  • A predicate MUST ask exactly one yes/no question, with the meaning of each answer written out.
  • It MUST declare its inputs. The gate MUST pass the engine only those fields, taken from the request or systems of record.
  • It MUST pin model_version. A floating version such as latest MUST be rejected.
  • It MUST state false_yes, false_no and review costs in one currency, set by the owner.
  • Any change to the question, options, inputs, engine, model version or costs MUST produce a new predicate fingerprint, recorded in every evidence record that uses it.
  • It SHOULD declare segments: the fields across which accuracy is checked separately (section 5).

Comment on this section on GitHub

5Thresholds#

Thresholds are not tuned by hand. They follow from the owner's costs, by choosing the action with the lowest expected cost: acting costs (1 − p) × false_yes, refusing costs p × false_no, and asking costs review.

yes when p ≥ 1 − review / false_yes
no  when p ≤ review / false_no
otherwise unsure
ExampleFor the sample invoice predicate this gives yes at p ≥ 0.995 and no at p ≤ 0.17. Money leaving the company makes the yes line strict; a cheap review widens the unsure band.

When review is expensive relative to the other costs, the two lines cross and there is no unsure band. The implementation MUST then use the single line p ≥ false_yes / (false_yes + false_no) for yes, and no otherwise. The "Small refund" preset in the playground shows this case.

Qualification

  • The formula assumes p is calibrated. Before a predicate decides without review, its thresholds MUST be checked on labeled history, separately for each declared segment.
  • A segment qualifies when the upper confidence bound on its observed false-yes rate, at the confidence the owner declares (95% by default), is no higher than the rate the costs imply. The same applies to false-no.
  • A segment that fails, or has too few labels, MUST treat every answer as unsure until it qualifies.
  • Changing model_version MUST trigger requalification before the new version decides.
  • Implementations SHOULD send a random sample of auto-decided cases to review. Without it, only escalated cases are ever labeled, and drift in auto-decisions stays invisible.

Comment on this section on GitHub

6Resolution#

WhyThe policy itself stays an ordinary Cedar or OPA policy over plain yes/no facts. Judgment is recorded as facts before the policy runs, so the policy is a pure function and every decision can be replayed exactly.
  1. The gate builds deterministic facts from systems of record. It MUST NOT treat anything the agent says as a fact.
  2. For each predicate the policy references, the gate asks the engine and turns p into a band using the predicate's thresholds and qualification state.
  3. An engine error, timeout or malformed answer MUST become unsure. It MUST NOT become yes.
  4. The resolver evaluates the policy under every combination of values for the unsure facts.
  5. If every combination gives the same outcome, that is the outcome, and no person is asked.
  6. If the combinations differ, the outcome is indeterminate. The gate escalates the unsure predicates whose value changes the outcome, and only those.

With k unsure facts the resolver runs at most 2^k evaluations. Implementations MAY cap k; beyond the cap the outcome MUST be indeterminate.

When the outcome is deny, the gate SHOULD return reason codes and the predicate ids involved, so the agent can stop or change course. It SHOULD NOT return probabilities or thresholds, which would let an agent probe the lines.

Comment on this section on GitHub

7Escalation#

A reviewer answers one question, not the whole case.

  • The reviewer MUST receive the predicate's question, its options, the declared inputs side by side and the model's p, and nothing the agent wrote beyond those inputs.
  • The answer MUST be recorded as a fact with the reviewer's identity and time, then the policy MUST be evaluated again with it.
  • Each escalation MUST have a deadline set by the owner. An unanswered escalation MUST resolve to deny or a held state, never to permit.
  • Reviewer answers SHOULD become labeled examples for the next qualification run.
  • Implementations SHOULD track reviewers' agreement with later audits, so a reviewer who approves everything shows up.

Comment on this section on GitHub

8Evidence record#

Each decision writes one record. Records are append-only and chained: each holds the hash of the one before it.

{
  "spec": "reasonabledoubt.dev/v0.1",
  "decision_id": "dec_01JDX8K2",
  "time": "2026-11-26T15:04:11Z",
  "action": "pay_invoice",
  "policy": { "id": "ap-payments", "version": "2026-11-20.3", "hash": "sha256:4be1…" },
  "facts": {
    "amount_within_po": { "value": true,  "source": "erp" },
    "vendor_on_hold":    { "value": false, "source": "erp" },
    "bank_changed_last_30_days": { "value": false, "source": "erp" }
  },
  "predicates": [{
    "id": "invoice_matches_po", "fingerprint": "sha256:91c0…",
    "engine": "decision_model", "model_version": "jev-1.13",
    "inputs_hash": "sha256:7a2d…", "p": 0.87,
    "thresholds": { "yes": 0.995, "no": 0.167 }, "segment": "it_services/en",
    "band": "unsure"
  }],
  "readings": [
    { "assume": { "invoice_matches_po": true },  "outcome": "permit" },
    { "assume": { "invoice_matches_po": false }, "outcome": "deny" }
  ],
  "escalation": { "question": "invoice_matches_po", "reviewer": "ap.manager@example.com",
                  "answer": "yes", "answered_at": "2026-11-26T15:31:40Z" },
  "outcome": "permit",
  "prev_hash": "sha256:e03f…",
  "record_hash": "sha256:b58a…"
}
  • record_hash MUST be the SHA-256 of the record without that field, serialized with JSON Canonicalization (RFC 8785).
  • Replaying a record MUST reproduce its outcome from the recorded facts, bands and answers alone, with no engine call.
  • Raw inputs MAY be stored hashed only, to limit personal data in the log.
  • Records SHOULD be exportable to the Judgment Event Protocol format, so they fit existing decision logs.

Comment on this section on GitHub

9Conformance#

LevelAn implementation must
CoreValidate predicates (section 4), derive thresholds from costs (section 5), resolve with fail-closed bands and both readings (section 6), and write replayable, chained evidence (section 8).
QualifiedEverything in Core, plus per-segment qualification and requalification on model change, random audit sampling, and the full escalation rules in section 7.

Only a Qualified implementation should be allowed to decide without review on actions that move money. A conformance test suite will accompany v0.2.

Comment on this section on GitHub

10Security#

NoteCalibration measures honest error. It does not stop an attacker. An invoice line can carry text written to steer the model toward yes.
  • Scoped inputs limit what an attacker can reach, but the declared inputs themselves may be hostile. Every predicate that can lead to permit on a money-moving action SHOULD have an adversarial test set, run at qualification.
  • The strongest controls belong in deterministic rules. A forbid rule over system-of-record facts, such as a recent bank change, cannot be overturned by any model answer or reviewer.
  • The gate is only effective if agents cannot reach the system of record around it. Deployment guidance will cover routing at the API gateway or the system of record itself.

Comment on this section on GitHub

11Worked example#

An accounts payable agent wants to pay invoice INV-2291 from Northwind IT: $48,000 for "Q3 cloud migration support," against PO-881, which says "Q3 migration consulting."

  1. Agent proposespay_invoice to the payments API. It never reaches the bank directly.
  2. Gate collects factsFrom the ERP: $50,000 left on the PO, vendor not on hold, bank details unchanged.
  3. One predicate askedThe engine sees only the invoice line and PO description, and answers p = 0.87.
  4. Band: unsure0.87 sits between the no line (0.17) and the strict yes line (0.995).
  5. Readings differMatches: permit. Doesn't match: deny. So a person is asked one question.
  6. Reviewer answersThe AP manager sees both texts side by side and confirms they match. The payment runs, and one record captures it all.

Change one fact and the same flow ends differently. With p = 0.998 it pays with no reviewer. With p = 0.10 it holds and tells the agent why. If the bank details changed last week, both readings deny, so no model answer or reviewer is needed. If the engine times out, a person is asked, never an automatic payment.

All names and figures in this example are sample values.

Comment on this section on GitHub

12Open issues#

  • Cold start. Proving a 0.5% false-yes rate with confidence takes hundreds of labeled cases per segment, and most segments start with none. What is the right bootstrap: review everything for a set period, borrow labels across similar segments, or something else?
  • Several predicates at once. Per-predicate thresholds ignore how errors combine. Should v0.2 add a joint risk budget per action?
  • Policy authoring. v0.1 assumes the owner writes predicates and rules with help. How far can drafts from policy documents go before an owner must review them?
  • Routing. What deployment patterns make it impossible for vendor agents to bypass the gate?
  • Reviewer quality. How should automation bias in reviewers be measured and corrected?

Comment on this section on GitHub