ToleranceArena
ToleranceArena hunts for the pose where a moving mechanism breaks its clearance, and every verdict rests on a number you can re-run.
arena sweep --angles-deg 0,30,60,90 --offsets-mm=-1.2 reads no_failure_found on four angles.
arena search --spec mechanism.yaml --budget 12 --seed 42 --output bundle finds the 0.8 mm gap at 45 degrees.
arena replay bundle re-measures the stored scenario in a fresh process, with no model code and no key,
and ends on replay: match for the scenario ID
scenario-bddcb450a86a87761837efc7837bc40304a3d6944919096373918f7ba478e396.
Recorded by scripts/readme-media/core-story.tape,
built by bash scripts/readme-media/build.sh (README media).
What it is
A mechanical design engineer needs to know whether a moving mechanism keeps a required gap while manufactured parts vary within their tolerances. A check at the nominal position answers "does it clear on paper". ToleranceArena asks whether it clears at the worst allowed placement and names the pose where it stops clearing.
Four parts work together. A search or a language model proposes poses to try. A CAD kernel measures the gap at each pose. An independent closed-form formula measures it again. A verdict exists only when the two numbers agree.
searchers referee record
grid sweep OCCT kernel + independent formula stored verdicts
seeded search --> one verdict per pose, with its --> campaign outcome, then
AI analyst scope and reason codes replay in a fresh process,
with no model
The built-in fixture is rotating_pin_v1. A pin orbits the origin at radius 40 mm while its arm turns from 0 to 90 degrees. A fixed obstacle stands at radius 46 mm and 45 degrees. Tolerance can shift the obstacle 1.2 mm in either radial direction, and the requirement is a surface gap of at least 1.5 mm. At the nominal position the gap is 2.0 mm. With the obstacle shifted 1.2 mm toward the origin, the gap at 45 degrees falls to 0.8 mm. A grid of 0, 30, 60 and 90 degrees at that shift measures a smallest gap of 8.04831268601 mm and misses the failure.
What it proves
- Two numbers must agree. The Open CASCADE kernel measures the minimum distance between the two solids, through build123d and OCP. A formula that imports no CAD code computes the same distance. A verdict is
satisfiedorviolatedonly when the two differ by at most 1e-5 mm. In a survey of 925 queries the largest difference was 8.882e-15 mm. - A kernel crash cannot produce a verdict. Each kernel query runs in a separate worker process under a 10 s deadline. A crash, a hang or an unparseable reply discards the worker and reports
indeterminatewith the reason codekernel_query_failed. - The model never decides. It proposes poses. Every measured number comes from the verifier, and the campaign outcome comes from stored verdicts.
- Every verdict names its scope. Each run prints what it checked and what it did not.
- A stored failure replays without a model.
arena replayre-measures a stored bundle in a fresh process that imports no model code and needs no key. - Guards are mutation-tested. The harness removes one guard at a time and requires a test to fail for each. It holds 1569 mutants, and 4103 tests sit behind three gates: 3282 fast, 367 native and 454 for the agent layer (all counts from 2026-12-03). The progress log records which batches ran, which mutants survived and what the survivors exposed.
What it does not claim
- It checks one named pair at the poses you give it and nothing else.
no_failure_foundmeans the sampled points held and nothing more. - It does not certify a design. The built-in fixture is synthetic, one pair of cylinders. The two STEP samples in
assets/step-samples/are small test mechanisms. - It makes no claim that the language model beats numerical search, and it makes no accuracy or speed claim for the analyst. The first recorded live analyst run (2026-12-02) found no failure, while the 21-point grid baseline found the 0.8 mm gap.
- It has been measured on Ubuntu 26.04 only. The 1e-5 mm tolerance was not re-checked on another kernel build or CPU.
Install
You need Python 3.12 and uv.
git clone https://github.com/vladimirrott/tolerance-arena
cd tolerance-arena
uv sync --locked
.venv/bin/arena doctor
arena doctor checks each capability this build advertises by doing it once: a kernel query, a failed-query report, a worker round trip, and a worker restart after SIGKILL. The AI analyst installs from its own dependency group, so the verifier runs without it:
uv sync --locked --group agents
bash scripts/check-agents.sh
Quick start
Two sweeps show the problem. The first checks four angles and says so.
.venv/bin/arena sweep --angles-deg 0,30,60,90 --offsets-mm=-1.2 # no_failure_found
.venv/bin/arena sweep --angles-deg 0,30,45,60,90 --offsets-mm=-1.2 # failure_found: 0.8 mm
The first sweep passes. It makes no claim about the angles between the four it measured. The second sweep adds 45 degrees and finds the failure, with a smallest gap of 0.8 mm against the 1.5 mm requirement. Write a negative value after an equals sign (--offset-mm=-1.2).
Check one pose, then search, then replay the stored result:
.venv/bin/arena verify --angle-deg 45 --offset-mm=-1.2 # violated, exit 1
.venv/bin/arena fixture rotating-pin --output . # writes mechanism.yaml
.venv/bin/arena search --spec mechanism.yaml --budget 12 --seed 42 --output bundle
.venv/bin/arena replay bundle # replay: match
The search and the replay both exit with status 1 here, because the stored finding is violated. Exit status: 0 for satisfied or no_failure_found, 1 for violated or failure_found, 2 for everything else (invalid input, a failed kernel query, indeterminate, inconclusive, an unexpected error), 130 after an interrupt.
Where to go next
| Section | What it holds |
|---|---|
| Getting started | Install: six routes and the fixes for the failures seen in clean containers. Use cases: who needs this and what the sources say. |
| How it works | Community specification: the engineering model, data contracts, search, repair and the analyst design. |
| Evidence and evaluation | Analyst evaluation protocol and the four rungs it scores. |
| Assembly and viewer | STEP import with a sidecar file, three mechanism families, mesh export and the web viewer, with an evidence log for each. |
| Project record | The progress log, the development log and the Kiro usage log. |
Status
State on 2026-12-03, from the progress log at commit 0e5f062. The log is the source of record: read it for what each command printed.
| Part | State and where to read |
|---|---|
| Kernel measurement, independent formula, verdict rule | Built, measured. Progress, commands and the 925-query survey. |
Supervised CAD worker and arena doctor | Built, measured. Progress, worker section. |
| Grid sweep that states what it sampled | Built, measured. Progress, commands. |
| Seeded search with a credit ledger, an evidence bundle and offline replay | Built, measured. Progress, issue 9. |
Counterexample reduction (arena reduce) | Built, measured. Development log, issue 13. |
AI analyst: Strands Agents SDK on Groq, model qwen/qwen3.8-27b | Built, tested offline, 160 registered live runs, no claim of an advantage over a grid. Progress, analyst section, and the evaluation protocol. |
Omission analyst (arena omissions) | Built, tested offline, one live run on the fixture and three live planted-case runs. Live evaluation, Kiro usage log, K29. |
Prose to fixture (arena fixture-from-prose) | Built, one live request recorded. Progress, issue 23. |
AI repair proposal with a paired before and after replay (arena repair-replay) | Built, tested offline, three live planted-case runs, the first one poor. Live evaluation, Progress, issue 16. |
| STEP assemblies: sidecar, families, pose measurement, export, pipeline commands | Built, measured. Assembly sidecar, families, export and viewer. |
Local API and web viewer (arena serve) | Built, measured. Progress, issues 11 and 26. |
| Hosted demo | Built. A replay of recorded kernel output on GitHub Pages. |
| Sketch input | Not built. The src/ tree holds no code for it. |
License and contest
ToleranceArena is licensed under the European Union Public Licence, version 1.2 only (EUPL-1.2). It is an entry to Kiroween 2026, category Frankenstein. The Kiro usage log gives each Kiro activity a row with its date, surface, version, command, output and result, and every other row reads planned.