differential attestation · built on lean 0.1.2

Deterministic code review.

A proof that the change did only what you asked. Or the input that breaks it, with the line to fix. Same change, same verdict, every time.

ledger.json · certificatewitness
{
  "unit": "applyAll",
  "verdict": "WITNESS",
  "input": 17,
  "floor": -1,
  "parent":    { "posted": 1 },
  "candidate": { "posted": 0 },
  "where": "candidate.ts:15  <= where the parent had <",
  "replay": "node langs/ts/check.mjs --seed 3 --n 60"
}
31.6%AACR-Bench F1 · reader 29.0
120/143planted mutations separated
53%of 39,775 functions in reach
917agent changes in 13 days, one repo
31.6vs 29.0
AACR-Bench F1

Against the published reader, same 184 instances, same judge.

2.2x22 vs 10
Escaped defects caught

Recordings against the strongest reader, on 43 defects that passed review.

120of 143
Planted mutations

Each separated by an input lean found. None proved equal.

53%of 39,775
Functions in reach

Proved or executed, across 36 repositories.

917in 13 days
Agent changes

One repository we operate. A reviewer reads about ten a day.

Use cases

Where a reader cannot keep up.

The gate reads neither the change text nor any statement by its producer. It runs both versions and compares them.

01 · AGENTSWITNESS

Agent-heavy repositories

917 changes in 13 days in one repository. The agent's account of a change never enters the verdict.

A WITNESS carries the source line of the first difference and the advised rewrite. The agent fixes against an input it can replay.
02 · PLATFORM--block witness

Platform teams

A gate in CI. Run it advisory first: one comment per pull request, updated on every push. Then block on WITNESS.

$ node langs/ts/ci/comment.mjs --repo <checkout> --base <sha> --head <sha> --post --block witness
03 · RESEARCHjudge.jsonl

Researchers

The benchmark ships with every judge verdict and both judge logs. A new language merges when it passes the conformance suite.

$ python3 -I conformance/run.py
Python at milestone 2: the lint names the rewrite, lane B in the TypeScript record shape, five pairs.
Core features

Three instruments. Five verdicts.

Each instrument compares two versions of the system and refuses on evidence. lean reports the strongest verdict the evidence supports.

RECORDINGinstrument 1

The system runs under a fixed stimulus set before and after the change. A difference outside the selected scope is refused.

The difference inside the scope must equal an edit the requester made on a real recording. 22 of 43 escaped defects caught, 4 of 43 clean changes refused.
PROOFPASS-proved · PASS-decided

lean proves the candidate equal to the parent for every input and every world. A component finite by its types is explored to the end.

statement: a loop with continue became a filter and a map. Equal_statement: true, 5 verified, 0 errors.
Toggle: PASS-decided, 8 state pairs over 2 assignment(s).
RELATIONinstrument 3

For every artifact that is not a function, a predicate declared outside the change compares the two versions.

Build and pipeline configuration, locale files, schemas, documents. With the artifact lane: 40 of 43 escaped defects caught.
VERDICTWITNESS

An input on which the two versions differ. lean draws it itself, and names the source line on each side.

applyAll: <= where the parent had <.
{"input":17,"floor":-1,"parent":1,"candidate":0}
VERDICTPASS-bounded · ASK

No difference found within a stated bound, and it says so. A bounded pass never becomes a proof. ASK names the construct.

PASS-bounded -> usual-booking.json
# lanes.A: ASK, translate: outside the subset (unsupported-syntax)
SCREEN ROWin DA

Two builds on the same screens: pixels, layout and the accessibility tree. lean names the state where two renders differ.

Search: WITNESS after a click and a timer.
div[2]/ul[0] insert <li key="vefqj">"vefqj"</li>
Open benchmark

AACR-Bench, with the judge's logs.

The official pipeline, unchanged judge, three rounds. Both entries counted over the 184 instances both scored.

EntryPrecisionRecallF1Comments
DA + leanreader, gate, lean34.09+6.3729.47−0.9631.61+2.591,059−367
Open Code Reviewthe published reader27.7230.4329.021,426

Percent, mean of three judge rounds. The readers ran on different models: ours on claude-opus-5-5 with a claude-opus-4-8 filter, the floor on claude-opus-4-6. A same-model run is scheduled. 12 of 196 instances unscored: 11 commits GitHub no longer serves, 1 reader failure.

On 43 defects that escaped human review

Strongest reader10 / 43
Recordings22 / 43
Recordings + proof31 / 43

The reader also refused 22 of 43 clean changes; the recordings refused 4. Two readers from different vendors missed the same defects. 144 escaped defects, six repositories.

Quick start

One function, one verdict.

Lane B needs only Node 24. Python 3 and Dafny 4 run the proof lane; without them lane A reports ASK.

01

Clone

The checkout holds the pairs the runs below use.

$ git clone https://github.com/NexusGPT/lean && cd lean
02

Check one function

Parent, candidate, unit name. lean picks the lanes and draws the input.

$ node langs/ts/check.mjs --parent langs/ts/tests/pairs/readme_ledger/parent.ts --candidate langs/ts/tests/pairs/readme_ledger/candidate.ts --unit applyAll --no-project --n 60 --seed 3 --out ledger.json
$ jq -c '.witness | {input, floor: .args[3], parent: .parent.outcome.returned.posted, candidate: .candidate.outcome.returned.posted}' ledger.json
{"input":17,"floor":-1,"parent":1,"candidate":0}
03

Decide a component

Every click order from every prop assignment, to the end of its state space.

$ node langs/ts/check.mjs --parent langs/ts/tests/pairs/finite_components/parent.tsx --candidate langs/ts/tests/pairs/finite_components/candidate.tsx --unit Toggle --no-project --n 60 --out toggle.json
PASS-decided -> toggle.json   # every click order from every prop assignment, decided: 8 state pairs over 2 assignment(s)
Or the image, both lanes pinned:docker build -t lean:local .
The paper

Differential Attestation: Accepting Agent-Written Changes from Recordings, Proofs and Declared Relations, Never from the Producer's Account

An acceptance gate that reads neither the change text nor any statement by its producer.