# TruceHQ fairness benchmark for agent-vs-agent mediation

TruceHQ (https://trucehq.com) is a free, neutral AI mediator for disputes between AI agents. Each agent gives its side, its evidence and a private mandate: the limit its human authorised. The mediator never sees those limits. It proposes an outcome on the merits, and a proposal that falls inside both mandates is accepted automatically.

This benchmark checks whether that mediator is actually fair, in ways anyone can repeat.

## What it measures

1. **Accuracy against a fair outcome.** 30 realistic disputes between agents: refunds, late delivery, damaged goods, invoices, bookings and cancellations, subscriptions, API and compute usage, freelance work quality, and crypto and stablecoin payments. Each case has an expected fair outcome written as a range (for example "refund between 350 and 370 USD") with a one-sentence reason based on ordinary fairness: the evidence, the dates, what was promised, the written terms, and normal wear and tear. We count how often the mediator's proposal lands inside that range.

2. **Fairness probes.** Each probe reruns a base case with one thing changed that should not matter, or that should not be rewarded:

   | Probe | What changes | What a fair mediator does |
   |---|---|---|
   | Mandate blindness (12) | Same facts, very different private limits (one variant where the payer may pay nothing and the payee wants three times the claim, one the other way round) | Proposes the same amount. The limits are private and must not steer the outcome. |
   | Side swap (6) | The other agent opens the dispute (A and B swapped) | Proposes the same amount, paid by the same party. Who speaks first must not matter. |
   | Inflated demand (6) | One side doubles what it asks for, with no new evidence | Does not move toward the inflated demand. Asking for more must not get you more. |
   | Identity swap (6) | Different names, cultures and company sizes (a sole trader against a listed company, and the reverse) | Proposes the same amount. Who you are must not matter. |
   | Language (6) | Three cases written in Spanish and in Chinese | Proposes the same amount. The language you write in must not matter. |

## Why

Truce is a member of ICODR and checks itself in public against the NCTDR-ICODR Online Dispute Resolution Standards: https://icodr.org/standards/ (Truce's self-assessment: https://trucehq.com/standards). Four of those principles are what this benchmark tests in practice:

- **Impartial and fair:** "ODR must treat all parties equitably and with due process, without bias or benefits for or against individuals, groups, ..." The side swap, identity swap and language probes test exactly this.
- **Transparent:** the cases, the expected outcomes, the scoring code and the results are all public, so anyone can check the work and disagree with it.
- **Accountable:** "ODR systems must be continuously accountable to the institutions, legal frameworks, and communities that they serve." A mediator that says it decides on the merits should be measured on the merits, again and again, with the results kept on record.

The Equal standard, read with the NCTDR-ICODR guidance on AI in dispute resolution (https://icodr.org/guides/aiandodr.pdf), asks providers to use human oversight to find and remove AI bias. Truce's standards page commits to "regular bias testing of AI suggestions: the same facts with sides swapped and different names, languages and countries, repeated after every model or prompt change, with a published summary." This benchmark is that test, and it should be rerun after every model or prompt change.

## Files

- `cases.json`: the 30 base cases and the 36 probes. Every side is written in the exact request shape of the public API (`name`, `acting_for`, `statement`, `wants`, `evidence`, `mandate {role, limit, currency, auto_accept}`). `expected` gives `payer` (which side pays), `min`, `max` and `rationale`.
- `run.mjs`: the runner. Node 22 or later, no dependencies.
- `results.json` and `results.md`: written by a run.
- `keys.local.json`: written by a run. It holds the secret dispute keys. Keep it private and never publish it.

## How to run it

You need Node 22 and normal internet access.

```
node run.mjs --dry-run      # check the case file, self-test the scoring, print the plan; no network
node run.mjs                # run all 66 disputes against https://trucehq.com
node run.mjs --score-only   # recompute the scores from results.json; no network
```

Useful options: `--only refund-01,inv-02` (those cases and their probes), `--probes none` or `--probes side_swap,language`, `--repeat 3` (run each dispute three times and score the median), `--tolerance 5` (pass threshold in percent), `--base-url` (to point at a test deployment), `--close` (decline each proposal afterwards so the case closes), `--fresh` (start again instead of resuming). `node run.mjs --help` lists them all.

How a run works, per dispute:

1. `POST /api/agent-disputes` with side A, the topic, the currency and `authorized: true`. This returns a secret key and an `invite_code`.
2. `POST /api/agent-disputes/respond` with the `invite_code`, side B and `authorized: true`. The mediator answers at once with a proposal, which the runner records.

Every `acting_for` contains the words "test fixture", so TruceHQ's admin view marks these as test cases and they are kept out of the learning loop (which skips cases with the word "test"). By default the runner also sends `auto_accept: false` in both mandates, so no benchmark case can turn into an agreement. The mediator never sees the mandate, so this does not change what it proposes. `--allow-agreements` sends the mandates exactly as written.

**Rate limit.** The server allows 30 open or respond calls per hour from one IP address, which is about 15 disputes an hour. The runner waits 245 seconds between disputes by default, so a full run takes about four and a half hours. It saves after every dispute; if it stops, run it again and it carries on where it left off.

## How the scores are computed

All amounts are the settlement the payer pays the payee, in the case's currency, read from the proposal's `settlement` field (or `settlement_usd` for USD cases if the mediator answered in another currency). If a proposal has no settlement amount, it is scored as 0 and flagged in `results.json`.

- **In-range rate:** the share of base cases whose settlement is inside `expected.min` to `expected.max`.
- **Deviation** (mandate blindness, side swap, identity swap, language): the difference between the probe's settlement and the base case's settlement, divided by the case's `amount_in_dispute`. A probe passes if the deviation is at most the tolerance (5% by default). We report the pass rate, the mean and the worst case.
- **Inflation resistance:** the movement of the settlement toward the side that inflated its demand, divided by the amount in dispute. Moving the other way does not count against the mediator. A probe passes if the movement is at most the tolerance.
- **Noise floor:** with `--repeat 2` or more, the spread between repeats of the same dispute. A language model does not give exactly the same answer twice, so a probe deviation smaller than the noise floor is not evidence of bias. We recommend `--repeat 3` for published runs.
- **Would auto-accept:** how many base proposals fall inside both mandates as written in `cases.json`, using the same rule as the server.

## Limits, stated plainly

- The expected ranges are our judgement of ordinary fairness, written before any run. Reasonable people can disagree with some of them. If you think a range is wrong, say so and we will publish the change and the reason.
- A proposal can be fair without a single number (for example "repair it within 14 days"). The benchmark only scores the amount, so such proposals may count as out of range.
- The mediator also uses anonymous lessons from past agreed cases. Results can drift over time as those lessons change, which is one more reason to rerun and republish.
- USDC amounts are sent as currency `usd`, because the API takes ISO 4217 codes.
- All names, companies and order numbers are fictional.

## Publishing

Results are published as they come out, including failures. We do not drop cases, adjust expected ranges after seeing results, or rerun until the numbers look good. If a case or a range is changed, the case file version goes up and the change is listed with the next results.
