> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rotascale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Behavioural contracts

> What an owner commits an agent will and will never do, in a form the platform can check against real traffic. Nine clause types, three states, and a revision that loosens must say so.

A grant says what an agent **may** do. A contract says what its owner expects it
**will** do — and unlike a grant, a contract is checked after the fact, against
the decisions that actually happened.

```
never calls wire_transfer
refused at most 5% of decisions
95% of authorised amounts at or below 500.00
```

Each of those is one clause. A contract is a set of them, declared by a named
person with a stated basis, and assessed over a window of real traffic.

## Why a closed vocabulary

There are nine clause types and you cannot write a tenth without changing the
platform. That is deliberate, and it costs less than it sounds.

A general policy language — Rego, Cedar, CEL — would buy expressiveness and lose
three things this product is built on:

<AccordionGroup>
  <Accordion title="Nobody can sign a policy module">
    A signature over 200 lines of policy is not an attestation, because the
    person signing cannot hold the whole of it in their head. Every clause here
    renders as **one line** a manager can be held to, and that line is what they
    sign.
  </Accordion>

  <Accordion title="Comparison stops being decidable">
    A revision has to be checkable against the contract in force. For numbers
    and sets that is arithmetic. For arbitrary predicates it is implication
    testing, which is not decidable in general — so "is this revision weaker?"
    would become a question with no answer.
  </Accordion>

  <Accordion title="You lose the third state">
    A predicate returns true or false. That collapses *held*, *breached* and
    *not demonstrated* into "no errors were raised", which is the vacuous signal
    this platform refuses everywhere.
  </Accordion>
</AccordionGroup>

## What a clause is not

A clause is **distributional**. It describes a population of decisions over a
window, not a single action.

"No single refund above 500" is not a clause — it is a [bound](/concepts/grants),
evaluated at the moment of the decision, and the platform already enforces it
there. "Refuses at most 5% of the time" cannot be evaluated at the moment of a
decision at all; there is no population yet.

That split is why a breach is a **finding, not a refusal**. Acting on a contract
at decision time would refuse an action because of a population it had not yet
joined. What refuses at decision time is the grant.

## The three states

<CardGroup cols={3}>
  <Card title="held" icon="check">
    The evidence shows the clause was kept.
  </Card>

  <Card title="breached" icon="triangle-exclamation">
    The evidence shows it was not.
  </Card>

  <Card title="not demonstrated" icon="circle-question">
    This window cannot tell those apart. Not a pass.
  </Card>
</CardGroup>

The third state is decided by a confidence interval, not by a comparison — see
[conformance claims](/concepts/conformance-claims). An agent at 5.4% against a
5% ceiling over 40 decisions is not breaching. It is unmeasured, and reporting
it as a breach is how people learn to ignore breaches.

One clause type has no minimum sample and should not: `never_tools`. "Never" is
not a rate. A single call to a forbidden tool is a breach on its own evidence.

## Revising a contract

Contracts are never edited. A revision supersedes the one in force, and the old
one stays readable — what was promised in March has to survive April tightening
it.

**Tightening is free.** A manager who committed to "at most 5%" is not harmed by
"at most 2%", so no fresh declaration is needed.

**Loosening must say so.** A revision that weakens a clause is refused unless it
is declared deliberately, in somebody's name. So is a revision that simply
*omits* a clause the contract carries: silence is not a promise, and treating an
omission as inheritance would let any revision drop any commitment by saying
nothing.

<Warning>
  This asymmetry is the whole control. If a contract could be edited in place, a
  breach could be resolved by widening the clause that was breached — which is
  the failure mode every configurable control has.
</Warning>

## Declaring one

<CodeGroup>
  ```bash cURL theme={"system"}
  curl -X POST https://your-deployment/v1/agents/$AGENT_ID/contract \
    -H "x-api-key: $ROTASCALE_API_KEY" \
    -H "content-type: application/json" \
    -d '{
      "clauses": {
        "never_tools": ["wire_transfer"],
        "max_deny_share": 0.05
      },
      "basis": "Reviewed the refund flow with the payments team on 3 August."
    }'
  ```
</CodeGroup>

`basis` is required. A contract with no stated basis is a signature on a blank
page, and the question an auditor asks is not whether somebody signed but what
they thought they were signing.

## The nine clause types

| Clause                  | Says                                                    |
| ----------------------- | ------------------------------------------------------- |
| `never_tools`           | These tools are never called                            |
| `max_deny_share`        | Refused at most this share of decisions                 |
| `max_gated_share`       | Blocked by the taint gate at most this share            |
| `max_exhausted_share`   | Out of budget at most this share                        |
| `max_allow_share`       | Allowed at most this share                              |
| `min_review_share`      | Sent to a person at least this share                    |
| `max_policy_divergence` | Policy disagreed with the outcome at most this share    |
| `min_observed_scope`    | Scope observed rather than asserted at least this share |
| `max_amount_p95`        | 95% of authorised amounts at or below this              |

Every one reads a measure the platform already computes for
[behavioural drift](/concepts/behaviour). That is not a convenience: it is what
makes a clause assessable against history, so the first question anybody asks
about a new control — *what would this have said last month?* — has an answer.
