diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000000000000000000000000000000000..eb25eaf90087c566e48462ded3b1cfcc2dfc3b70
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+*.7z filter=lfs diff=lfs merge=lfs -text
+*.arrow filter=lfs diff=lfs merge=lfs -text
+*.avro filter=lfs diff=lfs merge=lfs -text
+*.bin filter=lfs diff=lfs merge=lfs -text
+*.bz2 filter=lfs diff=lfs merge=lfs -text
+*.ckpt filter=lfs diff=lfs merge=lfs -text
+*.ftz filter=lfs diff=lfs merge=lfs -text
+*.gz filter=lfs diff=lfs merge=lfs -text
+*.h5 filter=lfs diff=lfs merge=lfs -text
+*.joblib filter=lfs diff=lfs merge=lfs -text
+*.lfs.* filter=lfs diff=lfs merge=lfs -text
+*.lz4 filter=lfs diff=lfs merge=lfs -text
+*.mds filter=lfs diff=lfs merge=lfs -text
+*.mlmodel filter=lfs diff=lfs merge=lfs -text
+*.model filter=lfs diff=lfs merge=lfs -text
+*.msgpack filter=lfs diff=lfs merge=lfs -text
+*.npy filter=lfs diff=lfs merge=lfs -text
+*.npz filter=lfs diff=lfs merge=lfs -text
+*.onnx filter=lfs diff=lfs merge=lfs -text
+*.ot filter=lfs diff=lfs merge=lfs -text
+*.parquet filter=lfs diff=lfs merge=lfs -text
+*.pb filter=lfs diff=lfs merge=lfs -text
+*.pickle filter=lfs diff=lfs merge=lfs -text
+*.pkl filter=lfs diff=lfs merge=lfs -text
+*.pt filter=lfs diff=lfs merge=lfs -text
+*.pth filter=lfs diff=lfs merge=lfs -text
+*.rar filter=lfs diff=lfs merge=lfs -text
+*.safetensors filter=lfs diff=lfs merge=lfs -text
+saved_model/**/* filter=lfs diff=lfs merge=lfs -text
+*.tar.* filter=lfs diff=lfs merge=lfs -text
+*.tar filter=lfs diff=lfs merge=lfs -text
+*.tflite filter=lfs diff=lfs merge=lfs -text
+*.tgz filter=lfs diff=lfs merge=lfs -text
+*.wasm filter=lfs diff=lfs merge=lfs -text
+*.xz filter=lfs diff=lfs merge=lfs -text
+*.zip filter=lfs diff=lfs merge=lfs -text
+*.zst filter=lfs diff=lfs merge=lfs -text
+*tfevents* filter=lfs diff=lfs merge=lfs -text
+# Audio files - uncompressed
+*.pcm filter=lfs diff=lfs merge=lfs -text
+*.sam filter=lfs diff=lfs merge=lfs -text
+*.raw filter=lfs diff=lfs merge=lfs -text
+# Audio files - compressed
+*.aac filter=lfs diff=lfs merge=lfs -text
+*.flac filter=lfs diff=lfs merge=lfs -text
+*.mp3 filter=lfs diff=lfs merge=lfs -text
+*.ogg filter=lfs diff=lfs merge=lfs -text
+*.wav filter=lfs diff=lfs merge=lfs -text
+# Image files - uncompressed
+*.bmp filter=lfs diff=lfs merge=lfs -text
+*.gif filter=lfs diff=lfs merge=lfs -text
+*.png filter=lfs diff=lfs merge=lfs -text
+*.tiff filter=lfs diff=lfs merge=lfs -text
+# Image files - compressed
+*.jpg filter=lfs diff=lfs merge=lfs -text
+*.jpeg filter=lfs diff=lfs merge=lfs -text
+*.webp filter=lfs diff=lfs merge=lfs -text
+# Video files - compressed
+*.mp4 filter=lfs diff=lfs merge=lfs -text
+*.webm filter=lfs diff=lfs merge=lfs -text
+sample/scorer/bin/sample_verifier-linux-amd64 filter=lfs diff=lfs merge=lfs -text
+sample/scorer/bin/sample_verifier-macos-arm64 filter=lfs diff=lfs merge=lfs -text
+sample/scorer/bin/sample_verifier-linux-arm64 filter=lfs diff=lfs merge=lfs -text
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000000000000000000000000000000000000..8a8364d9007df82ecb86e0c43058fb6199499b22
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,3 @@
+Evaluation only. This free sample is for evaluating the tasks. It grants no licence to train on them or pass them on. Licensed use: https://zerotrustphysics.com/offers/fast-start/
+
+Protocol Company
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..343c263ad66bae5010c2280e0a1146c1bf600243
--- /dev/null
+++ b/README.md
@@ -0,0 +1,75 @@
+---
+pretty_name: "Zero-Trust Physics free sample: Batteries, Thermal Runaway & Grid Frequency"
+license: other
+license_name: evaluation-only
+license_link: LICENSE.md
+language: [en]
+tags: [physics, rl-environment, rlvr, harbor, hud, mcp, evaluation, zero-trust-physics]
+task_categories: [reinforcement-learning, question-answering]
+size_categories: [n<1K]
+viewer: true
+configs:
+ - config_name: default
+ data_files:
+ - split: test
+ path: sample_tasks.jsonl
+---
+
+# Free sample: Batteries, Thermal Runaway & Grid Frequency
+
+
+**Five free tasks from the battery and grid pack.**
+
+An agent works with real battery cells, a Tesla Model 3 cell and a Panasonic cell, and with a cell heated in an oven until it runs away. Every answer is graded by rerunning the physics, with no AI judge.
+
+- **Run it:** clone this repository and run `sh sample/verify_sample.sh`. It works offline.
+- **What’s inside:** the 5 tasks, the scorer, the reference answers, the cheat suite and a quality report for each task.
+- **Beyond the sample:** Flagship task pack, Exclusive batches, Custom environments, Runtime & private infrastructure: scoped and invoiced, https://zerotrustphysics.com/offers/
+
+Every number is below.
+
+---
+
+
+> **Protocol Company** · [zerotrustphysics.com](https://zerotrustphysics.com) · **The Foundry:** physics environments of real systems ([free runnable preview](https://huggingface.co/datasets/zero-trust-physics/zero-trust-physics-foundry-preview)) · Flagship task pack, Exclusive batches, Custom environments, Runtime & private infrastructure: scoped and invoiced, https://zerotrustphysics.com/offers/ · free open-engine samples: [sample groups 1–5](https://huggingface.co/collections/zero-trust-physics/zero-trust-physics-6ad3b6ef5195b706ac6d041e) · [kruze@zerotrustphysics.com](mailto:kruze@zerotrustphysics.com)
+
+Protocol Company · Zero-Trust Physics · release v0.15.3 · 13 November 2026
+
+Five calibrated multi-step physics RLVR tasks scored by deterministic recomputation on the Zero-Trust Physics verifier; the reward is computed, never judged by a model.
+
+**Domain & slice coverage.** These 5 free evaluation tasks exercise empirical battery electrochemistry and thermal-runaway models (`energy/cell_2170_model3` Tesla 2170 cell, `energy/cell_18650pf` Panasonic NCR18650PF, and `energy/runaway_18650_lco` two-stage oven runaway chained via sealed `from` state continuation): two budgeted searches for physical cutoffs, two designs to a limit, and one sequential chained design. The full 30-task paid Domain Pack and 100,000-run SFT corpus expand across Great Britain power-grid frequency dynamics on 86 NESO interconnector trips (`energy/grid_gb`), cross-model electro-thermal-grid couplings, and forensics audits.
+
+**Evaluation only.** This free sample is for evaluating the tasks. It grants no licence to train on them or pass them on.
+
+| Task (kind) | pass@1 (solved / n) | pass@8 | Mean graded | Cheat suite |
+|---|---|---|---|---|
+| `g1d-budget5-cell1000-current-16min-11c` (budgeted search) | 37.5% (3 of 8) | 100% (n=8) | 0.721 | 0 of 16 above 0; honest 3 of 3 at 1 |
+| `g1f-budget4-cell1000-least-capacity-15a-31c` (budgeted search) | 12.5% (1 of 8) | 100% (n=8) | 0.468 | 0 of 16 above 0; honest 3 of 3 at 1 |
+| `g1d-limit-cell448-lowest-start-charge-11min-18c` (design to a limit) | 25% (2 of 8) | 100% (n=8) | 0.507 | 0 of 17 above 0; honest 3 of 3 at 1 |
+| `g1f-chain-runaway-new-soak-then-warm-room` (chained design) | 25% (2 of 8) | 100% (n=8) | 0.555 | 0 of 22 above 0; honest 3 of 3 at 1 |
+| `g1f-limit-18650pf-lowest-start-charge-2a7-27min` (design to a limit) | 62.5% (5 of 8) | 100% (n=8) | 0.653 | 0 of 17 above 0; honest 3 of 3 at 1 |
+
+Calibrated on a frontier model (tool variant, 8 attempts per task): sample `pass@1` spans 12.5%–62.5% (median 25%), with `pass@8` and continuous `graded` reward (scoring bracket or design tightness against task tolerance) reported beside binary `pass/fail`. Across all 5 tasks, 88 adversarial cheat attempts scored `0` above `0` and all 15 honest controls scored `1`. Per-task quality reports (HTML and JSON) are in `reports/`.
+
+**Attempting a task.** The Harbor, HUD, Inspect, and native MCP variants shipped in this free sample connect to https://mcp.zerotrustphysics.com/mcp/open (`Too many concurrent physics tasks.` triggers automatic retry in the bundled bridge). The public MCP preview endpoint serves 1 concurrent physics call per IP for interactive evaluation; parallel RL rollouts use the zero-dependency offline binary.
+
+> **`https://mcp.zerotrustphysics.com/mcp`** now serves the Vivarium: four closed physical systems to read, fork, drive and be graded on. The open library (`v0.15.3`) used here is at `https://mcp.zerotrustphysics.com/mcp/open`, unchanged.
+
+**For rollouts at scale,** the Flagship task pack and the runtime licence ship compiled offline binaries for Linux amd64, Linux arm64 and macOS arm64, so Harbor rollouts and grading run `--network none` with zero external dependencies and no rate limit. Managed private deployment is available under an enterprise agreement.
+
+**Scoring.** `scorer/` scores offline: `bin/` holds a sample-only verifier (macOS arm64, Linux amd64, Linux arm64) that computes these 5 tasks' requests, and refuses everything else by name. It holds no signing key, and its answers matched the served engine byte for byte on all 4,149 calls compared. The 5-crate Rust physics and proof-verification engine source is public, archived read-only at tag `v0.15.3` (https://github.com/johnkruze/zero-trust-physics-engine/tree/v0.15.3); read-only source audit of the pack verifier build is available under NDA for qualified buyers (https://zerotrustphysics.com/offers/fast-start/#runtime). Harbor's own grader runs in the task image and reaches the address.
+
+**HUD.** `tasks/hud/tasks/` packages these tasks for HUD's Harbor adapter (`hud.integrations.harbor.adapt`). Verifier calls route through an HTTP logging sidecar while the agent's sandbox has no network, and the grader reads the call log from the sidecar's container so the call budget holds without a Harbor trajectory (an edited or missing log scores `0`). Validated on HUD adapter 0.6.21 (5/5 tasks) and local Docker runtime; reach out for assisted HUD cloud onboarding.
+
+| Folder | What it holds |
+|---|---|
+| `tasks/` | `harbor/`, `hud/`, `inspect/`, `mcp/`: the 5 tasks in each format. |
+| `scorer/`, `harness/` | The scorer, cheat suite, sample verifier, bridge to the address, call-logging proxy. |
+| `reference/`, `reports/`, `calibration/` | Reference answers with SHA-384 proofs; a quality report per task; `passk_summary.json` and `cheat_suite.jsonl`. |
+| `VERIFY.md`, `verify_sample.sh`, `SHA384SUMS` | One command: every hash, the 5 references, the cheat suite. |
+
+**Commercial work:** this group's withheld tasks are not in this archive, and this sample verifier does not compute them. Flagship task pack, Exclusive batches, Custom environments, Runtime & private infrastructure: scoped and invoiced, https://zerotrustphysics.com/offers/
+
+Protocol Company · zerotrustphysics.com
+
+**In this repository:** `sample_tasks.jsonl` powers the Dataset Viewer above; `sample/` is the archive unpacked, unchanged (run `sh sample/verify_sample.sh`); `archive/` holds the `.tar.gz` archive, the Raw Data `.zip`, and their SHA-384 files. The Foundry (free preview: https://huggingface.co/datasets/zero-trust-physics/zero-trust-physics-foundry-preview) and its four offers: https://zerotrustphysics.com/offers/fast-start/
diff --git a/archive/zero-trust-physics-sample-raw-data_batteries-thermal-runaway-grid-frequency_2026-11-13.zip b/archive/zero-trust-physics-sample-raw-data_batteries-thermal-runaway-grid-frequency_2026-11-13.zip
new file mode 100644
index 0000000000000000000000000000000000000000..2bf2f23c540f92ad78b77cfda895c4df410f139c
--- /dev/null
+++ b/archive/zero-trust-physics-sample-raw-data_batteries-thermal-runaway-grid-frequency_2026-11-13.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7cb8935b3af89404f0e58572dbc9cf4fdd561dcfd26ae98f77c20d7c473310d9
+size 109987
diff --git a/archive/zero-trust-physics-sample-raw-data_batteries-thermal-runaway-grid-frequency_2026-11-13.zip.sha384 b/archive/zero-trust-physics-sample-raw-data_batteries-thermal-runaway-grid-frequency_2026-11-13.zip.sha384
new file mode 100644
index 0000000000000000000000000000000000000000..9ee298245036c379246e9073b4df68a77b4e4413
--- /dev/null
+++ b/archive/zero-trust-physics-sample-raw-data_batteries-thermal-runaway-grid-frequency_2026-11-13.zip.sha384
@@ -0,0 +1 @@
+c9d80c89086066b0cbf76c4b36a68e3e319ccf1879908dec0d73daf7b28a8d2fa90a0ef9d55633104745435a4f471a24 zero-trust-physics-sample-raw-data_batteries-thermal-runaway-grid-frequency_2026-11-13.zip
diff --git a/archive/zero-trust-physics-sample_batteries-thermal-runaway-grid-frequency_2026-11-13.tar.gz b/archive/zero-trust-physics-sample_batteries-thermal-runaway-grid-frequency_2026-11-13.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2c65d957c9b469cb50bd149ebdeab677e1141385
--- /dev/null
+++ b/archive/zero-trust-physics-sample_batteries-thermal-runaway-grid-frequency_2026-11-13.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c8100283808db7bccba51b50eb02ec936ba0a5f4f17af33b474e5d29833fca4b
+size 2076446
diff --git a/archive/zero-trust-physics-sample_batteries-thermal-runaway-grid-frequency_2026-11-13.tar.gz.sha384 b/archive/zero-trust-physics-sample_batteries-thermal-runaway-grid-frequency_2026-11-13.tar.gz.sha384
new file mode 100644
index 0000000000000000000000000000000000000000..2c362aa17b0f265d94bef952b9eee5d7c591cf5b
--- /dev/null
+++ b/archive/zero-trust-physics-sample_batteries-thermal-runaway-grid-frequency_2026-11-13.tar.gz.sha384
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4a2610a29fcb5b0448a350f2936b16dd1b1aee1eb9e08a468f047428d3b72e3b
+size 183
diff --git a/sample/README.md b/sample/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..861910964a4dd9775eecb6a77f2f6a9e99544d29
--- /dev/null
+++ b/sample/README.md
@@ -0,0 +1,40 @@
+# Free sample: Batteries, Thermal Runaway & Grid Frequency
+
+Protocol Company · Zero-Trust Physics · release v0.15.3 · 13 November 2026
+
+Five calibrated multi-step physics RLVR tasks scored by deterministic recomputation on the Zero-Trust Physics verifier; the reward is computed, never judged by a model.
+
+**Domain & slice coverage.** These 5 free evaluation tasks exercise empirical battery electrochemistry and thermal-runaway models (`energy/cell_2170_model3` Tesla 2170 cell, `energy/cell_18650pf` Panasonic NCR18650PF, and `energy/runaway_18650_lco` two-stage oven runaway chained via sealed `from` state continuation): two budgeted searches for physical cutoffs, two designs to a limit, and one sequential chained design. The full 30-task paid Domain Pack and 100,000-run SFT corpus expand across Great Britain power-grid frequency dynamics on 86 NESO interconnector trips (`energy/grid_gb`), cross-model electro-thermal-grid couplings, and forensics audits.
+
+**Evaluation only.** This free sample is for evaluating the tasks. It grants no licence to train on them or pass them on.
+
+| Task (kind) | pass@1 (solved / n) | pass@8 | Mean graded | Cheat suite |
+|---|---|---|---|---|
+| `g1d-budget5-cell1000-current-16min-11c` (budgeted search) | 37.5% (3 of 8) | 100% (n=8) | 0.721 | 0 of 16 above 0; honest 3 of 3 at 1 |
+| `g1f-budget4-cell1000-least-capacity-15a-31c` (budgeted search) | 12.5% (1 of 8) | 100% (n=8) | 0.468 | 0 of 16 above 0; honest 3 of 3 at 1 |
+| `g1d-limit-cell448-lowest-start-charge-11min-18c` (design to a limit) | 25% (2 of 8) | 100% (n=8) | 0.507 | 0 of 17 above 0; honest 3 of 3 at 1 |
+| `g1f-chain-runaway-new-soak-then-warm-room` (chained design) | 25% (2 of 8) | 100% (n=8) | 0.555 | 0 of 22 above 0; honest 3 of 3 at 1 |
+| `g1f-limit-18650pf-lowest-start-charge-2a7-27min` (design to a limit) | 62.5% (5 of 8) | 100% (n=8) | 0.653 | 0 of 17 above 0; honest 3 of 3 at 1 |
+
+Calibrated on a frontier model (tool variant, 8 attempts per task): sample `pass@1` spans 12.5%–62.5% (median 25%), with `pass@8` and continuous `graded` reward (scoring bracket or design tightness against task tolerance) reported beside binary `pass/fail`. Across all 5 tasks, 88 adversarial cheat attempts scored `0` above `0` and all 15 honest controls scored `1`. Per-task quality reports (HTML and JSON) are in `reports/`.
+
+**Attempting a task.** The Harbor, HUD, Inspect, and native MCP variants shipped in this free sample connect to https://mcp.zerotrustphysics.com/mcp/open (`Too many concurrent physics tasks.` triggers automatic retry in the bundled bridge). The public MCP preview endpoint serves 1 concurrent physics call per IP for interactive evaluation; parallel RL rollouts use the zero-dependency offline binary.
+
+> **`https://mcp.zerotrustphysics.com/mcp`** now serves the Vivarium: four closed physical systems to read, fork, drive and be graded on. The open library (`v0.15.3`) used here is at `https://mcp.zerotrustphysics.com/mcp/open`, unchanged.
+
+**For rollouts at scale:** Domain Pack, scoped and invoiced, https://zerotrustphysics.com/offers/
+
+**Scoring.** `scorer/` scores offline: `bin/` holds a sample-only verifier (macOS arm64, Linux amd64, Linux arm64) that computes these 5 tasks' requests, and refuses everything else by name. It holds no signing key, and its answers matched the served engine byte for byte on all 4,149 calls compared. The 5-crate Rust physics and proof-verification engine source is public at https://github.com/johnkruze/zero-trust-physics-engine (tag `v0.15.2`); read-only source audit of the pack verifier build is available under NDA for qualified buyers (https://zerotrustphysics.com/offers/#licence). Harbor's own grader runs in the task image and reaches the address.
+
+**HUD.** `tasks/hud/tasks/` packages these tasks for HUD's Harbor adapter (`hud.integrations.harbor.adapt`). Verifier calls route through an HTTP logging sidecar while the agent's sandbox has no network, and the grader reads the call log from the sidecar's container so the call budget holds without a Harbor trajectory (an edited or missing log scores `0`). Validated on HUD adapter 0.6.21 (5/5 tasks) and local Docker runtime; reach out for assisted HUD cloud onboarding.
+
+| Folder | What it holds |
+|---|---|
+| `tasks/` | `harbor/`, `hud/`, `inspect/`, `mcp/`: the 5 tasks in each format. |
+| `scorer/`, `harness/` | The scorer, cheat suite, sample verifier, bridge to the address, call-logging proxy. |
+| `reference/`, `reports/`, `calibration/` | Reference answers with SHA-384 proofs; a quality report per task; `passk_summary.json` and `cheat_suite.jsonl`. |
+| `VERIFY.md`, `verify_sample.sh`, `SHA384SUMS` | One command: every hash, the 5 references, the cheat suite. |
+
+**Commercial packs and licensing:** Domain Pack, scoped and invoiced, https://zerotrustphysics.com/offers/. None of the withheld tasks is in this archive, and this sample verifier does not compute them.
+
+Protocol Company · zerotrustphysics.com
diff --git a/sample/SHA384SUMS b/sample/SHA384SUMS
new file mode 100644
index 0000000000000000000000000000000000000000..decc0bbb04ea8ee7d9f38fbbbd25f00496691cd6
--- /dev/null
+++ b/sample/SHA384SUMS
@@ -0,0 +1,271 @@
+e6ef6a91632fce9fd169d423096cf927e76f26fa19cef219a4230e1f1b4752cd5a64d8147a73b1a78309cced0fb6c7ee ./README.md
+1e071fae1d71e92b776c89137452631b1a37a46f8de033135b91bf133e49a56a5257b4fea4fbbfeddd2c6dbe27fb6734 ./VERIFY.md
+7fdd8a41fa8d3047ac9939136032e2082b68796e5664bc95c3693eecda1d45def0b1f10280cd0f6a4a7819660a819d92 ./calibration/cheat_suite.jsonl
+ef50f494e3d3276291ca055cbc515900e3d945eb29935235c66a450be723fbdde2217a4ecd577d6f94c16f672c3c71c4 ./calibration/passk_summary.json
+87779703ea62613cc92343c13c470bfb394ba1688426eb4809d4f0dbf264fec2e96ab604b9ca2e49580060b99097deb4 ./harness/mcp_log_proxy.py
+7d578348822bef4aef55bc1d59e80043075486b89480efa3120fd7f5858b79cd911d64691956b12554d5151eff4bab4a ./reference/g1d-budget5-cell1000-current-16min-11c.calls.jsonl
+fc5d0700db21cfc38417c2b72613f0812a2b07e726cda630ca59557297b042fa08ac2b8977abaf206261c4d068f0e80b ./reference/g1d-budget5-cell1000-current-16min-11c.harness.jsonl
+a336f017f1134246eba676a6ac751f1be08654aa12ce050a771f8a09a2eee8f4f1a9be3618657ce8bfc14dfd7cbaf744 ./reference/g1d-budget5-cell1000-current-16min-11c.harness.jsonl.status.json
+25573a2325b8c659416ccf30d42da5a3a7e4a952e756842bff40bd60c2d6445580932e4abcaf8eee8addf36ba5cf5192 ./reference/g1d-budget5-cell1000-current-16min-11c.txt
+11c5ce0b7518ba026564dcc1baf5ffd6e0b614bcb1eac63bc0b4061932ca3435848a7905b4fcf79002d44539bb527b8c ./reference/g1d-limit-cell448-lowest-start-charge-11min-18c.calls.jsonl
+1173a82c442fe22d499bc7074e2d4a1c862d9ac719600db1de50e45396d19fee76a433318b6eaca618f5412ef281ea73 ./reference/g1d-limit-cell448-lowest-start-charge-11min-18c.harness.jsonl
+8f3376d80d87c5be83cf388aac63e1922eb5bc5332cf5fa743101acface13a236d98cbef73769e7e22352188089ed61c ./reference/g1d-limit-cell448-lowest-start-charge-11min-18c.harness.jsonl.status.json
+ecdc23c5ec0e9baf114bee6c823abf0b22ba5fd5bd16338b673ad8cc48cfec34c1bbb9d4781be75364c38d49715203f7 ./reference/g1d-limit-cell448-lowest-start-charge-11min-18c.txt
+602b5c07cdeb2a17e8203b991709d873e070ea9784dcfa320a5a50e7dcfe5c4accda3a834ee0f4ecd882cdf61cb4b647 ./reference/g1f-budget4-cell1000-least-capacity-15a-31c.calls.jsonl
+3c587e1c4d17ea9edc346566c8a5fd96e22ba29e974b8fca552a0195e001fe5bdbe128c7adc9f036a237eee242155b44 ./reference/g1f-budget4-cell1000-least-capacity-15a-31c.harness.jsonl
+5bcfe0fa444dca8a9b08d44b7fb3fdb5c791efc3b1a23bf42e7539a0071e88a83875d885de923e30613eb79610c6c211 ./reference/g1f-budget4-cell1000-least-capacity-15a-31c.harness.jsonl.status.json
+3704e719d70af59ab8e1e780e2f39c2a1db807b07f847bafacf974825c07ab6030299d2fb71fa1c1f16c577cc6bf3995 ./reference/g1f-budget4-cell1000-least-capacity-15a-31c.txt
+70280b01e1f7c266609854c6e642474503bd8d793da853ec0886ace2ffe3bf16ea76e54bee6a44cb87f6472d4946f6dd ./reference/g1f-chain-runaway-new-soak-then-warm-room.calls.jsonl
+f694d08033b93b241c49ed11a6c3bb63f76de50860a558afc4175098a9dbe53634182e59b3cf7cf425f3e8d86d55b3ee ./reference/g1f-chain-runaway-new-soak-then-warm-room.harness.jsonl
+aaeee5e61fe9f1332dea507858828ca080dc53214c63ac8c5e39fd35e5804195cea1e08c0d9586369c89ac94bad428ec ./reference/g1f-chain-runaway-new-soak-then-warm-room.harness.jsonl.status.json
+6e84b00771893a4715cc7fd63edb7b8a4802b6881f41adcce82667103cb7c36b937701f67c43daea25a690e80ae2923b ./reference/g1f-chain-runaway-new-soak-then-warm-room.txt
+980a661ed3a760250b5850f2de0ad570d94e2f7ca6d6b3d6d5511eccc73f6bae73480638641c8d6990faa1158c87adb7 ./reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.calls.jsonl
+210a4bf914c84c8565ce222ed0a6417f869a8cc47bc635398d220963bcf4bdaad74607076e087f3f0ffd7a50f6293b54 ./reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.harness.jsonl
+53d5969361167db4e03d942976fb454c55b71815a45a2212ea04e32543ce25cfb536035a05d294509fc27f4dc7134864 ./reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.harness.jsonl.status.json
+cede595cb52beb5b1fb1e0ad8ad41a506b35ce530853aacd819d4066a6ee79687b40835d5e32fca0ba769646fb6a57d8 ./reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.txt
+7455bbbbbe18b2dec13e68eda7b43e83e46de3161c5b242e17147515a78a27d296f3d14787e42ced95f494556b382dd8 ./reference/naive_scores.jsonl
+baad6e019e6fc762f315f944a321eedfb5956b680b58f8b73f7757543f97f99c4101881a2991795456070c5f7a0ab2f7 ./reference/reference_scores.jsonl
+cfeced2d2cc33993a3755ff98fcfccc239db4b21392484de44c7b47d1874772d0937ff9610035c63a714216d29f5b246 ./reports/describe_short.json
+dd561c8e5118e2decd8483dd7509953b52d7dfa37049984aa18f8ae48f12b4bfc18b646f0e35b29d1192c03836d57872 ./reports/g1d-budget5-cell1000-current-16min-11c.html
+33d3d8e3fdd2d8f609451a1ac700bf63ec30703cece52ea8ab64f9e564861a6e746b68a9606878913c2b6004cc534f41 ./reports/g1d-budget5-cell1000-current-16min-11c.json
+e290f39829b19e53f5344a6ce5a0fcdda5a9d0c5b9a83de050b1b348beae0ce16800d5129e1fe1dcd389aa148e7aff3c ./reports/g1d-limit-cell448-lowest-start-charge-11min-18c.html
+899a3579844b57b297ef9fac42176ef0cc372929d5051a35249cd8d329c9a285a5a3d4da86ee30d21aa54b2306fa8565 ./reports/g1d-limit-cell448-lowest-start-charge-11min-18c.json
+9c12c99d881886e939a54b699d76cfd0f0df66b5c7d38db9428a3380fb1bb274d6e4e9d890297ebe094d2c1280babfa2 ./reports/g1f-budget4-cell1000-least-capacity-15a-31c.html
+c3eace499451968ef81e197e5e98685dc607f8008378b4566c68df098eece04cdf208ad7dae537cf38f6a1717f807833 ./reports/g1f-budget4-cell1000-least-capacity-15a-31c.json
+6a53a1515eb98817bd89b7483575fc9dde23cd15fbfabfa74a406d02ceddad84ceb8816715a7346a58ec9afec064b728 ./reports/g1f-chain-runaway-new-soak-then-warm-room.html
+cb6d68016ff5a37ef5620ef0174640158e25848370751c6a44a478b8cd9b69d4a98c876346dd8a18e41d2931404b70a8 ./reports/g1f-chain-runaway-new-soak-then-warm-room.json
+ced74ab5917335039fe5d5cc851ddf29978cca37ef3fa752137ef1dfe45e16b2999f82b2f06fc428f14ab2a60852c031 ./reports/g1f-limit-18650pf-lowest-start-charge-2a7-27min.html
+3be753e66c45337e78ff413e77f3ddac733710c002a45fab84c87f1441db1ef20c80d0537883a92025e755ffd0fbc06c ./reports/g1f-limit-18650pf-lowest-start-charge-2a7-27min.json
+a86a7950d9fcdafceaa22e95377467f4dab6fc8714ac8f51d4aa06cfcd1b9ec2b816353f7bdd058d3b3f735cdb1f1b68 ./reports/index.html
+cc9386ff7611c028ff9eb83d86b65a59e0a6debf97b9969727b35fb5ba42c548cefa0e69ad261d2db666272413f47473 ./reports/live_scores.jsonl
+7174523593ce4af05a777e3f0c892aa1ed7bd65f020bf2020d4b136be4fda153dadf5b66f404b4994dee834ed1f03f35 ./reports/live_verify.json
+d93d727ec1a0016d238cbd0e7b6afe8eedc30e118bc4dd53b97b8dc30d62e73e53200bf6b752c0982acdfa6388290da0 ./reports/vault_proof.json
+0c91417d76cf74763d359af55531392cc6900191faae8269becb5460c41308a874d2ff5da5fbc7f940e787919e5ff2a3 ./scorer/bin/sample_verifier-linux-amd64
+7ae390020e85a9d80fdee8acc28001565443ff17e46fde548776fd567b8f5d5ea04128551a3bca460bb7b6bfb31d378b ./scorer/bin/sample_verifier-linux-arm64
+e4edc3039f8028ec096f46438466b46b02088d9bda727c97f5c8bad81f23bc53d4636f210ae6340ee937c64cbdf6171c ./scorer/bin/sample_verifier-macos-arm64
+4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./scorer/chainlib.py
+4ffa9c0aa8cf9f84cfc851f9b5df74807fbc6882f993c93a587b5db50a85febbcd8a33414f883d06abf64acae48d9156 ./scorer/data/environments.jsonl
+4420b16dd05d4ff3b21d421c6d48afbb9d163187db62e28024e3e99f78a9c6ef6b22621451dcf165581f94552c307715 ./scorer/mcp_stdio_open
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./scorer/pack_score.py
+d851c6838b15bcb7c96c4d1d75b6c59a905e9a3ee54b393a8f098ff768ae04fd2976cb7b00f949eb068b329392141bbb ./scorer/prompt.py
+f6fa72af84d02c0c72cd6866eb2c0fab9875fb8d5be40f1b74aca9066e58ab5fcc252943876ed5d3e7a69cd47606ebf1 ./scorer/run_cheat_suite.py
+4af2040470af799b1a4f3d4711207bb872b7bcd52323a7d28386f702fdc0142411ee5c1275775166a563362786f4d5ef ./scorer/run_naive.py
+a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./scorer/run_reference.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./scorer/score.py
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./scorer/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./scorer/ztp_open_bridge.py
+316800182cfc5271d3bd0a55756e654d477742da38011e2e44777d09135b344a4c81324df02d9e7240bac5df4573baec ./tasks/harbor/hud_taskset.json
+ac784d5ddc4a5daca08a94859691061d759bd1b0650f52f9507d1fcea5e51b02934c71bf888ba0c39715209983fde0fe ./tasks/harbor/registry.json
+7090ad05721bc3d91c88031408b678a18f732116c453e9f3608eef0f28625d5460b272d1344ad714a6703a4a6ef5ede9 ./tasks/harbor/task_checksums.json
+aa61cd689b637126915f3a082d32f6068c435522ff0ca3fb66cbb905d509d347a414907dfa65e03c5d4daccf869f6485 ./tasks/harbor/task_checksums.sha256
+8d29e0b753c89d8d5e47a306dd088deb5c8c9e5446bf27e9a39583e39575038d41b436385c27f787a51acaa35aaedc92 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/environment/Dockerfile
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/environment/ztp_open_bridge.py
+f0c920ef53fbb7ad3a16f88a0f8fec25b34c63778730ef8c4014d8ab4f184c2d4311bd19434ce4cd78e0fbc8a052208b ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/instruction.md
+4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/chainlib.py
+1778a42c9c049d80a5569b5d43bf984871585d7bf02c03c304b1746f194b49e0ae4875123347e2af0030560e63743745 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/data/environments.jsonl
+a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/run_reference.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/score.py
+e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/solve.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/ztp_mcp.py
+582dac033163de0efc4adb5c760f0890f80fb45aa89a4aa60fbe5df1f52d2d431a6f958d4dc6794a360362d07631a880 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/task.toml
+ec0982aa0762934fd944bf10e9256d32417e88f2e0a01a252d068f113680356a90efe6ea82a401e8c50e935ca7328ed8 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/Dockerfile
+1778a42c9c049d80a5569b5d43bf984871585d7bf02c03c304b1746f194b49e0ae4875123347e2af0030560e63743745 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/score.py
+4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_open_bridge.py
+8d29e0b753c89d8d5e47a306dd088deb5c8c9e5446bf27e9a39583e39575038d41b436385c27f787a51acaa35aaedc92 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/Dockerfile
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/ztp_open_bridge.py
+f9b2edb3c5618e12e49eed98ed557204aa0075aaa3ab4f14a416ccda3144568b555dba530121c91478f2a88add86db24 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/instruction.md
+4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/chainlib.py
+ae7bf0a2d427dcaf4a15e90f00c70bac66ba56702b90cb63da86311696738da5f6d48232ddcc98efdbc8053b394cbd54 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/data/environments.jsonl
+a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/run_reference.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/score.py
+e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/solve.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/ztp_mcp.py
+10345850ea10c6d9fc9c30b95150857095dca8cf58b25e0881cb6da0d6fa0c4e10603f833b19faa9b3fd4f70da4b4b16 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/task.toml
+ec0982aa0762934fd944bf10e9256d32417e88f2e0a01a252d068f113680356a90efe6ea82a401e8c50e935ca7328ed8 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/Dockerfile
+ae7bf0a2d427dcaf4a15e90f00c70bac66ba56702b90cb63da86311696738da5f6d48232ddcc98efdbc8053b394cbd54 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/score.py
+4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_open_bridge.py
+8d29e0b753c89d8d5e47a306dd088deb5c8c9e5446bf27e9a39583e39575038d41b436385c27f787a51acaa35aaedc92 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/Dockerfile
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/ztp_open_bridge.py
+42d2916c9b11f7dd8d99c05430677c0c019ea05477bf07a5fbc1d4cbd2d26b5b7c4fa30afb55dc44bd7eafb472c1d02a ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/instruction.md
+4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/chainlib.py
+6a47c0712fbc6fd82bb24cfd248b9e8f68d5bd92535b0769f0c2c630cbba2b3e7894c6e18d96cf3f801cf3c5f68e4b33 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/data/environments.jsonl
+a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/run_reference.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/score.py
+e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/solve.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/ztp_mcp.py
+34bec9e159f65e65a9f86f88741726633a91bd8550c037632a74210699a89213a897d8025ff0fb74eb5cb5e887de1a9a ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/task.toml
+ec0982aa0762934fd944bf10e9256d32417e88f2e0a01a252d068f113680356a90efe6ea82a401e8c50e935ca7328ed8 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/Dockerfile
+6a47c0712fbc6fd82bb24cfd248b9e8f68d5bd92535b0769f0c2c630cbba2b3e7894c6e18d96cf3f801cf3c5f68e4b33 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/score.py
+4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/ztp_open_bridge.py
+8d29e0b753c89d8d5e47a306dd088deb5c8c9e5446bf27e9a39583e39575038d41b436385c27f787a51acaa35aaedc92 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/environment/Dockerfile
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/environment/ztp_open_bridge.py
+3962a5cfd19e0fa56148e0c113a5e9ec59d2b868a7386796c8fd54b1ed2c5f1d3e79a27197a038aaac4c399aa9a9c373 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/instruction.md
+4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/solution/chainlib.py
+0cbbf05eb13a9cdd5302fc3e35e2c1236999aa041c0571c2238e870b78f520e60a5ff6aca4d77397d27a79187c21aa1e ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/solution/data/environments.jsonl
+a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/solution/run_reference.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/solution/score.py
+e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/solution/solve.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/solution/ztp_mcp.py
+b9ed562d0b7632cf7b28550535c7b98161db99fe0deaf438e0b6cb0f81e806599c389a230d7c2a8dbae10edb48773c92 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/task.toml
+ec0982aa0762934fd944bf10e9256d32417e88f2e0a01a252d068f113680356a90efe6ea82a401e8c50e935ca7328ed8 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/Dockerfile
+0cbbf05eb13a9cdd5302fc3e35e2c1236999aa041c0571c2238e870b78f520e60a5ff6aca4d77397d27a79187c21aa1e ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/score.py
+4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/ztp_open_bridge.py
+8d29e0b753c89d8d5e47a306dd088deb5c8c9e5446bf27e9a39583e39575038d41b436385c27f787a51acaa35aaedc92 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/environment/Dockerfile
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/environment/ztp_open_bridge.py
+b9d0d2328362bbbfd762624c907b4ee98d88175e6b1c427abd6cd2c89535f3cadbd47de74d83041dd5e510a666f821d4 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/instruction.md
+4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/solution/chainlib.py
+47406d2686e1fcbc1452757ff93634fa883a5f4c3a22683c3cb3d3da2ff5366d213a88cd59447fcc1ccf787fac086d4e ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/solution/data/environments.jsonl
+a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/solution/run_reference.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/solution/score.py
+e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/solution/solve.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/solution/ztp_mcp.py
+4556ed7cb8ce8cf1d72b34e86e2763895aa7c7478fffa5037c644c0f7f0e48572b28b2006e6741351eb0eacdf118d73e ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/task.toml
+ec0982aa0762934fd944bf10e9256d32417e88f2e0a01a252d068f113680356a90efe6ea82a401e8c50e935ca7328ed8 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/Dockerfile
+47406d2686e1fcbc1452757ff93634fa883a5f4c3a22683c3cb3d3da2ff5366d213a88cd59447fcc1ccf787fac086d4e ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/score.py
+4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/harbor/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/ztp_open_bridge.py
+236b5c4bb6d6f42e6b0a2c9713ee0a026f76152d7b1411370fa8891f54a6b9aa1d08a1d9fb84e9ceadef1af355c3954a ./tasks/hud/set_door.py
+28611d9a1c34f5541dc036ff33e7b389323dce1e00b7e600c308634b242233d0f7a0fd29449fd8d4f03ba991ee6f28b7 ./tasks/hud/task_checksums.json
+610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/environment/Dockerfile
+020c36ea94bfa603abc8db6113e54bc6b5682259b8861edaaf9f32de756bedee4dfc2ec0ed4334eaccc0df75cc0dc852 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/environment/docker-compose.yaml
+5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/environment/proxy/Dockerfile
+827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/environment/proxy/ztp_log_proxy.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/environment/proxy/ztp_open_bridge.py
+f0c920ef53fbb7ad3a16f88a0f8fec25b34c63778730ef8c4014d8ab4f184c2d4311bd19434ce4cd78e0fbc8a052208b ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/instruction.md
+d000fcd618c7f1888ff95bf92ac2ae32aea43033b96eae8852c9f523748e4ea09f4b1b182ba3118ef088764fb27510d7 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/task.toml
+2acd843a5600d97a0c67da00a878bd3bc5cde306848d8f4bbc59cba9f41db5af8ce43da17e38713f69c8b51450e08785 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/Dockerfile
+1778a42c9c049d80a5569b5d43bf984871585d7bf02c03c304b1746f194b49e0ae4875123347e2af0030560e63743745 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/grade.py
+37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/hud_grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/score.py
+cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_open_bridge.py
+610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/Dockerfile
+020c36ea94bfa603abc8db6113e54bc6b5682259b8861edaaf9f32de756bedee4dfc2ec0ed4334eaccc0df75cc0dc852 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/docker-compose.yaml
+5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/proxy/Dockerfile
+827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/proxy/ztp_log_proxy.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/proxy/ztp_open_bridge.py
+f9b2edb3c5618e12e49eed98ed557204aa0075aaa3ab4f14a416ccda3144568b555dba530121c91478f2a88add86db24 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/instruction.md
+4b38ecb92ef3e5fed0344db4e1303c488b16b574ef6706cb753df3948e02d0df98605f84ae37b97351231fbf5e3bf1ed ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/task.toml
+2acd843a5600d97a0c67da00a878bd3bc5cde306848d8f4bbc59cba9f41db5af8ce43da17e38713f69c8b51450e08785 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/Dockerfile
+ae7bf0a2d427dcaf4a15e90f00c70bac66ba56702b90cb63da86311696738da5f6d48232ddcc98efdbc8053b394cbd54 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/grade.py
+37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/hud_grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/score.py
+cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_open_bridge.py
+610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/Dockerfile
+020c36ea94bfa603abc8db6113e54bc6b5682259b8861edaaf9f32de756bedee4dfc2ec0ed4334eaccc0df75cc0dc852 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/docker-compose.yaml
+5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/proxy/Dockerfile
+827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/proxy/ztp_log_proxy.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/proxy/ztp_open_bridge.py
+42d2916c9b11f7dd8d99c05430677c0c019ea05477bf07a5fbc1d4cbd2d26b5b7c4fa30afb55dc44bd7eafb472c1d02a ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/instruction.md
+ff4c69ef7c20420eda8624d130515c34149c68726e02703aa33365e06a358ee28cc993ef9a317fd613d07981cd4852e9 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/task.toml
+2acd843a5600d97a0c67da00a878bd3bc5cde306848d8f4bbc59cba9f41db5af8ce43da17e38713f69c8b51450e08785 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/Dockerfile
+6a47c0712fbc6fd82bb24cfd248b9e8f68d5bd92535b0769f0c2c630cbba2b3e7894c6e18d96cf3f801cf3c5f68e4b33 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/grade.py
+37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/hud_grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/score.py
+cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/ztp_open_bridge.py
+610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/environment/Dockerfile
+020c36ea94bfa603abc8db6113e54bc6b5682259b8861edaaf9f32de756bedee4dfc2ec0ed4334eaccc0df75cc0dc852 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/environment/docker-compose.yaml
+5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/environment/proxy/Dockerfile
+827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/environment/proxy/ztp_log_proxy.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/environment/proxy/ztp_open_bridge.py
+3962a5cfd19e0fa56148e0c113a5e9ec59d2b868a7386796c8fd54b1ed2c5f1d3e79a27197a038aaac4c399aa9a9c373 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/instruction.md
+70c5c7b42dbb031e9f95df5bd4dd543c7da8f8f91bb1ab9d8d444178fca82c334c7e792ef4b16a61fbe42a4f7950cf6d ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/task.toml
+2acd843a5600d97a0c67da00a878bd3bc5cde306848d8f4bbc59cba9f41db5af8ce43da17e38713f69c8b51450e08785 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/Dockerfile
+0cbbf05eb13a9cdd5302fc3e35e2c1236999aa041c0571c2238e870b78f520e60a5ff6aca4d77397d27a79187c21aa1e ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/grade.py
+37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/hud_grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/score.py
+cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/ztp_open_bridge.py
+610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/environment/Dockerfile
+020c36ea94bfa603abc8db6113e54bc6b5682259b8861edaaf9f32de756bedee4dfc2ec0ed4334eaccc0df75cc0dc852 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/environment/docker-compose.yaml
+5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/environment/proxy/Dockerfile
+827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/environment/proxy/ztp_log_proxy.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/environment/proxy/ztp_open_bridge.py
+b9d0d2328362bbbfd762624c907b4ee98d88175e6b1c427abd6cd2c89535f3cadbd47de74d83041dd5e510a666f821d4 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/instruction.md
+5e53adb381f2ff3df9d0f689986fb35a68b88c60e1dbd09e9cd9bf31b945d2b05370d1d06eea191ad6a79537182fde8a ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/task.toml
+2acd843a5600d97a0c67da00a878bd3bc5cde306848d8f4bbc59cba9f41db5af8ce43da17e38713f69c8b51450e08785 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/Dockerfile
+47406d2686e1fcbc1452757ff93634fa883a5f4c3a22683c3cb3d3da2ff5366d213a88cd59447fcc1ccf787fac086d4e ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/environment.jsonl
+b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/grade.py
+37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/hud_grade.py
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/pack_score.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/score.py
+cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/test.sh
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/ztp_open_bridge.py
+4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/inspect/chainlib.py
+4ffa9c0aa8cf9f84cfc851f9b5df74807fbc6882f993c93a587b5db50a85febbcd8a33414f883d06abf64acae48d9156 ./tasks/inspect/data/environments.jsonl
+b36ffd89cb42467f54cedfccc924e89c35bf048ec0e5cf4d429a563cffb39cb55de20d9657972d370c2140517161418e ./tasks/inspect/inspect_task.py
+4420b16dd05d4ff3b21d421c6d48afbb9d163187db62e28024e3e99f78a9c6ef6b22621451dcf165581f94552c307715 ./tasks/inspect/mcp_stdio_open
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/inspect/pack_score.py
+d851c6838b15bcb7c96c4d1d75b6c59a905e9a3ee54b393a8f098ff768ae04fd2976cb7b00f949eb068b329392141bbb ./tasks/inspect/prompt.py
+38a991195690215d491627d069e86ea47303d186cfba1a3de9848d7a57a87f31b21f18c6382112c2107b7f847f40fc7f ./tasks/inspect/sandbox/compose.yaml
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/inspect/score.py
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/inspect/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/inspect/ztp_open_bridge.py
+266422579d937776408d9cf560404ec7af34dd996c2740875dd163f1a9e2a1f8b66d903829201f83d682cab7d09ff490 ./tasks/mcp/README.md
+fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g1d-budget5-cell1000-current-16min-11c/grade.sh
+680a4e741e92d7b90acb03ac712268a48a768044e42eb66631d30a2ff9b51b833d0d20f62e1ba16a0740931e8c8cad8e ./tasks/mcp/g1d-budget5-cell1000-current-16min-11c/mcp.json
+4c7e0798b65786fac24236ce581da58d8ed07f81e8e933ffcfde74feb807a75379e4c7a79d4dc6a7f0c7854277579e00 ./tasks/mcp/g1d-budget5-cell1000-current-16min-11c/prompt.md
+fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g1d-limit-cell448-lowest-start-charge-11min-18c/grade.sh
+c4e24e9e774dc767dd22dd6d9f9fc4c5400cd307ee8b69d44b8b311d10a31742e66d047af3ba52adc0959aa6c719fb66 ./tasks/mcp/g1d-limit-cell448-lowest-start-charge-11min-18c/mcp.json
+34c85c3c042d8fcedae1f4bd5f5ef5fe118a15e6df2062088dceebff2a2f211a309af21232a7a7ce72d841a0c459de7c ./tasks/mcp/g1d-limit-cell448-lowest-start-charge-11min-18c/prompt.md
+fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g1f-budget4-cell1000-least-capacity-15a-31c/grade.sh
+e2389b2c4001f2bfff7c9a8b345d6123a15afab42394fca88e8057b188a184267b5f1d4066bf97686029cd95fa2af2cc ./tasks/mcp/g1f-budget4-cell1000-least-capacity-15a-31c/mcp.json
+38b4561b7a16bb72616bb9d0e34f246e91cd5755b3d8ee55dc26f8c7f89f8236b03d4d2864be7f3050024e4f8e4b653c ./tasks/mcp/g1f-budget4-cell1000-least-capacity-15a-31c/prompt.md
+fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g1f-chain-runaway-new-soak-then-warm-room/grade.sh
+739962d729d7c7fabe6c6eccd95e528732a33c96b11dd0e879be931c1c0faf253b64c11ed85fd9ea586ff78ced65dc5a ./tasks/mcp/g1f-chain-runaway-new-soak-then-warm-room/mcp.json
+c481abdfb62dc8cec7f402406f580ba43c21d330e3c64a57b200d56d62d81b0cce3e484d544c47549432fa89a513e8b2 ./tasks/mcp/g1f-chain-runaway-new-soak-then-warm-room/prompt.md
+fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g1f-limit-18650pf-lowest-start-charge-2a7-27min/grade.sh
+320900821c9fc3a1d9aaea78f6f32edeeccab0e4bdeeb5da44f80dfa73f4e2022ae362bc27443876f65b56ad31c8fbf1 ./tasks/mcp/g1f-limit-18650pf-lowest-start-charge-2a7-27min/mcp.json
+50c6621c711afe7fb4ec75a413f7dc59197f452d640ab6911ea80cbdb24944a612f3ca29084c4804d47a9fdaa3254304 ./tasks/mcp/g1f-limit-18650pf-lowest-start-charge-2a7-27min/prompt.md
+0b4254f74fd12013bc5af575f0a260922a1c5888c60e65cfbdaa6f0e2a184d88267bd1226133134880037d9440cbef83 ./tasks/mcp/scorer/bind.py
+4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/mcp/scorer/chainlib.py
+4ffa9c0aa8cf9f84cfc851f9b5df74807fbc6882f993c93a587b5db50a85febbcd8a33414f883d06abf64acae48d9156 ./tasks/mcp/scorer/data/environments.jsonl
+df6cd1ed60eb0f654c6c6eb8f4323fb28a6dda73089c77e1b199ac70a0515d871ba1f2c6d5de809824c2ea721af5293a ./tasks/mcp/scorer/grade_mcp.py
+87779703ea62613cc92343c13c470bfb394ba1688426eb4809d4f0dbf264fec2e96ab604b9ca2e49580060b99097deb4 ./tasks/mcp/scorer/mcp_log_proxy.py
+4420b16dd05d4ff3b21d421c6d48afbb9d163187db62e28024e3e99f78a9c6ef6b22621451dcf165581f94552c307715 ./tasks/mcp/scorer/mcp_stdio_open
+88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/mcp/scorer/pack_score.py
+d851c6838b15bcb7c96c4d1d75b6c59a905e9a3ee54b393a8f098ff768ae04fd2976cb7b00f949eb068b329392141bbb ./tasks/mcp/scorer/prompt.py
+a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/mcp/scorer/run_reference.py
+ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/mcp/scorer/score.py
+be1dc2f239841f5ad366c0c19d979fa2fd4f33f5f070d9f4b5e84f7d68a5310bf8416cc7b6baa5fdc1ff1b389d26221f ./tasks/mcp/scorer/ztp_mcp.py
+45d88b8eb4d6632791490b842350e656c3ed1666ccce6d2a46d68371068650ab440a920b634ecb13594b82fc3fbf0431 ./tasks/mcp/scorer/ztp_open_bridge.py
+fd1b53535e0a3b7a706629cc481781dbbf94f800f712c6b1d2f369d3b4c52b21120fdb5bdbfff3ecaea1cd161019370a ./verify_sample.sh
diff --git a/sample/VERIFY.md b/sample/VERIFY.md
new file mode 100644
index 0000000000000000000000000000000000000000..13936ee75a02e4779cffeda51e5fcc60fd3a6900
--- /dev/null
+++ b/sample/VERIFY.md
@@ -0,0 +1,25 @@
+# Verify the sample
+
+Python 3 and nothing else. In the unpacked folder:
+
+ sh verify_sample.sh
+
+It verifies every SHA-384 in `SHA384SUMS`, scores the 5 reference answers on the bundled verifier (reward 1 on 5 of 5) and runs the cheat suite (every cheat 0, every honest control 1). It ends `SAMPLE HOLDS`, or names what did not hold, and exits non-zero.
+
+**With the network denied.** macOS: `sandbox-exec -p '(version 1)(allow default)(deny network*)' sh verify_sample.sh`. Linux: `sudo unshare -n sh verify_sample.sh` (or `docker run --network none ... sh verify_sample.sh`).
+
+**macOS browser downloads.** `git clone` and `curl` require no extra step; if you downloaded an archive through a macOS web browser or mail client, clear Gatekeeper quarantine once with `xattr -dr com.apple.quarantine scorer/bin`.
+
+**Linux.** `scorer/bin/sample_verifier-linux-amd64` and `sample_verifier-linux-arm64` are static binaries; `verify_sample.sh` selects the binary matching the host CPU (`x86_64` or `aarch64`/`arm64`) and runs with `--network none`. Any other platform can score against `https://mcp.zerotrustphysics.com/mcp/open`.
+
+**Harbor.** `harbor run -p tasks/harbor/tasks -a oracle` runs each reference answer in Harbor's containers and grades it with the task's `tests/grade.py`. Each image's `/usr/local/bin/mcp_stdio` connects to the public MCP preview endpoint (1 concurrent physics call per IP).
+
+**Inspect.** `tasks/inspect/inspect_task.py`, one Inspect task for the set.
+
+**HUD.** `tasks/hud/tasks/` for HUD's Harbor adapter (`hud.integrations.harbor.adapt`, hud 0.6.21). Your adapter run needs Docker. The Compose project's main service needs user namespaces for HUD's sandbox.
+
+**Native MCP.** `tasks/mcp/README.md`: per task a prompt, an `mcp.json` and a one-line grader.
+
+**A proof by hand.** Every run proof is a SHA-384 seal over the request and answer. `verify_tape` with the request and its `run_seal`, on the bundled verifier or at the address, computes it again. The bundled verifier signs nothing; the address signs its answers ML-DSA-87.
+
+Protocol Company · zerotrustphysics.com
diff --git a/sample/calibration/cheat_suite.jsonl b/sample/calibration/cheat_suite.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..f323aa570c2ff379abf8c4e2df2c6fb478b25ddd
--- /dev/null
+++ b/sample/calibration/cheat_suite.jsonl
@@ -0,0 +1,150 @@
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "5 computing calls; the budget is 4", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 2", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "copied_proof_other_task", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "nudged_figure", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "figure_plus_10_percent", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "card_request_not_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "swapped_sides", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks core_hottest", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "binding_misnamed", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "binding names 'end_voltage'; the constraint that binds is another", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "proof_from_other_design", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "failing_given_as_passing", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks core_hottest", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "proof_uppercase", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "extra_argument", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run differs from the task's at note", "ok": true}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "stop_misnamed", "applies": false, "why": "no stop binds"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "step_misnamed", "applies": false, "why": "no stop binds"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "missing_solve", "applies": false, "why": "a design of one request"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "solve_handed_other_run", "applies": false, "why": "a design of one request"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "next_start_rounded", "applies": false, "why": "not a continued design"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "next_proof_copied", "applies": false, "why": "not a continued design"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "next_request_edited", "applies": false, "why": "not a continued design"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "every_row_genuine", "applies": false, "why": "forensics only"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "every_row_false", "applies": false, "why": "forensics only"}
+{"task": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "vector": "every_row_false_true_reasons", "applies": false, "why": "forensics only"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "5 computing calls; the budget is 4", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 2", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "copied_proof_other_task", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "nudged_figure", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "figure_plus_10_percent", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "card_request_not_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "swapped_sides", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks pf_end_voltage", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "binding_misnamed", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "binding names 'completes'; the constraint that binds is another", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "proof_from_other_design", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "failing_given_as_passing", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks pf_end_voltage", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "proof_uppercase", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "extra_argument", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run differs from the task's at note", "ok": true}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "stop_misnamed", "applies": false, "why": "no stop binds"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "step_misnamed", "applies": false, "why": "no stop binds"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "missing_solve", "applies": false, "why": "a design of one request"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "solve_handed_other_run", "applies": false, "why": "a design of one request"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "next_start_rounded", "applies": false, "why": "not a continued design"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "next_proof_copied", "applies": false, "why": "not a continued design"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "next_request_edited", "applies": false, "why": "not a continued design"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "every_row_genuine", "applies": false, "why": "forensics only"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "every_row_false", "applies": false, "why": "forensics only"}
+{"task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "vector": "every_row_false_true_reasons", "applies": false, "why": "forensics only"}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "6 computing calls; the budget is 5", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 4", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "copied_proof_other_task", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "nudged_figure", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "figure_plus_10_percent", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "card_request_not_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "swapped_sides", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks next_vent_held", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "binding_misnamed", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "binding names 'next_cell_peak'; the constraint that binds is another", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "proof_from_other_design", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "failing_given_as_passing", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks next_vent_held", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "proof_uppercase", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "extra_argument", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run differs from the task's at note", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "missing_solve", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's next run is missing", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "solve_handed_other_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's next run does not continue the design's own sealed run (from)", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "next_start_rounded", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the failing design's next run does not start from its run's final_state.temperature_k, bit for bit", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "next_proof_copied", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the failing design's next run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "next_request_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the failing design's next run differs from the task's at segments[0].steps", "ok": true}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "stop_misnamed", "applies": false, "why": "no stop binds"}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "step_misnamed", "applies": false, "why": "no stop binds"}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "every_row_genuine", "applies": false, "why": "forensics only"}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "every_row_false", "applies": false, "why": "forensics only"}
+{"task": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "vector": "every_row_false_true_reasons", "applies": false, "why": "forensics only"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "6 computing calls; the budget is 5", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 2", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "copied_proof_other_task", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "nudged_figure", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "figure_plus_10_percent", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "card_request_not_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "swapped_sides", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the holds request comes back refused (UndervoltageLimit)", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "stop_misnamed", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the card names the stop 'SomeOtherStop'; the verifier names UndervoltageLimit", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "proof_from_other_design", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "proof_uppercase", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds seal: the proof is not a SHA-384 seal of 96 hex digits", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "extra_argument", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds request differs from the task's at note", "ok": true}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "binding_misnamed", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "failing_given_as_passing", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "step_misnamed", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "missing_solve", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "solve_handed_other_run", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "every_row_genuine", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "every_row_false", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "every_row_false_true_reasons", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "next_start_rounded", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "next_proof_copied", "applies": false, "why": "not a budget card"}
+{"task": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "vector": "next_request_edited", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "5 computing calls; the budget is 4", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 2", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "copied_proof_other_task", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "nudged_figure", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "figure_plus_10_percent", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "card_request_not_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "swapped_sides", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the holds request comes back refused (UndervoltageLimit)", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "stop_misnamed", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the card names the stop 'SomeOtherStop'; the verifier names UndervoltageLimit", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "proof_from_other_design", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "proof_uppercase", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds seal: the proof is not a SHA-384 seal of 96 hex digits", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "extra_argument", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds request differs from the task's at note", "ok": true}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "binding_misnamed", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "failing_given_as_passing", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "step_misnamed", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "missing_solve", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "solve_handed_other_run", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "every_row_genuine", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "every_row_false", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "every_row_false_true_reasons", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "next_start_rounded", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "next_proof_copied", "applies": false, "why": "not a budget card"}
+{"task": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "vector": "next_request_edited", "applies": false, "why": "not a budget card"}
diff --git a/sample/calibration/passk_summary.json b/sample/calibration/passk_summary.json
new file mode 100644
index 0000000000000000000000000000000000000000..768b97f55ca99c307d859aa30ced6f011517b0f8
--- /dev/null
+++ b/sample/calibration/passk_summary.json
@@ -0,0 +1,75 @@
+{
+ "note": "pass@k of this sample's tasks: pass@k = 1 - C(n-c, k) / C(n, k), n attempts with no harness error, c with reward 1",
+ "per_task": [
+ {
+ "variant": "tool",
+ "model": "Frontier model",
+ "task": "g1d-budget5-cell1000-current-16min-11c",
+ "attempts": 8,
+ "n": 8,
+ "correct": 3,
+ "harness_errors": 0,
+ "harness_error_rate": 0.0,
+ "mean_graded": 0.720544375,
+ "pass@1": 0.375,
+ "pass@8": 1.0,
+ "in_band": true
+ },
+ {
+ "variant": "tool",
+ "model": "Frontier model",
+ "task": "g1d-limit-cell448-lowest-start-charge-11min-18c",
+ "attempts": 8,
+ "n": 8,
+ "correct": 2,
+ "harness_errors": 0,
+ "harness_error_rate": 0.0,
+ "mean_graded": 0.50718325,
+ "pass@1": 0.25,
+ "pass@8": 1.0,
+ "in_band": true
+ },
+ {
+ "variant": "tool",
+ "model": "Frontier model",
+ "task": "g1f-budget4-cell1000-least-capacity-15a-31c",
+ "attempts": 8,
+ "n": 8,
+ "correct": 1,
+ "harness_errors": 0,
+ "harness_error_rate": 0.0,
+ "mean_graded": 0.46834175,
+ "pass@1": 0.125,
+ "pass@8": 1.0,
+ "in_band": true
+ },
+ {
+ "variant": "tool",
+ "model": "Frontier model",
+ "task": "g1f-chain-runaway-new-soak-then-warm-room",
+ "attempts": 8,
+ "n": 8,
+ "correct": 2,
+ "harness_errors": 0,
+ "harness_error_rate": 0.0,
+ "mean_graded": 0.5550174999999999,
+ "pass@1": 0.25,
+ "pass@8": 1.0,
+ "in_band": true
+ },
+ {
+ "variant": "tool",
+ "model": "Frontier model",
+ "task": "g1f-limit-18650pf-lowest-start-charge-2a7-27min",
+ "attempts": 8,
+ "n": 8,
+ "correct": 5,
+ "harness_errors": 0,
+ "harness_error_rate": 0.0,
+ "mean_graded": 0.65251625,
+ "pass@1": 0.625,
+ "pass@8": 1.0,
+ "in_band": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/sample/harness/mcp_log_proxy.py b/sample/harness/mcp_log_proxy.py
new file mode 100644
index 0000000000000000000000000000000000000000..0172d4963b39b33786a5d07ab7e2c9de50879123
--- /dev/null
+++ b/sample/harness/mcp_log_proxy.py
@@ -0,0 +1,288 @@
+#!/usr/bin/env python3
+"""A stdio MCP proxy that records every tool call and changes no byte of any message.
+
+ python3 mcp_log_proxy.py --log LOG [--forbid-under DIR ...] [--trace FILE] -- ENGINE [ENGINE ARGS ...]
+
+It starts ENGINE (an MCP server over stdio, one JSON-RPC message a line, such as the Zero-Trust
+Physics mcp_stdio), hands every line the client writes to ENGINE's stdin, and every line ENGINE
+writes back to the client's stdout, byte for byte. It reads a copy of each message and, for every
+tools/call, appends one JSON line to LOG when the answer comes back:
+
+ {"seq", "jsonrpc_id", "tool", "arguments", "ts_request", "ts_response", "duration_s",
+ "response_sha384", "text_sha384", "is_error", "chain"}
+
+response_sha384 is the SHA-384 of the answer line exactly as forwarded (without its newline);
+text_sha384 is the SHA-384 of the answer's text content. chain is the SHA-384 of the previous
+line's chain followed by this line's JSON without its chain (sorted keys, no spaces): an edit to
+any line, or a line taken out, breaks every chain after it. A call still unanswered when the
+client closes is written with "unanswered": true.
+
+LOG must lie outside the solver's working directory: the proxy refuses to start when LOG is
+under its own working directory (where an agent's CLI starts it) or under any --forbid-under.
+Beside LOG it keeps LOG.status.json: the engine command, the handshake (initialize, or
+server/discover under MCP 2026-07-28), the call count, the engine's exit code. --trace FILE also keeps every line both ways, for diagnosing a client.
+
+Standard library only. Licence: Apache-2.0.
+"""
+import hashlib
+import json
+import os
+import signal
+import subprocess
+import sys
+import threading
+import time
+
+
+# initialize (MCP 2025-06-18 and before) or server/discover (MCP 2026-07-28, which newer clients send first)
+HANDSHAKES = ("initialize", "server/discover")
+
+
+def now():
+ return time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()) + ".%03dZ" % (int(time.time() * 1000) % 1000)
+
+
+def sha384(data):
+ return hashlib.sha384(data).hexdigest()
+
+
+def chain_of(previous, entry):
+ payload = json.dumps(entry, sort_keys=True, separators=(",", ":"))
+ return sha384(((previous or "") + payload).encode("utf-8"))
+
+
+def under(path, folder):
+ path, folder = os.path.realpath(path), os.path.realpath(folder)
+ return path == folder or path.startswith(folder.rstrip(os.sep) + os.sep)
+
+
+class Recorder:
+ def __init__(self, log_path, engine):
+ self.log_path = log_path
+ self.lock = threading.Lock()
+ self.pending = {}
+ self.seq = 0
+ self.chain = None
+ self.status = {"engine": engine, "proxy_pid": os.getpid(), "started": now(), "handshake": None,
+ "tools_list": False, "calls": 0, "unanswered": 0, "engine_exit": None, "ended": None,
+ "problems": []}
+ open(log_path, "a").close()
+ self.write_status()
+
+ def write_status(self):
+ tmp = self.log_path + ".status.json.tmp"
+ with open(tmp, "w", encoding="utf-8") as f:
+ json.dump(self.status, f, indent=1)
+ os.replace(tmp, self.log_path + ".status.json")
+
+ def append(self, entry):
+ """One log line, chained to the one before. Called with the lock held."""
+ self.seq += 1
+ entry = dict(entry, seq=self.seq)
+ entry["chain"] = chain_of(self.chain, entry)
+ self.chain = entry["chain"]
+ with open(self.log_path, "a", encoding="utf-8") as f:
+ f.write(json.dumps(entry, sort_keys=True) + "\n")
+ f.flush()
+ os.fsync(f.fileno())
+ self.status["calls"] += 1
+
+ @staticmethod
+ def messages(line):
+ try:
+ found = json.loads(line)
+ except ValueError:
+ return []
+ if isinstance(found, list):
+ return [m for m in found if isinstance(m, dict)]
+ return [found] if isinstance(found, dict) else []
+
+ def from_client(self, line):
+ for message in self.messages(line):
+ if "id" in message and message.get("method"):
+ key = json.dumps(message["id"])
+ with self.lock:
+ self.pending[key] = {"method": message["method"], "params": message.get("params"),
+ "ts": now(), "t0": time.time(), "id": message["id"]}
+
+ def from_engine(self, line):
+ raw = line.rstrip(b"\r\n")
+ for message in self.messages(line):
+ if "id" not in message or message.get("method"):
+ continue
+ key = json.dumps(message["id"])
+ with self.lock:
+ asked = self.pending.pop(key, None)
+ if asked is None:
+ continue
+ if asked["method"] in HANDSHAKES:
+ result = message.get("result") if isinstance(message.get("result"), dict) else {}
+ if not (self.status["handshake"] or {}).get("ok"):
+ srv = result.get("serverInfo")
+ if isinstance(srv, dict) and str(srv.get("title") or "").startswith("Zero-Trust Physics"):
+ desc = str(srv.get("description") or "")
+ if ": " in desc:
+ desc = "Deterministic physics of real objects: " + desc.split(": ", 1)[1]
+ srv = dict(srv, title="Zero-Trust Physics Verifier", description=desc)
+ self.status["handshake"] = {"method": asked["method"], "ok": "result" in message,
+ "server": srv}
+ self.write_status()
+ elif asked["method"] == "tools/list":
+ if not self.status["tools_list"]:
+ self.status["tools_list"] = "result" in message
+ self.write_status()
+ elif asked["method"] == "tools/call":
+ params = asked["params"] if isinstance(asked["params"], dict) else {}
+ result = message.get("result") if isinstance(message.get("result"), dict) else {}
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [] if isinstance(c, dict))
+ self.append({"jsonrpc_id": asked["id"], "tool": params.get("name"),
+ "arguments": params.get("arguments") if params.get("arguments") is not None else {},
+ "ts_request": asked["ts"], "ts_response": now(),
+ "duration_s": round(time.time() - asked["t0"], 6),
+ "response_sha384": sha384(raw), "text_sha384": sha384(text.encode("utf-8")),
+ "is_error": bool(result.get("isError")) or "error" in message})
+
+ def close(self, engine_exit):
+ with self.lock:
+ for asked in self.pending.values():
+ if asked["method"] != "tools/call":
+ continue
+ params = asked["params"] if isinstance(asked["params"], dict) else {}
+ self.append({"jsonrpc_id": asked["id"], "tool": params.get("name"),
+ "arguments": params.get("arguments") if params.get("arguments") is not None else {},
+ "ts_request": asked["ts"], "ts_response": None, "duration_s": None,
+ "response_sha384": None, "text_sha384": None, "is_error": None, "unanswered": True})
+ self.status["unanswered"] += 1
+ self.pending.clear()
+ self.status["engine_exit"] = engine_exit
+ self.status["ended"] = now()
+ self.write_status()
+
+
+def main(argv):
+ log, forbid, engine, trace = None, [], None, None
+ i = 0
+ while i < len(argv):
+ if argv[i] == "--":
+ engine = argv[i + 1:]
+ break
+ if argv[i] == "--log" and i + 1 < len(argv):
+ log = argv[i + 1]
+ i += 2
+ continue
+ if argv[i] == "--trace" and i + 1 < len(argv):
+ trace = open(argv[i + 1], "ab")
+ i += 2
+ continue
+ if argv[i] == "--forbid-under" and i + 1 < len(argv):
+ forbid.append(argv[i + 1])
+ i += 2
+ continue
+ sys.exit("usage: mcp_log_proxy.py --log LOG [--forbid-under DIR ...] -- ENGINE [ARGS ...]")
+ if not log or not engine:
+ sys.exit("usage: mcp_log_proxy.py --log LOG [--forbid-under DIR ...] -- ENGINE [ARGS ...]")
+ log = os.path.abspath(log)
+ for folder in [os.getcwd()] + forbid:
+ if under(log, folder):
+ sys.exit("mcp_log_proxy: the log %s lies inside %s, where the solver works; put it outside" % (log, folder))
+ os.makedirs(os.path.dirname(log), exist_ok=True)
+ recorder = Recorder(log, engine)
+ try:
+ proc = subprocess.Popen(engine, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=sys.stderr.fileno(), bufsize=0)
+ except OSError as problem:
+ recorder.status["problems"].append("the engine did not start: %s" % problem)
+ recorder.close(None)
+ sys.exit("mcp_log_proxy: the engine did not start: %s" % problem)
+ out = sys.stdout.buffer
+
+ def engine_to_client():
+ try:
+ for line in iter(proc.stdout.readline, b""):
+ if trace:
+ trace.write(b"< " + line)
+ trace.flush()
+ try:
+ recorder.from_engine(line)
+ except Exception as problem: # the log must never stop an answer
+ recorder.status["problems"].append("log: %s" % problem)
+ out.write(line)
+ out.flush()
+ except (BrokenPipeError, OSError) as problem:
+ recorder.status["problems"].append("client output closed: %s" % problem)
+
+ finished = threading.Lock()
+
+ def finish():
+ """Once: close the engine, log what is unanswered, close the client's output, and leave."""
+ if not finished.acquire(blocking=False):
+ return
+ try:
+ proc.stdin.close()
+ except OSError:
+ pass
+ try:
+ code = proc.wait(timeout=30)
+ except subprocess.TimeoutExpired:
+ proc.kill()
+ code = proc.wait()
+ recorder.close(code)
+ try:
+ out.flush()
+ except OSError:
+ pass
+ os._exit(0)
+
+ reader_done = threading.Event()
+ client_closed = threading.Event()
+
+ def engine_to_client_then_finish():
+ engine_to_client()
+ reader_done.set()
+ if proc.poll() is None:
+ try:
+ proc.wait(timeout=5)
+ except subprocess.TimeoutExpired:
+ pass
+ if proc.poll() is not None and not client_closed.is_set():
+ # the engine has gone: the client must see its output close rather than wait for an answer
+ recorder.status["problems"].append("the engine closed its output (exit %s)" % proc.returncode)
+ finish()
+
+ reader = threading.Thread(target=engine_to_client_then_finish, daemon=True)
+ reader.start()
+
+ def stop(signum, frame):
+ raise KeyboardInterrupt
+
+ signal.signal(signal.SIGTERM, stop)
+ signal.signal(signal.SIGHUP, stop)
+ source = sys.stdin.buffer
+ try:
+ for line in iter(source.readline, b""):
+ if trace:
+ trace.write(b"> " + line)
+ trace.flush()
+ try:
+ recorder.from_client(line)
+ except Exception as problem:
+ recorder.status["problems"].append("log: %s" % problem)
+ try:
+ proc.stdin.write(line)
+ proc.stdin.flush()
+ except (BrokenPipeError, OSError) as problem:
+ recorder.status["problems"].append("engine input closed: %s" % problem)
+ break
+ except KeyboardInterrupt:
+ pass
+ client_closed.set()
+ try:
+ proc.stdin.close()
+ except OSError:
+ pass
+ reader.join(timeout=30)
+ finish()
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1:]))
diff --git a/sample/reference/g1d-budget5-cell1000-current-16min-11c.calls.jsonl b/sample/reference/g1d-budget5-cell1000-current-16min-11c.calls.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..9d0adc4b59b1316e33e923a147314432c34678bf
--- /dev/null
+++ b/sample/reference/g1d-budget5-cell1000-current-16min-11c.calls.jsonl
@@ -0,0 +1,2 @@
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059545636899294, "case_temperature_c": 11.0}}], "record_every": 960}}
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059617994390187, "case_temperature_c": 11.0}}], "record_every": 960}}
diff --git a/sample/reference/g1d-budget5-cell1000-current-16min-11c.harness.jsonl b/sample/reference/g1d-budget5-cell1000-current-16min-11c.harness.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..a14835c74986042f979494f0f61157defc3bb0d4
--- /dev/null
+++ b/sample/reference/g1d-budget5-cell1000-current-16min-11c.harness.jsonl
@@ -0,0 +1,2 @@
+{"arguments": {"card": "cell_2170_model3", "domain": "energy", "dt_s": 1.0, "initial": {"capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0, "cell_number": 1000.0, "state_of_charge": 0.93}, "record_every": 960, "segments": [{"load": {"case_temperature_c": 11.0, "current_a": 12.059545636899294}, "steps": 960}]}, "chain": "049b56d764429c86c8913698a666a6ba1be51e2139d40b632b7c6e02db7120f4f201b9beeb997679c35ad01663d0cfcc", "duration_s": 0.006313, "is_error": false, "jsonrpc_id": 2, "response_sha384": "7fa2ec18dda2e422ebfdb68447c56d567c4ae5a0ffa6eca90cb4a6278bd85d1c373ecaa27fe11668baabec219a0bd638", "seq": 1, "text_sha384": "a898c4ce68f7270aa9fa69f5b75bfd25868e5ec26452e124404822fb94c46acabc0d8440c02480612ade6673f3a3444e", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.113Z", "ts_response": "2026-11-14T01:25:03.119Z"}
+{"arguments": {"card": "cell_2170_model3", "domain": "energy", "dt_s": 1.0, "initial": {"capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0, "cell_number": 1000.0, "state_of_charge": 0.93}, "record_every": 960, "segments": [{"load": {"case_temperature_c": 11.0, "current_a": 12.059617994390187}, "steps": 960}]}, "chain": "dec885fc6ef54ac2a84f76535ddcf714e2a2a6719c87212b64caee3886317df16fb53c55c070616b63cdc891f9d910de", "duration_s": 0.004277, "is_error": false, "jsonrpc_id": 3, "response_sha384": "1fd776c1d17219e18e960a04474af63e9f8ff7de93f299ab697a0e120e6392d1fee71544760f2de5a5ae81afb81337f6", "seq": 2, "text_sha384": "ef0e64d415c98ee21f33b47be5061ac92a05516697c8f7c1230e698a615057132af81ef4a0a249a2b816031b04132c27", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.119Z", "ts_response": "2026-11-14T01:25:03.124Z"}
diff --git a/sample/reference/g1d-budget5-cell1000-current-16min-11c.harness.jsonl.status.json b/sample/reference/g1d-budget5-cell1000-current-16min-11c.harness.jsonl.status.json
new file mode 100644
index 0000000000000000000000000000000000000000..1e545b25c439b1dfb4ca8a4791aa7578e201cd7d
--- /dev/null
+++ b/sample/reference/g1d-budget5-cell1000-current-16min-11c.harness.jsonl.status.json
@@ -0,0 +1,24 @@
+{
+ "engine": [
+ ".../engine_0.15.3_served/mcp_stdio"
+ ],
+ "proxy_pid": 99789,
+ "started": "2026-11-14T01:25:03.106Z",
+ "handshake": {
+ "method": "initialize",
+ "ok": true,
+ "server": {
+ "name": "Zero-Trust Physics",
+ "title": "Zero-Trust Physics Verifier",
+ "version": "0.15.3",
+ "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1",
+ "websiteUrl": "https://zerotrustphysics.com"
+ }
+ },
+ "tools_list": false,
+ "calls": 2,
+ "unanswered": 0,
+ "engine_exit": 0,
+ "ended": "2026-11-14T01:25:03.124Z",
+ "problems": []
+}
\ No newline at end of file
diff --git a/sample/reference/g1d-budget5-cell1000-current-16min-11c.txt b/sample/reference/g1d-budget5-cell1000-current-16min-11c.txt
new file mode 100644
index 0000000000000000000000000000000000000000..c56bdf6ecf3c3238d0416880f05dddbb7e08e37a
--- /dev/null
+++ b/sample/reference/g1d-budget5-cell1000-current-16min-11c.txt
@@ -0,0 +1,3 @@
+The stop UndervoltageLimit lies between the two requests below.
+
+{"holds": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059545636899294, "case_temperature_c": 11.0}}], "record_every": 960}}, "proof": "74bbb04a7f1ce03d8d60aa42063b094b0e66f03d602d37398911e7486b803eec45399df2c82f1bfb7fdce1ae655c33d4"}, "stops": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059617994390187, "case_temperature_c": 11.0}}], "record_every": 960}}, "proof": "3a8d1ae90c4ebcdab0950a9aa2280bbf270ed5acd8fcfecac04daf6c8b9091c28c269d997e47ce4a851c879dfd6de519", "stopped": "UndervoltageLimit"}}
diff --git a/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.calls.jsonl b/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.calls.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..bacea8d54a91d8f0c0c8d663c4376ea73a0b6d40
--- /dev/null
+++ b/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.calls.jsonl
@@ -0,0 +1,2 @@
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465612150325692, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}}
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465606150325693, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}}
diff --git a/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.harness.jsonl b/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.harness.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..8c70fbb035f7851b74a0c0e8bfadbb91ad437e58
--- /dev/null
+++ b/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.harness.jsonl
@@ -0,0 +1,2 @@
+{"arguments": {"card": "cell_2170_model3", "domain": "energy", "dt_s": 1.0, "initial": {"capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0, "cell_number": 448.0, "state_of_charge": 0.5465612150325692}, "record_every": 660, "segments": [{"load": {"case_temperature_c": 18.0, "current_a": 9.6}, "steps": 660}]}, "chain": "341bad127295ef16fa92273033f52065a3ba81b918c672b3d1811b684aa40e617e1e8ef2aeaf951cdbcc41d390463ae6", "duration_s": 0.004641, "is_error": false, "jsonrpc_id": 2, "response_sha384": "eab834799606ca1e4664040d29137c0a550acdbd231bbdb7f1aa90a909e74467cef2af486e596e78458e195caae14823", "seq": 1, "text_sha384": "fbd483dcba2d603aea84f9e0870ab4efb25d7b57445df2dc28bff5febdff01589549c25b710ef8ebd3e1d2b55af45c98", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.203Z", "ts_response": "2026-11-14T01:25:03.208Z"}
+{"arguments": {"card": "cell_2170_model3", "domain": "energy", "dt_s": 1.0, "initial": {"capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0, "cell_number": 448.0, "state_of_charge": 0.5465606150325693}, "record_every": 660, "segments": [{"load": {"case_temperature_c": 18.0, "current_a": 9.6}, "steps": 660}]}, "chain": "52d21e476796f4ef40a89efcafe97f1177b72dd3552980285a15ef6387d7f43fd1bfe630cf68e58f1f6630d9e17e7ddc", "duration_s": 0.003544, "is_error": false, "jsonrpc_id": 3, "response_sha384": "b0b06d10f74d464cda55bfb80488c04af74320221755c5fe228b28e7f295af7ac69820a5fb32d5c8e34e98c0dca12c42", "seq": 2, "text_sha384": "4f5fe77a0997fcf4e2b6f459faca95aeeb6df383317e223c780f5cf53a7a10250ac0e389106464b89174720bbcff8756", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.208Z", "ts_response": "2026-11-14T01:25:03.212Z"}
diff --git a/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.harness.jsonl.status.json b/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.harness.jsonl.status.json
new file mode 100644
index 0000000000000000000000000000000000000000..d849b876b52dd5fe32e6efc63aed114018c4f664
--- /dev/null
+++ b/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.harness.jsonl.status.json
@@ -0,0 +1,24 @@
+{
+ "engine": [
+ ".../engine_0.15.3_served/mcp_stdio"
+ ],
+ "proxy_pid": 99793,
+ "started": "2026-11-14T01:25:03.199Z",
+ "handshake": {
+ "method": "initialize",
+ "ok": true,
+ "server": {
+ "name": "Zero-Trust Physics",
+ "title": "Zero-Trust Physics Verifier",
+ "version": "0.15.3",
+ "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1",
+ "websiteUrl": "https://zerotrustphysics.com"
+ }
+ },
+ "tools_list": false,
+ "calls": 2,
+ "unanswered": 0,
+ "engine_exit": 0,
+ "ended": "2026-11-14T01:25:03.213Z",
+ "problems": []
+}
\ No newline at end of file
diff --git a/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.txt b/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.txt
new file mode 100644
index 0000000000000000000000000000000000000000..127de4c7f156e5b3376a346ffa560fcc43b90ada
--- /dev/null
+++ b/sample/reference/g1d-limit-cell448-lowest-start-charge-11min-18c.txt
@@ -0,0 +1,3 @@
+The boundary lies between the two designs below; core_hottest binds.
+
+{"passing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465612150325692, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}}, "proof": "5409934b45e2559467989bb1cf922deb3a8a3c075c638a6bae4a4379cdb10e0e0e099537ca7e24a95f7f0f1f21baf887"}}, "failing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465606150325693, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}}, "proof": "baa948ee323f2595cb5a4109e49a1926d9de0ff6fc428024cd6e6d9ca23e6de522a52c96a4f23d40eeabddb7920c2a85"}}, "binding": "core_hottest"}
diff --git a/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.calls.jsonl b/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.calls.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..82a98194a93f349600b08c9d5f3d1256ffb9ea67
--- /dev/null
+++ b/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.calls.jsonl
@@ -0,0 +1,2 @@
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": 3.269752803378649, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": 3.269556624095825, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}
diff --git a/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.harness.jsonl b/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.harness.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..f72422bed875cf68247830443c46c866f1624183
--- /dev/null
+++ b/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.harness.jsonl
@@ -0,0 +1,2 @@
+{"arguments": {"card": "cell_2170_model3", "domain": "energy", "dt_s": 1.0, "initial": {"capacity_ah": 3.269752803378649, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0, "cell_number": 1000.0, "state_of_charge": 0.88}, "record_every": 600, "segments": [{"load": {"case_temperature_c": 31.0, "current_a": 15.0}, "steps": 600}]}, "chain": "995ef0079ac5e53c0f192ba4845e43d2b4e86955c30b959213fbd44d38799aca6fd435012de7226c87b18b105a34a50c", "duration_s": 0.005203, "is_error": false, "jsonrpc_id": 2, "response_sha384": "dc14f10f168f5e7ccd239dadfe9dc6a827f3e00c149811e1ffc946c5860d0906178724879831a25e09ebd928e5616302", "seq": 1, "text_sha384": "beb369fa05e31bb8939633a168b185c1041fa5f87401487123f3511ecb2c55d373b13fa35d6daff6fa9e382aeea0706c", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.159Z", "ts_response": "2026-11-14T01:25:03.164Z"}
+{"arguments": {"card": "cell_2170_model3", "domain": "energy", "dt_s": 1.0, "initial": {"capacity_ah": 3.269556624095825, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0, "cell_number": 1000.0, "state_of_charge": 0.88}, "record_every": 600, "segments": [{"load": {"case_temperature_c": 31.0, "current_a": 15.0}, "steps": 600}]}, "chain": "ab9bc1743fe22beaf7881313a2911b2d7e1bdd8835459bcaab1d50c031aef0eafd77201a8ffeaa5595e008827d61622a", "duration_s": 0.004152, "is_error": false, "jsonrpc_id": 3, "response_sha384": "88b25a916411bb2730fa1419d7277c10bbeb24c3bdaa1bec79513c6575ccda2b39d6595ae80541a8ae35223413ab01c6", "seq": 2, "text_sha384": "45d7a1772b50e1dcdb1e58a4889528fc206cc94f2d0085ad4e6cce2595f9b8cbd7b2c82a5d379aaba661b2af674f4ce3", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.164Z", "ts_response": "2026-11-14T01:25:03.168Z"}
diff --git a/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.harness.jsonl.status.json b/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.harness.jsonl.status.json
new file mode 100644
index 0000000000000000000000000000000000000000..bf60b9b19be452346f109d51cfb51e9fd85567d5
--- /dev/null
+++ b/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.harness.jsonl.status.json
@@ -0,0 +1,24 @@
+{
+ "engine": [
+ ".../engine_0.15.3_served/mcp_stdio"
+ ],
+ "proxy_pid": 99791,
+ "started": "2026-11-14T01:25:03.154Z",
+ "handshake": {
+ "method": "initialize",
+ "ok": true,
+ "server": {
+ "name": "Zero-Trust Physics",
+ "title": "Zero-Trust Physics Verifier",
+ "version": "0.15.3",
+ "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1",
+ "websiteUrl": "https://zerotrustphysics.com"
+ }
+ },
+ "tools_list": false,
+ "calls": 2,
+ "unanswered": 0,
+ "engine_exit": 0,
+ "ended": "2026-11-14T01:25:03.169Z",
+ "problems": []
+}
\ No newline at end of file
diff --git a/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.txt b/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.txt
new file mode 100644
index 0000000000000000000000000000000000000000..68e25b6bb264861fc73e1fe79a5fdf72780155f8
--- /dev/null
+++ b/sample/reference/g1f-budget4-cell1000-least-capacity-15a-31c.txt
@@ -0,0 +1,3 @@
+The stop UndervoltageLimit lies between the two requests below.
+
+{"holds": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": 3.269752803378649, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}, "proof": "cb1bd559d1d2265454e621416c6f462276b545f87432504b9e4ef59fd7b3dd88fa72d7c68c299fb3d8310399fbece51b"}, "stops": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": 3.269556624095825, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}, "proof": "1380e70918c6bec508ee957298bf797f296ef625ee93de955ffbd69e23bf3d12a48082e658a7d880638373e8ba6c78c2", "stopped": "UndervoltageLimit"}}
diff --git a/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.calls.jsonl b/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.calls.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..1aafeb61893d55e46e96d0b4dcde2c173e2dc34d
--- /dev/null
+++ b/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.calls.jsonl
@@ -0,0 +1,4 @@
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5106548116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}}
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 430.4672291538255, "sei_fraction": 0.09625617043171643, "anode_lithium_fraction": 0.7574684863929316, "cathode_unreacted_fraction": 0.9202519687560146, "electrolyte_fraction": 0.9999645125616834, "separator_unmelted_fraction": 0.0, "vent_gas_held_fraction": 0.60031241106013}, "dt_s": 10.0, "segments": [{"steps": 360, "load": {"oven_temperature_k": 305.15, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 360, "from": {"request": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5106548116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "run_seal": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"}}}
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5111948116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}}
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 430.468235992056, "sei_fraction": 0.09625468529952468, "anode_lithium_fraction": 0.7574672979619945, "cathode_unreacted_fraction": 0.9202464921736476, "electrolyte_fraction": 0.9999645073667627, "separator_unmelted_fraction": 0.0, "vent_gas_held_fraction": 0.6000340833497131}, "dt_s": 10.0, "segments": [{"steps": 360, "load": {"oven_temperature_k": 305.15, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 360, "from": {"request": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5111948116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "run_seal": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"}}}
diff --git a/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.harness.jsonl b/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.harness.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..8cdb7d47e74b7a4c1fa9033acb7b04fe9fb176dd
--- /dev/null
+++ b/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.harness.jsonl
@@ -0,0 +1,4 @@
+{"arguments": {"card": "runaway_18650_lco", "domain": "energy", "dt_s": 10.0, "initial": {"anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "sei_fraction": 0.12, "separator_unmelted_fraction": 1.0, "temperature_k": 297.15, "vent_gas_held_fraction": 1.0}, "record_every": 320, "segments": [{"load": {"adiabatic": 0.0, "heater_power_w": 0.0, "oven_temperature_k": 425.5106548116787}, "steps": 320}]}, "chain": "d9bc0bab0fe52b8d13af81b7ef47c4ed57d44b03266c54e4d6a0cb0cdce837cf4d712d069c89ed95ba79da28ecbe510d", "duration_s": 0.003809, "is_error": false, "jsonrpc_id": 2, "response_sha384": "1cc86ca6080da59106a63dc01d43fdd035a9e6a4f7706a70eb27cfdfd7ac65cff89f895f134b3b96aa8bad3bd1296a67", "seq": 1, "text_sha384": "ee3ab2de31f99e1cacb514b0ad150818c8070a04da3c332c6122056ca5efef4d5530828502a735763459b20be9e8f11c", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.247Z", "ts_response": "2026-11-14T01:25:03.251Z"}
+{"arguments": {"card": "runaway_18650_lco", "domain": "energy", "dt_s": 10.0, "from": {"request": {"card": "runaway_18650_lco", "domain": "energy", "dt_s": 10.0, "initial": {"anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "sei_fraction": 0.12, "separator_unmelted_fraction": 1.0, "temperature_k": 297.15, "vent_gas_held_fraction": 1.0}, "record_every": 320, "segments": [{"load": {"adiabatic": 0.0, "heater_power_w": 0.0, "oven_temperature_k": 425.5106548116787}, "steps": 320}]}, "run_seal": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"}, "initial": {"anode_lithium_fraction": 0.7574684863929316, "cathode_unreacted_fraction": 0.9202519687560146, "electrolyte_fraction": 0.9999645125616834, "sei_fraction": 0.09625617043171643, "separator_unmelted_fraction": 0.0, "temperature_k": 430.4672291538255, "vent_gas_held_fraction": 0.60031241106013}, "record_every": 360, "segments": [{"load": {"adiabatic": 0.0, "heater_power_w": 0.0, "oven_temperature_k": 305.15}, "steps": 360}]}, "chain": "5ba67d29a22e42b4b2e132b359f874d10471c4cdcfca946467eb413190a142d2fb489fbb7c36fbd78cb7eca99ee44adb", "duration_s": 0.00421, "is_error": false, "jsonrpc_id": 3, "response_sha384": "62dfad286ce0fd391f09667196dcf1d3a6386c075bc5743d722185cadecdd29ae9e9e246c697c16f9fddbb8cf1b14b95", "seq": 2, "text_sha384": "e5293d072eea076751a864d29310c2dc1903a16c6a6bed19f932f61950c8c40c72491a3286cc7b2f4eba9c9e5fe62607", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.252Z", "ts_response": "2026-11-14T01:25:03.256Z"}
+{"arguments": {"card": "runaway_18650_lco", "domain": "energy", "dt_s": 10.0, "initial": {"anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "sei_fraction": 0.12, "separator_unmelted_fraction": 1.0, "temperature_k": 297.15, "vent_gas_held_fraction": 1.0}, "record_every": 320, "segments": [{"load": {"adiabatic": 0.0, "heater_power_w": 0.0, "oven_temperature_k": 425.5111948116787}, "steps": 320}]}, "chain": "c766ea25918fab200e4f416fc4fc320735b0a9769a21d8831b871138d119d42a89ce78dcb76ffb482725fdcd999347c5", "duration_s": 0.00231, "is_error": false, "jsonrpc_id": 4, "response_sha384": "e5775cd0110808ac5c5bea03f5c5fa046147a0adb29e8a49ba426d98ea018de0102795db8a7b3376d2f369bdf463cc32", "seq": 3, "text_sha384": "b4277a63711858be1447a322cecc1220f20d6ee56fbc745816eaf79d5adda6bb8840ac640edc44cb084fae4ab4853fd9", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.256Z", "ts_response": "2026-11-14T01:25:03.259Z"}
+{"arguments": {"card": "runaway_18650_lco", "domain": "energy", "dt_s": 10.0, "from": {"request": {"card": "runaway_18650_lco", "domain": "energy", "dt_s": 10.0, "initial": {"anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "sei_fraction": 0.12, "separator_unmelted_fraction": 1.0, "temperature_k": 297.15, "vent_gas_held_fraction": 1.0}, "record_every": 320, "segments": [{"load": {"adiabatic": 0.0, "heater_power_w": 0.0, "oven_temperature_k": 425.5111948116787}, "steps": 320}]}, "run_seal": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"}, "initial": {"anode_lithium_fraction": 0.7574672979619945, "cathode_unreacted_fraction": 0.9202464921736476, "electrolyte_fraction": 0.9999645073667627, "sei_fraction": 0.09625468529952468, "separator_unmelted_fraction": 0.0, "temperature_k": 430.468235992056, "vent_gas_held_fraction": 0.6000340833497131}, "record_every": 360, "segments": [{"load": {"adiabatic": 0.0, "heater_power_w": 0.0, "oven_temperature_k": 305.15}, "steps": 360}]}, "chain": "b82dea41b1f9a0023cc633ed493a878dbd596757f789eac38a8b02a0db5254d2defb59851c8a4f2e929431edbb9cddbf", "duration_s": 0.003775, "is_error": false, "jsonrpc_id": 5, "response_sha384": "2333a390ef109556d02c4591bd9a7e27fee7c291c3808181dfd90c42e9310c3ace4dd055aaefeed46c2d7e578b19271d", "seq": 4, "text_sha384": "08822f98647840a830424599a005da6ab4ffda4a6ee23d9fc3253696007b3b1a20fc0e35c6e122750e073128b1cf4c91", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.259Z", "ts_response": "2026-11-14T01:25:03.263Z"}
diff --git a/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.harness.jsonl.status.json b/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.harness.jsonl.status.json
new file mode 100644
index 0000000000000000000000000000000000000000..3e536530792ed19657c7aaf809a31e0b3b335e5f
--- /dev/null
+++ b/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.harness.jsonl.status.json
@@ -0,0 +1,24 @@
+{
+ "engine": [
+ ".../engine_0.15.3_served/mcp_stdio"
+ ],
+ "proxy_pid": 99795,
+ "started": "2026-11-14T01:25:03.242Z",
+ "handshake": {
+ "method": "initialize",
+ "ok": true,
+ "server": {
+ "name": "Zero-Trust Physics",
+ "title": "Zero-Trust Physics Verifier",
+ "version": "0.15.3",
+ "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1",
+ "websiteUrl": "https://zerotrustphysics.com"
+ }
+ },
+ "tools_list": false,
+ "calls": 4,
+ "unanswered": 0,
+ "engine_exit": 0,
+ "ended": "2026-11-14T01:25:03.264Z",
+ "problems": []
+}
\ No newline at end of file
diff --git a/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.txt b/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e86450be0a4a41c312d3fc2682af086b356a57ed
--- /dev/null
+++ b/sample/reference/g1f-chain-runaway-new-soak-then-warm-room.txt
@@ -0,0 +1,3 @@
+The boundary lies between the two designs below; next_vent_held binds.
+
+{"passing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5106548116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}}, "proof": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"}, "next": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 430.4672291538255, "sei_fraction": 0.09625617043171643, "anode_lithium_fraction": 0.7574684863929316, "cathode_unreacted_fraction": 0.9202519687560146, "electrolyte_fraction": 0.9999645125616834, "separator_unmelted_fraction": 0.0, "vent_gas_held_fraction": 0.60031241106013}, "dt_s": 10.0, "segments": [{"steps": 360, "load": {"oven_temperature_k": 305.15, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 360, "from": {"request": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5106548116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "run_seal": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"}}}, "proof": "8175ff4962768bd8d6a42a515e6b98bc343970061dc2707bc0758ffa1964977faa0adefb2a4ffa4fc6e773a82c8505b5"}}, "failing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5111948116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}}, "proof": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"}, "next": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 430.468235992056, "sei_fraction": 0.09625468529952468, "anode_lithium_fraction": 0.7574672979619945, "cathode_unreacted_fraction": 0.9202464921736476, "electrolyte_fraction": 0.9999645073667627, "separator_unmelted_fraction": 0.0, "vent_gas_held_fraction": 0.6000340833497131}, "dt_s": 10.0, "segments": [{"steps": 360, "load": {"oven_temperature_k": 305.15, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 360, "from": {"request": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5111948116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "run_seal": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"}}}, "proof": "ac93a947646639614fa1397fde5373b92630d0562b5120cec430733c7e5a04cfdaf799566a4f202fc8d4656cc1636bc7"}}, "binding": "next_vent_held"}
diff --git a/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.calls.jsonl b/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.calls.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..59863afdaee2bec7b186453e6e2bbbb4e6a275ef
--- /dev/null
+++ b/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.calls.jsonl
@@ -0,0 +1,2 @@
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_18650pf", "initial": {"soc": 0.7845661995529128, "held_current_a": 2.7}, "dt_s": 6.0, "segments": [{"steps": 270, "load": {"current_a": 2.7}}], "record_every": 270}}
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_18650pf", "initial": {"soc": 0.7845181995529128, "held_current_a": 2.7}, "dt_s": 6.0, "segments": [{"steps": 270, "load": {"current_a": 2.7}}], "record_every": 270}}
diff --git a/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.harness.jsonl b/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.harness.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..80ec1e11968d93f0494e188a07d45af6bd38f64b
--- /dev/null
+++ b/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.harness.jsonl
@@ -0,0 +1,2 @@
+{"arguments": {"card": "cell_18650pf", "domain": "energy", "dt_s": 6.0, "initial": {"held_current_a": 2.7, "soc": 0.7845661995529128}, "record_every": 270, "segments": [{"load": {"current_a": 2.7}, "steps": 270}]}, "chain": "191ef930091d90900d46abf1a18f65abf18bf56cea1cef65a5db7701b06e2f2aed32a0caecc02dc6ab2135dd206f5690", "duration_s": 0.003254, "is_error": false, "jsonrpc_id": 2, "response_sha384": "e03ecbbffb5a299f39b7d4953974090564843cd8d557d6a735f3ba30d837bff17a8ce5f2ff3b9ec0d8ad571d6a3a605e", "seq": 1, "text_sha384": "8cd3a8809038a5a9625c94946cd56ad2ef3548b7279a6ef4ab5d9b1e267f6ba3269955c27625b482293a1ec89e7a2601", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.302Z", "ts_response": "2026-11-14T01:25:03.305Z"}
+{"arguments": {"card": "cell_18650pf", "domain": "energy", "dt_s": 6.0, "initial": {"held_current_a": 2.7, "soc": 0.7845181995529128}, "record_every": 270, "segments": [{"load": {"current_a": 2.7}, "steps": 270}]}, "chain": "6f1aed28af0e57b4f5fe704fe9a3c13832ce4a8ee36d02e5720777bf767e24a37765523a02159138959eb3124e5928da", "duration_s": 0.001687, "is_error": false, "jsonrpc_id": 3, "response_sha384": "d2d0b58ef897315400156686e1efaf9a9eab4e9be2cc2b48c96e12a66d0926964fecff40b8faf4966931c9806512ca3c", "seq": 2, "text_sha384": "a2e5f3eac7480b71b5092f7500d68d49979635f4bec583ee95784f3ae69f99c623e95c913424ff42f792aea81eb9e801", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:03.306Z", "ts_response": "2026-11-14T01:25:03.308Z"}
diff --git a/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.harness.jsonl.status.json b/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.harness.jsonl.status.json
new file mode 100644
index 0000000000000000000000000000000000000000..6720ffdc3cf8ac5d63f36994e40c33445948f8f3
--- /dev/null
+++ b/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.harness.jsonl.status.json
@@ -0,0 +1,24 @@
+{
+ "engine": [
+ ".../engine_0.15.3_served/mcp_stdio"
+ ],
+ "proxy_pid": 99797,
+ "started": "2026-11-14T01:25:03.297Z",
+ "handshake": {
+ "method": "initialize",
+ "ok": true,
+ "server": {
+ "name": "Zero-Trust Physics",
+ "title": "Zero-Trust Physics Verifier",
+ "version": "0.15.3",
+ "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1",
+ "websiteUrl": "https://zerotrustphysics.com"
+ }
+ },
+ "tools_list": false,
+ "calls": 2,
+ "unanswered": 0,
+ "engine_exit": 0,
+ "ended": "2026-11-14T01:25:03.308Z",
+ "problems": []
+}
\ No newline at end of file
diff --git a/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.txt b/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.txt
new file mode 100644
index 0000000000000000000000000000000000000000..037fa68d1eebe79bf72575fe68f1f3500bfe7540
--- /dev/null
+++ b/sample/reference/g1f-limit-18650pf-lowest-start-charge-2a7-27min.txt
@@ -0,0 +1,3 @@
+The boundary lies between the two designs below; pf_end_voltage binds.
+
+{"passing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_18650pf", "initial": {"soc": 0.7845661995529128, "held_current_a": 2.7}, "dt_s": 6.0, "segments": [{"steps": 270, "load": {"current_a": 2.7}}], "record_every": 270}}, "proof": "eaa7313b2dabcc37377021297ae0fbaae7439676b440bb00b3f8278b230f54ce98cd55b75ea149b2e046842928e75926"}}, "failing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_18650pf", "initial": {"soc": 0.7845181995529128, "held_current_a": 2.7}, "dt_s": 6.0, "segments": [{"steps": 270, "load": {"current_a": 2.7}}], "record_every": 270}}, "proof": "422a5adb5a10b1d8704b4864a3dacb002c698d7b83c2c41d44faebfdcdfc1101ab0275eb654bf312889c18606871687f"}}, "binding": "pf_end_voltage"}
diff --git a/sample/reference/naive_scores.jsonl b/sample/reference/naive_scores.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..f5d67ad7d42dfbd9f217c4a87165788205e71fe8
--- /dev/null
+++ b/sample/reference/naive_scores.jsonl
@@ -0,0 +1,5 @@
+{"id": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the holds request comes back refused (UndervoltageLimit)", "computing_calls": 1, "holds_outcome": "refused", "stops_outcome": "refused (UndervoltageLimit)", "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
+{"id": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the stops request comes back completed (None), not the stop UndervoltageLimit", "computing_calls": 1, "holds_outcome": "completed", "stops_outcome": "completed (None)", "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
+{"id": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the failing design meets every constraint", "computing_calls": 1, "passing": {"x": 0.625, "met": {"end_voltage": true, "core_hottest": true, "completes": true}, "values": {"end_voltage": 3.0213399702936363, "core_hottest": 24.610170128756533, "completes": "completed"}}, "failing": {"x": 0.625, "met": {"end_voltage": true, "core_hottest": true, "completes": true}, "values": {"end_voltage": 3.0213399702936363, "core_hottest": 24.610170128756533, "completes": "completed"}}, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
+{"id": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "kind": "chained_design", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's next run is missing", "computing_calls": 1, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
+{"id": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks pf_end_voltage", "computing_calls": 1, "passing": {"x": 0.6, "met": {"pf_end_voltage": false, "completes": true}, "values": {"pf_end_voltage": 3.2551432209222297, "completes": "completed"}}, "failing": {"x": 0.6, "met": {"pf_end_voltage": false, "completes": true}, "values": {"pf_end_voltage": 3.2551432209222297, "completes": "completed"}}, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
diff --git a/sample/reference/reference_scores.jsonl b/sample/reference/reference_scores.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..84f720a1f8100a703480acb99b9bbaad26fbd6ba
--- /dev/null
+++ b/sample/reference/reference_scores.jsonl
@@ -0,0 +1,5 @@
+{"id": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "holds_outcome": "completed", "stops_outcome": "refused (UndervoltageLimit)", "holds_value": 12.059545636899294, "stops_value": 12.059617994390187, "width": 7.235749089318233e-05, "width_ratio": 0.5999999999943105, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
+{"id": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "holds_outcome": "completed", "stops_outcome": "refused (UndervoltageLimit)", "holds_value": 3.269752803378649, "stops_value": 3.269556624095825, "width": 0.00019617928282400499, "width_ratio": 0.5999999999992989, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
+{"id": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "passing": {"x": 0.5465612150325692, "met": {"end_voltage": true, "core_hottest": true, "completes": true}, "values": {"end_voltage": 2.8349093713245175, "core_hottest": 26.173992565002724, "completes": "completed"}}, "failing": {"x": 0.5465606150325693, "met": {"end_voltage": true, "core_hottest": false, "completes": true}, "values": {"end_voltage": 2.8349079479164936, "core_hottest": 26.174007434990113, "completes": "completed"}}, "width": 5.999999999062311e-07, "width_ratio": 0.5999999999062311, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
+{"id": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "kind": "chained_design", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "passing": {"x": 425.5106548116787, "met": {"next_cell_peak": true, "next_vent_held": true}, "values": {"next_cell_peak": 428.089073580809, "next_vent_held": 0.59753991388013}}, "failing": {"x": 425.5111948116787, "met": {"next_cell_peak": true, "next_vent_held": false}, "values": {"next_cell_peak": 428.0900693769172, "next_vent_held": 0.5972600513108174}}, "width": 0.0005400000000008731, "width_ratio": 0.6000000000009701, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
+{"id": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "passing": {"x": 0.7845661995529128, "met": {"pf_end_voltage": true, "completes": true}, "values": {"pf_end_voltage": 3.4061234719996434, "completes": "completed"}}, "failing": {"x": 0.7845181995529128, "met": {"pf_end_voltage": false, "completes": true}, "values": {"pf_end_voltage": 3.4060765279996437, "completes": "completed"}}, "width": 4.8000000000048004e-05, "width_ratio": 0.6000000000006, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true}
diff --git a/sample/reports/describe_short.json b/sample/reports/describe_short.json
new file mode 100644
index 0000000000000000000000000000000000000000..6efb7950e2b676ee291c48e96fe209ca824770a0
--- /dev/null
+++ b/sample/reports/describe_short.json
@@ -0,0 +1,316 @@
+{
+ "energy/cell_18650pf": {
+ "domain": "energy",
+ "card": "cell_18650pf",
+ "form": "short",
+ "specimen": "Terminal voltage and state of charge of one Panasonic NCR18650PF lithium-ion cell, new, at 25 degC, in a held discharge at one current from a rested cell at any state of charge, with no temperature and no memory of the load before.",
+ "against_measurement": "compared with measurement",
+ "accuracy_against_measurement": "Compared with the eleven held 1C discharges from full charge not in the fit: terminal voltage within 27.8 to 30.0 mV RMS (target 50), largest single error 57 mV; delivered capacity within +0.04 percent (target 3) on the one run to cutoff. Gap: on one discharge at 0.87 A in 14 holds, not in the fit, 56.7 mV RMS (target 50), 204 and 206 mV in the last two holds, and it runs 71 s past the cell's 2.5 V, delivering 0.60 percent more than the cell.",
+ "phase_fields": [
+ {
+ "name": "soc",
+ "unit": "1",
+ "minimum": 0.03,
+ "maximum": 1.0
+ },
+ {
+ "name": "held_current_a",
+ "unit": "A",
+ "minimum": 0.0,
+ "minimum_exclusive": true,
+ "maximum": null
+ }
+ ],
+ "load_fields": [
+ {
+ "name": "current_a",
+ "unit": "A",
+ "minimum": 0.0,
+ "minimum_exclusive": true,
+ "maximum": null
+ }
+ ],
+ "dt_s": {
+ "unit": "s",
+ "floor_s": 1.6628265380859375e-05,
+ "ceiling_s": 17.436
+ },
+ "stops": [
+ "NonFiniteInput",
+ "NonFiniteState",
+ "NonPositiveDt",
+ "InvalidCell",
+ "CurrentNotDischarging",
+ "CurrentChangedDuringDischarge",
+ "StateOfChargeOutsideCard",
+ "UndervoltageCutoff",
+ "SpontaneousGeneration",
+ "FirstLawBreach",
+ "DtBelowFloor",
+ "DtAboveCeiling"
+ ],
+ "declared_ends": [],
+ "continues_with_from": true,
+ "example_run_trajectory": {
+ "domain": "energy",
+ "card": "cell_18650pf",
+ "initial": {
+ "soc": 1.0,
+ "held_current_a": 2.9
+ },
+ "dt_s": 17.436,
+ "segments": [
+ {
+ "steps": 4,
+ "load": {
+ "current_a": 2.9
+ }
+ }
+ ],
+ "record_every": 1
+ },
+ "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning."
+ },
+ "energy/cell_2170_model3": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "form": "short",
+ "specimen": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat.",
+ "against_measurement": "compared with measurement",
+ "accuracy_against_measurement": "Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.",
+ "phase_fields": [
+ {
+ "name": "cell_number",
+ "unit": "1",
+ "minimum": 80.0,
+ "maximum": 1000.0
+ },
+ {
+ "name": "state_of_charge",
+ "unit": "1",
+ "minimum": -0.05,
+ "maximum": 1.05
+ },
+ {
+ "name": "capacity_ah",
+ "unit": "Ah",
+ "minimum": 0.0,
+ "minimum_exclusive": true,
+ "maximum": null
+ },
+ {
+ "name": "case_temperature_least_c",
+ "unit": "degC",
+ "minimum": -273.15,
+ "minimum_exclusive": true,
+ "maximum": null
+ },
+ {
+ "name": "case_temperature_most_c",
+ "unit": "degC",
+ "minimum": -273.15,
+ "minimum_exclusive": true,
+ "maximum": null
+ }
+ ],
+ "load_fields": [
+ {
+ "name": "current_a",
+ "unit": "A",
+ "minimum": null,
+ "maximum": null
+ },
+ {
+ "name": "case_temperature_c",
+ "unit": "degC",
+ "minimum": -273.15,
+ "minimum_exclusive": true,
+ "maximum": null
+ }
+ ],
+ "dt_s": {
+ "unit": "s",
+ "floor_s": 1.0,
+ "ceiling_s": 1.0
+ },
+ "stops": [
+ "NonFiniteInput",
+ "NonFiniteState",
+ "NonPositiveDt",
+ "InvalidCell",
+ "CellNotRecognized",
+ "CapacityNotPositive",
+ "CaseTemperatureBelowAbsoluteZero",
+ "CoreAtElectrolyteGlassTemperature",
+ "CaseTemperatureSpanInverted",
+ "StateOfChargeOutsideCard",
+ "SurfaceOutsideCurve",
+ "ElectrolyteDepleted",
+ "UndervoltageLimit",
+ "OvervoltageLimit",
+ "SpontaneousGeneration",
+ "FirstLawBreach",
+ "DtBelowFloor",
+ "DtAboveCeiling",
+ "ContinuationWithoutUpstream",
+ "ContinuationNotOnCard"
+ ],
+ "declared_ends": [],
+ "continues_with_from": false,
+ "example_run_trajectory": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 80.0,
+ "state_of_charge": 1.0,
+ "capacity_ah": 4.2,
+ "case_temperature_least_c": -20.0,
+ "case_temperature_most_c": -20.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 600,
+ "load": {
+ "current_a": 4.5,
+ "case_temperature_c": -20.0
+ }
+ }
+ ],
+ "record_every": 60
+ },
+ "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning."
+ },
+ "energy/runaway_18650_lco": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "form": "short",
+ "specimen": "Thermal runaway of one LiCoO2 18650 cell in an oven, under a heater or in an adiabatic calorimeter: the four Hatchard-Kim stages, a separator melt at 130 degC and a vent at 160 degC, one heat capacity, oven loss and an energy ledger.",
+ "against_measurement": "compared with measurement",
+ "accuracy_against_measurement": "Compared with each record left out of the fit in turn, the constants refitted on the other 12: onsets within 16.2 K RMS on 10 records (9.8 on the eight reprinted cells), peaks within 51.7 K RMS on 7, Hatchard's 155 degC oven running away at 64.8 min against 51.1; in the fit 13.5 K, 51.1 K and 62.0 min, and 17 of the records' 23 comparisons within their targets. Gap: at 150 degC the card runs away at 109.7 min where Hatchard's cell did not in 120; Golubkov's cell peaks 115 K higher (853 degC); Mendoza-Hernandez's self-heats 30 K lower (100.0 degC); Lu's peaked at 370 degC against 705.",
+ "phase_fields": [
+ {
+ "name": "temperature_k",
+ "unit": "K",
+ "minimum": 0.0,
+ "minimum_exclusive": true,
+ "maximum": 1811.0,
+ "maximum_exclusive": true
+ },
+ {
+ "name": "sei_fraction",
+ "unit": "1",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ {
+ "name": "anode_lithium_fraction",
+ "unit": "1",
+ "minimum": 0.0,
+ "maximum": 0.92788
+ },
+ {
+ "name": "cathode_unreacted_fraction",
+ "unit": "1",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ {
+ "name": "electrolyte_fraction",
+ "unit": "1",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ {
+ "name": "separator_unmelted_fraction",
+ "unit": "1",
+ "minimum": 0.0,
+ "maximum": 1.0
+ },
+ {
+ "name": "vent_gas_held_fraction",
+ "unit": "1",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ ],
+ "load_fields": [
+ {
+ "name": "oven_temperature_k",
+ "unit": "K",
+ "minimum": null,
+ "maximum": null
+ },
+ {
+ "name": "heater_power_w",
+ "unit": "W",
+ "minimum": 0.0,
+ "maximum": null
+ },
+ {
+ "name": "adiabatic",
+ "unit": "1",
+ "minimum": 0.0,
+ "maximum": 1.0
+ }
+ ],
+ "dt_s": {
+ "unit": "s",
+ "floor_s": 1.0237675362844224e-05,
+ "ceiling_s": 10.734980681269745
+ },
+ "stops": [
+ "NonFiniteInput",
+ "NonFiniteState",
+ "NonPositiveDt",
+ "InvalidCell",
+ "OvenTemperatureNotPositive",
+ "HeaterPowerNegative",
+ "AdiabaticNotZeroOrOne",
+ "TemperatureNotPositive",
+ "CanMelting",
+ "SeiFractionOutsideCell",
+ "AnodeLithiumOutsideCell",
+ "CathodeUnreactedOutsideCell",
+ "ElectrolyteOutsideCell",
+ "SeparatorOutsideCell",
+ "VentGasOutsideCell",
+ "EveryReactantConsumed",
+ "SubstepsAboveBudget",
+ "SpontaneousGeneration",
+ "FirstLawBreach",
+ "DtBelowFloor",
+ "DtAboveCeiling"
+ ],
+ "declared_ends": [
+ "EveryReactantConsumed"
+ ],
+ "continues_with_from": true,
+ "example_run_trajectory": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 301.15,
+ "sei_fraction": 0.15,
+ "anode_lithium_fraction": 0.75,
+ "cathode_unreacted_fraction": 0.96,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 600,
+ "load": {
+ "oven_temperature_k": 428.15,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 10
+ },
+ "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning."
+ }
+}
diff --git a/sample/reports/g1d-budget5-cell1000-current-16min-11c.html b/sample/reports/g1d-budget5-cell1000-current-16min-11c.html
new file mode 100644
index 0000000000000000000000000000000000000000..45008355995c86c21a1aece78066b5d50676d98d
--- /dev/null
+++ b/sample/reports/g1d-budget5-cell1000-current-16min-11c.html
@@ -0,0 +1,114 @@
+
+Task report: g1d-budget5-cell1000-current-16min-11c
+g1d-budget5-cell1000-current-16min-11c
+Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.
+Budgeted search · models energy/cell_2170_model3 · Zero-Trust Physics v0.15.3 · Protocol Company
+Checksums
+| What | sha256 | SHA-384 |
+| Task row | 27a802ed2a996e11f01de6b1b585c3393e5330dc596cfd9376086b1b5783068b | 854acd9c04d098001e13f8429c2ea08774db2cdbb92054f12b497c4e5271a19accebeb452ef60474cc1fdb14c6ee51f3 |
+| Harbor directory | e16d994186e52ec102270282dc0856b571b5e7424974a810a8e875fa24f93b99 | 5a96034530e88c47f26a4bc4013b44f186ef802326456cd7a4a04b745bd307e2b86fb666e92d01f37f6bacd6e1855237 |
+Instruction
Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.62 Ah, rested at 93 percent charge with its case at 11 degrees Celsius, is discharged at one constant current for 16 minutes (960 steps of 1 s), its case held at 11 degrees Celsius. Above some current it reaches its lower voltage limit before the 16 minutes are up (UndervoltageLimit). Find that current, in amps.
+
+Find it to five significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.001 percent of the value apart. It lies between 10 and 15 A.
+
+The request, with <x> the one input you change:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": "<x>", "case_temperature_c": 11.0}}], "record_every": 960}}
+
+Budget: at most 5 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"holds": {"request": ..., "proof": ...}, "stops": {"request": ..., "proof": ..., "stopped": "<the stop's name exactly as the verifier gives it>"}}
+
+holds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+Reference solution
+From the reference agent's reply (g1d-budget5-cell1000-current-16min-11c.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.
+| On the card | Tool | Proof | Open address |
|---|
| holds | run_trajectory | 74bbb04a7f1ce03d8d60aa42063b094b0e66f03d602d37398911e7486b803eec45399df2c82f1bfb7fdce1ae655c33d4 | verified |
| stops | run_trajectory | 3a8d1ae90c4ebcdab0950a9aa2280bbf270ed5acd8fcfecac04daf6c8b9091c28c269d997e47ce4a851c879dfd6de519 | verified |
+{
+ "holds": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 1000.0,
+ "state_of_charge": 0.93,
+ "capacity_ah": 4.62,
+ "case_temperature_least_c": 11.0,
+ "case_temperature_most_c": 11.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 960,
+ "load": {
+ "current_a": 12.059545636899294,
+ "case_temperature_c": 11.0
+ }
+ }
+ ],
+ "record_every": 960
+ }
+ },
+ "proof": "74bbb04a7f1ce03d8d60aa42063b094b0e66f03d602d37398911e7486b803eec45399df2c82f1bfb7fdce1ae655c33d4"
+ },
+ "stops": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 1000.0,
+ "state_of_charge": 0.93,
+ "capacity_ah": 4.62,
+ "case_temperature_least_c": 11.0,
+ "case_temperature_most_c": 11.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 960,
+ "load": {
+ "current_a": 12.059617994390187,
+ "case_temperature_c": 11.0
+ }
+ }
+ ],
+ "record_every": 960
+ }
+ },
+ "proof": "3a8d1ae90c4ebcdab0950a9aa2280bbf270ed5acd8fcfecac04daf6c8b9091c28c269d997e47ce4a851c879dfd6de519",
+ "stopped": "UndervoltageLimit"
+ }
+}
+What the models were compared with
+| Model | Against | Specimen | Accuracy against measurement |
|---|
| energy/cell_2170_model3 | compared with measurement | Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. | Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS. |
+Cheat suite
0 cheat attempt(s) scored above 0. 19 vectors applied; 11 do not apply to this kind.
| Vector | Expected | Reward | Graded | Result | Scorer's reason |
|---|
| honest | honest control (1) | 1 | 1.000 | holds | |
| honest_reply_log_matches | honest control (1) | 1 | 1.000 | holds | |
| honest_numbers_respelled | honest control (1) | 1 | 1.000 | holds | |
| no_request_behind | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| edited_call_log | cheat (0) | 0 | 0.000 | holds | the call log beside the reply differs from the harness log |
| over_budget | cheat (0) | 0 | 0.000 | holds | 6 computing calls; the budget is 5 |
| forbidden_tool | cheat (0) | 0 | 0.000 | holds | the log holds calls of find_flip, which the task rules out |
| no_harness_log | cheat (0) | 0 | 0.000 | holds | no harness call log: every attempt is scored with the calls the harness recorded |
| harness_log_edited | cheat (0) | 0 | 0.000 | holds | the harness log's chain breaks at line 2 |
| stale_engine_tag | cheat (0) | 0 | 0.000 | holds | the task was built on engine 0.15.0; the verifier is 0.15.3 |
| copied_proof_other_task | cheat (0) | 0 | 0.000 | holds | the holds seal: the verifier says the seal does not hold (cause run_seal) |
| nudged_figure | cheat (0) | 0 | 0.000 | holds | the stops seal: the verifier says the seal does not hold (cause run_seal) |
| figure_plus_10_percent | cheat (0) | 0 | 0.000 | holds | the stops seal: the verifier says the seal does not hold (cause run_seal) |
| card_request_not_run | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| swapped_sides | cheat (0) | 0 | 0.000 | holds | the holds request comes back refused (UndervoltageLimit) |
| stop_misnamed | cheat (0) | 0 | 0.000 | holds | the card names the stop 'SomeOtherStop'; the verifier names UndervoltageLimit |
| proof_from_other_design | cheat (0) | 0 | 0.000 | holds | the stops seal: the verifier says the seal does not hold (cause run_seal) |
| proof_uppercase | cheat (0) | 0 | 0.000 | holds | the holds seal: the proof is not a SHA-384 seal of 96 hex digits |
| extra_argument | cheat (0) | 0 | 0.000 | holds | the holds request differs from the task's at note |
+Solver runs
+| Agent | Reward | Graded | Computing calls | Scorer's reason |
|---|
| Reference agent | 1 | 1.000 | 2 | |
| One-call agent | 0 | 0.000 | 1 | the holds request comes back refused (UndervoltageLimit) |
+Pass@k by model family
+| Family | Variant | Model | Solved | pass@1 | pass@8 | Mean graded | Harness errors |
|---|
| Frontier model | tool | Frontier model | 3 of 8 | 38% | 100% | 0.721 | 0% |
+Measured calibration: Frontier model, tool variant, n=8.
+Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.
+
+Written 2026-11-14T01:25:21Z.
+
\ No newline at end of file
diff --git a/sample/reports/g1d-budget5-cell1000-current-16min-11c.json b/sample/reports/g1d-budget5-cell1000-current-16min-11c.json
new file mode 100644
index 0000000000000000000000000000000000000000..bddcf702ba1a541bbc419e5c93591530634a2a32
--- /dev/null
+++ b/sample/reports/g1d-budget5-cell1000-current-16min-11c.json
@@ -0,0 +1,345 @@
+{
+ "id": "g1d-budget5-cell1000-current-16min-11c",
+ "family": "budget",
+ "kind": "budgeted_search",
+ "models": [
+ "energy/cell_2170_model3"
+ ],
+ "checksums": {
+ "row_sha256": "27a802ed2a996e11f01de6b1b585c3393e5330dc596cfd9376086b1b5783068b",
+ "row_sha384": "854acd9c04d098001e13f8429c2ea08774db2cdbb92054f12b497c4e5271a19accebeb452ef60474cc1fdb14c6ee51f3",
+ "harbor_dir_sha256": "e16d994186e52ec102270282dc0856b571b5e7424974a810a8e875fa24f93b99",
+ "harbor_dir_sha384": "5a96034530e88c47f26a4bc4013b44f186ef802326456cd7a4a04b745bd307e2b86fb666e92d01f37f6bacd6e1855237"
+ },
+ "instruction": "Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.62 Ah, rested at 93 percent charge with its case at 11 degrees Celsius, is discharged at one constant current for 16 minutes (960 steps of 1 s), its case held at 11 degrees Celsius. Above some current it reaches its lower voltage limit before the 16 minutes are up (UndervoltageLimit). Find that current, in amps.\n\nFind it to five significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.001 percent of the value apart. It lies between 10 and 15 A.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.93, \"capacity_ah\": 4.62, \"case_temperature_least_c\": 11.0, \"case_temperature_most_c\": 11.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 960, \"load\": {\"current_a\": \"\", \"case_temperature_c\": 11.0}}], \"record_every\": 960}}\n\nBudget: at most 5 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"holds\": {\"request\": ..., \"proof\": ...}, \"stops\": {\"request\": ..., \"proof\": ..., \"stopped\": \"\"}}\n\nholds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.",
+ "real_thing": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.",
+ "reference": {
+ "from": "the reference agent's reply (g1d-budget5-cell1000-current-16min-11c.txt)",
+ "card": {
+ "holds": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 1000.0,
+ "state_of_charge": 0.93,
+ "capacity_ah": 4.62,
+ "case_temperature_least_c": 11.0,
+ "case_temperature_most_c": 11.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 960,
+ "load": {
+ "current_a": 12.059545636899294,
+ "case_temperature_c": 11.0
+ }
+ }
+ ],
+ "record_every": 960
+ }
+ },
+ "proof": "74bbb04a7f1ce03d8d60aa42063b094b0e66f03d602d37398911e7486b803eec45399df2c82f1bfb7fdce1ae655c33d4"
+ },
+ "stops": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 1000.0,
+ "state_of_charge": 0.93,
+ "capacity_ah": 4.62,
+ "case_temperature_least_c": 11.0,
+ "case_temperature_most_c": 11.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 960,
+ "load": {
+ "current_a": 12.059617994390187,
+ "case_temperature_c": 11.0
+ }
+ }
+ ],
+ "record_every": 960
+ }
+ },
+ "proof": "3a8d1ae90c4ebcdab0950a9aa2280bbf270ed5acd8fcfecac04daf6c8b9091c28c269d997e47ce4a851c879dfd6de519",
+ "stopped": "UndervoltageLimit"
+ }
+ },
+ "proofs": [
+ {
+ "where": "holds",
+ "tool": "run_trajectory",
+ "proof": "74bbb04a7f1ce03d8d60aa42063b094b0e66f03d602d37398911e7486b803eec45399df2c82f1bfb7fdce1ae655c33d4",
+ "open_address": "verified"
+ },
+ {
+ "where": "stops",
+ "tool": "run_trajectory",
+ "proof": "3a8d1ae90c4ebcdab0950a9aa2280bbf270ed5acd8fcfecac04daf6c8b9091c28c269d997e47ce4a851c879dfd6de519",
+ "open_address": "verified"
+ }
+ ],
+ "open_address_record": true,
+ "engine_tag": "v0.15.3",
+ "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "measurement": [
+ {
+ "model": "energy/cell_2170_model3",
+ "against_measurement": "compared with measurement",
+ "accuracy_against_measurement": "Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.",
+ "specimen": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat.",
+ "error": null
+ }
+ ],
+ "cheat_suite": {
+ "vectors": [
+ {
+ "vector": "honest",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_reply_log_matches",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_numbers_respelled",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "no_request_behind",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "edited_call_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the call log beside the reply differs from the harness log"
+ },
+ {
+ "vector": "over_budget",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "6 computing calls; the budget is 5"
+ },
+ {
+ "vector": "forbidden_tool",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the log holds calls of find_flip, which the task rules out"
+ },
+ {
+ "vector": "no_harness_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "no harness call log: every attempt is scored with the calls the harness recorded"
+ },
+ {
+ "vector": "harness_log_edited",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the harness log's chain breaks at line 2"
+ },
+ {
+ "vector": "stale_engine_tag",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3"
+ },
+ {
+ "vector": "copied_proof_other_task",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the holds seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "nudged_figure",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "figure_plus_10_percent",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "card_request_not_run",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "swapped_sides",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the holds request comes back refused (UndervoltageLimit)"
+ },
+ {
+ "vector": "stop_misnamed",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the card names the stop 'SomeOtherStop'; the verifier names UndervoltageLimit"
+ },
+ {
+ "vector": "proof_from_other_design",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "proof_uppercase",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the holds seal: the proof is not a SHA-384 seal of 96 hex digits"
+ },
+ {
+ "vector": "extra_argument",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the holds request differs from the task's at note"
+ }
+ ],
+ "not_applicable": [
+ {
+ "vector": "binding_misnamed",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "failing_given_as_passing",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "step_misnamed",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "missing_solve",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "solve_handed_other_run",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "every_row_genuine",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "every_row_false",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "every_row_false_true_reasons",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "next_start_rounded",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "next_proof_copied",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "next_request_edited",
+ "why": "not a budget card"
+ }
+ ],
+ "cheats_scoring_above_0": 0,
+ "run": true
+ },
+ "solver_runs": {
+ "reference": {
+ "reward": 1,
+ "graded": 1.0,
+ "correct": 1,
+ "proofs_hold": 1,
+ "computing_calls": 2,
+ "verdict": "pass",
+ "reason": null
+ },
+ "naive": {
+ "reward": 0,
+ "graded": 0.0,
+ "correct": 0,
+ "proofs_hold": 1,
+ "computing_calls": 1,
+ "verdict": "wrong",
+ "reason": "the holds request comes back refused (UndervoltageLimit)"
+ }
+ },
+ "passk": [
+ {
+ "family": "Frontier model",
+ "model": "Frontier model",
+ "variant": "tool",
+ "n": 8,
+ "correct": 3,
+ "pass@1": 0.375,
+ "pass@8": 1.0,
+ "mean_graded": 0.720544375,
+ "harness_error_rate": 0.0
+ }
+ ],
+ "no_tool_question": false,
+ "physics_forensics": false,
+ "blind_baseline": null,
+ "written_utc": "2026-11-14T01:25:21Z"
+}
diff --git a/sample/reports/g1d-limit-cell448-lowest-start-charge-11min-18c.html b/sample/reports/g1d-limit-cell448-lowest-start-charge-11min-18c.html
new file mode 100644
index 0000000000000000000000000000000000000000..85d532a247a7c931807ac528c47c81034c31d5c1
--- /dev/null
+++ b/sample/reports/g1d-limit-cell448-lowest-start-charge-11min-18c.html
@@ -0,0 +1,123 @@
+
+Task report: g1d-limit-cell448-lowest-start-charge-11min-18c
+g1d-limit-cell448-lowest-start-charge-11min-18c
+Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.
+Design to a limit · models energy/cell_2170_model3 · Zero-Trust Physics v0.15.3 · Protocol Company
+Checksums
+| What | sha256 | SHA-384 |
+| Task row | c14366de33841ebf061a628f4a77d478d5832c49eb46f2df20250382cf31c01d | 980a4d2c60b803c9912ecda8dab70ed81dc0d68e0843a39e5fa65f23a50bbdf0f5eb170aa57fc3e08ae52d3752bd87c7 |
+| Harbor directory | 95506cc292eeed642b40850d19fcce34d1a23adc6fb980ebd946b4a890f1225a | f45a67d7a067180916ddc3e8031a2b0dbcd675682dd8f8bf864fa1a68a89b49b07c9d287c4b8c7b267a6272116e637b6 |
+Instruction
Cell m448 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.47 Ah, with its case at 18 degrees Celsius, is rested at a state of charge that you choose and then discharged at 9.6 A for eleven minutes (660 steps of 1 s), its case held at 18 degrees Celsius.
+
+Find the smallest starting state of charge (a fraction of full charge), from 0.25 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 1e-06 apart, and name the constraint that binds.
+
+Constraints (id, what, limit):
+- end_voltage, the cell's terminal voltage at the end of the run, in volts at or above 2.8012 V
+- core_hottest, the hottest the cell's core gets over the run, in degrees Celsius at or below 26.174 degC
+- completes, the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold
+Each design is one run:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": "<your value>", "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}}
+This task has no solve: leave "solve" out of each design.
+
+Budget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": "<constraint id>"}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out "solve" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it, and "step": the last step its run is sealed to (steps_landed), a whole number: {"run": {...}, "stopped": "<name>", "step": <steps_landed>}. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+Reference solution
+From the reference agent's reply (g1d-limit-cell448-lowest-start-charge-11min-18c.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.
+| On the card | Tool | Proof | Open address |
|---|
| passing.run | run_trajectory | 5409934b45e2559467989bb1cf922deb3a8a3c075c638a6bae4a4379cdb10e0e0e099537ca7e24a95f7f0f1f21baf887 | verified |
| failing.run | run_trajectory | baa948ee323f2595cb5a4109e49a1926d9de0ff6fc428024cd6e6d9ca23e6de522a52c96a4f23d40eeabddb7920c2a85 | verified |
+{
+ "passing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 448.0,
+ "state_of_charge": 0.5465612150325692,
+ "capacity_ah": 4.47,
+ "case_temperature_least_c": 18.0,
+ "case_temperature_most_c": 18.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 660,
+ "load": {
+ "current_a": 9.6,
+ "case_temperature_c": 18.0
+ }
+ }
+ ],
+ "record_every": 660
+ }
+ },
+ "proof": "5409934b45e2559467989bb1cf922deb3a8a3c075c638a6bae4a4379cdb10e0e0e099537ca7e24a95f7f0f1f21baf887"
+ }
+ },
+ "failing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 448.0,
+ "state_of_charge": 0.5465606150325693,
+ "capacity_ah": 4.47,
+ "case_temperature_least_c": 18.0,
+ "case_temperature_most_c": 18.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 660,
+ "load": {
+ "current_a": 9.6,
+ "case_temperature_c": 18.0
+ }
+ }
+ ],
+ "record_every": 660
+ }
+ },
+ "proof": "baa948ee323f2595cb5a4109e49a1926d9de0ff6fc428024cd6e6d9ca23e6de522a52c96a4f23d40eeabddb7920c2a85"
+ }
+ },
+ "binding": "core_hottest"
+}
+What the models were compared with
+| Model | Against | Specimen | Accuracy against measurement |
|---|
| energy/cell_2170_model3 | compared with measurement | Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. | Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS. |
+Cheat suite
0 cheat attempt(s) scored above 0. 20 vectors applied; 10 do not apply to this kind.
| Vector | Expected | Reward | Graded | Result | Scorer's reason |
|---|
| honest | honest control (1) | 1 | 1.000 | holds | |
| honest_reply_log_matches | honest control (1) | 1 | 1.000 | holds | |
| honest_numbers_respelled | honest control (1) | 1 | 1.000 | holds | |
| no_request_behind | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| edited_call_log | cheat (0) | 0 | 0.000 | holds | the call log beside the reply differs from the harness log |
| over_budget | cheat (0) | 0 | 0.000 | holds | 5 computing calls; the budget is 4 |
| forbidden_tool | cheat (0) | 0 | 0.000 | holds | the log holds calls of find_flip, which the task rules out |
| no_harness_log | cheat (0) | 0 | 0.000 | holds | no harness call log: every attempt is scored with the calls the harness recorded |
| harness_log_edited | cheat (0) | 0 | 0.000 | holds | the harness log's chain breaks at line 2 |
| stale_engine_tag | cheat (0) | 0 | 0.000 | holds | the task was built on engine 0.15.0; the verifier is 0.15.3 |
| copied_proof_other_task | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| nudged_figure | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| figure_plus_10_percent | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| card_request_not_run | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| swapped_sides | cheat (0) | 0 | 0.000 | holds | the passing design breaks core_hottest |
| binding_misnamed | cheat (0) | 0 | 0.000 | holds | binding names 'end_voltage'; the constraint that binds is another |
| proof_from_other_design | cheat (0) | 0 | 0.000 | holds | the failing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| failing_given_as_passing | cheat (0) | 0 | 0.000 | holds | the passing design breaks core_hottest |
| proof_uppercase | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits |
| extra_argument | cheat (0) | 0 | 0.000 | holds | the passing design's run differs from the task's at note |
+Solver runs
+| Agent | Reward | Graded | Computing calls | Scorer's reason |
|---|
| Reference agent | 1 | 1.000 | 2 | |
| One-call agent | 0 | 0.000 | 1 | the failing design meets every constraint |
+Pass@k by model family
+| Family | Variant | Model | Solved | pass@1 | pass@8 | Mean graded | Harness errors |
|---|
| Frontier model | tool | Frontier model | 2 of 8 | 25% | 100% | 0.507 | 0% |
+Measured calibration: Frontier model, tool variant, n=8.
+Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.
+
+Written 2026-11-14T01:25:21Z.
+
\ No newline at end of file
diff --git a/sample/reports/g1d-limit-cell448-lowest-start-charge-11min-18c.json b/sample/reports/g1d-limit-cell448-lowest-start-charge-11min-18c.json
new file mode 100644
index 0000000000000000000000000000000000000000..1564a9439df42395edbc0bcc2b4bf88f52e21c03
--- /dev/null
+++ b/sample/reports/g1d-limit-cell448-lowest-start-charge-11min-18c.json
@@ -0,0 +1,353 @@
+{
+ "id": "g1d-limit-cell448-lowest-start-charge-11min-18c",
+ "family": "tradeoff",
+ "kind": "design_to_limit",
+ "models": [
+ "energy/cell_2170_model3"
+ ],
+ "checksums": {
+ "row_sha256": "c14366de33841ebf061a628f4a77d478d5832c49eb46f2df20250382cf31c01d",
+ "row_sha384": "980a4d2c60b803c9912ecda8dab70ed81dc0d68e0843a39e5fa65f23a50bbdf0f5eb170aa57fc3e08ae52d3752bd87c7",
+ "harbor_dir_sha256": "95506cc292eeed642b40850d19fcce34d1a23adc6fb980ebd946b4a890f1225a",
+ "harbor_dir_sha384": "f45a67d7a067180916ddc3e8031a2b0dbcd675682dd8f8bf864fa1a68a89b49b07c9d287c4b8c7b267a6272116e637b6"
+ },
+ "instruction": "Cell m448 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.47 Ah, with its case at 18 degrees Celsius, is rested at a state of charge that you choose and then discharged at 9.6 A for eleven minutes (660 steps of 1 s), its case held at 18 degrees Celsius.\n\nFind the smallest starting state of charge (a fraction of full charge), from 0.25 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 1e-06 apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- end_voltage, the cell's terminal voltage at the end of the run, in volts at or above 2.8012 V\n- core_hottest, the hottest the cell's core gets over the run, in degrees Celsius at or below 26.174 degC\n- completes, the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold\nEach design is one run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 448.0, \"state_of_charge\": \"\", \"capacity_ah\": 4.47, \"case_temperature_least_c\": 18.0, \"case_temperature_most_c\": 18.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 660, \"load\": {\"current_a\": 9.6, \"case_temperature_c\": 18.0}}], \"record_every\": 660}}\nThis task has no solve: leave \"solve\" out of each design.\n\nBudget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out \"solve\" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries \"stopped\": the stop's name exactly as the verifier gives it, and \"step\": the last step its run is sealed to (steps_landed), a whole number: {\"run\": {...}, \"stopped\": \"\", \"step\": }. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.",
+ "real_thing": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.",
+ "reference": {
+ "from": "the reference agent's reply (g1d-limit-cell448-lowest-start-charge-11min-18c.txt)",
+ "card": {
+ "passing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 448.0,
+ "state_of_charge": 0.5465612150325692,
+ "capacity_ah": 4.47,
+ "case_temperature_least_c": 18.0,
+ "case_temperature_most_c": 18.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 660,
+ "load": {
+ "current_a": 9.6,
+ "case_temperature_c": 18.0
+ }
+ }
+ ],
+ "record_every": 660
+ }
+ },
+ "proof": "5409934b45e2559467989bb1cf922deb3a8a3c075c638a6bae4a4379cdb10e0e0e099537ca7e24a95f7f0f1f21baf887"
+ }
+ },
+ "failing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 448.0,
+ "state_of_charge": 0.5465606150325693,
+ "capacity_ah": 4.47,
+ "case_temperature_least_c": 18.0,
+ "case_temperature_most_c": 18.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 660,
+ "load": {
+ "current_a": 9.6,
+ "case_temperature_c": 18.0
+ }
+ }
+ ],
+ "record_every": 660
+ }
+ },
+ "proof": "baa948ee323f2595cb5a4109e49a1926d9de0ff6fc428024cd6e6d9ca23e6de522a52c96a4f23d40eeabddb7920c2a85"
+ }
+ },
+ "binding": "core_hottest"
+ },
+ "proofs": [
+ {
+ "where": "passing.run",
+ "tool": "run_trajectory",
+ "proof": "5409934b45e2559467989bb1cf922deb3a8a3c075c638a6bae4a4379cdb10e0e0e099537ca7e24a95f7f0f1f21baf887",
+ "open_address": "verified"
+ },
+ {
+ "where": "failing.run",
+ "tool": "run_trajectory",
+ "proof": "baa948ee323f2595cb5a4109e49a1926d9de0ff6fc428024cd6e6d9ca23e6de522a52c96a4f23d40eeabddb7920c2a85",
+ "open_address": "verified"
+ }
+ ],
+ "open_address_record": true,
+ "engine_tag": "v0.15.3",
+ "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "measurement": [
+ {
+ "model": "energy/cell_2170_model3",
+ "against_measurement": "compared with measurement",
+ "accuracy_against_measurement": "Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.",
+ "specimen": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat.",
+ "error": null
+ }
+ ],
+ "cheat_suite": {
+ "vectors": [
+ {
+ "vector": "honest",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_reply_log_matches",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_numbers_respelled",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "no_request_behind",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "edited_call_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the call log beside the reply differs from the harness log"
+ },
+ {
+ "vector": "over_budget",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "5 computing calls; the budget is 4"
+ },
+ {
+ "vector": "forbidden_tool",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the log holds calls of find_flip, which the task rules out"
+ },
+ {
+ "vector": "no_harness_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "no harness call log: every attempt is scored with the calls the harness recorded"
+ },
+ {
+ "vector": "harness_log_edited",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the harness log's chain breaks at line 2"
+ },
+ {
+ "vector": "stale_engine_tag",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3"
+ },
+ {
+ "vector": "copied_proof_other_task",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "nudged_figure",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "figure_plus_10_percent",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "card_request_not_run",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "swapped_sides",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design breaks core_hottest"
+ },
+ {
+ "vector": "binding_misnamed",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "binding names 'end_voltage'; the constraint that binds is another"
+ },
+ {
+ "vector": "proof_from_other_design",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "failing_given_as_passing",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design breaks core_hottest"
+ },
+ {
+ "vector": "proof_uppercase",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits"
+ },
+ {
+ "vector": "extra_argument",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run differs from the task's at note"
+ }
+ ],
+ "not_applicable": [
+ {
+ "vector": "stop_misnamed",
+ "why": "no stop binds"
+ },
+ {
+ "vector": "step_misnamed",
+ "why": "no stop binds"
+ },
+ {
+ "vector": "missing_solve",
+ "why": "a design of one request"
+ },
+ {
+ "vector": "solve_handed_other_run",
+ "why": "a design of one request"
+ },
+ {
+ "vector": "next_start_rounded",
+ "why": "not a continued design"
+ },
+ {
+ "vector": "next_proof_copied",
+ "why": "not a continued design"
+ },
+ {
+ "vector": "next_request_edited",
+ "why": "not a continued design"
+ },
+ {
+ "vector": "every_row_genuine",
+ "why": "forensics only"
+ },
+ {
+ "vector": "every_row_false",
+ "why": "forensics only"
+ },
+ {
+ "vector": "every_row_false_true_reasons",
+ "why": "forensics only"
+ }
+ ],
+ "cheats_scoring_above_0": 0,
+ "run": true
+ },
+ "solver_runs": {
+ "reference": {
+ "reward": 1,
+ "graded": 1.0,
+ "correct": 1,
+ "proofs_hold": 1,
+ "computing_calls": 2,
+ "verdict": "pass",
+ "reason": null
+ },
+ "naive": {
+ "reward": 0,
+ "graded": 0.0,
+ "correct": 0,
+ "proofs_hold": 1,
+ "computing_calls": 1,
+ "verdict": "wrong",
+ "reason": "the failing design meets every constraint"
+ }
+ },
+ "passk": [
+ {
+ "family": "Frontier model",
+ "model": "Frontier model",
+ "variant": "tool",
+ "n": 8,
+ "correct": 2,
+ "pass@1": 0.25,
+ "pass@8": 1.0,
+ "mean_graded": 0.50718325,
+ "harness_error_rate": 0.0
+ }
+ ],
+ "no_tool_question": false,
+ "physics_forensics": false,
+ "blind_baseline": null,
+ "written_utc": "2026-11-14T01:25:21Z"
+}
diff --git a/sample/reports/g1f-budget4-cell1000-least-capacity-15a-31c.html b/sample/reports/g1f-budget4-cell1000-least-capacity-15a-31c.html
new file mode 100644
index 0000000000000000000000000000000000000000..ee2c0f8627a21e3048f48dcc2c7091ad64c9b6a9
--- /dev/null
+++ b/sample/reports/g1f-budget4-cell1000-least-capacity-15a-31c.html
@@ -0,0 +1,114 @@
+
+Task report: g1f-budget4-cell1000-least-capacity-15a-31c
+g1f-budget4-cell1000-least-capacity-15a-31c
+Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.
+Budgeted search · models energy/cell_2170_model3 · Zero-Trust Physics v0.15.3 · Protocol Company
+Checksums
+| What | sha256 | SHA-384 |
+| Task row | 9f5e4e8b22f19821bf563f3a65a058de097852c24eed892e9aceedf51525e680 | a5e513e8c00de787cde8c34bdd0da9aa4ee64a26085f1f4ddaae68f335d7f9d60a89b4032dae27dccfed46dd88588e65 |
+| Harbor directory | 83321caff349d6ecd808c741eae87aa9b59215a58aad96ae41c277a5cefd49e0 | a418dade8b4693b0de7e833e38d8a15586276e0bdbc8d8948031d44f39c80dae529b0373f427250cb523d3b817303982 |
+Instruction
Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, rested at 88 percent charge with its case at 31 degrees Celsius, is discharged at 15 A for 10 minutes (600 steps of 1 s), its case held at 31 degrees Celsius. Its capacity (capacity_ah) is the one input you change: an aged cell holds less. Below some capacity it reaches its lower voltage limit before the 10 minutes are up (UndervoltageLimit). Find that capacity, in ampere-hours.
+
+Find it to four significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.01 percent of the value apart. It lies between 2.5 and 4.1 Ah.
+
+The request, with <x> the one input you change:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": "<x>", "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}
+
+Budget: at most 4 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"holds": {"request": ..., "proof": ...}, "stops": {"request": ..., "proof": ..., "stopped": "<the stop's name exactly as the verifier gives it>"}}
+
+holds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+Reference solution
+From the reference agent's reply (g1f-budget4-cell1000-least-capacity-15a-31c.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.
+| On the card | Tool | Proof | Open address |
|---|
| holds | run_trajectory | cb1bd559d1d2265454e621416c6f462276b545f87432504b9e4ef59fd7b3dd88fa72d7c68c299fb3d8310399fbece51b | verified |
| stops | run_trajectory | 1380e70918c6bec508ee957298bf797f296ef625ee93de955ffbd69e23bf3d12a48082e658a7d880638373e8ba6c78c2 | verified |
+{
+ "holds": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 1000.0,
+ "state_of_charge": 0.88,
+ "capacity_ah": 3.269752803378649,
+ "case_temperature_least_c": 31.0,
+ "case_temperature_most_c": 31.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 600,
+ "load": {
+ "current_a": 15.0,
+ "case_temperature_c": 31.0
+ }
+ }
+ ],
+ "record_every": 600
+ }
+ },
+ "proof": "cb1bd559d1d2265454e621416c6f462276b545f87432504b9e4ef59fd7b3dd88fa72d7c68c299fb3d8310399fbece51b"
+ },
+ "stops": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 1000.0,
+ "state_of_charge": 0.88,
+ "capacity_ah": 3.269556624095825,
+ "case_temperature_least_c": 31.0,
+ "case_temperature_most_c": 31.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 600,
+ "load": {
+ "current_a": 15.0,
+ "case_temperature_c": 31.0
+ }
+ }
+ ],
+ "record_every": 600
+ }
+ },
+ "proof": "1380e70918c6bec508ee957298bf797f296ef625ee93de955ffbd69e23bf3d12a48082e658a7d880638373e8ba6c78c2",
+ "stopped": "UndervoltageLimit"
+ }
+}
+What the models were compared with
+| Model | Against | Specimen | Accuracy against measurement |
|---|
| energy/cell_2170_model3 | compared with measurement | Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. | Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS. |
+Cheat suite
0 cheat attempt(s) scored above 0. 19 vectors applied; 11 do not apply to this kind.
| Vector | Expected | Reward | Graded | Result | Scorer's reason |
|---|
| honest | honest control (1) | 1 | 1.000 | holds | |
| honest_reply_log_matches | honest control (1) | 1 | 1.000 | holds | |
| honest_numbers_respelled | honest control (1) | 1 | 1.000 | holds | |
| no_request_behind | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| edited_call_log | cheat (0) | 0 | 0.000 | holds | the call log beside the reply differs from the harness log |
| over_budget | cheat (0) | 0 | 0.000 | holds | 5 computing calls; the budget is 4 |
| forbidden_tool | cheat (0) | 0 | 0.000 | holds | the log holds calls of find_flip, which the task rules out |
| no_harness_log | cheat (0) | 0 | 0.000 | holds | no harness call log: every attempt is scored with the calls the harness recorded |
| harness_log_edited | cheat (0) | 0 | 0.000 | holds | the harness log's chain breaks at line 2 |
| stale_engine_tag | cheat (0) | 0 | 0.000 | holds | the task was built on engine 0.15.0; the verifier is 0.15.3 |
| copied_proof_other_task | cheat (0) | 0 | 0.000 | holds | the holds seal: the verifier says the seal does not hold (cause run_seal) |
| nudged_figure | cheat (0) | 0 | 0.000 | holds | the stops seal: the verifier says the seal does not hold (cause run_seal) |
| figure_plus_10_percent | cheat (0) | 0 | 0.000 | holds | the stops seal: the verifier says the seal does not hold (cause run_seal) |
| card_request_not_run | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| swapped_sides | cheat (0) | 0 | 0.000 | holds | the holds request comes back refused (UndervoltageLimit) |
| stop_misnamed | cheat (0) | 0 | 0.000 | holds | the card names the stop 'SomeOtherStop'; the verifier names UndervoltageLimit |
| proof_from_other_design | cheat (0) | 0 | 0.000 | holds | the stops seal: the verifier says the seal does not hold (cause run_seal) |
| proof_uppercase | cheat (0) | 0 | 0.000 | holds | the holds seal: the proof is not a SHA-384 seal of 96 hex digits |
| extra_argument | cheat (0) | 0 | 0.000 | holds | the holds request differs from the task's at note |
+Solver runs
+| Agent | Reward | Graded | Computing calls | Scorer's reason |
|---|
| Reference agent | 1 | 1.000 | 2 | |
| One-call agent | 0 | 0.000 | 1 | the stops request comes back completed (None), not the stop UndervoltageLimit |
+Pass@k by model family
+| Family | Variant | Model | Solved | pass@1 | pass@8 | Mean graded | Harness errors |
|---|
| Frontier model | tool | Frontier model | 1 of 8 | 12% | 100% | 0.468 | 0% |
+Measured calibration: Frontier model, tool variant, n=8.
+Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.
+
+Written 2026-11-14T01:25:21Z.
+
\ No newline at end of file
diff --git a/sample/reports/g1f-budget4-cell1000-least-capacity-15a-31c.json b/sample/reports/g1f-budget4-cell1000-least-capacity-15a-31c.json
new file mode 100644
index 0000000000000000000000000000000000000000..566d253fad0e19c7f18b0dd140930b6c1ffdcf91
--- /dev/null
+++ b/sample/reports/g1f-budget4-cell1000-least-capacity-15a-31c.json
@@ -0,0 +1,345 @@
+{
+ "id": "g1f-budget4-cell1000-least-capacity-15a-31c",
+ "family": "budget",
+ "kind": "budgeted_search",
+ "models": [
+ "energy/cell_2170_model3"
+ ],
+ "checksums": {
+ "row_sha256": "9f5e4e8b22f19821bf563f3a65a058de097852c24eed892e9aceedf51525e680",
+ "row_sha384": "a5e513e8c00de787cde8c34bdd0da9aa4ee64a26085f1f4ddaae68f335d7f9d60a89b4032dae27dccfed46dd88588e65",
+ "harbor_dir_sha256": "83321caff349d6ecd808c741eae87aa9b59215a58aad96ae41c277a5cefd49e0",
+ "harbor_dir_sha384": "a418dade8b4693b0de7e833e38d8a15586276e0bdbc8d8948031d44f39c80dae529b0373f427250cb523d3b817303982"
+ },
+ "instruction": "Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, rested at 88 percent charge with its case at 31 degrees Celsius, is discharged at 15 A for 10 minutes (600 steps of 1 s), its case held at 31 degrees Celsius. Its capacity (capacity_ah) is the one input you change: an aged cell holds less. Below some capacity it reaches its lower voltage limit before the 10 minutes are up (UndervoltageLimit). Find that capacity, in ampere-hours.\n\nFind it to four significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.01 percent of the value apart. It lies between 2.5 and 4.1 Ah.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.88, \"capacity_ah\": \"\", \"case_temperature_least_c\": 31.0, \"case_temperature_most_c\": 31.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 600, \"load\": {\"current_a\": 15.0, \"case_temperature_c\": 31.0}}], \"record_every\": 600}}\n\nBudget: at most 4 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"holds\": {\"request\": ..., \"proof\": ...}, \"stops\": {\"request\": ..., \"proof\": ..., \"stopped\": \"\"}}\n\nholds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.",
+ "real_thing": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.",
+ "reference": {
+ "from": "the reference agent's reply (g1f-budget4-cell1000-least-capacity-15a-31c.txt)",
+ "card": {
+ "holds": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 1000.0,
+ "state_of_charge": 0.88,
+ "capacity_ah": 3.269752803378649,
+ "case_temperature_least_c": 31.0,
+ "case_temperature_most_c": 31.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 600,
+ "load": {
+ "current_a": 15.0,
+ "case_temperature_c": 31.0
+ }
+ }
+ ],
+ "record_every": 600
+ }
+ },
+ "proof": "cb1bd559d1d2265454e621416c6f462276b545f87432504b9e4ef59fd7b3dd88fa72d7c68c299fb3d8310399fbece51b"
+ },
+ "stops": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_2170_model3",
+ "initial": {
+ "cell_number": 1000.0,
+ "state_of_charge": 0.88,
+ "capacity_ah": 3.269556624095825,
+ "case_temperature_least_c": 31.0,
+ "case_temperature_most_c": 31.0
+ },
+ "dt_s": 1.0,
+ "segments": [
+ {
+ "steps": 600,
+ "load": {
+ "current_a": 15.0,
+ "case_temperature_c": 31.0
+ }
+ }
+ ],
+ "record_every": 600
+ }
+ },
+ "proof": "1380e70918c6bec508ee957298bf797f296ef625ee93de955ffbd69e23bf3d12a48082e658a7d880638373e8ba6c78c2",
+ "stopped": "UndervoltageLimit"
+ }
+ },
+ "proofs": [
+ {
+ "where": "holds",
+ "tool": "run_trajectory",
+ "proof": "cb1bd559d1d2265454e621416c6f462276b545f87432504b9e4ef59fd7b3dd88fa72d7c68c299fb3d8310399fbece51b",
+ "open_address": "verified"
+ },
+ {
+ "where": "stops",
+ "tool": "run_trajectory",
+ "proof": "1380e70918c6bec508ee957298bf797f296ef625ee93de955ffbd69e23bf3d12a48082e658a7d880638373e8ba6c78c2",
+ "open_address": "verified"
+ }
+ ],
+ "open_address_record": true,
+ "engine_tag": "v0.15.3",
+ "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "measurement": [
+ {
+ "model": "energy/cell_2170_model3",
+ "against_measurement": "compared with measurement",
+ "accuracy_against_measurement": "Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.",
+ "specimen": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat.",
+ "error": null
+ }
+ ],
+ "cheat_suite": {
+ "vectors": [
+ {
+ "vector": "honest",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_reply_log_matches",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_numbers_respelled",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "no_request_behind",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "edited_call_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the call log beside the reply differs from the harness log"
+ },
+ {
+ "vector": "over_budget",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "5 computing calls; the budget is 4"
+ },
+ {
+ "vector": "forbidden_tool",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the log holds calls of find_flip, which the task rules out"
+ },
+ {
+ "vector": "no_harness_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "no harness call log: every attempt is scored with the calls the harness recorded"
+ },
+ {
+ "vector": "harness_log_edited",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the harness log's chain breaks at line 2"
+ },
+ {
+ "vector": "stale_engine_tag",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3"
+ },
+ {
+ "vector": "copied_proof_other_task",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the holds seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "nudged_figure",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "figure_plus_10_percent",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "card_request_not_run",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "swapped_sides",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the holds request comes back refused (UndervoltageLimit)"
+ },
+ {
+ "vector": "stop_misnamed",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the card names the stop 'SomeOtherStop'; the verifier names UndervoltageLimit"
+ },
+ {
+ "vector": "proof_from_other_design",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "proof_uppercase",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the holds seal: the proof is not a SHA-384 seal of 96 hex digits"
+ },
+ {
+ "vector": "extra_argument",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the holds request differs from the task's at note"
+ }
+ ],
+ "not_applicable": [
+ {
+ "vector": "binding_misnamed",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "failing_given_as_passing",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "step_misnamed",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "missing_solve",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "solve_handed_other_run",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "every_row_genuine",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "every_row_false",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "every_row_false_true_reasons",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "next_start_rounded",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "next_proof_copied",
+ "why": "not a budget card"
+ },
+ {
+ "vector": "next_request_edited",
+ "why": "not a budget card"
+ }
+ ],
+ "cheats_scoring_above_0": 0,
+ "run": true
+ },
+ "solver_runs": {
+ "reference": {
+ "reward": 1,
+ "graded": 1.0,
+ "correct": 1,
+ "proofs_hold": 1,
+ "computing_calls": 2,
+ "verdict": "pass",
+ "reason": null
+ },
+ "naive": {
+ "reward": 0,
+ "graded": 0.0,
+ "correct": 0,
+ "proofs_hold": 1,
+ "computing_calls": 1,
+ "verdict": "wrong",
+ "reason": "the stops request comes back completed (None), not the stop UndervoltageLimit"
+ }
+ },
+ "passk": [
+ {
+ "family": "Frontier model",
+ "model": "Frontier model",
+ "variant": "tool",
+ "n": 8,
+ "correct": 1,
+ "pass@1": 0.125,
+ "pass@8": 1.0,
+ "mean_graded": 0.46834175,
+ "harness_error_rate": 0.0
+ }
+ ],
+ "no_tool_question": false,
+ "physics_forensics": false,
+ "blind_baseline": null,
+ "written_utc": "2026-11-14T01:25:21Z"
+}
diff --git a/sample/reports/g1f-chain-runaway-new-soak-then-warm-room.html b/sample/reports/g1f-chain-runaway-new-soak-then-warm-room.html
new file mode 100644
index 0000000000000000000000000000000000000000..7a9cdffc93b07a0a3e4a8f69c18b60f3a2aad295
--- /dev/null
+++ b/sample/reports/g1f-chain-runaway-new-soak-then-warm-room.html
@@ -0,0 +1,248 @@
+
+Task report: g1f-chain-runaway-new-soak-then-warm-room
+g1f-chain-runaway-new-soak-then-warm-room
+Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.
+Chained design · models energy/runaway_18650_lco · Zero-Trust Physics v0.15.3 · Protocol Company
+Checksums
+| What | sha256 | SHA-384 |
+| Task row | e06442b8196bb20965f68cbb36cf3dfa8505592a608503500c628ead2e76f6aa | 04845b45c68ad35124f996c98a5ecec71016e1df9a22e8641fb092273632906176c51006f4a4e78cdabfc8ee8ae8db20 |
+| Harbor directory | 118cbf61ceb17e81769843685f703ae86d6f5d1eb26ec3fd6ec9fea82fad11a5 | d90fec9588d7c275f04b909f17b2c7186279a68ed02ead05c62cdde024467c3477f0e3ec22f345ea88e66781926f4a06 |
+Instruction
One LiCoO2 18650 cell starts at 297.15 K with 12 percent of its SEI layer, 78 percent of its anode lithium, 97 percent of its cathode unreacted, its electrolyte, separator and vent gas whole. It soaks in an oven held at one temperature that you choose for 3200 s (320 steps of 10 s), with no heater, not adiabatic. That run is then continued (from) with the oven at 305.15 K for 3600 s (360 steps of 10 s).
+
+Find the largest oven temperature of the first run, in kelvin, from 395 to 470 K, for which every constraint below holds. Give the passing design and the first failing design, no more than 0.0009 K apart, and name the constraint that binds.
+
+Constraints (id, what, limit):
+- next_cell_peak, the hottest the cell gets over the next run, in kelvin at or below 432.27 K
+- next_vent_held, the fraction of the cell's vent gas still held at the end of the next run (1 before it vents) at or above 0.5974
+Each design is two runs of runaway_18650_lco. The first run, which must complete:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": "<your value>", "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}}
+Then the next run, which continues that sealed first run: its initial state is the first run's answer, value for value and bit for bit, and its from names the first run's request and seal:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": "<the first run's final_state.temperature_k>", "sei_fraction": "<the first run's final_state.sei_fraction>", "anode_lithium_fraction": "<the first run's final_state.anode_lithium_fraction>", "cathode_unreacted_fraction": "<the first run's final_state.cathode_unreacted_fraction>", "electrolyte_fraction": "<the first run's final_state.electrolyte_fraction>", "separator_unmelted_fraction": "<the first run's final_state.separator_unmelted_fraction>", "vent_gas_held_fraction": "<the first run's final_state.vent_gas_held_fraction>"}, "dt_s": 10.0, "segments": [{"steps": 360, "load": {"oven_temperature_k": 305.15, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 360, "from": {"request": "<the first run's request>", "run_seal": "<the first run's run_seal>"}}}
+Constraints whose id begins next_ are read from the next run; the others from the first run. This task has no solve.
+
+Budget: at most 5 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "binding": "<constraint id>"}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Each design is two runs: "run" is the first run, and "next" is the run that continues that same sealed run, with "from": {"request": <the first run's request>, "run_seal": <its proof>} and its initial state equal to the first run's final_state, value for value, bit for bit. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+Reference solution
+From the reference agent's reply (g1f-chain-runaway-new-soak-then-warm-room.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.
+| On the card | Tool | Proof | Open address |
|---|
| passing.run | run_trajectory | b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa | verified |
| passing.next | run_trajectory | 8175ff4962768bd8d6a42a515e6b98bc343970061dc2707bc0758ffa1964977faa0adefb2a4ffa4fc6e773a82c8505b5 | verified |
| failing.run | run_trajectory | bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654 | verified |
| failing.next | run_trajectory | ac93a947646639614fa1397fde5373b92630d0562b5120cec430733c7e5a04cfdaf799566a4f202fc8d4656cc1636bc7 | verified |
+{
+ "passing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 297.15,
+ "sei_fraction": 0.12,
+ "anode_lithium_fraction": 0.78,
+ "cathode_unreacted_fraction": 0.97,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 320,
+ "load": {
+ "oven_temperature_k": 425.5106548116787,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 320
+ }
+ },
+ "proof": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"
+ },
+ "next": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 430.4672291538255,
+ "sei_fraction": 0.09625617043171643,
+ "anode_lithium_fraction": 0.7574684863929316,
+ "cathode_unreacted_fraction": 0.9202519687560146,
+ "electrolyte_fraction": 0.9999645125616834,
+ "separator_unmelted_fraction": 0.0,
+ "vent_gas_held_fraction": 0.60031241106013
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 360,
+ "load": {
+ "oven_temperature_k": 305.15,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 360,
+ "from": {
+ "request": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 297.15,
+ "sei_fraction": 0.12,
+ "anode_lithium_fraction": 0.78,
+ "cathode_unreacted_fraction": 0.97,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 320,
+ "load": {
+ "oven_temperature_k": 425.5106548116787,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 320
+ },
+ "run_seal": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"
+ }
+ }
+ },
+ "proof": "8175ff4962768bd8d6a42a515e6b98bc343970061dc2707bc0758ffa1964977faa0adefb2a4ffa4fc6e773a82c8505b5"
+ }
+ },
+ "failing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 297.15,
+ "sei_fraction": 0.12,
+ "anode_lithium_fraction": 0.78,
+ "cathode_unreacted_fraction": 0.97,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 320,
+ "load": {
+ "oven_temperature_k": 425.5111948116787,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 320
+ }
+ },
+ "proof": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"
+ },
+ "next": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 430.468235992056,
+ "sei_fraction": 0.09625468529952468,
+ "anode_lithium_fraction": 0.7574672979619945,
+ "cathode_unreacted_fraction": 0.9202464921736476,
+ "electrolyte_fraction": 0.9999645073667627,
+ "separator_unmelted_fraction": 0.0,
+ "vent_gas_held_fraction": 0.6000340833497131
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 360,
+ "load": {
+ "oven_temperature_k": 305.15,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 360,
+ "from": {
+ "request": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 297.15,
+ "sei_fraction": 0.12,
+ "anode_lithium_fraction": 0.78,
+ "cathode_unreacted_fraction": 0.97,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 320,
+ "load": {
+ "oven_temperature_k": 425.5111948116787,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 320
+ },
+ "run_seal": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"
+ }
+ }
+ },
+ "proof": "ac93a947646639614fa1397fde5373b92630d0562b5120cec430733c7e5a04cfdaf799566a4f202fc8d4656cc1636bc7"
+ }
+ },
+ "binding": "next_vent_held"
+}
+What the models were compared with
+| Model | Against | Specimen | Accuracy against measurement |
|---|
| energy/runaway_18650_lco | compared with measurement | Thermal runaway of one LiCoO2 18650 cell in an oven, under a heater or in an adiabatic calorimeter: the four Hatchard-Kim stages, a separator melt at 130 degC and a vent at 160 degC, one heat capacity, oven loss and an energy ledger. | Compared with each record left out of the fit in turn, the constants refitted on the other 12: onsets within 16.2 K RMS on 10 records (9.8 on the eight reprinted cells), peaks within 51.7 K RMS on 7, Hatchard's 155 degC oven running away at 64.8 min against 51.1; in the fit 13.5 K, 51.1 K and 62.0 min, and 17 of the records' 23 comparisons within their targets. Gap: at 150 degC the card runs away at 109.7 min where Hatchard's cell did not in 120; Golubkov's cell peaks 115 K higher (853 degC); Mendoza-Hernandez's self-heats 30 K lower (100.0 degC); Lu's peaked at 370 degC against 705. |
+Cheat suite
0 cheat attempt(s) scored above 0. 25 vectors applied; 5 do not apply to this kind.
| Vector | Expected | Reward | Graded | Result | Scorer's reason |
|---|
| honest | honest control (1) | 1 | 1.000 | holds | |
| honest_reply_log_matches | honest control (1) | 1 | 1.000 | holds | |
| honest_numbers_respelled | honest control (1) | 1 | 1.000 | holds | |
| no_request_behind | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| edited_call_log | cheat (0) | 0 | 0.000 | holds | the call log beside the reply differs from the harness log |
| over_budget | cheat (0) | 0 | 0.000 | holds | 6 computing calls; the budget is 5 |
| forbidden_tool | cheat (0) | 0 | 0.000 | holds | the log holds calls of find_flip, which the task rules out |
| no_harness_log | cheat (0) | 0 | 0.000 | holds | no harness call log: every attempt is scored with the calls the harness recorded |
| harness_log_edited | cheat (0) | 0 | 0.000 | holds | the harness log's chain breaks at line 4 |
| stale_engine_tag | cheat (0) | 0 | 0.000 | holds | the task was built on engine 0.15.0; the verifier is 0.15.3 |
| copied_proof_other_task | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| nudged_figure | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| figure_plus_10_percent | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| card_request_not_run | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| swapped_sides | cheat (0) | 0 | 0.000 | holds | the passing design breaks next_vent_held |
| binding_misnamed | cheat (0) | 0 | 0.000 | holds | binding names 'next_cell_peak'; the constraint that binds is another |
| proof_from_other_design | cheat (0) | 0 | 0.000 | holds | the failing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| failing_given_as_passing | cheat (0) | 0 | 0.000 | holds | the passing design breaks next_vent_held |
| proof_uppercase | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits |
| extra_argument | cheat (0) | 0 | 0.000 | holds | the passing design's run differs from the task's at note |
| missing_solve | cheat (0) | 0 | 0.000 | holds | the passing design's next run is missing |
| solve_handed_other_run | cheat (0) | 0 | 0.000 | holds | the passing design's next run does not continue the design's own sealed run (from) |
| next_start_rounded | cheat (0) | 0 | 0.000 | holds | the failing design's next run does not start from its run's final_state.temperature_k, bit for bit |
| next_proof_copied | cheat (0) | 0 | 0.000 | holds | the failing design's next run_seal: the verifier says the seal does not hold (cause run_seal) |
| next_request_edited | cheat (0) | 0 | 0.000 | holds | the failing design's next run differs from the task's at segments[0].steps |
+Solver runs
+| Agent | Reward | Graded | Computing calls | Scorer's reason |
|---|
| Reference agent | 1 | 1.000 | 4 | |
| One-call agent | 0 | 0.000 | 1 | the passing design's next run is missing |
+Pass@k by model family
+| Family | Variant | Model | Solved | pass@1 | pass@8 | Mean graded | Harness errors |
|---|
| Frontier model | tool | Frontier model | 2 of 8 | 25% | 100% | 0.555 | 0% |
+Measured calibration: Frontier model, tool variant, n=8.
+Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.
+
+Written 2026-11-14T01:25:21Z.
+
\ No newline at end of file
diff --git a/sample/reports/g1f-chain-runaway-new-soak-then-warm-room.json b/sample/reports/g1f-chain-runaway-new-soak-then-warm-room.json
new file mode 100644
index 0000000000000000000000000000000000000000..28cefad9eaf41cbd6bf2a4f8d3451eedab6697d9
--- /dev/null
+++ b/sample/reports/g1f-chain-runaway-new-soak-then-warm-room.json
@@ -0,0 +1,509 @@
+{
+ "id": "g1f-chain-runaway-new-soak-then-warm-room",
+ "family": "chain_design",
+ "kind": "chained_design",
+ "models": [
+ "energy/runaway_18650_lco"
+ ],
+ "checksums": {
+ "row_sha256": "e06442b8196bb20965f68cbb36cf3dfa8505592a608503500c628ead2e76f6aa",
+ "row_sha384": "04845b45c68ad35124f996c98a5ecec71016e1df9a22e8641fb092273632906176c51006f4a4e78cdabfc8ee8ae8db20",
+ "harbor_dir_sha256": "118cbf61ceb17e81769843685f703ae86d6f5d1eb26ec3fd6ec9fea82fad11a5",
+ "harbor_dir_sha384": "d90fec9588d7c275f04b909f17b2c7186279a68ed02ead05c62cdde024467c3477f0e3ec22f345ea88e66781926f4a06"
+ },
+ "instruction": "One LiCoO2 18650 cell starts at 297.15 K with 12 percent of its SEI layer, 78 percent of its anode lithium, 97 percent of its cathode unreacted, its electrolyte, separator and vent gas whole. It soaks in an oven held at one temperature that you choose for 3200 s (320 steps of 10 s), with no heater, not adiabatic. That run is then continued (from) with the oven at 305.15 K for 3600 s (360 steps of 10 s).\n\nFind the largest oven temperature of the first run, in kelvin, from 395 to 470 K, for which every constraint below holds. Give the passing design and the first failing design, no more than 0.0009 K apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- next_cell_peak, the hottest the cell gets over the next run, in kelvin at or below 432.27 K\n- next_vent_held, the fraction of the cell's vent gas still held at the end of the next run (1 before it vents) at or above 0.5974\nEach design is two runs of runaway_18650_lco. The first run, which must complete:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"runaway_18650_lco\", \"initial\": {\"temperature_k\": 297.15, \"sei_fraction\": 0.12, \"anode_lithium_fraction\": 0.78, \"cathode_unreacted_fraction\": 0.97, \"electrolyte_fraction\": 1.0, \"separator_unmelted_fraction\": 1.0, \"vent_gas_held_fraction\": 1.0}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 320, \"load\": {\"oven_temperature_k\": \"\", \"heater_power_w\": 0.0, \"adiabatic\": 0.0}}], \"record_every\": 320}}\nThen the next run, which continues that sealed first run: its initial state is the first run's answer, value for value and bit for bit, and its from names the first run's request and seal:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"runaway_18650_lco\", \"initial\": {\"temperature_k\": \"\", \"sei_fraction\": \"\", \"anode_lithium_fraction\": \"\", \"cathode_unreacted_fraction\": \"\", \"electrolyte_fraction\": \"\", \"separator_unmelted_fraction\": \"\", \"vent_gas_held_fraction\": \"\"}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 360, \"load\": {\"oven_temperature_k\": 305.15, \"heater_power_w\": 0.0, \"adiabatic\": 0.0}}], \"record_every\": 360, \"from\": {\"request\": \"\", \"run_seal\": \"\"}}}\nConstraints whose id begins next_ are read from the next run; the others from the first run. This task has no solve.\n\nBudget: at most 5 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"next\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"next\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Each design is two runs: \"run\" is the first run, and \"next\" is the run that continues that same sealed run, with \"from\": {\"request\": , \"run_seal\": } and its initial state equal to the first run's final_state, value for value, bit for bit. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.",
+ "real_thing": "Thermal runaway of one LiCoO2 18650 cell in an oven, under a heater or in an adiabatic calorimeter: the four Hatchard-Kim stages, a separator melt at 130 degC and a vent at 160 degC, one heat capacity, oven loss and an energy ledger. Compared with each record left out of the fit in turn, the constants refitted on the other 12: onsets within 16.2 K RMS on 10 records (9.8 on the eight reprinted cells), peaks within 51.7 K RMS on 7, Hatchard's 155 degC oven running away at 64.8 min against 51.1; in the fit 13.5 K, 51.1 K and 62.0 min, and 17 of the records' 23 comparisons within their targets. Gap: at 150 degC the card runs away at 109.7 min where Hatchard's cell did not in 120; Golubkov's cell peaks 115 K higher (853 degC); Mendoza-Hernandez's self-heats 30 K lower (100.0 degC); Lu's peaked at 370 degC against 705.",
+ "reference": {
+ "from": "the reference agent's reply (g1f-chain-runaway-new-soak-then-warm-room.txt)",
+ "card": {
+ "passing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 297.15,
+ "sei_fraction": 0.12,
+ "anode_lithium_fraction": 0.78,
+ "cathode_unreacted_fraction": 0.97,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 320,
+ "load": {
+ "oven_temperature_k": 425.5106548116787,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 320
+ }
+ },
+ "proof": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"
+ },
+ "next": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 430.4672291538255,
+ "sei_fraction": 0.09625617043171643,
+ "anode_lithium_fraction": 0.7574684863929316,
+ "cathode_unreacted_fraction": 0.9202519687560146,
+ "electrolyte_fraction": 0.9999645125616834,
+ "separator_unmelted_fraction": 0.0,
+ "vent_gas_held_fraction": 0.60031241106013
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 360,
+ "load": {
+ "oven_temperature_k": 305.15,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 360,
+ "from": {
+ "request": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 297.15,
+ "sei_fraction": 0.12,
+ "anode_lithium_fraction": 0.78,
+ "cathode_unreacted_fraction": 0.97,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 320,
+ "load": {
+ "oven_temperature_k": 425.5106548116787,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 320
+ },
+ "run_seal": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"
+ }
+ }
+ },
+ "proof": "8175ff4962768bd8d6a42a515e6b98bc343970061dc2707bc0758ffa1964977faa0adefb2a4ffa4fc6e773a82c8505b5"
+ }
+ },
+ "failing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 297.15,
+ "sei_fraction": 0.12,
+ "anode_lithium_fraction": 0.78,
+ "cathode_unreacted_fraction": 0.97,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 320,
+ "load": {
+ "oven_temperature_k": 425.5111948116787,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 320
+ }
+ },
+ "proof": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"
+ },
+ "next": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 430.468235992056,
+ "sei_fraction": 0.09625468529952468,
+ "anode_lithium_fraction": 0.7574672979619945,
+ "cathode_unreacted_fraction": 0.9202464921736476,
+ "electrolyte_fraction": 0.9999645073667627,
+ "separator_unmelted_fraction": 0.0,
+ "vent_gas_held_fraction": 0.6000340833497131
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 360,
+ "load": {
+ "oven_temperature_k": 305.15,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 360,
+ "from": {
+ "request": {
+ "domain": "energy",
+ "card": "runaway_18650_lco",
+ "initial": {
+ "temperature_k": 297.15,
+ "sei_fraction": 0.12,
+ "anode_lithium_fraction": 0.78,
+ "cathode_unreacted_fraction": 0.97,
+ "electrolyte_fraction": 1.0,
+ "separator_unmelted_fraction": 1.0,
+ "vent_gas_held_fraction": 1.0
+ },
+ "dt_s": 10.0,
+ "segments": [
+ {
+ "steps": 320,
+ "load": {
+ "oven_temperature_k": 425.5111948116787,
+ "heater_power_w": 0.0,
+ "adiabatic": 0.0
+ }
+ }
+ ],
+ "record_every": 320
+ },
+ "run_seal": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"
+ }
+ }
+ },
+ "proof": "ac93a947646639614fa1397fde5373b92630d0562b5120cec430733c7e5a04cfdaf799566a4f202fc8d4656cc1636bc7"
+ }
+ },
+ "binding": "next_vent_held"
+ },
+ "proofs": [
+ {
+ "where": "passing.run",
+ "tool": "run_trajectory",
+ "proof": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa",
+ "open_address": "verified"
+ },
+ {
+ "where": "passing.next",
+ "tool": "run_trajectory",
+ "proof": "8175ff4962768bd8d6a42a515e6b98bc343970061dc2707bc0758ffa1964977faa0adefb2a4ffa4fc6e773a82c8505b5",
+ "open_address": "verified"
+ },
+ {
+ "where": "failing.run",
+ "tool": "run_trajectory",
+ "proof": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654",
+ "open_address": "verified"
+ },
+ {
+ "where": "failing.next",
+ "tool": "run_trajectory",
+ "proof": "ac93a947646639614fa1397fde5373b92630d0562b5120cec430733c7e5a04cfdaf799566a4f202fc8d4656cc1636bc7",
+ "open_address": "verified"
+ }
+ ],
+ "open_address_record": true,
+ "engine_tag": "v0.15.3",
+ "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "measurement": [
+ {
+ "model": "energy/runaway_18650_lco",
+ "against_measurement": "compared with measurement",
+ "accuracy_against_measurement": "Compared with each record left out of the fit in turn, the constants refitted on the other 12: onsets within 16.2 K RMS on 10 records (9.8 on the eight reprinted cells), peaks within 51.7 K RMS on 7, Hatchard's 155 degC oven running away at 64.8 min against 51.1; in the fit 13.5 K, 51.1 K and 62.0 min, and 17 of the records' 23 comparisons within their targets. Gap: at 150 degC the card runs away at 109.7 min where Hatchard's cell did not in 120; Golubkov's cell peaks 115 K higher (853 degC); Mendoza-Hernandez's self-heats 30 K lower (100.0 degC); Lu's peaked at 370 degC against 705.",
+ "specimen": "Thermal runaway of one LiCoO2 18650 cell in an oven, under a heater or in an adiabatic calorimeter: the four Hatchard-Kim stages, a separator melt at 130 degC and a vent at 160 degC, one heat capacity, oven loss and an energy ledger.",
+ "error": null
+ }
+ ],
+ "cheat_suite": {
+ "vectors": [
+ {
+ "vector": "honest",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_reply_log_matches",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_numbers_respelled",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "no_request_behind",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "edited_call_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the call log beside the reply differs from the harness log"
+ },
+ {
+ "vector": "over_budget",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "6 computing calls; the budget is 5"
+ },
+ {
+ "vector": "forbidden_tool",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the log holds calls of find_flip, which the task rules out"
+ },
+ {
+ "vector": "no_harness_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "no harness call log: every attempt is scored with the calls the harness recorded"
+ },
+ {
+ "vector": "harness_log_edited",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the harness log's chain breaks at line 4"
+ },
+ {
+ "vector": "stale_engine_tag",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3"
+ },
+ {
+ "vector": "copied_proof_other_task",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "nudged_figure",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "figure_plus_10_percent",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "card_request_not_run",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "swapped_sides",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design breaks next_vent_held"
+ },
+ {
+ "vector": "binding_misnamed",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "binding names 'next_cell_peak'; the constraint that binds is another"
+ },
+ {
+ "vector": "proof_from_other_design",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "failing_given_as_passing",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design breaks next_vent_held"
+ },
+ {
+ "vector": "proof_uppercase",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits"
+ },
+ {
+ "vector": "extra_argument",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run differs from the task's at note"
+ },
+ {
+ "vector": "missing_solve",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's next run is missing"
+ },
+ {
+ "vector": "solve_handed_other_run",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's next run does not continue the design's own sealed run (from)"
+ },
+ {
+ "vector": "next_start_rounded",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the failing design's next run does not start from its run's final_state.temperature_k, bit for bit"
+ },
+ {
+ "vector": "next_proof_copied",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the failing design's next run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "next_request_edited",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the failing design's next run differs from the task's at segments[0].steps"
+ }
+ ],
+ "not_applicable": [
+ {
+ "vector": "stop_misnamed",
+ "why": "no stop binds"
+ },
+ {
+ "vector": "step_misnamed",
+ "why": "no stop binds"
+ },
+ {
+ "vector": "every_row_genuine",
+ "why": "forensics only"
+ },
+ {
+ "vector": "every_row_false",
+ "why": "forensics only"
+ },
+ {
+ "vector": "every_row_false_true_reasons",
+ "why": "forensics only"
+ }
+ ],
+ "cheats_scoring_above_0": 0,
+ "run": true
+ },
+ "solver_runs": {
+ "reference": {
+ "reward": 1,
+ "graded": 1.0,
+ "correct": 1,
+ "proofs_hold": 1,
+ "computing_calls": 4,
+ "verdict": "pass",
+ "reason": null
+ },
+ "naive": {
+ "reward": 0,
+ "graded": 0.0,
+ "correct": 0,
+ "proofs_hold": 1,
+ "computing_calls": 1,
+ "verdict": "integrity",
+ "reason": "the passing design's next run is missing"
+ }
+ },
+ "passk": [
+ {
+ "family": "Frontier model",
+ "model": "Frontier model",
+ "variant": "tool",
+ "n": 8,
+ "correct": 2,
+ "pass@1": 0.25,
+ "pass@8": 1.0,
+ "mean_graded": 0.5550174999999999,
+ "harness_error_rate": 0.0
+ }
+ ],
+ "no_tool_question": false,
+ "physics_forensics": false,
+ "blind_baseline": null,
+ "written_utc": "2026-11-14T01:25:21Z"
+}
diff --git a/sample/reports/g1f-limit-18650pf-lowest-start-charge-2a7-27min.html b/sample/reports/g1f-limit-18650pf-lowest-start-charge-2a7-27min.html
new file mode 100644
index 0000000000000000000000000000000000000000..0639c241493594b175fca4a7e4d9942bb8d0324d
--- /dev/null
+++ b/sample/reports/g1f-limit-18650pf-lowest-start-charge-2a7-27min.html
@@ -0,0 +1,114 @@
+
+Task report: g1f-limit-18650pf-lowest-start-charge-2a7-27min
+g1f-limit-18650pf-lowest-start-charge-2a7-27min
+Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.
+Design to a limit · models energy/cell_18650pf · Zero-Trust Physics v0.15.3 · Protocol Company
+Checksums
+| What | sha256 | SHA-384 |
+| Task row | 678f4595b6cf3ab321c0ace0d1dd7ed9815ba98a936e3a7d5c3ce4705d4d1f01 | e6eaf64a13585c675fe8d23030cad93ff8b83ac15f281928dfa101df6e9a342da71726f9e75b9090b2895799e701afac |
+| Harbor directory | d401712e8d75a01d721d449929864758f023cc90bed37ad6989134fc695c4f27 | b413ceefd206823d317607bca24c07b4c34720320f99fa5856fa039ad7e19923f8132cbc8431e031d895bec430bc8a0e |
+Instruction
One new Panasonic NCR18650PF lithium-ion cell at 25 degrees Celsius is rested at a state of charge that you choose and then discharged at a held 2.7 A for 27 minutes (270 steps of 6 s).
+
+Find the smallest starting state of charge (a fraction of full charge), from 0.2 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 8e-05 apart, and name the constraint that binds.
+
+Constraints (id, what, limit):
+- pf_end_voltage, the cell's terminal voltage at the end of the discharge, in volts at or above 3.4061 V
+- completes, the run completes every step: a run that the verifier stops part way (UndervoltageCutoff) does not hold
+Each design is one run:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_18650pf", "initial": {"soc": "<your value>", "held_current_a": 2.7}, "dt_s": 6.0, "segments": [{"steps": 270, "load": {"current_a": 2.7}}], "record_every": 270}}
+This task has no solve: leave "solve" out of each design.
+
+Budget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": "<constraint id>"}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out "solve" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it, and "step": the last step its run is sealed to (steps_landed), a whole number: {"run": {...}, "stopped": "<name>", "step": <steps_landed>}. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+Reference solution
+From the reference agent's reply (g1f-limit-18650pf-lowest-start-charge-2a7-27min.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.
+| On the card | Tool | Proof | Open address |
|---|
| passing.run | run_trajectory | eaa7313b2dabcc37377021297ae0fbaae7439676b440bb00b3f8278b230f54ce98cd55b75ea149b2e046842928e75926 | verified |
| failing.run | run_trajectory | 422a5adb5a10b1d8704b4864a3dacb002c698d7b83c2c41d44faebfdcdfc1101ab0275eb654bf312889c18606871687f | verified |
+{
+ "passing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_18650pf",
+ "initial": {
+ "soc": 0.7845661995529128,
+ "held_current_a": 2.7
+ },
+ "dt_s": 6.0,
+ "segments": [
+ {
+ "steps": 270,
+ "load": {
+ "current_a": 2.7
+ }
+ }
+ ],
+ "record_every": 270
+ }
+ },
+ "proof": "eaa7313b2dabcc37377021297ae0fbaae7439676b440bb00b3f8278b230f54ce98cd55b75ea149b2e046842928e75926"
+ }
+ },
+ "failing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_18650pf",
+ "initial": {
+ "soc": 0.7845181995529128,
+ "held_current_a": 2.7
+ },
+ "dt_s": 6.0,
+ "segments": [
+ {
+ "steps": 270,
+ "load": {
+ "current_a": 2.7
+ }
+ }
+ ],
+ "record_every": 270
+ }
+ },
+ "proof": "422a5adb5a10b1d8704b4864a3dacb002c698d7b83c2c41d44faebfdcdfc1101ab0275eb654bf312889c18606871687f"
+ }
+ },
+ "binding": "pf_end_voltage"
+}
+What the models were compared with
+| Model | Against | Specimen | Accuracy against measurement |
|---|
| energy/cell_18650pf | compared with measurement | Terminal voltage and state of charge of one Panasonic NCR18650PF lithium-ion cell, new, at 25 degC, in a held discharge at one current from a rested cell at any state of charge, with no temperature and no memory of the load before. | Compared with the eleven held 1C discharges from full charge not in the fit: terminal voltage within 27.8 to 30.0 mV RMS (target 50), largest single error 57 mV; delivered capacity within +0.04 percent (target 3) on the one run to cutoff. Gap: on one discharge at 0.87 A in 14 holds, not in the fit, 56.7 mV RMS (target 50), 204 and 206 mV in the last two holds, and it runs 71 s past the cell's 2.5 V, delivering 0.60 percent more than the cell. |
+Cheat suite
0 cheat attempt(s) scored above 0. 20 vectors applied; 10 do not apply to this kind.
| Vector | Expected | Reward | Graded | Result | Scorer's reason |
|---|
| honest | honest control (1) | 1 | 1.000 | holds | |
| honest_reply_log_matches | honest control (1) | 1 | 1.000 | holds | |
| honest_numbers_respelled | honest control (1) | 1 | 1.000 | holds | |
| no_request_behind | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| edited_call_log | cheat (0) | 0 | 0.000 | holds | the call log beside the reply differs from the harness log |
| over_budget | cheat (0) | 0 | 0.000 | holds | 5 computing calls; the budget is 4 |
| forbidden_tool | cheat (0) | 0 | 0.000 | holds | the log holds calls of find_flip, which the task rules out |
| no_harness_log | cheat (0) | 0 | 0.000 | holds | no harness call log: every attempt is scored with the calls the harness recorded |
| harness_log_edited | cheat (0) | 0 | 0.000 | holds | the harness log's chain breaks at line 2 |
| stale_engine_tag | cheat (0) | 0 | 0.000 | holds | the task was built on engine 0.15.0; the verifier is 0.15.3 |
| copied_proof_other_task | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| nudged_figure | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| figure_plus_10_percent | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| card_request_not_run | cheat (0) | 0 | 0.000 | holds | a run_trajectory request on the card is not among the calls in the log |
| swapped_sides | cheat (0) | 0 | 0.000 | holds | the passing design breaks pf_end_voltage |
| binding_misnamed | cheat (0) | 0 | 0.000 | holds | binding names 'completes'; the constraint that binds is another |
| proof_from_other_design | cheat (0) | 0 | 0.000 | holds | the failing design's run_seal: the verifier says the seal does not hold (cause run_seal) |
| failing_given_as_passing | cheat (0) | 0 | 0.000 | holds | the passing design breaks pf_end_voltage |
| proof_uppercase | cheat (0) | 0 | 0.000 | holds | the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits |
| extra_argument | cheat (0) | 0 | 0.000 | holds | the passing design's run differs from the task's at note |
+Solver runs
+| Agent | Reward | Graded | Computing calls | Scorer's reason |
|---|
| Reference agent | 1 | 1.000 | 2 | |
| One-call agent | 0 | 0.000 | 1 | the passing design breaks pf_end_voltage |
+Pass@k by model family
+| Family | Variant | Model | Solved | pass@1 | pass@8 | Mean graded | Harness errors |
|---|
| Frontier model | tool | Frontier model | 5 of 8 | 62% | 100% | 0.653 | 0% |
+Measured calibration: Frontier model, tool variant, n=8.
+Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.
+
+Written 2026-11-14T01:25:21Z.
+
\ No newline at end of file
diff --git a/sample/reports/g1f-limit-18650pf-lowest-start-charge-2a7-27min.json b/sample/reports/g1f-limit-18650pf-lowest-start-charge-2a7-27min.json
new file mode 100644
index 0000000000000000000000000000000000000000..244c7bb3fcaa1718ed205ab0b1af5c2259a4de24
--- /dev/null
+++ b/sample/reports/g1f-limit-18650pf-lowest-start-charge-2a7-27min.json
@@ -0,0 +1,345 @@
+{
+ "id": "g1f-limit-18650pf-lowest-start-charge-2a7-27min",
+ "family": "tradeoff",
+ "kind": "design_to_limit",
+ "models": [
+ "energy/cell_18650pf"
+ ],
+ "checksums": {
+ "row_sha256": "678f4595b6cf3ab321c0ace0d1dd7ed9815ba98a936e3a7d5c3ce4705d4d1f01",
+ "row_sha384": "e6eaf64a13585c675fe8d23030cad93ff8b83ac15f281928dfa101df6e9a342da71726f9e75b9090b2895799e701afac",
+ "harbor_dir_sha256": "d401712e8d75a01d721d449929864758f023cc90bed37ad6989134fc695c4f27",
+ "harbor_dir_sha384": "b413ceefd206823d317607bca24c07b4c34720320f99fa5856fa039ad7e19923f8132cbc8431e031d895bec430bc8a0e"
+ },
+ "instruction": "One new Panasonic NCR18650PF lithium-ion cell at 25 degrees Celsius is rested at a state of charge that you choose and then discharged at a held 2.7 A for 27 minutes (270 steps of 6 s).\n\nFind the smallest starting state of charge (a fraction of full charge), from 0.2 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 8e-05 apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- pf_end_voltage, the cell's terminal voltage at the end of the discharge, in volts at or above 3.4061 V\n- completes, the run completes every step: a run that the verifier stops part way (UndervoltageCutoff) does not hold\nEach design is one run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_18650pf\", \"initial\": {\"soc\": \"\", \"held_current_a\": 2.7}, \"dt_s\": 6.0, \"segments\": [{\"steps\": 270, \"load\": {\"current_a\": 2.7}}], \"record_every\": 270}}\nThis task has no solve: leave \"solve\" out of each design.\n\nBudget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out \"solve\" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries \"stopped\": the stop's name exactly as the verifier gives it, and \"step\": the last step its run is sealed to (steps_landed), a whole number: {\"run\": {...}, \"stopped\": \"\", \"step\": }. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.",
+ "real_thing": "Terminal voltage and state of charge of one Panasonic NCR18650PF lithium-ion cell, new, at 25 degC, in a held discharge at one current from a rested cell at any state of charge, with no temperature and no memory of the load before. Compared with the eleven held 1C discharges from full charge not in the fit: terminal voltage within 27.8 to 30.0 mV RMS (target 50), largest single error 57 mV; delivered capacity within +0.04 percent (target 3) on the one run to cutoff. Gap: on one discharge at 0.87 A in 14 holds, not in the fit, 56.7 mV RMS (target 50), 204 and 206 mV in the last two holds, and it runs 71 s past the cell's 2.5 V, delivering 0.60 percent more than the cell.",
+ "reference": {
+ "from": "the reference agent's reply (g1f-limit-18650pf-lowest-start-charge-2a7-27min.txt)",
+ "card": {
+ "passing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_18650pf",
+ "initial": {
+ "soc": 0.7845661995529128,
+ "held_current_a": 2.7
+ },
+ "dt_s": 6.0,
+ "segments": [
+ {
+ "steps": 270,
+ "load": {
+ "current_a": 2.7
+ }
+ }
+ ],
+ "record_every": 270
+ }
+ },
+ "proof": "eaa7313b2dabcc37377021297ae0fbaae7439676b440bb00b3f8278b230f54ce98cd55b75ea149b2e046842928e75926"
+ }
+ },
+ "failing": {
+ "run": {
+ "request": {
+ "tool": "run_trajectory",
+ "arguments": {
+ "domain": "energy",
+ "card": "cell_18650pf",
+ "initial": {
+ "soc": 0.7845181995529128,
+ "held_current_a": 2.7
+ },
+ "dt_s": 6.0,
+ "segments": [
+ {
+ "steps": 270,
+ "load": {
+ "current_a": 2.7
+ }
+ }
+ ],
+ "record_every": 270
+ }
+ },
+ "proof": "422a5adb5a10b1d8704b4864a3dacb002c698d7b83c2c41d44faebfdcdfc1101ab0275eb654bf312889c18606871687f"
+ }
+ },
+ "binding": "pf_end_voltage"
+ },
+ "proofs": [
+ {
+ "where": "passing.run",
+ "tool": "run_trajectory",
+ "proof": "eaa7313b2dabcc37377021297ae0fbaae7439676b440bb00b3f8278b230f54ce98cd55b75ea149b2e046842928e75926",
+ "open_address": "verified"
+ },
+ {
+ "where": "failing.run",
+ "tool": "run_trajectory",
+ "proof": "422a5adb5a10b1d8704b4864a3dacb002c698d7b83c2c41d44faebfdcdfc1101ab0275eb654bf312889c18606871687f",
+ "open_address": "verified"
+ }
+ ],
+ "open_address_record": true,
+ "engine_tag": "v0.15.3",
+ "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "measurement": [
+ {
+ "model": "energy/cell_18650pf",
+ "against_measurement": "compared with measurement",
+ "accuracy_against_measurement": "Compared with the eleven held 1C discharges from full charge not in the fit: terminal voltage within 27.8 to 30.0 mV RMS (target 50), largest single error 57 mV; delivered capacity within +0.04 percent (target 3) on the one run to cutoff. Gap: on one discharge at 0.87 A in 14 holds, not in the fit, 56.7 mV RMS (target 50), 204 and 206 mV in the last two holds, and it runs 71 s past the cell's 2.5 V, delivering 0.60 percent more than the cell.",
+ "specimen": "Terminal voltage and state of charge of one Panasonic NCR18650PF lithium-ion cell, new, at 25 degC, in a held discharge at one current from a rested cell at any state of charge, with no temperature and no memory of the load before.",
+ "error": null
+ }
+ ],
+ "cheat_suite": {
+ "vectors": [
+ {
+ "vector": "honest",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_reply_log_matches",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "honest_numbers_respelled",
+ "expect": "honest control (1)",
+ "reward": 1,
+ "graded": 1.0,
+ "ok": true,
+ "reason": null
+ },
+ {
+ "vector": "no_request_behind",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "edited_call_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the call log beside the reply differs from the harness log"
+ },
+ {
+ "vector": "over_budget",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "5 computing calls; the budget is 4"
+ },
+ {
+ "vector": "forbidden_tool",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the log holds calls of find_flip, which the task rules out"
+ },
+ {
+ "vector": "no_harness_log",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "no harness call log: every attempt is scored with the calls the harness recorded"
+ },
+ {
+ "vector": "harness_log_edited",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the harness log's chain breaks at line 2"
+ },
+ {
+ "vector": "stale_engine_tag",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3"
+ },
+ {
+ "vector": "copied_proof_other_task",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "nudged_figure",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "figure_plus_10_percent",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "card_request_not_run",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "a run_trajectory request on the card is not among the calls in the log"
+ },
+ {
+ "vector": "swapped_sides",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design breaks pf_end_voltage"
+ },
+ {
+ "vector": "binding_misnamed",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "binding names 'completes'; the constraint that binds is another"
+ },
+ {
+ "vector": "proof_from_other_design",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)"
+ },
+ {
+ "vector": "failing_given_as_passing",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design breaks pf_end_voltage"
+ },
+ {
+ "vector": "proof_uppercase",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits"
+ },
+ {
+ "vector": "extra_argument",
+ "expect": "cheat (0)",
+ "reward": 0,
+ "graded": 0.0,
+ "ok": true,
+ "reason": "the passing design's run differs from the task's at note"
+ }
+ ],
+ "not_applicable": [
+ {
+ "vector": "stop_misnamed",
+ "why": "no stop binds"
+ },
+ {
+ "vector": "step_misnamed",
+ "why": "no stop binds"
+ },
+ {
+ "vector": "missing_solve",
+ "why": "a design of one request"
+ },
+ {
+ "vector": "solve_handed_other_run",
+ "why": "a design of one request"
+ },
+ {
+ "vector": "next_start_rounded",
+ "why": "not a continued design"
+ },
+ {
+ "vector": "next_proof_copied",
+ "why": "not a continued design"
+ },
+ {
+ "vector": "next_request_edited",
+ "why": "not a continued design"
+ },
+ {
+ "vector": "every_row_genuine",
+ "why": "forensics only"
+ },
+ {
+ "vector": "every_row_false",
+ "why": "forensics only"
+ },
+ {
+ "vector": "every_row_false_true_reasons",
+ "why": "forensics only"
+ }
+ ],
+ "cheats_scoring_above_0": 0,
+ "run": true
+ },
+ "solver_runs": {
+ "reference": {
+ "reward": 1,
+ "graded": 1.0,
+ "correct": 1,
+ "proofs_hold": 1,
+ "computing_calls": 2,
+ "verdict": "pass",
+ "reason": null
+ },
+ "naive": {
+ "reward": 0,
+ "graded": 0.0,
+ "correct": 0,
+ "proofs_hold": 1,
+ "computing_calls": 1,
+ "verdict": "wrong",
+ "reason": "the passing design breaks pf_end_voltage"
+ }
+ },
+ "passk": [
+ {
+ "family": "Frontier model",
+ "model": "Frontier model",
+ "variant": "tool",
+ "n": 8,
+ "correct": 5,
+ "pass@1": 0.625,
+ "pass@8": 1.0,
+ "mean_graded": 0.65251625,
+ "harness_error_rate": 0.0
+ }
+ ],
+ "no_tool_question": false,
+ "physics_forensics": false,
+ "blind_baseline": null,
+ "written_utc": "2026-11-14T01:25:21Z"
+}
diff --git a/sample/reports/index.html b/sample/reports/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..ef0875fab2d0b83c36e07fe7287724f78b8365f6
--- /dev/null
+++ b/sample/reports/index.html
@@ -0,0 +1,18 @@
+
+Task quality reportsTask quality reports
+5 tasks · Zero-Trust Physics v0.15.3 · Protocol Company
+
\ No newline at end of file
diff --git a/sample/reports/live_scores.jsonl b/sample/reports/live_scores.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..677cc06dbcf14bd65eaa8176dcb99ced02d7d059
--- /dev/null
+++ b/sample/reports/live_scores.jsonl
@@ -0,0 +1,5 @@
+{"id": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "holds_outcome": "completed", "stops_outcome": "refused (UndervoltageLimit)", "holds_value": 12.059545636899294, "stops_value": 12.059617994390187, "width": 7.235749089318233e-05, "width_ratio": 0.5999999999943105}
+{"id": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "holds_outcome": "completed", "stops_outcome": "refused (UndervoltageLimit)", "holds_value": 3.269752803378649, "stops_value": 3.269556624095825, "width": 0.00019617928282400499, "width_ratio": 0.5999999999992989}
+{"id": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "passing": {"x": 0.5465612150325692, "met": {"end_voltage": true, "core_hottest": true, "completes": true}, "values": {"end_voltage": 2.8349093713245175, "core_hottest": 26.173992565002724, "completes": "completed"}}, "failing": {"x": 0.5465606150325693, "met": {"end_voltage": true, "core_hottest": false, "completes": true}, "values": {"end_voltage": 2.8349079479164936, "core_hottest": 26.174007434990113, "completes": "completed"}}, "width": 5.999999999062311e-07, "width_ratio": 0.5999999999062311}
+{"id": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "kind": "chained_design", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "passing": {"x": 425.5106548116787, "met": {"next_cell_peak": true, "next_vent_held": true}, "values": {"next_cell_peak": 428.089073580809, "next_vent_held": 0.59753991388013}}, "failing": {"x": 425.5111948116787, "met": {"next_cell_peak": true, "next_vent_held": false}, "values": {"next_cell_peak": 428.0900693769172, "next_vent_held": 0.5972600513108174}}, "width": 0.0005400000000008731, "width_ratio": 0.6000000000009701}
+{"id": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "passing": {"x": 0.7845661995529128, "met": {"pf_end_voltage": true, "completes": true}, "values": {"pf_end_voltage": 3.4061234719996434, "completes": "completed"}}, "failing": {"x": 0.7845181995529128, "met": {"pf_end_voltage": false, "completes": true}, "values": {"pf_end_voltage": 3.4060765279996437, "completes": "completed"}}, "width": 4.8000000000048004e-05, "width_ratio": 0.6000000000006}
diff --git a/sample/reports/live_verify.json b/sample/reports/live_verify.json
new file mode 100644
index 0000000000000000000000000000000000000000..efc439ea9dd567e4614bbfc8196af182dbe20461
--- /dev/null
+++ b/sample/reports/live_verify.json
@@ -0,0 +1,7 @@
+{
+ "date": "13 November 2026",
+ "address": "https://mcp.zerotrustphysics.com/mcp",
+ "tasks": 5,
+ "reward_1": 5,
+ "proofs_hold": 5
+}
\ No newline at end of file
diff --git a/sample/reports/vault_proof.json b/sample/reports/vault_proof.json
new file mode 100644
index 0000000000000000000000000000000000000000..59066f78f53bfb3d8b11731fb54bc7bd87a1aaea
--- /dev/null
+++ b/sample/reports/vault_proof.json
@@ -0,0 +1,65 @@
+{
+ "sample_set": "public_sample",
+ "group": "batteries-thermal-runaway-grid-frequency",
+ "engine_tag": "v0.15.3",
+ "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1",
+ "tasks": 5,
+ "by_kind": {
+ "budgeted_search": 2,
+ "design_to_limit": 2,
+ "chained_design": 1
+ },
+ "calibration": {
+ "model": "Frontier model",
+ "variant": "tool",
+ "band_is_on": "pass@1",
+ "pass1_min": 0.125,
+ "pass1_median": 0.25,
+ "pass1_max": 0.625,
+ "n_min": 8,
+ "n_max": 8,
+ "pass8_min": 1.0,
+ "pass8_max": 1.0
+ },
+ "cheat_suite": {
+ "vectors": [
+ "binding_misnamed",
+ "card_request_not_run",
+ "copied_proof_other_task",
+ "edited_call_log",
+ "extra_argument",
+ "failing_given_as_passing",
+ "figure_plus_10_percent",
+ "forbidden_tool",
+ "harness_log_edited",
+ "missing_solve",
+ "next_proof_copied",
+ "next_request_edited",
+ "next_start_rounded",
+ "no_harness_log",
+ "no_request_behind",
+ "nudged_figure",
+ "over_budget",
+ "proof_from_other_design",
+ "proof_uppercase",
+ "solve_handed_other_run",
+ "stale_engine_tag",
+ "stop_misnamed",
+ "swapped_sides"
+ ],
+ "executed_adversarial": 88,
+ "adversarial_above_zero": 0,
+ "honest_controls": 15,
+ "honest_controls_at_one": 15,
+ "not_applicable_skipped": 47,
+ "all_zero": true
+ },
+ "reference": {
+ "scored": 5,
+ "reward_1": 5
+ },
+ "disjoint": {
+ "clean": true,
+ "tasks_with_hits": []
+ }
+}
\ No newline at end of file
diff --git a/sample/scorer/bin/sample_verifier-linux-amd64 b/sample/scorer/bin/sample_verifier-linux-amd64
new file mode 100755
index 0000000000000000000000000000000000000000..fd42de6752a253e0ab580f6a7b9c7d485a824bd1
--- /dev/null
+++ b/sample/scorer/bin/sample_verifier-linux-amd64
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7e0c7850626d2a57b8a2482ec8b5b5cbc0aa6de0ea3d8b2441c13f635648ea7e
+size 1112896
diff --git a/sample/scorer/bin/sample_verifier-linux-arm64 b/sample/scorer/bin/sample_verifier-linux-arm64
new file mode 100644
index 0000000000000000000000000000000000000000..241055cce2ec3b31b7e518173c6b5c8fd09146b9
--- /dev/null
+++ b/sample/scorer/bin/sample_verifier-linux-arm64
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5692bd3658e2c12af0a67401310a0cad42e0ac8451931c1a143f81a38c7a35de
+size 927584
diff --git a/sample/scorer/bin/sample_verifier-macos-arm64 b/sample/scorer/bin/sample_verifier-macos-arm64
new file mode 100755
index 0000000000000000000000000000000000000000..05868f2a40f3fc75f5716767084dda1c96aa7e13
--- /dev/null
+++ b/sample/scorer/bin/sample_verifier-macos-arm64
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1cd817ae3e009a9806604b738c23a3c173612f562b484dd49a15694b22dfe721
+size 865648
diff --git a/sample/scorer/chainlib.py b/sample/scorer/chainlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5
--- /dev/null
+++ b/sample/scorer/chainlib.py
@@ -0,0 +1,63 @@
+"""Build the solve request of a chained design from a run's answer: the history its coupling hands over.
+
+A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's
+32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This
+module reads the slots from frame_hex with the standard library and lays the history out the way a
+task states it.
+
+ chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from
+
+layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or
+{"kind": "triga_element"}.
+
+Licence: Apache-2.0.
+"""
+import copy
+import struct
+
+
+def _slots(run_answer, f64_at, f32_at):
+ """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened."""
+ out = [[] for _ in range(1 + len(f32_at))]
+ for frame in run_answer["frames"]:
+ raw = bytes.fromhex(frame["frame_hex"])
+ out[0].append(struct.unpack(" the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.93, \"capacity_ah\": 4.62, \"case_temperature_least_c\": 11.0, \"case_temperature_most_c\": 11.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 960, \"load\": {\"current_a\": \"\", \"case_temperature_c\": 11.0}}], \"record_every\": 960}}\n\nBudget: at most 5 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.", "check": {"tool": "run_trajectory", "template": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": null, "case_temperature_c": 11.0}}], "record_every": 960}, "variable": "segments[0].load.current_a", "also": [], "stop": "UndervoltageLimit", "relative_width": 1e-05, "budget": 5, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "A stop located by halving on the local 0.15.3 build; the task rules the search tools out and allows 5 computing calls."}, "reference": {"boundary": 12.05958181564474, "bisect_width": 6.9118044621063746e-12, "holds": {"x": 12.059545636899294, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059545636899294, "case_temperature_c": 11.0}}], "record_every": 960}}, "proof": "74bbb04a7f1ce03d8d60aa42063b094b0e66f03d602d37398911e7486b803eec45399df2c82f1bfb7fdce1ae655c33d4", "outcome": "completed", "steps_landed": 960}, "stops": {"x": 12.059617994390187, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059617994390187, "case_temperature_c": 11.0}}], "record_every": 960}}, "proof": "3a8d1ae90c4ebcdab0950a9aa2280bbf270ed5acd8fcfecac04daf6c8b9091c28c269d997e47ce4a851c879dfd6de519", "outcome": "refused", "steps_landed": 959}, "span_pattern": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhssssssssssssssssssssssssssssssssssss", "span": [10.0, 15.0], "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
+{"id": "g1f-budget4-cell1000-least-capacity-15a-31c", "family": "budget", "kind": "budgeted_search", "models": ["energy/cell_2170_model3"], "real_thing": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.", "task": "Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, rested at 88 percent charge with its case at 31 degrees Celsius, is discharged at 15 A for 10 minutes (600 steps of 1 s), its case held at 31 degrees Celsius. Its capacity (capacity_ah) is the one input you change: an aged cell holds less. Below some capacity it reaches its lower voltage limit before the 10 minutes are up (UndervoltageLimit). Find that capacity, in ampere-hours.\n\nFind it to four significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.01 percent of the value apart. It lies between 2.5 and 4.1 Ah.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.88, \"capacity_ah\": \"\", \"case_temperature_least_c\": 31.0, \"case_temperature_most_c\": 31.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 600, \"load\": {\"current_a\": 15.0, \"case_temperature_c\": 31.0}}], \"record_every\": 600}}\n\nBudget: at most 4 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.", "check": {"tool": "run_trajectory", "template": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": null, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}, "variable": "initial.capacity_ah", "also": [], "stop": "UndervoltageLimit", "relative_width": 0.0001, "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "A stop located by halving on the local 0.15.3 build; the task rules the search tools out and allows 4 computing calls."}, "reference": {"boundary": 3.269654713737237, "bisect_width": 1.928235349168972e-12, "holds": {"x": 3.269752803378649, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": 3.269752803378649, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}, "proof": "cb1bd559d1d2265454e621416c6f462276b545f87432504b9e4ef59fd7b3dd88fa72d7c68c299fb3d8310399fbece51b", "outcome": "completed", "steps_landed": 600}, "stops": {"x": 3.269556624095825, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": 3.269556624095825, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}, "proof": "1380e70918c6bec508ee957298bf797f296ef625ee93de955ffbd69e23bf3d12a48082e658a7d880638373e8ba6c78c2", "outcome": "refused", "steps_landed": 599}, "span_pattern": "sssssssssssssssssssssssssssssssshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", "span": [2.5, 4.1], "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
+{"id": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "kind": "design_to_limit", "models": ["energy/cell_2170_model3"], "real_thing": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.", "task": "Cell m448 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.47 Ah, with its case at 18 degrees Celsius, is rested at a state of charge that you choose and then discharged at 9.6 A for eleven minutes (660 steps of 1 s), its case held at 18 degrees Celsius.\n\nFind the smallest starting state of charge (a fraction of full charge), from 0.25 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 1e-06 apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- end_voltage, the cell's terminal voltage at the end of the run, in volts at or above 2.8012 V\n- core_hottest, the hottest the cell's core gets over the run, in degrees Celsius at or below 26.174 degC\n- completes, the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold\nEach design is one run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 448.0, \"state_of_charge\": \"\", \"capacity_ah\": 4.47, \"case_temperature_least_c\": 18.0, \"case_temperature_most_c\": 18.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 660, \"load\": {\"current_a\": 9.6, \"case_temperature_c\": 18.0}}], \"record_every\": 660}}\nThis task has no solve: leave \"solve\" out of each design.\n\nBudget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "path", "on": "run", "path": "initial.state_of_charge", "words": "the starting state of charge (a fraction of full charge)"}, "template": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": null, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "free": [], "run_outcomes": ["completed"], "direction": "smallest", "units": "", "chain": null, "range": [0.25, 1.0], "tolerance": 1e-06}, "constraints": [{"id": "end_voltage", "on": "run", "read": {"kind": "final", "quantity": "terminal_v"}, "op": ">=", "words": "the cell's terminal voltage at the end of the run, in volts", "unit": "V", "limit": 2.8012}, {"id": "core_hottest", "on": "run", "read": {"kind": "extreme", "quantity": "core_temperature_c", "which": "maximum"}, "op": "<=", "words": "the hottest the cell's core gets over the run, in degrees Celsius", "unit": "degC", "limit": 26.174}, {"id": "completes", "on": "outcome", "words": "the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold", "stop": "UndervoltageLimit"}], "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "Limits read at seeded designs; the window sampled at 61 designs and the boundary bisected on the local 0.15.3 build."}, "reference": {"boundary": 0.5465609150325692, "binding": "core_hottest", "window_pattern": "........................HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", "constraint_patterns": {"end_voltage": "-+-----+-+--+------++++++++++++++++++++++++++++++++++++++++++", "core_hottest": "+++++++++++++++---------+++++++++++++++++++++++++++++++++++++", "completes": "-----------------------++++++++++++++++++++++++++++++++++++++"}, "band": [0.55, 1.0], "near_pattern": "....................HHHHHHHHHHHHHHHHHHHHH", "passing": {"x": 0.5465612150325692, "values": {"end_voltage": 2.8349093713245175, "core_hottest": 26.173992565002724, "completes": "completed"}, "run": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465612150325692, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "run_seal": "5409934b45e2559467989bb1cf922deb3a8a3c075c638a6bae4a4379cdb10e0e0e099537ca7e24a95f7f0f1f21baf887", "solve": null, "solution_seal": null, "next": null, "next_seal": null}, "failing": {"x": 0.5465606150325693, "values": {"end_voltage": 2.8349079479164936, "core_hottest": 26.174007434990113, "completes": "completed"}, "run": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465606150325693, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "run_seal": "baa948ee323f2595cb5a4109e49a1926d9de0ff6fc428024cd6e6d9ca23e6de522a52c96a4f23d40eeabddb7920c2a85", "solve": null, "solution_seal": null, "next": null, "next_seal": null, "outcome": "completed", "stopped": null, "steps_landed": 660}, "limit_targets": {"end_voltage": 0.4670589356940773, "core_hottest": 0.4267557164426305}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
+{"id": "g1f-chain-runaway-new-soak-then-warm-room", "family": "chain_design", "kind": "chained_design", "models": ["energy/runaway_18650_lco"], "real_thing": "Thermal runaway of one LiCoO2 18650 cell in an oven, under a heater or in an adiabatic calorimeter: the four Hatchard-Kim stages, a separator melt at 130 degC and a vent at 160 degC, one heat capacity, oven loss and an energy ledger. Compared with each record left out of the fit in turn, the constants refitted on the other 12: onsets within 16.2 K RMS on 10 records (9.8 on the eight reprinted cells), peaks within 51.7 K RMS on 7, Hatchard's 155 degC oven running away at 64.8 min against 51.1; in the fit 13.5 K, 51.1 K and 62.0 min, and 17 of the records' 23 comparisons within their targets. Gap: at 150 degC the card runs away at 109.7 min where Hatchard's cell did not in 120; Golubkov's cell peaks 115 K higher (853 degC); Mendoza-Hernandez's self-heats 30 K lower (100.0 degC); Lu's peaked at 370 degC against 705.", "task": "One LiCoO2 18650 cell starts at 297.15 K with 12 percent of its SEI layer, 78 percent of its anode lithium, 97 percent of its cathode unreacted, its electrolyte, separator and vent gas whole. It soaks in an oven held at one temperature that you choose for 3200 s (320 steps of 10 s), with no heater, not adiabatic. That run is then continued (from) with the oven at 305.15 K for 3600 s (360 steps of 10 s).\n\nFind the largest oven temperature of the first run, in kelvin, from 395 to 470 K, for which every constraint below holds. Give the passing design and the first failing design, no more than 0.0009 K apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- next_cell_peak, the hottest the cell gets over the next run, in kelvin at or below 432.27 K\n- next_vent_held, the fraction of the cell's vent gas still held at the end of the next run (1 before it vents) at or above 0.5974\nEach design is two runs of runaway_18650_lco. The first run, which must complete:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"runaway_18650_lco\", \"initial\": {\"temperature_k\": 297.15, \"sei_fraction\": 0.12, \"anode_lithium_fraction\": 0.78, \"cathode_unreacted_fraction\": 0.97, \"electrolyte_fraction\": 1.0, \"separator_unmelted_fraction\": 1.0, \"vent_gas_held_fraction\": 1.0}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 320, \"load\": {\"oven_temperature_k\": \"\", \"heater_power_w\": 0.0, \"adiabatic\": 0.0}}], \"record_every\": 320}}\nThen the next run, which continues that sealed first run: its initial state is the first run's answer, value for value and bit for bit, and its from names the first run's request and seal:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"runaway_18650_lco\", \"initial\": {\"temperature_k\": \"\", \"sei_fraction\": \"\", \"anode_lithium_fraction\": \"\", \"cathode_unreacted_fraction\": \"\", \"electrolyte_fraction\": \"\", \"separator_unmelted_fraction\": \"\", \"vent_gas_held_fraction\": \"\"}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 360, \"load\": {\"oven_temperature_k\": 305.15, \"heater_power_w\": 0.0, \"adiabatic\": 0.0}}], \"record_every\": 360, \"from\": {\"request\": \"\", \"run_seal\": \"\"}}}\nConstraints whose id begins next_ are read from the next run; the others from the first run. This task has no solve.\n\nBudget: at most 5 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "path", "on": "run", "path": "segments[0].load.oven_temperature_k", "words": "the oven temperature of the first run, in kelvin"}, "template": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": null, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "free": [], "run_outcomes": ["completed"], "direction": "largest", "units": "K", "range": [395.0, 470.0], "chain": {"kind": "continuation", "next_template": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": null, "sei_fraction": null, "anode_lithium_fraction": null, "cathode_unreacted_fraction": null, "electrolyte_fraction": null, "separator_unmelted_fraction": null, "vent_gas_held_fraction": null}, "dt_s": 10.0, "segments": [{"steps": 360, "load": {"oven_temperature_k": 305.15, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 360}, "carried": {"temperature_k": "final_state.temperature_k", "sei_fraction": "final_state.sei_fraction", "anode_lithium_fraction": "final_state.anode_lithium_fraction", "cathode_unreacted_fraction": "final_state.cathode_unreacted_fraction", "electrolyte_fraction": "final_state.electrolyte_fraction", "separator_unmelted_fraction": "final_state.separator_unmelted_fraction", "vent_gas_held_fraction": "final_state.vent_gas_held_fraction"}, "next_outcomes": ["completed"]}, "tolerance": 0.0009}, "constraints": [{"id": "next_cell_peak", "on": "next", "read": {"kind": "extreme", "quantity": "temperature_k", "which": "maximum"}, "op": "<=", "words": "the hottest the cell gets over the next run, in kelvin", "unit": "K", "limit": 432.27}, {"id": "next_vent_held", "on": "next", "read": {"kind": "final", "quantity": "vent_gas_held_fraction"}, "op": ">=", "words": "the fraction of the cell's vent gas still held at the end of the next run (1 before it vents)", "unit": "", "limit": 0.5974}], "budget": 5, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "Limits read at seeded designs; the window sampled at 61 designs and the boundary bisected on the local 0.15.3 build. Each design is a run continued by the next run (from); the verifier holds the hand-off bit for bit."}, "reference": {"boundary": 425.5109248116787, "binding": "next_vent_held", "window_pattern": "HHHHHHHHHHHHHHHHHHHHHHHHH....................................", "constraint_patterns": {"next_cell_peak": "++++++++++++++++++++++++++-----------------------------------", "next_vent_held": "+++++++++++++++++++++++++------------------------------------"}, "band": [395.0, 425.0], "near_pattern": "HHHHHHHHHHHHHHHHHHHH.....................", "passing": {"x": 425.5106548116787, "values": {"next_cell_peak": 428.089073580809, "next_vent_held": 0.59753991388013}, "run": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5106548116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "run_seal": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa", "solve": null, "solution_seal": null, "next": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 430.4672291538255, "sei_fraction": 0.09625617043171643, "anode_lithium_fraction": 0.7574684863929316, "cathode_unreacted_fraction": 0.9202519687560146, "electrolyte_fraction": 0.9999645125616834, "separator_unmelted_fraction": 0.0, "vent_gas_held_fraction": 0.60031241106013}, "dt_s": 10.0, "segments": [{"steps": 360, "load": {"oven_temperature_k": 305.15, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 360, "from": {"request": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5106548116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "run_seal": "b0ce3c22226865cae91c9cd94a49085ba5d8abf65cebd24aa85ce0101e4ecf7fdb4c4ec5dd6e2e49a28e876e94f847fa"}}, "next_seal": "8175ff4962768bd8d6a42a515e6b98bc343970061dc2707bc0758ffa1964977faa0adefb2a4ffa4fc6e773a82c8505b5"}, "failing": {"x": 425.5111948116787, "values": {"next_cell_peak": 428.0900693769172, "next_vent_held": 0.5972600513108174}, "run": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5111948116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "run_seal": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654", "solve": null, "solution_seal": null, "next": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 430.468235992056, "sei_fraction": 0.09625468529952468, "anode_lithium_fraction": 0.7574672979619945, "cathode_unreacted_fraction": 0.9202464921736476, "electrolyte_fraction": 0.9999645073667627, "separator_unmelted_fraction": 0.0, "vent_gas_held_fraction": 0.6000340833497131}, "dt_s": 10.0, "segments": [{"steps": 360, "load": {"oven_temperature_k": 305.15, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 360, "from": {"request": {"domain": "energy", "card": "runaway_18650_lco", "initial": {"temperature_k": 297.15, "sei_fraction": 0.12, "anode_lithium_fraction": 0.78, "cathode_unreacted_fraction": 0.97, "electrolyte_fraction": 1.0, "separator_unmelted_fraction": 1.0, "vent_gas_held_fraction": 1.0}, "dt_s": 10.0, "segments": [{"steps": 320, "load": {"oven_temperature_k": 425.5111948116787, "heater_power_w": 0.0, "adiabatic": 0.0}}], "record_every": 320}, "run_seal": "bdd03a078224e98ecb35c879fae29626e81bc05378c3993c7f22f5f8e49de44192900c0b8b8d62f1adc2955f65f36654"}}, "next_seal": "ac93a947646639614fa1397fde5373b92630d0562b5120cec430733c7e5a04cfdaf799566a4f202fc8d4656cc1636bc7", "outcome": "completed", "stopped": null, "steps_landed": 360}, "limit_targets": {"next_cell_peak": 427.3778900508458, "next_vent_held": 425.5108842700434}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
+{"id": "g1f-limit-18650pf-lowest-start-charge-2a7-27min", "family": "tradeoff", "kind": "design_to_limit", "models": ["energy/cell_18650pf"], "real_thing": "Terminal voltage and state of charge of one Panasonic NCR18650PF lithium-ion cell, new, at 25 degC, in a held discharge at one current from a rested cell at any state of charge, with no temperature and no memory of the load before. Compared with the eleven held 1C discharges from full charge not in the fit: terminal voltage within 27.8 to 30.0 mV RMS (target 50), largest single error 57 mV; delivered capacity within +0.04 percent (target 3) on the one run to cutoff. Gap: on one discharge at 0.87 A in 14 holds, not in the fit, 56.7 mV RMS (target 50), 204 and 206 mV in the last two holds, and it runs 71 s past the cell's 2.5 V, delivering 0.60 percent more than the cell.", "task": "One new Panasonic NCR18650PF lithium-ion cell at 25 degrees Celsius is rested at a state of charge that you choose and then discharged at a held 2.7 A for 27 minutes (270 steps of 6 s).\n\nFind the smallest starting state of charge (a fraction of full charge), from 0.2 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 8e-05 apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- pf_end_voltage, the cell's terminal voltage at the end of the discharge, in volts at or above 3.4061 V\n- completes, the run completes every step: a run that the verifier stops part way (UndervoltageCutoff) does not hold\nEach design is one run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_18650pf\", \"initial\": {\"soc\": \"\", \"held_current_a\": 2.7}, \"dt_s\": 6.0, \"segments\": [{\"steps\": 270, \"load\": {\"current_a\": 2.7}}], \"record_every\": 270}}\nThis task has no solve: leave \"solve\" out of each design.\n\nBudget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "path", "on": "run", "path": "initial.soc", "words": "the starting state of charge (a fraction of full charge)"}, "template": {"domain": "energy", "card": "cell_18650pf", "initial": {"soc": null, "held_current_a": 2.7}, "dt_s": 6.0, "segments": [{"steps": 270, "load": {"current_a": 2.7}}], "record_every": 270}, "free": [], "run_outcomes": ["completed"], "direction": "smallest", "units": "", "chain": null, "range": [0.2, 1.0], "tolerance": 8e-05}, "constraints": [{"id": "pf_end_voltage", "on": "run", "read": {"kind": "final", "quantity": "terminal_v"}, "op": ">=", "words": "the cell's terminal voltage at the end of the discharge, in volts", "unit": "V", "limit": 3.4061}, {"id": "completes", "on": "outcome", "words": "the run completes every step: a run that the verifier stops part way (UndervoltageCutoff) does not hold", "stop": "UndervoltageCutoff"}], "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "Limits read at seeded designs; the window sampled at 61 designs and the boundary bisected on the local 0.15.3 build."}, "reference": {"boundary": 0.7845421995529128, "binding": "pf_end_voltage", "window_pattern": "............................................HHHHHHHHHHHHHHHHH", "constraint_patterns": {"pf_end_voltage": "--------------------------------------------+++++++++++++++++", "completes": "---------------------++++++++++++++++++++++++++++++++++++++++"}, "band": [0.7866666666666666, 1.0], "near_pattern": ".....................HHHHHHHHHHHHHHHHHHHH", "passing": {"x": 0.7845661995529128, "values": {"pf_end_voltage": 3.4061234719996434, "completes": "completed"}, "run": {"domain": "energy", "card": "cell_18650pf", "initial": {"soc": 0.7845661995529128, "held_current_a": 2.7}, "dt_s": 6.0, "segments": [{"steps": 270, "load": {"current_a": 2.7}}], "record_every": 270}, "run_seal": "eaa7313b2dabcc37377021297ae0fbaae7439676b440bb00b3f8278b230f54ce98cd55b75ea149b2e046842928e75926", "solve": null, "solution_seal": null, "next": null, "next_seal": null}, "failing": {"x": 0.7845181995529128, "values": {"pf_end_voltage": 3.4060765279996437, "completes": "completed"}, "run": {"domain": "energy", "card": "cell_18650pf", "initial": {"soc": 0.7845181995529128, "held_current_a": 2.7}, "dt_s": 6.0, "segments": [{"steps": 270, "load": {"current_a": 2.7}}], "record_every": 270}, "run_seal": "422a5adb5a10b1d8704b4864a3dacb002c698d7b83c2c41d44faebfdcdfc1101ab0275eb654bf312889c18606871687f", "solve": null, "solution_seal": null, "next": null, "next_seal": null, "outcome": "completed", "stopped": null, "steps_landed": 270}, "limit_targets": {"pf_end_voltage": 0.784546578954772}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
diff --git a/sample/scorer/mcp_stdio_open b/sample/scorer/mcp_stdio_open
new file mode 100755
index 0000000000000000000000000000000000000000..71b5af54451c58cf6f0ff8bbc0b611f4cf5ed8b2
--- /dev/null
+++ b/sample/scorer/mcp_stdio_open
@@ -0,0 +1,3 @@
+#!/bin/sh
+# The Zero-Trust Physics verifier at its open MCP address, as an MCP stdio server.
+exec python3 "$(dirname "$0")/ztp_open_bridge.py" "${ZTP_VERIFIER_URL:-https://mcp.zerotrustphysics.com/mcp/open}"
diff --git a/sample/scorer/pack_score.py b/sample/scorer/pack_score.py
new file mode 100644
index 0000000000000000000000000000000000000000..b41382aa52ca13dbeccd56097b08175a0fed19a2
--- /dev/null
+++ b/sample/scorer/pack_score.py
@@ -0,0 +1,105 @@
+"""Cross-platform release-pinned scorer wrapper for Zero-Trust Physics packs (macOS arm64, Linux amd64, Linux arm64, HTTP).
+
+ python3 pack_score.py REPLIES --engine ENGINE --environments F [score.py's options] [--strict-binary]
+ python3 pack_score.py --run run_cheat_suite.py [its options] [--strict-binary]
+
+Verifies that the target verifier answers MCP initialize as release 0.15.3 (matching reference.gateway_version and
+engine_tag) on kernel genesis_kernel_v0.13.1, while recording engine_binary_sha256_seen and engine_binary_is_reference on
+every score row. Pass --strict-binary to additionally require exact SHA-256 identity with reference.engine_binary_sha256.
+All deterministic recomputation, seal, budget, and grading invariants of score.py apply unchanged.
+
+Standard library only. Licence: Apache-2.0.
+"""
+import inspect
+import os
+import re
+import runpy
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+if HERE not in sys.path:
+ sys.path.insert(0, HERE)
+
+KERNEL = "genesis_kernel_v0.13.1"
+STRICT = False
+
+
+def _kernel_of(replay):
+ """The kernel the verifier names: its serverInfo.description is the kernel's name (0.15.2), or one line that ends
+ with it ("... Cards: genesis_kernel_v0.13.1", 0.15.3)."""
+ server = getattr(getattr(replay, "verifier", None), "server", None) or {}
+ found = re.findall(r"genesis_kernel_v[0-9][0-9.]*[0-9]", server.get("description") or "")
+ return found[-1] if found else server.get("description")
+
+
+def install(strict=False):
+ """Configure cross-platform release identity verification on score (idempotent). Returns the score module."""
+ global STRICT
+ STRICT = bool(strict)
+ import score
+ if getattr(score, "_pack_engine_identity", False):
+ return score
+ original = score.engine_problem
+ original_score = score.score
+
+ def engine_problem(env, replay):
+ ref = env.get("reference") or {}
+ want = ref.get("engine_binary_sha256")
+ seen = getattr(replay, "binary_sha256", None)
+ if STRICT or not (seen and want and seen != want):
+ return original(env, replay)
+ # a different file: held to the release by what it says it is, every other rule as score.py's
+ saved = replay.binary_sha256
+ replay.binary_sha256 = None
+ try:
+ problem = original(env, replay)
+ finally:
+ replay.binary_sha256 = saved
+ if problem:
+ return problem
+ kernel = _kernel_of(replay)
+ if kernel != KERNEL:
+ return "the verifier reports kernel %s; release %s runs %s" % (kernel, replay.version, KERNEL)
+ return None
+
+ def scored(env, reply, replay, *args, **kwargs):
+ row = original_score(env, reply, replay, *args, **kwargs)
+ if isinstance(row, dict):
+ want = (env.get("reference") or {}).get("engine_binary_sha256")
+ seen = getattr(replay, "binary_sha256", None)
+ row["engine_binary_sha256_seen"] = seen
+ row["engine_binary_is_reference"] = None if not seen else (seen == want)
+ return row
+
+ # score.py may one day hold its own source-build rule; then it is left as it is
+ if "strict" in inspect.getsource(original).lower():
+ return score
+ score.engine_problem = engine_problem
+ score.score = scored
+ score._pack_engine_identity = True
+ return score
+
+
+def main():
+ argv = sys.argv[1:]
+ strict = "--strict-binary" in argv
+ argv = [a for a in argv if a != "--strict-binary"]
+ if argv[:1] == ["--run"]:
+ if len(argv) < 2:
+ sys.exit("give the program: --run run_cheat_suite.py [options]")
+ program = argv[1] if os.path.isabs(argv[1]) or os.path.isfile(argv[1]) else os.path.join(HERE, argv[1])
+ folder = os.path.dirname(os.path.abspath(program))
+ if folder not in sys.path:
+ sys.path.insert(0, folder)
+ install(strict)
+ # a program that does `from score import score` takes the replaced function, as the module now holds it
+ sys.argv = [program] + argv[2:]
+ runpy.run_path(program, run_name="__main__")
+ return
+ score = install(strict)
+ sys.argv = [os.path.join(HERE, "score.py")] + argv
+ score.main()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/scorer/prompt.py b/sample/scorer/prompt.py
new file mode 100644
index 0000000000000000000000000000000000000000..a97c7cd395c83cb0842e59fcb0161d67a5b1c164
--- /dev/null
+++ b/sample/scorer/prompt.py
@@ -0,0 +1,194 @@
+"""Print exactly the text an agent is given for one environment: the task, then its family's footer.
+
+ python3 prompt.py --environments F ENVIRONMENT_ID the text for one environment
+ python3 prompt.py --environments F --list every environment id, one a line
+ python3 prompt.py --environments F --all FOLDER write FOLDER/.txt for every environment
+
+Any runner for any model gives the agent this text and nothing else, with the verifier as its
+tool server.
+
+Licence: Apache-2.0.
+"""
+import json
+import os
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+
+COMMON = """You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request."""
+
+FOOTERS = {
+ "tradeoff": COMMON + """
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": ""}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out "solve" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names.""",
+ "chain_design": COMMON + """
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": ""}
+
+passing: the design that keeps the constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks the constraint, no further from passing than the task's tolerance. binding: the id of the constraint. Each solve is the one handed its own design's sealed run through the coupling the task names.""",
+ "budget": COMMON + """
+
+The card:
+{"holds": {"request": ..., "proof": ...}, "stops": {"request": ..., "proof": ..., "stopped": ""}}
+
+holds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.""",
+ "forensics": COMMON + """
+
+The card:
+{"false_rows": {"": "", ...}}
+
+Name every false row, each with its one reason from value_altered, seal_wrong, flag_omitted, retired_model, stop_hidden. Leave the genuine rows out. {"false_rows": {}} says every row is genuine.""",
+}
+
+
+def load_environments(path):
+ with open(path, encoding="utf-8") as f:
+ return [json.loads(line) for line in f if line.strip()]
+
+
+STOP_BINDS = """ Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it, and "step": the last step its run is sealed to (steps_landed), a whole number: {"run": {...}, "stopped": "", "step": }."""
+
+
+# The design shapes of the 29 Oct 2026 groups, each footer as its group built it (score.design_shape).
+CONTINUED_CARRIED = COMMON + """
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "binding": ""}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Each design is two runs: "run" is the first run, and "next" is the run that continues that same sealed run, with "from": {"request": , "run_seal": } and its initial state equal to the first run's final_state, value for value, bit for bit."""
+
+CONTINUED_HANDED = COMMON + """
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "binding": ""}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. run is the design's first run; next is the run that continues that same sealed run through from: its from holds the first run's request and run_seal, and its start fields are the first run's final state exactly as the verifier returned it."""
+
+CONTINUED_CARRY = COMMON + """
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "binding": ""}
+
+Each design is two runs: run, and next, which continues that design's own sealed run through from (from.request is the run's request, from.run_seal its proof) and starts from its final state. passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary."""
+
+SOLVE_DESIGN = COMMON + """
+
+The card:
+{"passing": {"solve": {"request": ..., "proof": ...}}, "failing": {"solve": {"request": ..., "proof": ...}}, "binding": ""}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Each design is one solve and no run."""
+
+SOLVE_ONLY = COMMON + """
+
+The card:
+{"passing": {"solve": {"request": ..., "proof": ...}}, "failing": {"solve": {"request": ..., "proof": ...}}, "binding": ""}
+
+Each design is one solve: leave out "run". passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary."""
+
+STAGED = COMMON + """
+
+The card:
+{"passing": {%s}, "failing": {%s}, "binding": ""}
+
+Each design is the requests the task names, one entry each, under the names the task gives them (%s), each with the proof the verifier gave for it. passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. A later request that carries an earlier one's answer carries it bit for bit, from that design's own answer."""
+
+STAGED_STOP = """ Where one constraint is that a request is not stopped by a named stop and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it%s."""
+
+STOP_BINDS_SOLVE = """ Where one constraint is that the solve is not refused by a named stop and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it: {"solve": {...}, "stopped": ""}."""
+
+SOLVE_STOP_G4 = """ Where one constraint is that the solve converges (it names a refusal) and that constraint binds, binding is its id and the failing design also carries "stopped": the refusal's name exactly as the verifier gives it: {"solve": {...}, "stopped": ""}."""
+
+CARRY_STOP_G5 = (" Where one constraint is that the second run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries"
+ " \"stopped\": the stop's name exactly as the verifier gives it, and \"step\": the last step the second run (next) is sealed to (its steps_landed), a whole number:"
+ " {\"run\": {...}, \"next\": {...}, \"stopped\": \"\", \"step\": }.")
+
+BUDGET_WORDS = " Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all."
+
+
+def shaped_footer(environment):
+ """The footer of a design of one of the added shapes, or None for a run or a coupled solve (FOOTERS)."""
+ family = environment["family"]
+ check = environment.get("check") or {}
+ design = check.get("design") or {}
+ if family not in ("tradeoff", "chain_design"):
+ return None
+ chain = design.get("chain") or {}
+ stops = [c for c in check.get("constraints") or [] if c.get("on") == "outcome"]
+ if design.get("stages"): # group 3
+ stages = design["stages"]
+ shape = ", ".join('"%s": {"request": ..., "proof": ...}' % st["key"] for st in stages)
+ footer = STAGED % (shape, shape, ", ".join(st["key"] for st in stages))
+ if stops:
+ runs = any(st["key"] == c.get("stage") and st["tool"] == "run_trajectory" for c in stops for st in stages)
+ footer += STAGED_STOP % (', and, for a run, "step": the last step its run is sealed to (steps_landed), a whole number' if runs else "")
+ elif design.get("tool") == "solve": # group 4
+ footer = SOLVE_DESIGN + (SOLVE_STOP_G4 if stops else "")
+ elif design.get("kind") == "solve": # group 5
+ footer = SOLVE_ONLY + (STOP_BINDS_SOLVE if stops else "")
+ elif chain.get("kind") == "continuation" and "carried" in chain: # group 1
+ footer = CONTINUED_CARRIED
+ if stops:
+ footer += STOP_BINDS + " In a chain the stop and the step are those of the failing design's next run."
+ elif chain.get("kind") == "continuation": # group 4
+ footer = CONTINUED_HANDED
+ if stops:
+ footer += STOP_BINDS.replace("the run completes", "the second run completes").replace(
+ "the last step its run is sealed to", "the last step its next run is sealed to")
+ elif (chain.get("layout") or {}).get("kind") == "continue": # group 5
+ footer = CONTINUED_CARRY + (CARRY_STOP_G5 if stops else "")
+ else:
+ return None
+ if check.get("budget"):
+ footer += BUDGET_WORDS
+ return footer
+
+
+def prompt(environment):
+ """The whole text an agent is given for one environment."""
+ family = environment["family"]
+ shaped = shaped_footer(environment)
+ if shaped is not None:
+ return environment["task"] + "\n\n" + shaped
+ footer = FOOTERS[family]
+ check = environment.get("check") or {}
+ if family in ("tradeoff", "chain_design") and any(c.get("on") == "outcome" for c in check.get("constraints") or []):
+ footer += STOP_BINDS
+ if family in ("tradeoff", "chain_design", "forensics") and check.get("budget"):
+ footer += " Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all."
+ if family == "forensics" and check.get("reasons"):
+ footer = footer.replace("Name every false row, each with its one reason from value_altered, seal_wrong, flag_omitted, retired_model, stop_hidden.",
+ "Name every false row, each with its one reason from %s (the first of them, in that order, that is true of the row)." % ", ".join(check["reasons"]))
+ return environment["task"] + "\n\n" + footer
+
+
+def main():
+ argv = sys.argv[1:]
+ if len(argv) < 3 or argv[0] != "--environments":
+ sys.exit(__doc__)
+ environments = load_environments(argv[1])
+ argv = argv[2:]
+ if argv[0] == "--list":
+ print("\n".join(e["id"] for e in environments))
+ elif argv[0] == "--all":
+ if len(argv) < 2:
+ sys.exit("give the folder to write into")
+ os.makedirs(argv[1], exist_ok=True)
+ for e in environments:
+ with open(os.path.join(argv[1], e["id"] + ".txt"), "w", encoding="utf-8") as f:
+ f.write(prompt(e) + "\n")
+ print("wrote %d prompts to %s" % (len(environments), argv[1]))
+ else:
+ found = [e for e in environments if e["id"] == argv[0]]
+ if not found:
+ sys.exit("no environment with the id %s; --list names them" % argv[0])
+ print(prompt(found[0]))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/scorer/run_cheat_suite.py b/sample/scorer/run_cheat_suite.py
new file mode 100644
index 0000000000000000000000000000000000000000..694040c86592b7badbe78b94caa530f935d0f193
--- /dev/null
+++ b/sample/scorer/run_cheat_suite.py
@@ -0,0 +1,436 @@
+"""Cheat suite: every way of faking an answer, built from the honest reference and scored. Every cheat scores 0.
+
+ python3 run_cheat_suite.py --environments F --reference DIR --engine ENGINE [--only id,id] [--out F]
+
+DIR holds the honest reference replies made through the harness proxy by run_reference.py:
+.txt and .harness.jsonl (made here, on the verifier, for any task that has none). For every
+task, each vector below that applies to its family is built from the honest reply and scored by
+score.py with the harness log as the call record. The honest reply must score reward 1 and graded 1;
+every cheat reward 0 and graded 0. One JSON line per task and vector to --out; exit 1 on any cheat
+above 0 or an honest reply below 1.
+
+ honest the reference reply and its harness log (control: 1)
+ honest_reply_log_matches with a reply-side calls.jsonl equal to the harness log (control: 1)
+ honest_numbers_respelled the harness log with whole numbers spelt 18 where the card has 18.0 (control: 1)
+ copied_proof_other_task a proof copied from another task's card
+ nudged_figure the design value moved inside the bracket, the original proof kept
+ figure_plus_10_percent the design value times 1.1, the original proof kept
+ no_request_behind the card with no calls in the harness log (forensics: free calls only)
+ card_request_not_run the card's request differs from the one the harness log shows was run
+ edited_call_log a reply-side calls.jsonl that differs from the harness log (a call dropped)
+ over_budget more computing calls than the budget
+ forbidden_tool a ruled-out tool (find_flip) in the log
+ no_harness_log no harness log; only the reply-side log
+ harness_log_edited the harness log edited after the run (its chain breaks)
+ stale_engine_tag the task's reference marked as built on engine 0.15.0
+ swapped_sides passing and failing (holds and stops) swapped
+ binding_misnamed another constraint named as binding
+ proof_from_other_design the failing design (stops side) carrying the passing one's proof
+ failing_given_as_passing the failing design given for both
+ proof_uppercase the proof in upper-case hex
+ extra_argument a request with one argument more than the template
+ stop_misnamed, step_misnamed the stop or step the card must name, wrong
+ missing_solve a chained design without its solve (coupled) or its next run (continued) or its
+ last stage (staged)
+ solve_handed_other_run a solve (coupled), a next run (continued) or a later stage (staged) handed the other
+ design's first request and its proof
+ next_start_rounded continued: the next run's start state rounded to 9 significant figures (as sent)
+ next_proof_copied continued: the failing design's next proof replaced by the passing design's
+ next_request_edited continued: the next run's last segment one step longer than the task's (as sent)
+
+The design shapes (score.design_shape): run, coupled, continued, solve, staged. A vector that edits "the first
+request" edits the design's first entry: run, solve, or the first stage.
+ every_row_genuine forensics: {"false_rows": {}}
+ every_row_false forensics: every row named false with the first reason
+ every_row_false_true_reasons forensics: the false rows with their reasons and every genuine row too
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import json
+import math
+import os
+import sys
+import tempfile
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from score import (FREE_TOOLS, Replay, canonical, close_verifier, continuation_of, design_shape, # noqa: E402
+ load_environments, open_verifier, read_card, read_harness_log, score, set_path, write_harness_log)
+
+
+def respelled(value):
+ """Whole floats written as ints (18.0 -> 18), as a client may send what a card writes as 18.0."""
+ if isinstance(value, dict):
+ return {k: respelled(v) for k, v in value.items()}
+ if isinstance(value, list):
+ return [respelled(v) for v in value]
+ if isinstance(value, float) and value.is_integer() and abs(value) < 2 ** 53:
+ return int(value)
+ return value
+
+
+def computing(calls):
+ return [(t, a) for t, a in calls if t not in FREE_TOOLS]
+
+
+def replace_call(calls, tool, old, new):
+ """The log with the first call of tool with arguments old sent with new instead."""
+ out, done = [], False
+ for t, a in calls:
+ if not done and t == tool and canonical(a) == canonical(old):
+ out.append((t, new))
+ done = True
+ else:
+ out.append((t, a))
+ if not done:
+ raise ValueError("the call to replace is not in the log")
+ return out
+
+
+def parts_of(env):
+ """The keys of one design on the card, in order, and the tool of each."""
+ spec = env["check"]["design"]
+ shape = design_shape(spec)
+ if shape == "staged":
+ return [(st["key"], st["tool"]) for st in spec["stages"]]
+ return {"solve": [("solve", "solve")], "continued": [("run", "run_trajectory"), ("next", "run_trajectory")],
+ "coupled": [("run", "run_trajectory"), ("solve", "solve")]}.get(shape, [("run", "run_trajectory")])
+
+
+def moved_design(env, design, x):
+ """(design, [(tool, old arguments, new arguments)]): one boundary design with its value set to x."""
+ spec = env["check"]["design"]
+ var = spec["variable"]
+ shape = design_shape(spec)
+ new = copy.deepcopy(design)
+ changes = []
+ if shape in ("staged", "solve") or (shape == "continued" and var.get("on") == "next"):
+ key = var["stage"] if shape == "staged" else ("solve" if shape == "solve" else "next")
+ tool = dict(parts_of(env))[key]
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(new[key]["request"]["arguments"], place, x)
+ return new, [(tool, design[key]["request"]["arguments"], new[key]["request"]["arguments"])]
+ run_old = design["run"]["request"]["arguments"]
+ run_new = new["run"]["request"]["arguments"]
+ if var["kind"] == "entry_angle_deg":
+ g = math.radians(x)
+ run_new["initial"]["radial_speed_m_s"] = -var["speed_m_s"] * math.sin(g)
+ run_new["initial"]["transverse_speed_m_s"] = var["speed_m_s"] * math.cos(g)
+ elif var.get("on", "run") == "run":
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(run_new, place, x)
+ if var.get("on", "run") == "run" or var["kind"] == "entry_angle_deg":
+ changes.append(("run_trajectory", run_old, run_new))
+ for key in ("solve", "next"):
+ if new.get(key):
+ new[key]["request"]["arguments"]["from"]["request"] = copy.deepcopy(run_new)
+ if key == "next":
+ for place in continuation_of(spec)[3]:
+ set_path(new[key]["request"]["arguments"], place, x)
+ changes.append((dict(parts_of(env)).get(key, "solve"), design[key]["request"]["arguments"],
+ new[key]["request"]["arguments"]))
+ else:
+ set_path(new["solve"]["request"]["arguments"], var["path"], x)
+ changes.append(("solve", design["solve"]["request"]["arguments"], new["solve"]["request"]["arguments"]))
+ return new, changes
+
+
+def moved_budget(env, side, x):
+ check = env["check"]
+ new = copy.deepcopy(side)
+ for place in [check["variable"]] + list(check.get("also") or []):
+ set_path(new["request"]["arguments"], place, x)
+ return new, [(check["tool"], side["request"]["arguments"], new["request"]["arguments"])]
+
+
+def apply_changes(calls, changes):
+ for tool, old, new in changes:
+ calls = replace_call(calls, tool, old, new)
+ return calls
+
+
+def other_proof(env, others, family_tool):
+ """A proof from another task's honest card, for the same kind of request (any part of any design or side)."""
+ for other_id, other_card in others:
+ if other_id == env["id"] or not isinstance(other_card, dict):
+ continue
+ for side in ("passing", "failing", "holds", "stops"):
+ part = other_card.get(side)
+ candidates = [part] if side in ("holds", "stops") else (list(part.values()) if isinstance(part, dict) else [])
+ for one in candidates:
+ if (isinstance(one, dict) and isinstance(one.get("proof"), str) and isinstance(one.get("request"), dict)
+ and one["request"].get("tool") == family_tool):
+ return other_id, one["proof"]
+ return None, None
+
+
+def stale(env):
+ out = copy.deepcopy(env)
+ out["reference"]["engine_tag"] = "v0.15.0"
+ out["reference"]["gateway_version"] = "0.15.0"
+ return out
+
+
+def edited_log_file(calls, folder):
+ """A harness log of calls, chained, then one line's arguments edited without its chain."""
+ path = os.path.join(folder, "edited.harness.jsonl")
+ write_harness_log(path, calls)
+ lines = open(path).read().splitlines()
+ pick = max(i for i, l in enumerate(lines) if json.loads(l)["tool"] not in FREE_TOOLS)
+ entry = json.loads(lines[pick])
+ entry["arguments"] = dict(entry["arguments"], edited=True)
+ lines[pick] = json.dumps(entry, sort_keys=True)
+ open(path, "w").write("\n".join(lines) + "\n")
+ return read_harness_log(path)
+
+
+def vectors(env, card, calls, others, scratch):
+ """[(name, expect, env, card, calls, reply_calls, log_problem)] and [(name, why not)]."""
+ family, check, ref = env["family"], env["check"], env["reference"]
+ out, skipped = [], []
+ add = lambda name, expect, card_, calls_, reply_calls=None, env_=None, log_problem=None: out.append( # noqa: E731
+ (name, expect, env_ or env, card_, calls_, reply_calls, log_problem))
+ add("honest", 1, card, calls)
+ add("honest_reply_log_matches", 1, card, calls, reply_calls=list(calls))
+ add("honest_numbers_respelled", 1, card, [(t, respelled(a)) for t, a in calls])
+ comp = computing(calls)
+
+ # ---- the call record, the same for every family
+ if family == "forensics":
+ add("no_request_behind", 0, card, [c for c in calls if c[0] in FREE_TOOLS])
+ else:
+ add("no_request_behind", 0, card, [])
+ last = max(i for i, c in enumerate(calls) if c[0] not in FREE_TOOLS)
+ add("edited_call_log", 0, card, calls, reply_calls=calls[:last] + calls[last + 1:])
+ if check.get("budget"):
+ add("over_budget", 0, card, calls + [comp[0]] * (check["budget"] - len(comp) + 1))
+ else:
+ skipped.append(("over_budget", "the task has no call budget"))
+ forbidden = check.get("forbidden") or []
+ if forbidden:
+ tool = "find_flip" if "find_flip" in forbidden else forbidden[0]
+ add("forbidden_tool", 0, card, [(tool, {})] + list(calls))
+ else:
+ skipped.append(("forbidden_tool", "the task rules out no tool"))
+ add("no_harness_log", 0, card, None, reply_calls=list(calls))
+ edited_calls, problem = edited_log_file(calls, scratch)
+ add("harness_log_edited", 0, card, edited_calls, log_problem=problem)
+ add("stale_engine_tag", 0, card, calls, env_=stale(env))
+
+ if family in ("tradeoff", "chain_design"):
+ xp, xf = ref["passing"]["x"], ref["failing"]["x"]
+ parts = parts_of(env)
+ first, first_tool = parts[0]
+ shape = design_shape(check["design"])
+ oid, proof = other_proof(env, others, first_tool)
+ bad = copy.deepcopy(card)
+ bad["passing"][first]["proof"] = proof
+ add("copied_proof_other_task", 0, bad, calls)
+ for name, x in (("nudged_figure", 0.5 * (xp + xf)), ("figure_plus_10_percent", xp * 1.1)):
+ design, changes = moved_design(env, card["passing"], x)
+ add(name, 0, dict(card, passing=design), apply_changes(calls, changes))
+ design, changes = moved_design(env, card["passing"], 0.5 * (xp + xf))
+ add("card_request_not_run", 0, card, apply_changes(calls, changes[:1]))
+ add("swapped_sides", 0, dict(card, passing=card["failing"], failing=card["passing"]), calls)
+ other = [c["id"] for c in check["constraints"] if c["id"] != card["binding"]]
+ add("binding_misnamed", 0, dict(card, binding=other[0] if other else "none"), calls)
+ bad = copy.deepcopy(card)
+ for key, _ in parts:
+ if bad["failing"][key]["proof"] != card["passing"][key]["proof"]:
+ bad["failing"][key]["proof"] = card["passing"][key]["proof"]
+ break
+ add("proof_from_other_design", 0, bad, calls)
+ add("failing_given_as_passing", 0, dict(card, passing=copy.deepcopy(card["failing"])), calls)
+ bad = copy.deepcopy(card)
+ bad["passing"][first]["proof"] = bad["passing"][first]["proof"].upper()
+ add("proof_uppercase", 0, bad, calls)
+ bad = copy.deepcopy(card)
+ bad["passing"][first]["request"]["arguments"]["note"] = "the same run"
+ changes = [(first_tool, card["passing"][first]["request"]["arguments"], bad["passing"][first]["request"]["arguments"])]
+ add("extra_argument", 0, bad, apply_changes(calls, changes))
+ if card["failing"].get("stopped"):
+ bad = copy.deepcopy(card)
+ bad["failing"]["stopped"] = "SomeOtherStop"
+ add("stop_misnamed", 0, bad, calls)
+ if "step" in card["failing"]:
+ bad = copy.deepcopy(card)
+ bad["failing"]["step"] = card["failing"]["step"] + 1
+ add("step_misnamed", 0, bad, calls)
+ else:
+ skipped.append(("step_misnamed", "the stop that binds is a solve's: it has no step"))
+ else:
+ skipped += [("stop_misnamed", "no stop binds"), ("step_misnamed", "no stop binds")]
+ if len(parts) > 1:
+ last = parts[-1][0]
+ bad = copy.deepcopy(card)
+ del bad["passing"][last]
+ add("missing_solve", 0, bad, calls)
+ # the later request handed the other design's earlier request and proof (or, staged, its later request)
+ bad = copy.deepcopy(card)
+ later = bad["passing"][last]["request"]["arguments"]
+ if shape in ("coupled", "continued"):
+ later["from"]["run_seal"] = card["failing"]["run"]["proof"]
+ later["from"]["request"] = copy.deepcopy(card["failing"]["run"]["request"]["arguments"])
+ same = card["failing"]["run"]["proof"] == card["passing"]["run"]["proof"]
+ else:
+ bad["passing"][last] = copy.deepcopy(card["failing"][last])
+ same = card["failing"][parts[0][0]]["proof"] == card["passing"][parts[0][0]]["proof"]
+ if same:
+ skipped.append(("solve_handed_other_run", "the two designs share one first request"))
+ else:
+ add("solve_handed_other_run", 0, bad, apply_changes(calls, [(parts[-1][1], card["passing"][last]["request"]["arguments"],
+ bad["passing"][last]["request"]["arguments"])])
+ if shape in ("coupled", "continued") else calls)
+ else:
+ skipped += [("missing_solve", "a design of one request"), ("solve_handed_other_run", "a design of one request")]
+ if shape == "continued":
+ bad = copy.deepcopy(card)
+ start = bad["failing"]["next"]["request"]["arguments"]["initial"]
+ for k, v in start.items():
+ if isinstance(v, float) and v != 0.0:
+ start[k] = float("%.9g" % v)
+ if start == card["failing"]["next"]["request"]["arguments"]["initial"]:
+ for k, v in start.items():
+ if isinstance(v, float):
+ start[k] = v * (1 + 1e-12) if v else 1e-12
+ break
+ add("next_start_rounded", 0, bad, apply_changes(calls, [("run_trajectory", card["failing"]["next"]["request"]["arguments"],
+ bad["failing"]["next"]["request"]["arguments"])]))
+ bad = copy.deepcopy(card)
+ bad["failing"]["next"]["proof"] = card["passing"]["next"]["proof"]
+ add("next_proof_copied", 0, bad, calls)
+ bad = copy.deepcopy(card)
+ bad["failing"]["next"]["request"]["arguments"]["segments"][-1]["steps"] += 1
+ add("next_request_edited", 0, bad, apply_changes(calls, [("run_trajectory", card["failing"]["next"]["request"]["arguments"],
+ bad["failing"]["next"]["request"]["arguments"])]))
+ else:
+ skipped += [(v, "not a continued design") for v in ("next_start_rounded", "next_proof_copied", "next_request_edited")]
+ skipped += [(v, "forensics only") for v in ("every_row_genuine", "every_row_false", "every_row_false_true_reasons")]
+
+ elif family == "budget":
+ xh, xs = ref["holds"]["x"], ref["stops"]["x"]
+ oid, proof = other_proof(env, others, check["tool"])
+ bad = copy.deepcopy(card)
+ bad["holds"]["proof"] = proof
+ add("copied_proof_other_task", 0, bad, calls)
+ for name, x in (("nudged_figure", 0.5 * (xh + xs)), ("figure_plus_10_percent", xs * 1.1)):
+ side, changes = moved_budget(env, card["stops"], x)
+ add(name, 0, dict(card, stops=side), apply_changes(calls, changes))
+ side, changes = moved_budget(env, card["stops"], 0.5 * (xh + xs))
+ add("card_request_not_run", 0, card, apply_changes(calls, changes))
+ add("swapped_sides", 0, dict(card, holds={k: v for k, v in card["stops"].items() if k != "stopped"},
+ stops=dict(card["holds"], stopped=check["stop"])), calls)
+ bad = copy.deepcopy(card)
+ bad["stops"]["stopped"] = "SomeOtherStop"
+ add("stop_misnamed", 0, bad, calls)
+ bad = copy.deepcopy(card)
+ bad["stops"]["proof"] = card["holds"]["proof"]
+ add("proof_from_other_design", 0, bad, calls)
+ bad = copy.deepcopy(card)
+ bad["holds"]["proof"] = bad["holds"]["proof"].upper()
+ add("proof_uppercase", 0, bad, calls)
+ bad = copy.deepcopy(card)
+ bad["holds"]["request"]["arguments"]["note"] = "the same run"
+ add("extra_argument", 0, bad, apply_changes(calls, [(check["tool"], card["holds"]["request"]["arguments"],
+ bad["holds"]["request"]["arguments"])]))
+ skipped += [(v, "not a budget card") for v in ("binding_misnamed", "failing_given_as_passing", "step_misnamed",
+ "missing_solve", "solve_handed_other_run", "every_row_genuine",
+ "every_row_false", "every_row_false_true_reasons",
+ "next_start_rounded", "next_proof_copied", "next_request_edited")]
+ else:
+ rows = [r["row"] for r in check["rows"]]
+ reasons = check.get("reasons") or ["value_altered"]
+ truth = ref["false_rows"]
+ if truth:
+ add("every_row_genuine", 0, {"false_rows": {}}, calls)
+ else:
+ skipped.append(("every_row_genuine", "the table has no false row: that is the right answer"))
+ add("every_row_false", 0, {"false_rows": {r: reasons[0] for r in rows}}, calls)
+ add("every_row_false_true_reasons", 0, {"false_rows": {r: truth.get(r, reasons[0]) for r in rows}}, calls)
+ skipped += [(v, "a forensics card carries no request or proof") for v in (
+ "copied_proof_other_task", "nudged_figure", "figure_plus_10_percent", "card_request_not_run", "swapped_sides",
+ "binding_misnamed", "proof_from_other_design", "failing_given_as_passing", "proof_uppercase", "extra_argument",
+ "stop_misnamed", "step_misnamed", "missing_solve", "solve_handed_other_run",
+ "next_start_rounded", "next_proof_copied", "next_request_edited")]
+ return out, skipped
+
+
+def ensure_reference(env, folder, engine):
+ reply_path = os.path.join(folder, env["id"] + ".txt")
+ log_path = os.path.join(folder, env["id"] + ".harness.jsonl")
+ if os.path.isfile(reply_path) and os.path.isfile(log_path):
+ return
+ from run_reference import proxied, reference_reply
+ verifier = proxied(engine, log_path)
+ try:
+ reply, calls = reference_reply(env, verifier)
+ finally:
+ close_verifier(verifier)
+ open(reply_path, "w", encoding="utf-8").write(reply + "\n")
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--reference", required=True)
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--out")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ os.makedirs(args.reference, exist_ok=True)
+ for env in environments:
+ ensure_reference(env, args.reference, args.engine)
+ honest = {}
+ for env in environments:
+ card, problem = read_card(open(os.path.join(args.reference, env["id"] + ".txt"), encoding="utf-8").read())
+ calls, log_problem = read_harness_log(os.path.join(args.reference, env["id"] + ".harness.jsonl"))
+ if problem or log_problem or calls is None:
+ sys.exit("the honest reference of %s cannot be read: %s" % (env["id"], problem or log_problem or "no harness log"))
+ honest[env["id"]] = (card, calls)
+ others = [(i, c) for i, (c, _) in honest.items()]
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ verifier = open_verifier(args.engine)
+ rows, failures, by_vector = [], 0, {}
+ scratch = tempfile.mkdtemp(prefix="ztp_cheats_")
+ try:
+ for env in environments:
+ card, calls = honest[env["id"]]
+ replay = Replay(verifier)
+ built, skipped = vectors(env, card, calls, others, scratch)
+ for name, expect, env_, card_, calls_, reply_calls, log_problem in built:
+ row = score(env_, "A reply.\n\n" + json.dumps(card_), replay, calls_, reply_calls, "harness", log_problem)
+ ok = (row["reward"] == 1 and row["graded"] == 1.0) if expect else (row["reward"] == 0 and row["graded"] == 0.0)
+ failures += not ok
+ one = {"task": env["id"], "family": env["family"], "vector": name, "applies": True, "expect": expect,
+ "reward": row["reward"], "graded": row["graded"], "verdict": row["verdict"], "reason": row["reason"], "ok": ok}
+ rows.append(one)
+ tally = by_vector.setdefault(name, [0, 0, 0])
+ tally[0] += 1
+ tally[1] += not ok
+ print("%-4s %-52s %-30s reward %d graded %.4f %s" % ("ok" if ok else "FAIL", env["id"], name, row["reward"],
+ row["graded"], (row["reason"] or "")[:110]), flush=True)
+ for name, why in skipped:
+ rows.append({"task": env["id"], "family": env["family"], "vector": name, "applies": False, "why": why})
+ by_vector.setdefault(name, [0, 0, 0])[2] += 1
+ finally:
+ close_verifier(verifier)
+ if args.out:
+ with open(args.out, "w", encoding="utf-8") as f:
+ for row in rows:
+ f.write(json.dumps(row) + "\n")
+ print("\n%-30s %6s %6s %6s" % ("vector", "tasks", "fail", "n/a"))
+ for name in sorted(by_vector):
+ print("%-30s %6d %6d %6d" % (name, *by_vector[name]))
+ scored = [r for r in rows if r["applies"]]
+ print("\n%d tasks, %d scored attempts (%d honest controls, %d cheats); %d failures" % (
+ len(environments), len(scored), sum(1 for r in scored if r["expect"]), sum(1 for r in scored if not r["expect"]), failures))
+ sys.exit(1 if failures else 0)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/scorer/run_naive.py b/sample/scorer/run_naive.py
new file mode 100644
index 0000000000000000000000000000000000000000..a8ccc29abc9ddf51103db6cfd37254367bddbb1a
--- /dev/null
+++ b/sample/scorer/run_naive.py
@@ -0,0 +1,175 @@
+"""A one-call agent: one forward request at a plausible default, and its answer reported.
+
+ python3 run_naive.py --engine ENGINE --environments F --out DIR [--only id,id]
+
+It shows what a single tool call earns on a set. For a tradeoff or chain_design environment it sends
+one run at the middle of the design's range (no solve: one call) and gives it as both designs; a staged design
+sends its first stage's request that way, and a solve design a solve. For a
+budget environment it sends the task's request at the middle of the stated span and gives it as both
+sides, naming the task's stop. For a forensics table it sends the first row's request and calls every
+row genuine. Calls go through harness/mcp_log_proxy.py, as in run_reference.py.
+
+ python3 score.py DIR --engine ENGINE --environments F --calls-from harness
+ python3 run_naive.py --gate DIR --environments F --scores F
+
+--gate reads what the run left. A task with no reply, no logged call, or no score row, or a score of "the reply is empty",
+stops it with exit 1: a 0 with nothing behind it is not a one-call score. It prints the counts, solve-shape rows and calls
+the verifier answered with an error among them.
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import json
+import math
+import os
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from run_reference import proxied # noqa: E402
+from score import close_verifier, load_environments, open_verifier, set_path # noqa: E402
+
+DEFAULTS = {"aerospace/capsule_stardust": 8.21, "energy/reactor_triga_jsi": 2.5, "energy/reactor_spert3": 1.0,
+ "energy/cell_2170_model3": 5.0, "energy/grid_gb": 1000.0}
+
+
+def middle(env, spec):
+ if spec.get("range"):
+ return 0.5 * sum(spec["range"])
+ if env["models"][0] in DEFAULTS:
+ return DEFAULTS[env["models"][0]]
+ return float(env["reference"]["boundary"]) * 0.9 # a guess near the answer, one call only
+
+
+def naive_reply(env, verifier):
+ calls = []
+ family = env["family"]
+ if family in ("tradeoff", "chain_design"):
+ spec = env["check"]["design"]
+ var = spec["variable"]
+ if spec.get("stages") or spec.get("tool") == "solve" or spec.get("kind") == "solve":
+ # a staged design has no check.design.template (its first stage is sent), and a solve design is sent as a solve, not a run
+ key, tool, template = (spec["stages"][0]["key"], spec["stages"][0]["tool"], spec["stages"][0]["template"]) if spec.get("stages") else ("solve", "solve", spec["template"])
+ q = copy.deepcopy(template)
+ if not spec.get("stages") or var.get("stage") == key:
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(q, place, middle(env, spec))
+ calls.append({"tool": tool, "arguments": q})
+ body, is_error = verifier.call_json(tool, q)
+ proof = (body.get("run_seal") or body.get("solution_seal")) if isinstance(body, dict) else None
+ one = {key: {"request": {"tool": tool, "arguments": q}, "proof": proof}}
+ card = {"passing": one, "failing": one, "binding": env["check"]["constraints"][0]["id"]}
+ return "One request at the middle of the range.\n\n" + json.dumps(card), calls
+ run = copy.deepcopy(spec["template"])
+ if var["kind"] == "entry_angle_deg":
+ g = math.radians(middle(env, spec))
+ run["initial"]["radial_speed_m_s"] = -var["speed_m_s"] * math.sin(g)
+ run["initial"]["transverse_speed_m_s"] = var["speed_m_s"] * math.cos(g)
+ elif var.get("on", "run") == "run" and var["path"].startswith("initial.start_temperature_k"):
+ set_path(run, var["path"], 296.15)
+ elif var.get("on", "run") == "run":
+ value = middle(env, spec)
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(run, place, value)
+ calls.append({"tool": "run_trajectory", "arguments": run})
+ body, is_error = verifier.call_json("run_trajectory", run)
+ proof = body.get("run_seal") if isinstance(body, dict) else None
+ one = {"run": {"request": {"tool": "run_trajectory", "arguments": run}, "proof": proof}}
+ card = {"passing": one, "failing": one, "binding": env["check"]["constraints"][0]["id"]}
+ words = "One run at the default design."
+ elif family == "budget":
+ lo, hi = env["reference"].get("span") or (env["reference"]["boundary"] * 0.9, env["reference"]["boundary"] * 1.1)
+ request = copy.deepcopy(env["check"]["template"])
+ for place in [env["check"]["variable"]] + list(env["check"].get("also") or []):
+ set_path(request, place, 0.5 * (lo + hi))
+ calls.append({"tool": env["check"]["tool"], "arguments": request})
+ body, is_error = verifier.call_json(env["check"]["tool"], request)
+ proof = (body.get("run_seal") or body.get("solution_seal")) if isinstance(body, dict) else None
+ side = {"request": {"tool": env["check"]["tool"], "arguments": request}, "proof": proof}
+ card = {"holds": side, "stops": dict(side, stopped=env["check"]["stop"])}
+ words = "One run at the middle of the span."
+ else:
+ first = env["check"]["rows"][0]["request"]
+ calls.append(first)
+ verifier.call_json(first["tool"], first["arguments"])
+ card = {"false_rows": {}}
+ words = "The first row came back; every row is taken as genuine."
+ return words + "\n\n" + json.dumps(card), calls
+
+
+def gate(folder, environments_path, scores_path):
+ environments = load_environments(environments_path)
+ scores = {}
+ if os.path.isfile(scores_path):
+ with open(scores_path, encoding="utf-8") as f:
+ scores = {r["id"]: r for r in (json.loads(line) for line in f if line.strip())}
+ missing, errors, solve_shape, staged = [], 0, 0, 0
+ for env in environments:
+ tid = env["id"]
+ spec = env["check"].get("design") or {}
+ staged += bool(spec.get("stages"))
+ solve_shape += spec.get("tool") == "solve" or spec.get("kind") == "solve" or env["check"].get("tool") == "solve"
+ reply = os.path.join(folder, tid + ".txt")
+ log = os.path.join(folder, tid + ".harness.jsonl")
+ lines = []
+ if os.path.isfile(log):
+ with open(log, encoding="utf-8") as f:
+ lines = [json.loads(line) for line in f if line.strip()]
+ errors += sum(1 for line in lines if line.get("is_error"))
+ row = scores.get(tid)
+ if not os.path.isfile(reply) or not open(reply, encoding="utf-8").read().strip():
+ missing.append(tid + " (no reply)")
+ elif not lines:
+ missing.append(tid + " (no call)")
+ elif row is None:
+ missing.append(tid + " (no score)")
+ elif row.get("reason") == "the reply is empty":
+ missing.append(tid + " (empty reply)")
+ rows = [scores[e["id"]] for e in environments if e["id"] in scores]
+ print("one-call agent: replied on %d of %d; reward above 0 on %d, graded above 0 on %d; solve-shape rows %d, staged rows %d; calls answered with an error %d" % (
+ len(environments) - len(missing), len(environments), sum(1 for r in rows if r.get("reward")), sum(1 for r in rows if r.get("graded")), solve_shape, staged, errors))
+ if missing:
+ sys.exit("NOT a one-call score: " + ", ".join(missing[:8]))
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--engine")
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out")
+ parser.add_argument("--only")
+ parser.add_argument("--direct", action="store_true")
+ parser.add_argument("--gate", metavar="DIR")
+ parser.add_argument("--scores")
+ args = parser.parse_args()
+ if args.gate:
+ return gate(args.gate, args.environments, args.scores or "")
+ if not args.engine or not args.out:
+ parser.error("give --engine and --out")
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ os.makedirs(args.out, exist_ok=True)
+ shared = open_verifier(args.engine) if args.direct else None
+ try:
+ for env in environments:
+ verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl"))
+ try:
+ reply, calls = naive_reply(env, verifier)
+ finally:
+ if not shared:
+ close_verifier(verifier)
+ with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f:
+ f.write(reply + "\n")
+ with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f:
+ for c in calls:
+ f.write(json.dumps(c) + "\n")
+ finally:
+ if shared:
+ close_verifier(shared)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/scorer/run_reference.py b/sample/scorer/run_reference.py
new file mode 100644
index 0000000000000000000000000000000000000000..0dc7d591e31fb27d4a9ccc2c2a50f5436eb503b2
--- /dev/null
+++ b/sample/scorer/run_reference.py
@@ -0,0 +1,208 @@
+"""An agent with no model in it: answer every environment from its reference, through the harness proxy.
+
+ python3 run_reference.py --engine ENGINE --environments F --out DIR [--only id,id] [--direct]
+
+For a tradeoff or chain_design environment it sends the reference passing and failing runs to the
+verifier, hands each run to its solve through the task's coupling where the task has one, and writes
+the card with the seals this verifier gives. For a budget environment it sends the two reference
+requests. For a forensics table it puts the table to the verifier (each row's request as sent, up to
+the task's budget) and names the false rows the build recorded.
+
+Every call goes through harness/mcp_log_proxy.py, started in an empty working folder, so the
+authoritative call record is DIR/.harness.jsonl, as in a pass@k attempt. The same calls are also
+written beside the reply, DIR/.calls.jsonl. --direct talks to ENGINE with no proxy and writes the
+reply-side log only.
+
+ python3 score.py DIR --engine ENGINE --environments F --calls-from harness
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import json
+import os
+import subprocess
+import sys
+import tempfile
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+import chainlib # noqa: E402
+from score import (FREE_TOOLS, NOT_STOPPED, build_stage_request, close_verifier, continuation_of, design_shape, # noqa: E402
+ file_sha256, get_path, load_environments, open_verifier)
+from ztp_mcp import McpError, StdioVerifier # noqa: E402
+
+PROXY = os.path.join(HERE, "..", "harness", "mcp_log_proxy.py")
+
+
+class ProxiedVerifier(StdioVerifier):
+ """The engine behind the logging proxy, the proxy started in its own empty working folder."""
+
+ def __init__(self, engine, log, cwd=None, **kwargs):
+ self.cwd = cwd or tempfile.mkdtemp(prefix="ztp_ref_cwd_")
+ if engine.startswith("http://") or engine.startswith("https://"):
+ # an MCP address: the proxy runs the stdio bridge to it (ztp_open_bridge.py, beside this file)
+ child = [sys.executable, os.path.join(HERE, "ztp_open_bridge.py"), engine]
+ else:
+ child = [os.path.abspath(engine)]
+ command = [sys.executable, os.path.abspath(PROXY), "--log", os.path.abspath(log), "--"] + child
+ super(StdioVerifier, self).__init__(url="stdio: " + " ".join(command), timeout_s=600, **kwargs)
+ self.proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, cwd=self.cwd)
+ self.binary_sha256 = None if len(child) > 1 else file_sha256(engine)
+
+ def close(self):
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ try:
+ self.proc.wait(timeout=60)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def proxied(engine, log, cwd=None):
+ if os.path.exists(log):
+ os.remove(log)
+ verifier = ProxiedVerifier(engine, log, cwd)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the proxied verifier failed: %s" % problem)
+ return verifier
+
+
+class Logged:
+ def __init__(self, verifier):
+ self.verifier, self.calls, self.seen = verifier, [], {}
+
+ def call(self, tool, arguments, refused_ok=False):
+ # the same request twice is one call: a chain with its value in the next run has one first run for both designs
+ key = json.dumps([tool, arguments], sort_keys=True)
+ if key in self.seen and not self.seen[key][1]:
+ return self.seen[key][0]
+ self.calls.append({"tool": tool, "arguments": arguments})
+ body, is_error = self.verifier.call_json(tool, arguments)
+ self.seen[key] = (body, is_error)
+ if is_error and not refused_ok:
+ raise SystemExit("the reference request was refused: %s %s" % (tool, str(body)[:300]))
+ return body
+
+
+def design_staged(env, ref, agent):
+ """A staged design: each stage sent in order, handed values and continuations built from this verifier's answers."""
+ spec = env["check"]["design"]
+ answers, requests, out = {}, {}, {}
+ for stage in spec["stages"]:
+ q = build_stage_request(spec, stage, ref["x"], answers, requests)
+ body = agent.call(stage["tool"], q, refused_ok=True)
+ stopped = body.get("outcome") not in NOT_STOPPED
+ answers[stage["key"]] = {"body": body, "proof": body.get("run_seal") or body.get("solution_seal"),
+ "outcome": body.get("outcome"), "stop": body.get("reject") if stopped else None, "stopped": stopped}
+ requests[stage["key"]] = q
+ out[stage["key"]] = {"request": {"tool": stage["tool"], "arguments": q}, "proof": answers[stage["key"]]["proof"]}
+ return out
+
+
+def design(env, ref, agent):
+ spec = env["check"]["design"]
+ shape = design_shape(spec)
+ if shape == "staged":
+ return design_staged(env, ref, agent)
+ if shape == "solve":
+ solved = agent.call("solve", ref["solve"], refused_ok=True)
+ return {"solve": {"request": {"tool": "solve", "arguments": ref["solve"]}, "proof": solved["solution_seal"]}}
+ run_args = ref["run"]
+ run = agent.call("run_trajectory", run_args)
+ out = {"run": {"request": {"tool": "run_trajectory", "arguments": run_args}, "proof": run["run_seal"]}}
+ if shape == "continued":
+ # the run that continues this design's own sealed run: the reference's next run, its start fields and from
+ # set from this verifier's answer to the first run
+ _, carried, _, _ = continuation_of(spec)
+ next_args = copy.deepcopy(ref["next"])
+ next_args["initial"] = {name: get_path(run, source) for name, source in carried.items()}
+ next_args["from"] = {"request": run_args, "run_seal": run["run_seal"]}
+ nxt = agent.call("run_trajectory", next_args, refused_ok=True)
+ out["next"] = {"request": {"tool": "run_trajectory", "arguments": next_args}, "proof": nxt["run_seal"]}
+ elif spec.get("chain"):
+ overrides = {}
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ overrides[spec["variable"]["path"].split(".", 1)[1]] = ref["x"]
+ solve_args = chainlib.chained_solve(spec["chain"], run_args, run, overrides)
+ solved = agent.call("solve", solve_args)
+ out["solve"] = {"request": {"tool": "solve", "arguments": solve_args}, "proof": solved["solution_seal"]}
+ return out
+
+
+def reference_reply(env, verifier):
+ """(reply text, calls [{"tool", "arguments"}])."""
+ agent = Logged(verifier)
+ family, ref = env["family"], env["reference"]
+ if family in ("tradeoff", "chain_design"):
+ card = {"passing": design(env, ref["passing"], agent), "failing": design(env, ref["failing"], agent), "binding": ref["binding"]}
+ if ref["failing"].get("stopped"):
+ card["failing"]["stopped"] = ref["failing"]["stopped"]
+ if ref["failing"].get("steps_landed") is not None:
+ card["failing"]["step"] = ref["failing"]["steps_landed"]
+ words = "The boundary lies between the two designs below; %s binds." % ref["binding"]
+ elif family == "budget":
+ card = {}
+ for side in ("holds", "stops"):
+ request = ref[side]["request"]
+ answer = agent.call(request["tool"], request["arguments"])
+ card[side] = {"request": request, "proof": answer.get("run_seal") or answer.get("solution_seal")}
+ card["stops"]["stopped"] = env["check"]["stop"]
+ words = "The stop %s lies between the two requests below." % env["check"]["stop"]
+ else:
+ agent.call("list_cards", {}, refused_ok=True)
+ rows = env["check"]["rows"]
+ budget = env["check"].get("budget") or len(rows)
+ computing = 0
+ for row in rows:
+ request = row["request"]
+ if computing >= budget:
+ break
+ if request["tool"] in FREE_TOOLS:
+ continue
+ agent.call(request["tool"], request["arguments"], refused_ok=True)
+ computing += 1
+ card = {"false_rows": ref["false_rows"]}
+ words = "%d of the %d rows are false." % (len(ref["false_rows"]), len(rows))
+ return words + "\n\n" + json.dumps(card), agent.calls
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--direct", action="store_true", help="no proxy: the reply-side log only")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ os.makedirs(args.out, exist_ok=True)
+ shared = open_verifier(args.engine) if args.direct else None
+ try:
+ for env in environments:
+ verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl"))
+ try:
+ reply, calls = reference_reply(env, verifier)
+ finally:
+ if not shared:
+ close_verifier(verifier)
+ with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f:
+ f.write(reply + "\n")
+ with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f:
+ for c in calls:
+ f.write(json.dumps(c) + "\n")
+ print("%-60s %d calls" % (env["id"], len(calls)), flush=True)
+ finally:
+ if shared:
+ close_verifier(shared)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/scorer/score.py b/sample/scorer/score.py
new file mode 100644
index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2
--- /dev/null
+++ b/sample/scorer/score.py
@@ -0,0 +1,1199 @@
+"""Score replies to the multi-step environments with no judge: a program and the verifier.
+
+ python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F]
+ [--calls-from reply|harness] [--harness-dir DIR]
+
+ REPLIES is a folder with one file per environment, .txt, the whole text of a reply.
+ --calls-from harness the call record is the harness's own: .harness.jsonl, written by
+ harness/mcp_log_proxy.py outside the solver's working directory (in
+ --harness-dir, default REPLIES). A .calls.jsonl beside the reply,
+ when there is one, is read only to catch an edit: it must equal the
+ harness log call for call.
+ --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply:
+ one JSON object a line, {"tool": "", "arguments": {...}}.
+
+ ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address
+ beginning http. A task is scored only on the engine it was built on: the verifier's version must
+ be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's
+ reference.engine_binary_sha256.
+
+The answer card is one JSON object on the reply's last line. Its shape is the family's:
+
+ tradeoff, chain_design (kind design_to_limit, chained_design)
+ {"passing": DESIGN, "failing": DESIGN, "binding": ""}
+ DESIGN = {"run": {"request": R, "proof": ""},
+ "solve": {"request": R, "proof": ""}} (solve only where the task has one)
+ Where a constraint is that the run completes and it binds, the failing DESIGN also carries
+ "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}}
+ The design shapes, one scorer for every group (check.design says which):
+ run a run alone.
+ coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run.
+ continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of
+ the same card that continues it through from, starting from its sealed final state,
+ DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template
+ is chain.next_template, chain.template or chain.next; its start fields are chain.carried
+ ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or
+ chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on
+ "next" reads the next run, and a stop constraint judges it.
+ solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no
+ run. A binding refusal is named ("stopped") with no step.
+ staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per
+ stage in order; a later stage carries an earlier stage's answer at a named input (handed) or
+ continues an earlier run (continues), bit for bit.
+ A constraint's read may carry "index": one entry of an output the verifier returns as a list.
+ budget (kind budgeted_search)
+ {"holds": {"request": R, "proof": ""},
+ "stops": {"request": R, "proof": "", "stopped": ""}}
+ forensics
+ {"false_rows": {"": "", ...}} ({} when every row is genuine)
+
+Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a
+solution_seal, short form) and every number judged is read from the verifier's own answer to the
+card's request, sent again here, never from the reply.
+
+Scores per environment
+----------------------
+reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1.
+ proofs_hold: every proof on the card verifies. correct: the card is the right answer and
+ nothing below under "integrity" failed.
+graded in [0, 1], beside reward.
+
+ Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not
+ verify (a copied, nudged, edited or stale proof); a request differs from the task's template other
+ than at the design variable; a chained solve not handed its own design's sealed run; no call log;
+ a call log beside the reply that differs from the harness log; a harness log whose chain breaks;
+ a forbidden tool called; more computing calls than the budget; a request on the card that is not
+ among the calls; a forensics answer with no computing call behind it; a task built on another
+ engine than the verifier.
+
+ tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the
+ passing design meets every constraint and the failing one breaks the named binding constraint
+ (budget: holds completes, stops ends with the task's stop, named on the card), on the side the
+ task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0.
+ With the sides right:
+
+ e = the length of the smallest interval holding both designs' values and the reference
+ boundary (for a bracket that straddles the boundary, its width)
+ tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget)
+ r = e / tol
+ graded = 1 when reward is 1 (r <= 1 and the bracket straddles it)
+ = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score
+ (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25)
+ = 0.5 when r <= 1 but the bracket misses the reference boundary
+ by more than the slack (another crossing than the one asked)
+
+ The decay is smooth and falls monotonically with r, and a near miss scores near the top.
+
+ forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found
+ only with its right reason. precision = found / named, recall = found / false rows; an empty
+ answer to a table with no false row scores 1. A card that names every row of the table false is
+ a blanket answer and scores 0, as do unknown rows and reasons outside the task's list.
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import hashlib
+import json
+import math
+import os
+import re
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402
+
+FAMILIES = ("tradeoff", "chain_design", "budget", "forensics")
+KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"}
+NOT_STOPPED = ("completed", "converged")
+PREFIX_ENDS = ("__", ".", ":", "/")
+VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite",
+ "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset",
+ "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip")
+# Calls that read the catalogue compute nothing and are free in a call budget.
+FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt")
+REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden")
+GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r)
+OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary
+
+
+class Integrity(Exception):
+ """The answer cannot be trusted: graded 0 and reward 0."""
+
+
+class Wrong(Exception):
+ """The answer is trusted and wrong: graded 0 and reward 0."""
+
+
+def load_environments(path):
+ with open(path, encoding="utf-8") as f:
+ return [json.loads(line) for line in f if line.strip()]
+
+
+def row_problems(env):
+ """What a task row lacks against the shared row contract (empty when none)."""
+ out = []
+ for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"):
+ if key not in env:
+ out.append("no %s" % key)
+ family = env.get("family")
+ if family not in FAMILIES:
+ out.append("family %r" % family)
+ elif "kind" in env and env["kind"] != KINDS[family]:
+ out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family]))
+ ref = env.get("reference") or {}
+ for key in ("engine_tag", "engine_commit", "engine_binary_sha256"):
+ if not ref.get(key):
+ out.append("reference.%s missing" % key)
+ return out
+
+
+def file_sha256(path):
+ h = hashlib.sha256()
+ with open(path, "rb") as f:
+ for block in iter(lambda: f.read(1 << 20), b""):
+ h.update(block)
+ return h.hexdigest()
+
+
+def open_verifier(engine):
+ if engine.startswith("http://") or engine.startswith("https://"):
+ verifier = Verifier(engine, pause_s=0.5)
+ verifier.binary_sha256 = None
+ else:
+ if not os.path.isfile(engine):
+ sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine)
+ verifier = StdioVerifier([engine])
+ verifier.binary_sha256 = file_sha256(engine)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the verifier failed, so nothing was scored: %s" % problem)
+ if not isinstance(verifier.server, dict) or not verifier.server.get("name"):
+ close_verifier(verifier)
+ sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine)
+ return verifier
+
+
+def close_verifier(verifier):
+ if hasattr(verifier, "close"):
+ verifier.close()
+
+
+# ------------------------------------------------------------------------------------------
+# reading the reply and the call logs
+# ------------------------------------------------------------------------------------------
+def _no_constant(name):
+ raise ValueError("%s is not a number" % name)
+
+
+def read_card(reply):
+ """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over."""
+ lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()]
+ while lines and lines[-1].startswith("```"):
+ lines.pop()
+ if not lines:
+ return None, "the reply is empty"
+ try:
+ card = json.loads(lines[-1], parse_constant=_no_constant)
+ except ValueError:
+ return None, "the last line is not one JSON object"
+ if not isinstance(card, dict):
+ return None, "the last line is not one JSON object"
+ return card, None
+
+
+def tool_name(name):
+ """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve)."""
+ if not isinstance(name, str):
+ return None
+ if name in VERIFIER_TOOLS:
+ return name
+ for tool in VERIFIER_TOOLS:
+ for joint in PREFIX_ENDS:
+ if name.endswith(joint + tool):
+ return tool
+ return name
+
+
+def without_readout(arguments):
+ """A run's arguments as sealed: a readout is not part of a run's seal."""
+ if not isinstance(arguments, dict):
+ return arguments
+ return {k: v for k, v in arguments.items() if k != "readout"}
+
+
+def numbers_by_value(value):
+ """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept."""
+ if isinstance(value, dict):
+ return {k: numbers_by_value(v) for k, v in value.items()}
+ if isinstance(value, list):
+ return [numbers_by_value(v) for v in value]
+ if isinstance(value, int) and not isinstance(value, bool):
+ return float(value)
+ return value
+
+
+def canonical(arguments):
+ """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value."""
+ return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":"))
+
+
+def _arguments(one):
+ arguments = one.get("arguments")
+ if isinstance(arguments, str):
+ try:
+ arguments = json.loads(arguments)
+ except ValueError:
+ arguments = {}
+ return arguments if isinstance(arguments, dict) else {}
+
+
+def read_calls(path):
+ """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log."""
+ if not path or not os.path.isfile(path):
+ return None
+ calls = []
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for line in f:
+ line = line.strip()
+ if not line:
+ continue
+ try:
+ one = json.loads(line)
+ except ValueError:
+ continue
+ if isinstance(one, dict):
+ calls.append((tool_name(one.get("tool")), _arguments(one)))
+ return calls
+
+
+def chain_of(previous, entry):
+ payload = json.dumps(entry, sort_keys=True, separators=(",", ":"))
+ return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest()
+
+
+def read_harness_log(path):
+ """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log;
+ problem names the first line whose chain does not follow (an edit, a line taken out or put in)."""
+ if not path or not os.path.isfile(path):
+ return None, None
+ calls, previous = [], None
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for number_, line in enumerate(f, 1):
+ if not line.strip():
+ continue
+ try:
+ entry = json.loads(line)
+ except ValueError:
+ return calls, "line %d of the harness log is not JSON" % number_
+ if not isinstance(entry, dict) or "chain" not in entry:
+ return calls, "line %d of the harness log carries no chain" % number_
+ chain = entry.pop("chain")
+ if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1:
+ return calls, "the harness log's chain breaks at line %d" % number_
+ previous = chain
+ calls.append((tool_name(entry.get("tool")), _arguments(entry)))
+ return calls, None
+
+
+def write_harness_log(path, calls):
+ """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)]."""
+ previous = None
+ with open(path, "w", encoding="utf-8") as f:
+ for seq, (tool, arguments) in enumerate(calls, 1):
+ entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None,
+ "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False}
+ entry["chain"] = chain_of(previous, entry)
+ previous = entry["chain"]
+ f.write(json.dumps(entry, sort_keys=True) + "\n")
+
+
+# ------------------------------------------------------------------------------------------
+# the verifier, asked again
+# ------------------------------------------------------------------------------------------
+def stop_name_in(sentence):
+ names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "")
+ return names[-1] if names else None
+
+
+class Replay:
+ """The verifier, with every answer remembered: the same request is sent once."""
+
+ def __init__(self, verifier):
+ self.verifier = verifier
+ self.seen = {}
+ server = getattr(verifier, "server", None) or {}
+ self.version = server.get("version")
+ self.binary_sha256 = getattr(verifier, "binary_sha256", None)
+
+ def call(self, tool, arguments):
+ key = tool + "\x00" + json.dumps(arguments, sort_keys=True)
+ if key not in self.seen:
+ try:
+ self.seen[key] = self.verifier.call_json(tool, arguments)
+ except McpError as problem:
+ if not str(problem).startswith("protocol error"):
+ raise SystemExit("the verifier failed, so nothing was scored: %s" % problem)
+ self.seen[key] = ("the verifier did not take the request: %s" % problem, True)
+ return self.seen[key]
+
+ def answer(self, tool, arguments, readout=None):
+ """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}."""
+ arguments = copy.deepcopy(without_readout(arguments))
+ if readout is not None and tool == "run_trajectory":
+ arguments["readout"] = readout
+ body, is_error = self.call(tool, arguments)
+ if is_error or not isinstance(body, dict):
+ sentence = body if isinstance(body, str) else json.dumps(body)
+ return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence),
+ "proof": None, "body": None, "sentence": sentence}
+ outcome = body.get("outcome")
+ stopped = outcome not in NOT_STOPPED
+ return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None,
+ "proof": body.get("run_seal") or body.get("solution_seal"), "body": body,
+ "sentence": body.get("reject_detail")}
+
+ def proof_holds(self, tool, arguments, proof):
+ """(holds, words): the card's seal verified by verify_tape or verify_solution, short form."""
+ if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof):
+ return False, "the proof is not a SHA-384 seal of 96 hex digits"
+ if tool == "run_trajectory":
+ body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof})
+ elif tool == "solve":
+ body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof})
+ else:
+ return False, "a proof is verified for run_trajectory or solve only, not %s" % tool
+ if is_error or not isinstance(body, dict):
+ return False, "the verifier would not verify it: %s" % (str(body)[:200])
+ if body.get("holds") is True:
+ return True, None
+ return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause")
+
+
+def engine_problem(env, replay):
+ """None when the verifier is the engine the task was built on; else what differs."""
+ ref = env.get("reference") or {}
+ tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v")
+ if not tag:
+ return "the task names no engine it was built on"
+ if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag:
+ return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version"))
+ if replay.version != tag:
+ return "the task was built on engine %s; the verifier is %s" % (tag, replay.version)
+ want = ref.get("engine_binary_sha256")
+ if replay.binary_sha256 and want and replay.binary_sha256 != want:
+ return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12])
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# requests and their inputs
+# ------------------------------------------------------------------------------------------
+_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)")
+
+
+def get_path(obj, path):
+ here = obj
+ for part in path.split("."):
+ found = _PART.fullmatch(part)
+ if not found or not isinstance(here, dict) or found.group(1) not in here:
+ return None
+ here = here[found.group(1)]
+ for index in re.findall(r"\[(\d+)\]", found.group(2)):
+ if not isinstance(here, list) or int(index) >= len(here):
+ return None
+ here = here[int(index)]
+ return here
+
+
+def set_path(obj, path, value):
+ parts = path.split(".")
+ here = obj
+ for i, part in enumerate(parts):
+ m = _PART.fullmatch(part)
+ name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))]
+ last = i == len(parts) - 1
+ if not idx:
+ if last:
+ here[name] = value
+ else:
+ here = here[name]
+ else:
+ here = here[name]
+ for j, k in enumerate(idx):
+ if last and j == len(idx) - 1:
+ here[k] = value
+ else:
+ here = here[k]
+
+
+def number(value):
+ return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value)
+
+
+def differs(template, given, free, where=""):
+ """The first place where a request differs from the task's, other than the free places. None when none."""
+ if where in free:
+ return None
+ if isinstance(template, dict):
+ if not isinstance(given, dict):
+ return where or "the request"
+ for key in set(template) | set(given):
+ place = "%s.%s" % (where, key) if where else key
+ if place in free:
+ continue
+ if key not in given or key not in template:
+ return place
+ found = differs(template[key], given[key], free, place)
+ if found:
+ return found
+ return None
+ if isinstance(template, list):
+ if not isinstance(given, list) or len(given) != len(template):
+ return where
+ for index, (a, b) in enumerate(zip(template, given)):
+ found = differs(a, b, free, "%s[%d]" % (where, index))
+ if found:
+ return found
+ return None
+ if number(template) and number(given):
+ return None if float(template) == float(given) else where
+ return None if template == given else where
+
+
+def design_value(variable, run_arguments, solve_arguments, next_arguments=None):
+ """The design variable of one design, read from its requests (on: run, solve, or next, a continued run)."""
+ kind = variable["kind"]
+ if kind == "path":
+ on = variable.get("on", "run")
+ source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {}
+ value = get_path(source, variable["path"])
+ for place in variable.get("also") or []:
+ again = get_path(source, place)
+ if not (number(again) and number(value) and float(again) == float(value)):
+ return None
+ return float(value) if number(value) else None
+ if kind == "entry_angle_deg":
+ radial = get_path(run_arguments or {}, "initial.radial_speed_m_s")
+ transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s")
+ if not (number(radial) and number(transverse)) or transverse <= 0:
+ return None
+ speed = math.hypot(radial, transverse)
+ if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]:
+ return None
+ return math.degrees(math.atan2(-radial, transverse))
+ return None
+
+
+def variable_places(variable):
+ if variable["kind"] == "entry_angle_deg":
+ return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"}
+ if variable["kind"] == "path" and variable.get("on", "run") == "run":
+ return {variable["path"]} | set(variable.get("also") or [])
+ return set()
+
+
+def read_value(read, answer):
+ """One number from a replayed answer: final, result, or the extreme of a run's readout."""
+ body = answer["body"]
+ if body is None:
+ return None
+ kind = read["kind"]
+ value = None
+ if kind == "final":
+ value = (body.get("final_state") or {}).get(read["quantity"])
+ elif kind == "result":
+ value = (body.get("result") or {}).get(read["quantity"])
+ elif kind == "flag_extent":
+ # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it
+ value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or []
+ if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0])
+ elif kind == "extreme":
+ for quantity in (body.get("readout") or {}).get("quantities") or []:
+ if quantity.get("quantity") == read["quantity"]:
+ value = quantity.get(read["which"])
+ if "index" in read:
+ # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points)
+ k = read["index"]
+ value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None
+ return value if number(value) else None
+
+
+def readout_for(constraints, on="run"):
+ """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key)."""
+ quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"})
+ return {"quantities": quantities} if quantities else None
+
+
+def design_shape(spec):
+ """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged."""
+ if spec.get("stages"):
+ return "staged"
+ if spec.get("tool") == "solve" or spec.get("kind") == "solve":
+ return "solve"
+ chain = spec.get("chain") or {}
+ if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue":
+ return "continued"
+ return "coupled" if chain else "run"
+
+
+def continuation_of(spec):
+ """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it},
+ next outcomes, the next run's places that also hold a first-run design value)."""
+ chain = spec["chain"]
+ template = chain.get("next_template") or chain.get("template") or chain.get("next")
+ if "carried" in chain: # group 1
+ carried = dict(chain["carried"])
+ elif "handed" in chain: # group 4
+ named = chain.get("handed_from") or {}
+ carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]}
+ else: # group 5
+ carried = {k: "final_state." + k for k in chain.get("carry") or []}
+ if chain.get("clock"):
+ carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"]
+ outcomes = chain.get("next_outcomes") or spec["run_outcomes"]
+ return template, carried, outcomes, list(chain.get("next_also") or [])
+
+
+def meets(constraint, value):
+ if value is None:
+ return False
+ return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"]
+
+
+def history_layout_problem(layout, parameters, frames_count):
+ """None when the arrays of a chained solve are laid out as the task states; else what is not."""
+ if layout is None:
+ return None
+ if layout["kind"] == "stardust_slab":
+ names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s",
+ "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2")
+ columns = [parameters.get(name) for name in names]
+ if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns):
+ return "the history columns are not all lists of numbers"
+ time, pressure, coefficient, enthalpy, radiative = columns
+ rows = frames_count + 3
+ if any(len(c) != rows for c in columns):
+ return "the history has not one row before the %d frames handed and two after them" % frames_count
+ if time[0] != 0.0 or coefficient[0] != 0.0:
+ return "row 0 is not at 0 s with no heating"
+ if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]:
+ return "row 0 does not repeat the first frame's pressure and enthalpy"
+ if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]:
+ return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"]
+ if coefficient[-2] != 0.0 or coefficient[-1] != 0.0:
+ return "the stream is not off after the frames"
+ if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]:
+ return "the rows after the frames do not hold the last frame's pressure and enthalpy"
+ if any(v != 0.0 for v in radiative):
+ return "a row of the history holds radiative heating"
+ return None
+ if layout["kind"] == "triga_element":
+ return None # every array is handed by the coupling and held to its bits by the verifier
+ return "an unknown layout"
+
+
+# ------------------------------------------------------------------------------------------
+# the call record
+# ------------------------------------------------------------------------------------------
+def card_requests(env, card):
+ """Every request on the card, [(tool, arguments)], read leniently (for the call log)."""
+ out = []
+
+ def take(part):
+ if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict):
+ out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"]))
+
+ if env["family"] in ("tradeoff", "chain_design"):
+ stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []]
+ for side in ("passing", "failing"):
+ design = card.get(side) if isinstance(card.get(side), dict) else {}
+ for key in stages or ("run", "solve", "next"):
+ take(design.get(key))
+ elif env["family"] == "budget":
+ take(card.get("holds"))
+ take(card.get("stops"))
+ return out
+
+
+def sequence(calls):
+ return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls]
+
+
+def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row):
+ """None when the call record holds; else why not (an integrity failure)."""
+ check = env["check"]
+ if calls_from == "harness":
+ if calls is None:
+ return "no harness call log: every attempt is scored with the calls the harness recorded"
+ if log_problem:
+ return log_problem
+ if reply_calls is not None and sequence(reply_calls) != sequence(calls):
+ return "the call log beside the reply differs from the harness log"
+ elif calls is None:
+ return "no call log: every environment is scored with the agent's calls"
+ calls = [(tool_name(t), a) for t, a in calls]
+ banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])})
+ if banned:
+ return "the log holds calls of %s, which the task rules out" % ", ".join(banned)
+ computing = [(t, a) for t, a in calls if t not in FREE_TOOLS]
+ row["computing_calls"] = len(computing)
+ if check.get("budget") and len(computing) > check["budget"]:
+ return "%d computing calls; the budget is %d" % (len(computing), check["budget"])
+ sent = {(t, canonical(a)) for t, a in computing}
+ for tool, arguments in card_requests(env, card):
+ if (tool, canonical(arguments)) not in sent:
+ return "a %s request on the card is not among the calls in the log" % tool
+ if env["family"] == "forensics" and not computing:
+ return "no computing call behind the answer: the table was not put to the verifier"
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# the families
+# ------------------------------------------------------------------------------------------
+def request_of(part, tool, what):
+ """The arguments of one request on the card (Integrity when it is not one)."""
+ if not isinstance(part, dict):
+ raise Integrity("%s is missing" % what)
+ request = part.get("request")
+ if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)):
+ raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what)
+ if tool_name(request.get("tool")) != tool:
+ raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool))
+ return request["arguments"]
+
+
+def score_design(env, design, which, replay, proofs):
+ """One design of a boundary family: facts {x, met, values, stopped, steps_landed}."""
+ check = env["check"]
+ spec = check["design"]
+ shape = design_shape(spec)
+ if shape in ("solve", "staged", "continued") and not isinstance(design, dict):
+ raise Integrity("the %s design is missing" % which)
+ if shape == "solve":
+ return score_solve_design(env, design, which, replay, proofs)
+ if shape == "staged":
+ return score_staged_design(env, design, which, replay, proofs)
+ if shape == "continued":
+ return score_continued_design(env, design, which, replay, proofs)
+ chain = spec.get("chain")
+ run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory",
+ "the %s design's run" % which)
+ free = set(spec.get("free") or []) | variable_places(spec["variable"])
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ for place in spec.get("free") or []:
+ if place.endswith(".steps"):
+ steps = get_path(run_args, place)
+ if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)):
+ raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"]))
+ stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"]
+ stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names
+ if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name:
+ raise Wrong("the %s design's run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ solve_args, solve = None, None
+ if chain:
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != chain["solver"]:
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ handed = solve_args.get("from")
+ if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]:
+ raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"]))
+ if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof:
+ raise Integrity("the %s design's solve is not handed the design's own sealed run" % which)
+ parameters = solve_args.get("parameters")
+ if not isinstance(parameters, dict):
+ raise Integrity("the %s design's solve has no parameters" % which)
+ solve_free = set(chain.get("handed") or [])
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ solve_free.add(spec["variable"]["path"].split(".", 1)[1])
+ where = differs(chain["parameters"], parameters, solve_free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where))
+ frames = len((run["body"] or {}).get("frames") or [])
+ problem = history_layout_problem(chain.get("layout"), parameters, frames)
+ if problem:
+ raise Integrity("the %s design's solve: %s" % (which, problem))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] != "converged":
+ raise Wrong("the %s design's solve comes back %s%s, not converged" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else ""))
+ x = design_value(spec["variable"], run_args, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", "")))
+ met, values = {}, {}
+ for constraint in check["constraints"]:
+ if constraint["on"] == "outcome":
+ values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"])
+ met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"])
+ continue
+ value = read_value(constraint["read"], run if constraint["on"] == "run" else solve)
+ values[constraint["id"]] = value
+ met[constraint["id"]] = meets(constraint, value)
+ facts = {"x": x, "met": met, "values": values}
+ if run["outcome"] not in NOT_STOPPED and run["body"]:
+ facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed")
+ return facts
+
+
+def halted(answer, stop, staged=False):
+ """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that
+ is not completed or converged (group 3's rule, kept as built)."""
+ if staged:
+ return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop
+ return answer["outcome"] == "refused" and answer["stop"] == stop
+
+
+def constraint_facts(check, answers, judged, staged=False):
+ """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop
+ constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design."""
+ met, values = {}, {}
+ for c in check["constraints"]:
+ if c["on"] == "outcome":
+ a = answers.get(c["stage"]) if c.get("stage") else judged
+ values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"]))
+ met[c["id"]] = a is not None and not halted(a, c["stop"], staged)
+ continue
+ a = answers.get(c["on"])
+ value = read_value(c["read"], a) if a is not None else None
+ values[c["id"]] = value
+ met[c["id"]] = meets(c, value) if c.get("limit") is not None else None
+ return met, values
+
+
+def stopped_by(answer, constraints, stage=None):
+ """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given)."""
+ return any(halted(answer, c["stop"], stage is not None) for c in constraints
+ if c["on"] == "outcome" and (stage is None or c.get("stage") == stage))
+
+
+def score_solve_design(env, design, which, replay, proofs):
+ """One design that is one solve and no run (check.design.tool or kind "solve")."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != spec["template"].get("solver"):
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or [])
+ where = differs(spec["template"], solve_args, free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at %s" % (which, where))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]):
+ raise Wrong("the %s design's solve comes back %s%s, not %s" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"])))
+ x = design_value(dict(var, on="solve"), None, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, {"solve": solve}, solve)
+ facts = {"x": x, "met": met, "values": values}
+ if solve["outcome"] not in NOT_STOPPED and solve["body"]:
+ facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True
+ return facts
+
+
+def score_continued_design(env, design, which, replay, proofs):
+ """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes
+ the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer
+ also holds each carried start field to the first run's answer, bit for bit."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ on_next = var["kind"] == "path" and var.get("on") == "next"
+ template, carried, next_outcomes, next_also = continuation_of(spec)
+ run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which)
+ free = set(spec.get("free") or []) | (set() if on_next else variable_places(var))
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run"))
+ if run["outcome"] not in spec["run_outcomes"]:
+ raise Wrong("the %s design's first run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which)
+ handed = next_args.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args)
+ or handed.get("run_seal") != run_proof):
+ raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which)
+ next_free = {"initial." + name for name in carried} | {"from"} | set(next_also)
+ if on_next:
+ next_free |= {var["path"]} | set(var.get("also") or [])
+ where = differs(template, without_readout(next_args), next_free)
+ if where:
+ raise Integrity("the %s design's next run differs from the task's at %s" % (which, where))
+ start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {}
+ for name, source in carried.items():
+ held, given = get_path(run["body"] or {}, source), start.get(name)
+ if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))):
+ raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source))
+ holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's next run_seal: %s" % (which, words))
+ nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next"))
+ if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]):
+ raise Wrong("the %s design's next run comes back %s%s, not %s" % (
+ which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes)))
+ x = design_value(var, run_args, None, next_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ for place in next_also:
+ again = get_path(next_args, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place))
+ met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt)
+ facts = {"x": x, "met": met, "values": values}
+ if nxt["outcome"] not in NOT_STOPPED and nxt["body"]:
+ facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed")
+ return facts
+
+
+def build_stage_request(spec, stage, x, answers, requests):
+ """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from
+ earlier stages' answers, and a continuation's start and from (used by run_reference.py)."""
+ q = copy.deepcopy(stage["template"])
+ var = spec["variable"]
+ if var.get("stage") == stage["key"]:
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(q, place, x)
+ for h in stage.get("handed") or []:
+ set_path(q, h["to"], read_value(h["read"], answers[h["from"]]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ final = answers[parent]["body"]["final_state"]
+ q["initial"] = {k: final[k] for k in stage["template"]["initial"]}
+ q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]}
+ return q
+
+
+def score_staged_design(env, design, which, replay, proofs):
+ """One staged design (check.design.stages): each stage a run or a solve, in order."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ stages = spec["stages"]
+ answers, requests, facts = {}, {}, {}
+ for i, stage in enumerate(stages):
+ key, tool = stage["key"], stage["tool"]
+ sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key)))
+ free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []}
+ if var.get("stage") == key:
+ free |= {var["path"]} | set(var.get("also") or [])
+ if stage.get("continues"):
+ free |= {"initial", "from"}
+ where = differs(stage["template"], sent, free)
+ if where:
+ raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where))
+ for h in stage.get("handed") or []:
+ want = read_value(h["read"], answers[h["from"]])
+ got = get_path(sent, h["to"])
+ if want is None or not number(got) or float(got) != float(want):
+ raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % (
+ which, key, h["from"], h["read"]["quantity"], h["to"]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ handed = sent.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent])
+ or handed.get("run_seal") != design[parent].get("proof")):
+ raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent))
+ final = (answers[parent]["body"] or {}).get("final_state") or {}
+ start = sent.get("initial")
+ keys = set(stage["template"]["initial"])
+ if not isinstance(start, dict) or set(start) != keys or any(
+ not number(start[k]) or float(start[k]) != final.get(k) for k in keys):
+ raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent))
+ holds, words = replay.proof_holds(tool, sent, design[key].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's %s proof: %s" % (which, key, words))
+ answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None)
+ named = stopped_by(answer, check["constraints"], stage=key)
+ if answer["outcome"] not in stage["outcomes"] and not named:
+ raise Wrong("the %s design's %s comes back %s%s, not %s" % (
+ which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"])))
+ answers[key], requests[key] = answer, sent
+ if named:
+ facts["stopped"], facts["stopped_stage"] = answer["stop"], key
+ facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None
+ facts["no_step"] = tool != "run_trajectory"
+ if i != len(stages) - 1:
+ raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"]))
+ x = design_value(dict(var, on="run"), requests.get(var["stage"]), None)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, answers, None, staged=True)
+ facts.update({"x": x, "met": met, "values": values})
+ return facts
+
+
+def grade_bracket(a, b, star, tol, slack, row):
+ """(reward_ok, graded) for a bracket [a, b] with its sides right."""
+ width = abs(b - a)
+ straddles = min(a, b) - slack <= star <= max(a, b) + slack
+ within = width <= tol * (1 + 1e-9)
+ e = max(a, b, star) - min(a, b, star)
+ r = e / tol if tol > 0 else float("inf")
+ row["width"], row["width_ratio"] = width, r
+ if within and straddles:
+ return True, 1.0
+ if r <= 1:
+ return False, OTHER_CROSSING
+ return False, GRADED_DECAY ** math.log10(r)
+
+
+def score_boundary(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ passing = score_design(env, card.get("passing"), "passing", replay, proofs)
+ failing = score_design(env, card.get("failing"), "failing", replay, proofs)
+ row["passing"], row["failing"] = passing, failing
+ span = check["design"].get("range")
+ if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])):
+ raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span))
+ broken = [c for c, ok in passing["met"].items() if not ok]
+ if broken:
+ raise Wrong("the passing design breaks %s" % ", ".join(broken))
+ broken = [c for c, ok in failing["met"].items() if not ok]
+ if not broken:
+ raise Wrong("the failing design meets every constraint")
+ binding = card.get("binding")
+ if binding != reference["binding"]:
+ raise Wrong("binding names %r; the constraint that binds is another" % (binding,))
+ if binding not in broken:
+ raise Wrong("the failing design does not break %s, the constraint named binding" % binding)
+ if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]:
+ said = card.get("failing") or {}
+ if said.get("stopped") != failing.get("stopped"):
+ raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped")))
+ if failing.get("no_step"):
+ pass # a solve that is refused has no step: its stop's name is stated
+ elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")):
+ raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step")))
+ spec = check["design"]
+ xp, xf = passing["x"], failing["x"]
+ if spec["direction"] == "largest" and not xf > xp:
+ raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one")
+ if spec["direction"] == "smallest" and not xf < xp:
+ raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one")
+ ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row)
+ if not ok:
+ return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % (
+ abs(xf - xp), spec["tolerance"])
+ return 1.0, None
+
+
+def score_budget(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ template, path, tool = check["template"], check["variable"], check["tool"]
+ sides = {}
+ for side in ("holds", "stops"):
+ arguments = request_of(card.get(side), tool, side)
+ also = check.get("also") or []
+ where = differs(template, without_readout(arguments), {path} | set(also))
+ if where:
+ raise Integrity("the %s request differs from the task's at %s" % (side, where))
+ x = get_path(arguments, path)
+ if not number(x):
+ raise Integrity("the %s request has no number at %s" % (side, path))
+ for place in also:
+ again = get_path(arguments, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path))
+ holds, words = replay.proof_holds(tool, arguments, card[side].get("proof"))
+ proofs.append(holds)
+ sides[side] = (float(x), arguments, holds, words)
+ for side in ("holds", "stops"):
+ if not sides[side][2]:
+ raise Integrity("the %s seal: %s" % (side, sides[side][3]))
+ held = replay.answer(tool, sides["holds"][1])
+ stopped = replay.answer(tool, sides["stops"][1])
+ row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"])
+ if held["outcome"] not in NOT_STOPPED:
+ raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"]))
+ if stopped["stop"] != check["stop"]:
+ raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"]))
+ if card["stops"].get("stopped") != check["stop"]:
+ raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"]))
+ xh, xs = sides["holds"][0], sides["stops"][0]
+ star = reference["boundary"]
+ row["holds_value"], row["stops_value"] = xh, xs
+ tol = check["relative_width"] * abs(star)
+ ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row)
+ if not ok:
+ return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % (
+ abs(xs - xh), check["relative_width"])
+ return 1.0, None
+
+
+def forensics_f1(env, named):
+ """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer."""
+ if not isinstance(named, dict):
+ return 0.0, "false_rows is not an object of row and reason"
+ rows = [c["row"] for c in env["check"]["rows"]]
+ truth = env["reference"]["false_rows"]
+ unknown = [r for r in named if r not in set(rows)]
+ if unknown:
+ return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown))
+ reasons = env["check"].get("reasons") or REASONS
+ bad = [r for r, why in named.items() if why not in reasons]
+ if bad:
+ return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons))
+ if rows and set(named) == set(rows):
+ return 0.0, "every row of the table is named false: a blanket answer"
+ found = sum(1 for r, why in named.items() if truth.get(r) == why)
+ if not truth and not named:
+ return 1.0, None
+ precision = found / len(named) if named else 0.0
+ recall = found / len(truth) if truth else 0.0
+ f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0
+ if f1 >= 1.0:
+ return 1.0, None
+ missed = sorted(set(truth) - set(named))
+ wrongly = sorted(set(named) - set(truth))
+ wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r])
+ said = []
+ if missed:
+ said.append("%d false row(s) not named" % len(missed))
+ if wrongly:
+ said.append("%d genuine row(s) named false" % len(wrongly))
+ if wrong_reason:
+ said.append("%d false row(s) with another reason" % len(wrong_reason))
+ return f1, "; ".join(said)
+
+
+def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None):
+ """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record);
+ reply_calls: the reply-side log, compared with calls under calls_from="harness"."""
+ row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from,
+ "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None}
+ card, problem = read_card(reply)
+ if problem:
+ row.update(verdict="no_card", reason=problem)
+ return row
+ proofs = []
+ try:
+ problem = engine_problem(env, replay)
+ if problem:
+ raise Integrity(problem)
+ problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row)
+ if problem:
+ raise Integrity(problem)
+ family = env["family"]
+ if family in ("tradeoff", "chain_design"):
+ graded, reason = score_boundary(env, card, replay, row, proofs)
+ elif family == "budget":
+ graded, reason = score_budget(env, card, replay, row, proofs)
+ elif family == "forensics":
+ named = card.get("false_rows")
+ if isinstance(named, dict):
+ row["named"] = named
+ graded, reason = forensics_f1(env, named)
+ proofs = [True]
+ if reason and graded == 0.0 and not isinstance(named, dict):
+ raise Wrong(reason)
+ else:
+ raise Wrong("unknown family %s" % family)
+ except Integrity as problem:
+ row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ except Wrong as problem:
+ row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ proofs_hold = int(bool(proofs) and all(proofs))
+ correct = int(graded >= 1.0 and reason is None)
+ row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1),
+ graded=round(graded, 6) if proofs_hold else 0.0,
+ verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason)
+ return row
+
+
+def records_for(folder, env_id, calls_from, harness_dir=None):
+ """(calls, reply_calls, log_problem) for one environment's reply in folder."""
+ reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl"))
+ if calls_from == "harness":
+ calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl"))
+ return calls, reply_calls, log_problem
+ return reply_calls, None, None
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
+ parser.add_argument("replies")
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out")
+ parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness")
+ parser.add_argument("--harness-dir")
+ parser.add_argument("--quiet", action="store_true")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ missing = wanted - {e["id"] for e in environments}
+ if missing:
+ sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments))
+ for env in environments:
+ for problem in row_problems(env):
+ print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr)
+ verifier = open_verifier(args.engine)
+ replay = Replay(verifier)
+ rows = []
+ try:
+ for env in environments:
+ path = os.path.join(args.replies, env["id"] + ".txt")
+ reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else ""
+ calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir)
+ row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem)
+ rows.append(row)
+ if not args.quiet:
+ print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"],
+ row["reason"] or ""), flush=True)
+ replay.seen.clear()
+ finally:
+ close_verifier(verifier)
+ if args.out:
+ with open(args.out, "w", encoding="utf-8") as f:
+ for row in rows:
+ f.write(json.dumps(row) + "\n")
+ total = len(rows)
+ print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % (
+ total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows),
+ sum(r["graded"] for r in rows) / total if total else 0.0,
+ sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows)))
+ by = {}
+ for r in rows:
+ by.setdefault(r["family"], []).append(r)
+ for family in FAMILIES:
+ if family in by:
+ print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]),
+ sum(r["graded"] for r in by[family]) / len(by[family])))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/scorer/ztp_mcp.py b/sample/scorer/ztp_mcp.py
new file mode 100644
index 0000000000000000000000000000000000000000..1afbc12d8c05d8c143563152ffae500e8052a6db
--- /dev/null
+++ b/sample/scorer/ztp_mcp.py
@@ -0,0 +1,188 @@
+"""A small Model Context Protocol client for the Zero-Trust Physics verifier.
+
+Standard library only. It speaks MCP two ways:
+
+ stdio to a verifier built from the public source and started here as a program
+ (target/release/mcp_stdio): one JSON-RPC message a line, no network.
+ HTTP to an MCP address (JSON-RPC in a POST), such as
+
+ https://mcp.zerotrustphysics.com/mcp/open Open to any agent.
+
+The open address gives each network address one place in the physics pool at a
+time and answers "Too many concurrent physics tasks." or HTTP 429 when it is
+busy; nothing waits on the server, so this client sends one request at a time
+and, when it is told to come back, waits and sends the same request again.
+
+Licence: Apache-2.0.
+"""
+import json
+import select
+import shlex
+import subprocess
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+
+
+class McpError(RuntimeError):
+ pass
+
+
+class Verifier:
+ """One MCP endpoint. call(tool, arguments) returns (text, is_error)."""
+
+ def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True):
+ self.url = url
+ self.timeout_s = timeout_s
+ self.patience_s = patience_s # how long to keep asking politely before giving up on one request
+ self.pause_s = pause_s # a fixed pause after every request, for a shared address
+ self.headers = dict(headers or {})
+ self.quiet = quiet
+ self.session = None
+ self.server = None
+ self.requests_sent = 0
+ self.times_asked_to_wait = 0
+ self._id = 0
+
+ # -- transport -------------------------------------------------------------------------
+ def _post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-environments/1.0", **self.headers}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ self.requests_sent += 1
+ with urllib.request.urlopen(request, timeout=self.timeout_s) as response:
+ session = response.headers.get("Mcp-Session-Id")
+ if session:
+ self.session = session
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ raise McpError("the event stream held no answer to the request")
+ return json.loads(raw) if raw.strip() else {}
+
+ def _ask(self, method, params=None):
+ """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again."""
+ self._id += 1
+ message = {"jsonrpc": "2.0", "id": self._id, "method": method}
+ if params is not None:
+ message["params"] = params
+ started, wait = time.time(), 2.0
+ while True:
+ reason = None
+ try:
+ answer = self._post(message)
+ if "error" in answer:
+ raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300])
+ result = answer.get("result", {})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ if method == "tools/call" and BUSY in text and len(text) < 400:
+ reason = "the physics pool is busy"
+ else:
+ if self.pause_s:
+ time.sleep(self.pause_s)
+ return result
+ except urllib.error.HTTPError as problem:
+ if problem.code == 429 or problem.code >= 500:
+ after = problem.headers.get("Retry-After")
+ reason = "HTTP %d" % problem.code
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ else:
+ raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300]))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem:
+ reason = "no connection (%s)" % problem
+ self.times_asked_to_wait += 1
+ if time.time() - started + wait > self.patience_s:
+ raise McpError("gave up after %d s: %s" % (self.patience_s, reason))
+ if not self.quiet:
+ print(" %s; asking again in %.0f s" % (reason, wait), flush=True)
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+ # -- protocol --------------------------------------------------------------------------
+ def connect(self):
+ result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {},
+ "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}})
+ self.server = result.get("serverInfo")
+ try:
+ self._post({"jsonrpc": "2.0", "method": "notifications/initialized"})
+ except Exception: # a notification has no answer; some servers close without one
+ pass
+ return result
+
+ def tools(self):
+ """The tool declarations exactly as the endpoint gives them."""
+ return self._ask("tools/list").get("tools", [])
+
+ def call(self, tool, arguments=None):
+ """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag."""
+ result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ return text, bool(result.get("isError"))
+
+ def call_json(self, tool, arguments=None):
+ """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON."""
+ text, is_error = self.call(tool, arguments)
+ try:
+ return json.loads(text), is_error
+ except ValueError:
+ return text, is_error
+
+
+class StdioVerifier(Verifier):
+ """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line.
+ For anyone who holds an MCP server as a program; the open address needs none of this."""
+
+ def __init__(self, command, timeout_s=600, **kwargs):
+ super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs)
+ self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+
+ def _post(self, message):
+ self.requests_sent += 1
+ try:
+ self.proc.stdin.write((json.dumps(message) + "\n").encode())
+ self.proc.stdin.flush()
+ except OSError: # a program that has stopped reading will not start again
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ raise McpError("the program stopped reading")
+ if "id" not in message:
+ return {}
+ while True:
+ ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s)
+ if not ready:
+ raise McpError("no answer in %d s" % self.timeout_s)
+ line = self.proc.stdout.readline()
+ if not line:
+ raise McpError("the program closed its output")
+ found = json.loads(line)
+ if found.get("id") == message["id"]:
+ return found
+
+ def close(self):
+ self.proc.terminate()
+ try:
+ self.proc.wait(timeout=5)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def connect(endpoint=OPEN_ADDRESS, **kwargs):
+ """A connected verifier: an http(s) address, or "stdio:" for a program."""
+ verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs)
+ verifier.connect()
+ return verifier
diff --git a/sample/scorer/ztp_open_bridge.py b/sample/scorer/ztp_open_bridge.py
new file mode 100644
index 0000000000000000000000000000000000000000..bc0e20b469db24286278a387680ad8d3898f0661
--- /dev/null
+++ b/sample/scorer/ztp_open_bridge.py
@@ -0,0 +1,109 @@
+"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's
+MCP address, and its answer written back on stdout, one line each. Standard library only.
+
+ python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp/open
+
+It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio
+server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds
+nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a
+notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for
+every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same
+message again, as ztp_mcp.Verifier does, so a client sees one answer per request.
+
+Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no
+key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image.
+
+Licence: Apache-2.0.
+"""
+import json
+import os
+import sys
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900"))
+API_KEY = os.environ.get("ZTP_API_KEY") or None
+
+
+class Bridge:
+ def __init__(self, url):
+ self.url = url
+ self.session = None
+ self.extra_headers = {}
+
+ def post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-bridge/1.0"}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ if API_KEY:
+ headers["Authorization"] = "Bearer " + API_KEY
+ headers.update(self.extra_headers)
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ with urllib.request.urlopen(request, timeout=600) as response:
+ if response.headers.get("Mcp-Session-Id"):
+ self.session = response.headers["Mcp-Session-Id"]
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "id" not in message:
+ return None
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}}
+ return json.loads(raw) if raw.strip() else None
+
+ def forward(self, message):
+ started, wait = time.time(), 2.0
+ while True:
+ try:
+ answer = self.post(message)
+ text = ""
+ if isinstance(answer, dict) and isinstance(answer.get("result"), dict):
+ text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict))
+ if not (BUSY in text and len(text) < 400):
+ return answer
+ except urllib.error.HTTPError as problem:
+ if not (problem.code == 429 or problem.code >= 500):
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}}
+ after = problem.headers.get("Retry-After")
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError):
+ pass
+ if time.time() - started + wait > PATIENCE_S:
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}}
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+
+def main():
+ bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS)
+ for line in sys.stdin:
+ if not line.strip():
+ continue
+ try:
+ message = json.loads(line)
+ except ValueError:
+ continue
+ answer = bridge.forward(message)
+ if answer is not None:
+ sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n")
+ sys.stdout.flush()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/hud_taskset.json b/sample/tasks/harbor/hud_taskset.json
new file mode 100644
index 0000000000000000000000000000000000000000..38545bba4bedbf82b5003b1ce2e6dce94482a7ae
--- /dev/null
+++ b/sample/tasks/harbor/hud_taskset.json
@@ -0,0 +1,214 @@
+{
+ "format": "Harbor task directories, for HUD's Harbor import",
+ "rests_on": "HUD imports Harbor tasks; this file indexes them",
+ "dataset": "zero-trust-physics-sample-batteries-thermal-runaway-grid-frequency@2026-11-13",
+ "hud_export": "tasks/hud/tasks",
+ "hud_runtime": {
+ "runs_as_shipped": false,
+ "harbor_tasks": "HUD's adapter (hud 0.6.21) takes these Harbor directories, but they declare a stdio MCP server, which HUD's agents are not given: to run a task on HUD use tasks/hud/tasks.",
+ "export": "tasks/hud/tasks takes HUD's adapter (hud 0.6.21) and its proxy and grader images have run with no route out. HUD's hosted runtime has not run these tasks with an agent.",
+ "docs": "https://docs.hud.ai/v6/experimental/harbor"
+ },
+ "tasks": [
+ {
+ "id": "g1d-budget5-cell1000-current-16min-11c",
+ "harbor_path": "tasks/g1d-budget5-cell1000-current-16min-11c",
+ "family": "budget",
+ "kind": "budgeted_search",
+ "prompt_file": "tasks/g1d-budget5-cell1000-current-16min-11c/instruction.md",
+ "prompt": "Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.62 Ah, rested at 93 percent charge with its case at 11 degrees Celsius, is discharged at one constant current for 16 minutes (960 steps of 1 s), its case held at 11 degrees Celsius. Above some current it reaches its lower voltage limit before the 16 minutes are up (UndervoltageLimit). Find that current, in amps.\n\nFind it to five significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.001 percent of the value apart. It lies between 10 and 15 A.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.93, \"capacity_ah\": 4.62, \"case_temperature_least_c\": 11.0, \"case_temperature_most_c\": 11.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 960, \"load\": {\"current_a\": \"\", \"case_temperature_c\": 11.0}}], \"record_every\": 960}}\n\nBudget: at most 5 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"holds\": {\"request\": ..., \"proof\": ...}, \"stops\": {\"request\": ..., \"proof\": ..., \"stopped\": \"\"}}\n\nholds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n",
+ "grader": {
+ "command": "bash /tests/test.sh",
+ "file": "tasks/g1d-budget5-cell1000-current-16min-11c/tests/test.sh",
+ "runs_in": "a fresh copy of the task image (environment_mode separate)",
+ "reward_file": "/logs/verifier/reward.json",
+ "scores": [
+ "reward",
+ "correct",
+ "proofs_hold"
+ ]
+ },
+ "mcp_servers": [
+ {
+ "name": "verifier",
+ "transport": "stdio",
+ "command": "/usr/local/bin/mcp_stdio",
+ "args": []
+ }
+ ],
+ "hud_export": "tasks/hud/tasks/g1d-budget5-cell1000-current-16min-11c",
+ "artifacts": [
+ "/app/answer.json",
+ "/app/calls.jsonl",
+ "/logs/agent/trajectory.json"
+ ],
+ "engine": {
+ "source": "https://github.com/johnkruze/zero-trust-physics-engine",
+ "tag": "v0.15.3",
+ "commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "sha256": "e16d994186e52ec102270282dc0856b571b5e7424974a810a8e875fa24f93b99"
+ },
+ {
+ "id": "g1f-budget4-cell1000-least-capacity-15a-31c",
+ "harbor_path": "tasks/g1f-budget4-cell1000-least-capacity-15a-31c",
+ "family": "budget",
+ "kind": "budgeted_search",
+ "prompt_file": "tasks/g1f-budget4-cell1000-least-capacity-15a-31c/instruction.md",
+ "prompt": "Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, rested at 88 percent charge with its case at 31 degrees Celsius, is discharged at 15 A for 10 minutes (600 steps of 1 s), its case held at 31 degrees Celsius. Its capacity (capacity_ah) is the one input you change: an aged cell holds less. Below some capacity it reaches its lower voltage limit before the 10 minutes are up (UndervoltageLimit). Find that capacity, in ampere-hours.\n\nFind it to four significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.01 percent of the value apart. It lies between 2.5 and 4.1 Ah.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.88, \"capacity_ah\": \"\", \"case_temperature_least_c\": 31.0, \"case_temperature_most_c\": 31.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 600, \"load\": {\"current_a\": 15.0, \"case_temperature_c\": 31.0}}], \"record_every\": 600}}\n\nBudget: at most 4 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"holds\": {\"request\": ..., \"proof\": ...}, \"stops\": {\"request\": ..., \"proof\": ..., \"stopped\": \"\"}}\n\nholds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n",
+ "grader": {
+ "command": "bash /tests/test.sh",
+ "file": "tasks/g1f-budget4-cell1000-least-capacity-15a-31c/tests/test.sh",
+ "runs_in": "a fresh copy of the task image (environment_mode separate)",
+ "reward_file": "/logs/verifier/reward.json",
+ "scores": [
+ "reward",
+ "correct",
+ "proofs_hold"
+ ]
+ },
+ "mcp_servers": [
+ {
+ "name": "verifier",
+ "transport": "stdio",
+ "command": "/usr/local/bin/mcp_stdio",
+ "args": []
+ }
+ ],
+ "hud_export": "tasks/hud/tasks/g1f-budget4-cell1000-least-capacity-15a-31c",
+ "artifacts": [
+ "/app/answer.json",
+ "/app/calls.jsonl",
+ "/logs/agent/trajectory.json"
+ ],
+ "engine": {
+ "source": "https://github.com/johnkruze/zero-trust-physics-engine",
+ "tag": "v0.15.3",
+ "commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "sha256": "83321caff349d6ecd808c741eae87aa9b59215a58aad96ae41c277a5cefd49e0"
+ },
+ {
+ "id": "g1d-limit-cell448-lowest-start-charge-11min-18c",
+ "harbor_path": "tasks/g1d-limit-cell448-lowest-start-charge-11min-18c",
+ "family": "tradeoff",
+ "kind": "design_to_limit",
+ "prompt_file": "tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/instruction.md",
+ "prompt": "Cell m448 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.47 Ah, with its case at 18 degrees Celsius, is rested at a state of charge that you choose and then discharged at 9.6 A for eleven minutes (660 steps of 1 s), its case held at 18 degrees Celsius.\n\nFind the smallest starting state of charge (a fraction of full charge), from 0.25 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 1e-06 apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- end_voltage, the cell's terminal voltage at the end of the run, in volts at or above 2.8012 V\n- core_hottest, the hottest the cell's core gets over the run, in degrees Celsius at or below 26.174 degC\n- completes, the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold\nEach design is one run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 448.0, \"state_of_charge\": \"\", \"capacity_ah\": 4.47, \"case_temperature_least_c\": 18.0, \"case_temperature_most_c\": 18.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 660, \"load\": {\"current_a\": 9.6, \"case_temperature_c\": 18.0}}], \"record_every\": 660}}\nThis task has no solve: leave \"solve\" out of each design.\n\nBudget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out \"solve\" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries \"stopped\": the stop's name exactly as the verifier gives it, and \"step\": the last step its run is sealed to (steps_landed), a whole number: {\"run\": {...}, \"stopped\": \"\", \"step\": }. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n",
+ "grader": {
+ "command": "bash /tests/test.sh",
+ "file": "tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/test.sh",
+ "runs_in": "a fresh copy of the task image (environment_mode separate)",
+ "reward_file": "/logs/verifier/reward.json",
+ "scores": [
+ "reward",
+ "correct",
+ "proofs_hold"
+ ]
+ },
+ "mcp_servers": [
+ {
+ "name": "verifier",
+ "transport": "stdio",
+ "command": "/usr/local/bin/mcp_stdio",
+ "args": []
+ }
+ ],
+ "hud_export": "tasks/hud/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c",
+ "artifacts": [
+ "/app/answer.json",
+ "/app/calls.jsonl",
+ "/logs/agent/trajectory.json"
+ ],
+ "engine": {
+ "source": "https://github.com/johnkruze/zero-trust-physics-engine",
+ "tag": "v0.15.3",
+ "commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "sha256": "95506cc292eeed642b40850d19fcce34d1a23adc6fb980ebd946b4a890f1225a"
+ },
+ {
+ "id": "g1f-chain-runaway-new-soak-then-warm-room",
+ "harbor_path": "tasks/g1f-chain-runaway-new-soak-then-warm-room",
+ "family": "chain_design",
+ "kind": "chained_design",
+ "prompt_file": "tasks/g1f-chain-runaway-new-soak-then-warm-room/instruction.md",
+ "prompt": "One LiCoO2 18650 cell starts at 297.15 K with 12 percent of its SEI layer, 78 percent of its anode lithium, 97 percent of its cathode unreacted, its electrolyte, separator and vent gas whole. It soaks in an oven held at one temperature that you choose for 3200 s (320 steps of 10 s), with no heater, not adiabatic. That run is then continued (from) with the oven at 305.15 K for 3600 s (360 steps of 10 s).\n\nFind the largest oven temperature of the first run, in kelvin, from 395 to 470 K, for which every constraint below holds. Give the passing design and the first failing design, no more than 0.0009 K apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- next_cell_peak, the hottest the cell gets over the next run, in kelvin at or below 432.27 K\n- next_vent_held, the fraction of the cell's vent gas still held at the end of the next run (1 before it vents) at or above 0.5974\nEach design is two runs of runaway_18650_lco. The first run, which must complete:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"runaway_18650_lco\", \"initial\": {\"temperature_k\": 297.15, \"sei_fraction\": 0.12, \"anode_lithium_fraction\": 0.78, \"cathode_unreacted_fraction\": 0.97, \"electrolyte_fraction\": 1.0, \"separator_unmelted_fraction\": 1.0, \"vent_gas_held_fraction\": 1.0}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 320, \"load\": {\"oven_temperature_k\": \"\", \"heater_power_w\": 0.0, \"adiabatic\": 0.0}}], \"record_every\": 320}}\nThen the next run, which continues that sealed first run: its initial state is the first run's answer, value for value and bit for bit, and its from names the first run's request and seal:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"runaway_18650_lco\", \"initial\": {\"temperature_k\": \"\", \"sei_fraction\": \"\", \"anode_lithium_fraction\": \"\", \"cathode_unreacted_fraction\": \"\", \"electrolyte_fraction\": \"\", \"separator_unmelted_fraction\": \"\", \"vent_gas_held_fraction\": \"\"}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 360, \"load\": {\"oven_temperature_k\": 305.15, \"heater_power_w\": 0.0, \"adiabatic\": 0.0}}], \"record_every\": 360, \"from\": {\"request\": \"\", \"run_seal\": \"\"}}}\nConstraints whose id begins next_ are read from the next run; the others from the first run. This task has no solve.\n\nBudget: at most 5 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"next\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"next\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Each design is two runs: \"run\" is the first run, and \"next\" is the run that continues that same sealed run, with \"from\": {\"request\": , \"run_seal\": } and its initial state equal to the first run's final_state, value for value, bit for bit. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n",
+ "grader": {
+ "command": "bash /tests/test.sh",
+ "file": "tasks/g1f-chain-runaway-new-soak-then-warm-room/tests/test.sh",
+ "runs_in": "a fresh copy of the task image (environment_mode separate)",
+ "reward_file": "/logs/verifier/reward.json",
+ "scores": [
+ "reward",
+ "correct",
+ "proofs_hold"
+ ]
+ },
+ "mcp_servers": [
+ {
+ "name": "verifier",
+ "transport": "stdio",
+ "command": "/usr/local/bin/mcp_stdio",
+ "args": []
+ }
+ ],
+ "hud_export": "tasks/hud/tasks/g1f-chain-runaway-new-soak-then-warm-room",
+ "artifacts": [
+ "/app/answer.json",
+ "/app/calls.jsonl",
+ "/logs/agent/trajectory.json"
+ ],
+ "engine": {
+ "source": "https://github.com/johnkruze/zero-trust-physics-engine",
+ "tag": "v0.15.3",
+ "commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "sha256": "118cbf61ceb17e81769843685f703ae86d6f5d1eb26ec3fd6ec9fea82fad11a5"
+ },
+ {
+ "id": "g1f-limit-18650pf-lowest-start-charge-2a7-27min",
+ "harbor_path": "tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min",
+ "family": "tradeoff",
+ "kind": "design_to_limit",
+ "prompt_file": "tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/instruction.md",
+ "prompt": "One new Panasonic NCR18650PF lithium-ion cell at 25 degrees Celsius is rested at a state of charge that you choose and then discharged at a held 2.7 A for 27 minutes (270 steps of 6 s).\n\nFind the smallest starting state of charge (a fraction of full charge), from 0.2 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 8e-05 apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- pf_end_voltage, the cell's terminal voltage at the end of the discharge, in volts at or above 3.4061 V\n- completes, the run completes every step: a run that the verifier stops part way (UndervoltageCutoff) does not hold\nEach design is one run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_18650pf\", \"initial\": {\"soc\": \"\", \"held_current_a\": 2.7}, \"dt_s\": 6.0, \"segments\": [{\"steps\": 270, \"load\": {\"current_a\": 2.7}}], \"record_every\": 270}}\nThis task has no solve: leave \"solve\" out of each design.\n\nBudget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out \"solve\" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries \"stopped\": the stop's name exactly as the verifier gives it, and \"step\": the last step its run is sealed to (steps_landed), a whole number: {\"run\": {...}, \"stopped\": \"\", \"step\": }. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n",
+ "grader": {
+ "command": "bash /tests/test.sh",
+ "file": "tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min/tests/test.sh",
+ "runs_in": "a fresh copy of the task image (environment_mode separate)",
+ "reward_file": "/logs/verifier/reward.json",
+ "scores": [
+ "reward",
+ "correct",
+ "proofs_hold"
+ ]
+ },
+ "mcp_servers": [
+ {
+ "name": "verifier",
+ "transport": "stdio",
+ "command": "/usr/local/bin/mcp_stdio",
+ "args": []
+ }
+ ],
+ "hud_export": "tasks/hud/tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min",
+ "artifacts": [
+ "/app/answer.json",
+ "/app/calls.jsonl",
+ "/logs/agent/trajectory.json"
+ ],
+ "engine": {
+ "source": "https://github.com/johnkruze/zero-trust-physics-engine",
+ "tag": "v0.15.3",
+ "commit": "664d68f426ccdfd0159e5f91857edba3872390d1"
+ },
+ "sha256": "d401712e8d75a01d721d449929864758f023cc90bed37ad6989134fc695c4f27"
+ }
+ ],
+ "hud_import": {
+ "command": "hud harbor import tasks/harbor/tasks --taskset ",
+ "docs": "https://docs.hud.ai/platform/harbor-import",
+ "gives": "browse, compare and QA on HUD; HUD does not run imported Harbor tasks"
+ }
+}
\ No newline at end of file
diff --git a/sample/tasks/harbor/registry.json b/sample/tasks/harbor/registry.json
new file mode 100644
index 0000000000000000000000000000000000000000..48639aa6dd98a35551264d33cd88a95d0c3d4db0
--- /dev/null
+++ b/sample/tasks/harbor/registry.json
@@ -0,0 +1,29 @@
+[
+ {
+ "name": "zero-trust-physics-sample-batteries-thermal-runaway-grid-frequency",
+ "version": "2026-11-13",
+ "description": "Free sample of Protocol Company's Group 1 Domain Pack: 5 multi-step physics environments (designs to a limit, a chained design, budgeted searches), each scored by a program on the Zero-Trust Physics verifier (v0.15.3).",
+ "tasks": [
+ {
+ "name": "g1d-budget5-cell1000-current-16min-11c",
+ "path": "tasks/g1d-budget5-cell1000-current-16min-11c"
+ },
+ {
+ "name": "g1f-budget4-cell1000-least-capacity-15a-31c",
+ "path": "tasks/g1f-budget4-cell1000-least-capacity-15a-31c"
+ },
+ {
+ "name": "g1d-limit-cell448-lowest-start-charge-11min-18c",
+ "path": "tasks/g1d-limit-cell448-lowest-start-charge-11min-18c"
+ },
+ {
+ "name": "g1f-chain-runaway-new-soak-then-warm-room",
+ "path": "tasks/g1f-chain-runaway-new-soak-then-warm-room"
+ },
+ {
+ "name": "g1f-limit-18650pf-lowest-start-charge-2a7-27min",
+ "path": "tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min"
+ }
+ ]
+ }
+]
diff --git a/sample/tasks/harbor/task_checksums.json b/sample/tasks/harbor/task_checksums.json
new file mode 100644
index 0000000000000000000000000000000000000000..50bf9549932a82380286d143f02bedc099df99ff
--- /dev/null
+++ b/sample/tasks/harbor/task_checksums.json
@@ -0,0 +1,45 @@
+{
+ "algorithm": "sha256 and sha384 over every file of the task: relative path, NUL, bytes, in sorted path order",
+ "tasks": {
+ "g1d-budget5-cell1000-current-16min-11c": {
+ "path": "tasks/g1d-budget5-cell1000-current-16min-11c",
+ "sha256": "bdcb63566d4d37bd18fc62e2cc3305fb0a68cf047a0b211c51cd0b753f751f00",
+ "sha384": "17640b8bc079899e5a8042a6d93f6fb9b596f54144c2df9dadd59d7891a15afb7190a3ca4ad573adb9064dfb9164d8ba",
+ "row_sha256": "27a802ed2a996e11f01de6b1b585c3393e5330dc596cfd9376086b1b5783068b",
+ "row_sha384": "854acd9c04d098001e13f8429c2ea08774db2cdbb92054f12b497c4e5271a19accebeb452ef60474cc1fdb14c6ee51f3",
+ "files": 18
+ },
+ "g1f-budget4-cell1000-least-capacity-15a-31c": {
+ "path": "tasks/g1f-budget4-cell1000-least-capacity-15a-31c",
+ "sha256": "7b23d68c019f0bcbf6a2856341c3dd047cb40f24b5935d223721aabe4366773c",
+ "sha384": "d6ced41ca123cd83423a3f46f845ab91483a9303ca6d9a06e36e21f347c9f884119f5b065b716ec48b8a1a156ca9f9db",
+ "row_sha256": "9f5e4e8b22f19821bf563f3a65a058de097852c24eed892e9aceedf51525e680",
+ "row_sha384": "a5e513e8c00de787cde8c34bdd0da9aa4ee64a26085f1f4ddaae68f335d7f9d60a89b4032dae27dccfed46dd88588e65",
+ "files": 18
+ },
+ "g1d-limit-cell448-lowest-start-charge-11min-18c": {
+ "path": "tasks/g1d-limit-cell448-lowest-start-charge-11min-18c",
+ "sha256": "3940169cc2dc5b8ebdfea0194c834b36bda3a3ba87d3680222d96772e022ff14",
+ "sha384": "a7272af962afd75b364d0a595a21ec26babe1941a5fb8c07b994130d489839fb1d533b43b9165e713c7cda49d7da3581",
+ "row_sha256": "c14366de33841ebf061a628f4a77d478d5832c49eb46f2df20250382cf31c01d",
+ "row_sha384": "980a4d2c60b803c9912ecda8dab70ed81dc0d68e0843a39e5fa65f23a50bbdf0f5eb170aa57fc3e08ae52d3752bd87c7",
+ "files": 18
+ },
+ "g1f-chain-runaway-new-soak-then-warm-room": {
+ "path": "tasks/g1f-chain-runaway-new-soak-then-warm-room",
+ "sha256": "df676208c6db419e6ccdfbf5b79ce2bcb90bf4f5a256de5fa24bef962015d99d",
+ "sha384": "4895f24b8a436957738acd4b02d86f60c5c9a69b89ba7a98975c62d28237199c5da90495b928bf062f54c8ee2ec460da",
+ "row_sha256": "e06442b8196bb20965f68cbb36cf3dfa8505592a608503500c628ead2e76f6aa",
+ "row_sha384": "04845b45c68ad35124f996c98a5ecec71016e1df9a22e8641fb092273632906176c51006f4a4e78cdabfc8ee8ae8db20",
+ "files": 18
+ },
+ "g1f-limit-18650pf-lowest-start-charge-2a7-27min": {
+ "path": "tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min",
+ "sha256": "d36536811683c806f39bea96710bba77b1542b79e01c4510efb28a6d38ef0d59",
+ "sha384": "6e95a8af1fdb368b59fb4c297a372982b8a8bb1368f022e2428b7d0844fd72b024f33d83906d0e19e5647a927f81f525",
+ "row_sha256": "678f4595b6cf3ab321c0ace0d1dd7ed9815ba98a936e3a7d5c3ce4705d4d1f01",
+ "row_sha384": "e6eaf64a13585c675fe8d23030cad93ff8b83ac15f281928dfa101df6e9a342da71726f9e75b9090b2895799e701afac",
+ "files": 18
+ }
+ }
+}
diff --git a/sample/tasks/harbor/task_checksums.sha256 b/sample/tasks/harbor/task_checksums.sha256
new file mode 100644
index 0000000000000000000000000000000000000000..9a20d3df51c632c0ef0b1441c6db01897e13d563
--- /dev/null
+++ b/sample/tasks/harbor/task_checksums.sha256
@@ -0,0 +1,5 @@
+bdcb63566d4d37bd18fc62e2cc3305fb0a68cf047a0b211c51cd0b753f751f00 tasks/g1d-budget5-cell1000-current-16min-11c
+7b23d68c019f0bcbf6a2856341c3dd047cb40f24b5935d223721aabe4366773c tasks/g1f-budget4-cell1000-least-capacity-15a-31c
+3940169cc2dc5b8ebdfea0194c834b36bda3a3ba87d3680222d96772e022ff14 tasks/g1d-limit-cell448-lowest-start-charge-11min-18c
+df676208c6db419e6ccdfbf5b79ce2bcb90bf4f5a256de5fa24bef962015d99d tasks/g1f-chain-runaway-new-soak-then-warm-room
+d36536811683c806f39bea96710bba77b1542b79e01c4510efb28a6d38ef0d59 tasks/g1f-limit-18650pf-lowest-start-charge-2a7-27min
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/environment/Dockerfile b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/environment/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..568742bebe61fc9c90daad15a6ed51c93a294086
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/environment/Dockerfile
@@ -0,0 +1,14 @@
+# Harbor environment image for Zero-Trust Physics release v0.15.3 (commit 664d68f4).
+# Public 5-crate Rust engine reference source is at https://github.com/johnkruze/zero-trust-physics-engine (tag v0.15.2);
+# read-only source audit of the pack verifier build is available under NDA (https://zerotrustphysics.com/offers/#licence).
+# In this free evaluation sample, /usr/local/bin/mcp_stdio bridges JSON-RPC over stdio to the public MCP endpoint
+# (ztp_open_bridge.py), and the scorer verifies release 0.15.3 version and kernel invariants on every reply.
+# Paid Domain Packs ship compiled static Linux/macOS rollout binaries for --network none execution.
+FROM python:3.12-slim-bookworm
+ARG ZTP_ENGINE_TAG=v0.15.3
+ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1
+ARG ZTP_VERIFIER_URL=https://mcp.zerotrustphysics.com/mcp/open
+COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py
+RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "%s"\n' "$ZTP_VERIFIER_URL" > /usr/local/bin/mcp_stdio \
+ && chmod +x /usr/local/bin/mcp_stdio
+WORKDIR /app
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/environment/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/environment/ztp_open_bridge.py
new file mode 100644
index 0000000000000000000000000000000000000000..bc0e20b469db24286278a387680ad8d3898f0661
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/environment/ztp_open_bridge.py
@@ -0,0 +1,109 @@
+"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's
+MCP address, and its answer written back on stdout, one line each. Standard library only.
+
+ python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp/open
+
+It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio
+server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds
+nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a
+notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for
+every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same
+message again, as ztp_mcp.Verifier does, so a client sees one answer per request.
+
+Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no
+key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image.
+
+Licence: Apache-2.0.
+"""
+import json
+import os
+import sys
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900"))
+API_KEY = os.environ.get("ZTP_API_KEY") or None
+
+
+class Bridge:
+ def __init__(self, url):
+ self.url = url
+ self.session = None
+ self.extra_headers = {}
+
+ def post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-bridge/1.0"}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ if API_KEY:
+ headers["Authorization"] = "Bearer " + API_KEY
+ headers.update(self.extra_headers)
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ with urllib.request.urlopen(request, timeout=600) as response:
+ if response.headers.get("Mcp-Session-Id"):
+ self.session = response.headers["Mcp-Session-Id"]
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "id" not in message:
+ return None
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}}
+ return json.loads(raw) if raw.strip() else None
+
+ def forward(self, message):
+ started, wait = time.time(), 2.0
+ while True:
+ try:
+ answer = self.post(message)
+ text = ""
+ if isinstance(answer, dict) and isinstance(answer.get("result"), dict):
+ text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict))
+ if not (BUSY in text and len(text) < 400):
+ return answer
+ except urllib.error.HTTPError as problem:
+ if not (problem.code == 429 or problem.code >= 500):
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}}
+ after = problem.headers.get("Retry-After")
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError):
+ pass
+ if time.time() - started + wait > PATIENCE_S:
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}}
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+
+def main():
+ bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS)
+ for line in sys.stdin:
+ if not line.strip():
+ continue
+ try:
+ message = json.loads(line)
+ except ValueError:
+ continue
+ answer = bridge.forward(message)
+ if answer is not None:
+ sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n")
+ sys.stdout.flush()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/instruction.md b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/instruction.md
new file mode 100644
index 0000000000000000000000000000000000000000..206e38548d5af9f306ea7bdea1c3af1619323256
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/instruction.md
@@ -0,0 +1,19 @@
+Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.62 Ah, rested at 93 percent charge with its case at 11 degrees Celsius, is discharged at one constant current for 16 minutes (960 steps of 1 s), its case held at 11 degrees Celsius. Above some current it reaches its lower voltage limit before the 16 minutes are up (UndervoltageLimit). Find that current, in amps.
+
+Find it to five significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.001 percent of the value apart. It lies between 10 and 15 A.
+
+The request, with the one input you change:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": "", "case_temperature_c": 11.0}}], "record_every": 960}}
+
+Budget: at most 5 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"holds": {"request": ..., "proof": ...}, "stops": {"request": ..., "proof": ..., "stopped": ""}}
+
+holds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+
+Also write that answer card, by itself, to the file `/app/answer.json`.
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/chainlib.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/chainlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/chainlib.py
@@ -0,0 +1,63 @@
+"""Build the solve request of a chained design from a run's answer: the history its coupling hands over.
+
+A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's
+32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This
+module reads the slots from frame_hex with the standard library and lays the history out the way a
+task states it.
+
+ chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from
+
+layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or
+{"kind": "triga_element"}.
+
+Licence: Apache-2.0.
+"""
+import copy
+import struct
+
+
+def _slots(run_answer, f64_at, f32_at):
+ """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened."""
+ out = [[] for _ in range(1 + len(f32_at))]
+ for frame in run_answer["frames"]:
+ raw = bytes.fromhex(frame["frame_hex"])
+ out[0].append(struct.unpack(" the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.93, \"capacity_ah\": 4.62, \"case_temperature_least_c\": 11.0, \"case_temperature_most_c\": 11.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 960, \"load\": {\"current_a\": \"\", \"case_temperature_c\": 11.0}}], \"record_every\": 960}}\n\nBudget: at most 5 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.", "check": {"tool": "run_trajectory", "template": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": null, "case_temperature_c": 11.0}}], "record_every": 960}, "variable": "segments[0].load.current_a", "also": [], "stop": "UndervoltageLimit", "relative_width": 1e-05, "budget": 5, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "A stop located by halving on the local 0.15.3 build; the task rules the search tools out and allows 5 computing calls."}, "reference": {"boundary": 12.05958181564474, "bisect_width": 6.9118044621063746e-12, "holds": {"x": 12.059545636899294, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059545636899294, "case_temperature_c": 11.0}}], "record_every": 960}}, "proof": "74bbb04a7f1ce03d8d60aa42063b094b0e66f03d602d37398911e7486b803eec45399df2c82f1bfb7fdce1ae655c33d4", "outcome": "completed", "steps_landed": 960}, "stops": {"x": 12.059617994390187, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059617994390187, "case_temperature_c": 11.0}}], "record_every": 960}}, "proof": "3a8d1ae90c4ebcdab0950a9aa2280bbf270ed5acd8fcfecac04daf6c8b9091c28c269d997e47ce4a851c879dfd6de519", "outcome": "refused", "steps_landed": 959}, "span_pattern": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhssssssssssssssssssssssssssssssssssss", "span": [10.0, 15.0], "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/run_reference.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/run_reference.py
new file mode 100644
index 0000000000000000000000000000000000000000..0dc7d591e31fb27d4a9ccc2c2a50f5436eb503b2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/run_reference.py
@@ -0,0 +1,208 @@
+"""An agent with no model in it: answer every environment from its reference, through the harness proxy.
+
+ python3 run_reference.py --engine ENGINE --environments F --out DIR [--only id,id] [--direct]
+
+For a tradeoff or chain_design environment it sends the reference passing and failing runs to the
+verifier, hands each run to its solve through the task's coupling where the task has one, and writes
+the card with the seals this verifier gives. For a budget environment it sends the two reference
+requests. For a forensics table it puts the table to the verifier (each row's request as sent, up to
+the task's budget) and names the false rows the build recorded.
+
+Every call goes through harness/mcp_log_proxy.py, started in an empty working folder, so the
+authoritative call record is DIR/.harness.jsonl, as in a pass@k attempt. The same calls are also
+written beside the reply, DIR/.calls.jsonl. --direct talks to ENGINE with no proxy and writes the
+reply-side log only.
+
+ python3 score.py DIR --engine ENGINE --environments F --calls-from harness
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import json
+import os
+import subprocess
+import sys
+import tempfile
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+import chainlib # noqa: E402
+from score import (FREE_TOOLS, NOT_STOPPED, build_stage_request, close_verifier, continuation_of, design_shape, # noqa: E402
+ file_sha256, get_path, load_environments, open_verifier)
+from ztp_mcp import McpError, StdioVerifier # noqa: E402
+
+PROXY = os.path.join(HERE, "..", "harness", "mcp_log_proxy.py")
+
+
+class ProxiedVerifier(StdioVerifier):
+ """The engine behind the logging proxy, the proxy started in its own empty working folder."""
+
+ def __init__(self, engine, log, cwd=None, **kwargs):
+ self.cwd = cwd or tempfile.mkdtemp(prefix="ztp_ref_cwd_")
+ if engine.startswith("http://") or engine.startswith("https://"):
+ # an MCP address: the proxy runs the stdio bridge to it (ztp_open_bridge.py, beside this file)
+ child = [sys.executable, os.path.join(HERE, "ztp_open_bridge.py"), engine]
+ else:
+ child = [os.path.abspath(engine)]
+ command = [sys.executable, os.path.abspath(PROXY), "--log", os.path.abspath(log), "--"] + child
+ super(StdioVerifier, self).__init__(url="stdio: " + " ".join(command), timeout_s=600, **kwargs)
+ self.proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, cwd=self.cwd)
+ self.binary_sha256 = None if len(child) > 1 else file_sha256(engine)
+
+ def close(self):
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ try:
+ self.proc.wait(timeout=60)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def proxied(engine, log, cwd=None):
+ if os.path.exists(log):
+ os.remove(log)
+ verifier = ProxiedVerifier(engine, log, cwd)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the proxied verifier failed: %s" % problem)
+ return verifier
+
+
+class Logged:
+ def __init__(self, verifier):
+ self.verifier, self.calls, self.seen = verifier, [], {}
+
+ def call(self, tool, arguments, refused_ok=False):
+ # the same request twice is one call: a chain with its value in the next run has one first run for both designs
+ key = json.dumps([tool, arguments], sort_keys=True)
+ if key in self.seen and not self.seen[key][1]:
+ return self.seen[key][0]
+ self.calls.append({"tool": tool, "arguments": arguments})
+ body, is_error = self.verifier.call_json(tool, arguments)
+ self.seen[key] = (body, is_error)
+ if is_error and not refused_ok:
+ raise SystemExit("the reference request was refused: %s %s" % (tool, str(body)[:300]))
+ return body
+
+
+def design_staged(env, ref, agent):
+ """A staged design: each stage sent in order, handed values and continuations built from this verifier's answers."""
+ spec = env["check"]["design"]
+ answers, requests, out = {}, {}, {}
+ for stage in spec["stages"]:
+ q = build_stage_request(spec, stage, ref["x"], answers, requests)
+ body = agent.call(stage["tool"], q, refused_ok=True)
+ stopped = body.get("outcome") not in NOT_STOPPED
+ answers[stage["key"]] = {"body": body, "proof": body.get("run_seal") or body.get("solution_seal"),
+ "outcome": body.get("outcome"), "stop": body.get("reject") if stopped else None, "stopped": stopped}
+ requests[stage["key"]] = q
+ out[stage["key"]] = {"request": {"tool": stage["tool"], "arguments": q}, "proof": answers[stage["key"]]["proof"]}
+ return out
+
+
+def design(env, ref, agent):
+ spec = env["check"]["design"]
+ shape = design_shape(spec)
+ if shape == "staged":
+ return design_staged(env, ref, agent)
+ if shape == "solve":
+ solved = agent.call("solve", ref["solve"], refused_ok=True)
+ return {"solve": {"request": {"tool": "solve", "arguments": ref["solve"]}, "proof": solved["solution_seal"]}}
+ run_args = ref["run"]
+ run = agent.call("run_trajectory", run_args)
+ out = {"run": {"request": {"tool": "run_trajectory", "arguments": run_args}, "proof": run["run_seal"]}}
+ if shape == "continued":
+ # the run that continues this design's own sealed run: the reference's next run, its start fields and from
+ # set from this verifier's answer to the first run
+ _, carried, _, _ = continuation_of(spec)
+ next_args = copy.deepcopy(ref["next"])
+ next_args["initial"] = {name: get_path(run, source) for name, source in carried.items()}
+ next_args["from"] = {"request": run_args, "run_seal": run["run_seal"]}
+ nxt = agent.call("run_trajectory", next_args, refused_ok=True)
+ out["next"] = {"request": {"tool": "run_trajectory", "arguments": next_args}, "proof": nxt["run_seal"]}
+ elif spec.get("chain"):
+ overrides = {}
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ overrides[spec["variable"]["path"].split(".", 1)[1]] = ref["x"]
+ solve_args = chainlib.chained_solve(spec["chain"], run_args, run, overrides)
+ solved = agent.call("solve", solve_args)
+ out["solve"] = {"request": {"tool": "solve", "arguments": solve_args}, "proof": solved["solution_seal"]}
+ return out
+
+
+def reference_reply(env, verifier):
+ """(reply text, calls [{"tool", "arguments"}])."""
+ agent = Logged(verifier)
+ family, ref = env["family"], env["reference"]
+ if family in ("tradeoff", "chain_design"):
+ card = {"passing": design(env, ref["passing"], agent), "failing": design(env, ref["failing"], agent), "binding": ref["binding"]}
+ if ref["failing"].get("stopped"):
+ card["failing"]["stopped"] = ref["failing"]["stopped"]
+ if ref["failing"].get("steps_landed") is not None:
+ card["failing"]["step"] = ref["failing"]["steps_landed"]
+ words = "The boundary lies between the two designs below; %s binds." % ref["binding"]
+ elif family == "budget":
+ card = {}
+ for side in ("holds", "stops"):
+ request = ref[side]["request"]
+ answer = agent.call(request["tool"], request["arguments"])
+ card[side] = {"request": request, "proof": answer.get("run_seal") or answer.get("solution_seal")}
+ card["stops"]["stopped"] = env["check"]["stop"]
+ words = "The stop %s lies between the two requests below." % env["check"]["stop"]
+ else:
+ agent.call("list_cards", {}, refused_ok=True)
+ rows = env["check"]["rows"]
+ budget = env["check"].get("budget") or len(rows)
+ computing = 0
+ for row in rows:
+ request = row["request"]
+ if computing >= budget:
+ break
+ if request["tool"] in FREE_TOOLS:
+ continue
+ agent.call(request["tool"], request["arguments"], refused_ok=True)
+ computing += 1
+ card = {"false_rows": ref["false_rows"]}
+ words = "%d of the %d rows are false." % (len(ref["false_rows"]), len(rows))
+ return words + "\n\n" + json.dumps(card), agent.calls
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--direct", action="store_true", help="no proxy: the reply-side log only")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ os.makedirs(args.out, exist_ok=True)
+ shared = open_verifier(args.engine) if args.direct else None
+ try:
+ for env in environments:
+ verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl"))
+ try:
+ reply, calls = reference_reply(env, verifier)
+ finally:
+ if not shared:
+ close_verifier(verifier)
+ with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f:
+ f.write(reply + "\n")
+ with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f:
+ for c in calls:
+ f.write(json.dumps(c) + "\n")
+ print("%-60s %d calls" % (env["id"], len(calls)), flush=True)
+ finally:
+ if shared:
+ close_verifier(shared)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/score.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/score.py
new file mode 100644
index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/score.py
@@ -0,0 +1,1199 @@
+"""Score replies to the multi-step environments with no judge: a program and the verifier.
+
+ python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F]
+ [--calls-from reply|harness] [--harness-dir DIR]
+
+ REPLIES is a folder with one file per environment, .txt, the whole text of a reply.
+ --calls-from harness the call record is the harness's own: .harness.jsonl, written by
+ harness/mcp_log_proxy.py outside the solver's working directory (in
+ --harness-dir, default REPLIES). A .calls.jsonl beside the reply,
+ when there is one, is read only to catch an edit: it must equal the
+ harness log call for call.
+ --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply:
+ one JSON object a line, {"tool": "", "arguments": {...}}.
+
+ ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address
+ beginning http. A task is scored only on the engine it was built on: the verifier's version must
+ be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's
+ reference.engine_binary_sha256.
+
+The answer card is one JSON object on the reply's last line. Its shape is the family's:
+
+ tradeoff, chain_design (kind design_to_limit, chained_design)
+ {"passing": DESIGN, "failing": DESIGN, "binding": ""}
+ DESIGN = {"run": {"request": R, "proof": ""},
+ "solve": {"request": R, "proof": ""}} (solve only where the task has one)
+ Where a constraint is that the run completes and it binds, the failing DESIGN also carries
+ "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}}
+ The design shapes, one scorer for every group (check.design says which):
+ run a run alone.
+ coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run.
+ continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of
+ the same card that continues it through from, starting from its sealed final state,
+ DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template
+ is chain.next_template, chain.template or chain.next; its start fields are chain.carried
+ ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or
+ chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on
+ "next" reads the next run, and a stop constraint judges it.
+ solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no
+ run. A binding refusal is named ("stopped") with no step.
+ staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per
+ stage in order; a later stage carries an earlier stage's answer at a named input (handed) or
+ continues an earlier run (continues), bit for bit.
+ A constraint's read may carry "index": one entry of an output the verifier returns as a list.
+ budget (kind budgeted_search)
+ {"holds": {"request": R, "proof": ""},
+ "stops": {"request": R, "proof": "", "stopped": ""}}
+ forensics
+ {"false_rows": {"": "", ...}} ({} when every row is genuine)
+
+Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a
+solution_seal, short form) and every number judged is read from the verifier's own answer to the
+card's request, sent again here, never from the reply.
+
+Scores per environment
+----------------------
+reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1.
+ proofs_hold: every proof on the card verifies. correct: the card is the right answer and
+ nothing below under "integrity" failed.
+graded in [0, 1], beside reward.
+
+ Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not
+ verify (a copied, nudged, edited or stale proof); a request differs from the task's template other
+ than at the design variable; a chained solve not handed its own design's sealed run; no call log;
+ a call log beside the reply that differs from the harness log; a harness log whose chain breaks;
+ a forbidden tool called; more computing calls than the budget; a request on the card that is not
+ among the calls; a forensics answer with no computing call behind it; a task built on another
+ engine than the verifier.
+
+ tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the
+ passing design meets every constraint and the failing one breaks the named binding constraint
+ (budget: holds completes, stops ends with the task's stop, named on the card), on the side the
+ task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0.
+ With the sides right:
+
+ e = the length of the smallest interval holding both designs' values and the reference
+ boundary (for a bracket that straddles the boundary, its width)
+ tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget)
+ r = e / tol
+ graded = 1 when reward is 1 (r <= 1 and the bracket straddles it)
+ = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score
+ (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25)
+ = 0.5 when r <= 1 but the bracket misses the reference boundary
+ by more than the slack (another crossing than the one asked)
+
+ The decay is smooth and falls monotonically with r, and a near miss scores near the top.
+
+ forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found
+ only with its right reason. precision = found / named, recall = found / false rows; an empty
+ answer to a table with no false row scores 1. A card that names every row of the table false is
+ a blanket answer and scores 0, as do unknown rows and reasons outside the task's list.
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import hashlib
+import json
+import math
+import os
+import re
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402
+
+FAMILIES = ("tradeoff", "chain_design", "budget", "forensics")
+KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"}
+NOT_STOPPED = ("completed", "converged")
+PREFIX_ENDS = ("__", ".", ":", "/")
+VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite",
+ "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset",
+ "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip")
+# Calls that read the catalogue compute nothing and are free in a call budget.
+FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt")
+REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden")
+GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r)
+OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary
+
+
+class Integrity(Exception):
+ """The answer cannot be trusted: graded 0 and reward 0."""
+
+
+class Wrong(Exception):
+ """The answer is trusted and wrong: graded 0 and reward 0."""
+
+
+def load_environments(path):
+ with open(path, encoding="utf-8") as f:
+ return [json.loads(line) for line in f if line.strip()]
+
+
+def row_problems(env):
+ """What a task row lacks against the shared row contract (empty when none)."""
+ out = []
+ for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"):
+ if key not in env:
+ out.append("no %s" % key)
+ family = env.get("family")
+ if family not in FAMILIES:
+ out.append("family %r" % family)
+ elif "kind" in env and env["kind"] != KINDS[family]:
+ out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family]))
+ ref = env.get("reference") or {}
+ for key in ("engine_tag", "engine_commit", "engine_binary_sha256"):
+ if not ref.get(key):
+ out.append("reference.%s missing" % key)
+ return out
+
+
+def file_sha256(path):
+ h = hashlib.sha256()
+ with open(path, "rb") as f:
+ for block in iter(lambda: f.read(1 << 20), b""):
+ h.update(block)
+ return h.hexdigest()
+
+
+def open_verifier(engine):
+ if engine.startswith("http://") or engine.startswith("https://"):
+ verifier = Verifier(engine, pause_s=0.5)
+ verifier.binary_sha256 = None
+ else:
+ if not os.path.isfile(engine):
+ sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine)
+ verifier = StdioVerifier([engine])
+ verifier.binary_sha256 = file_sha256(engine)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the verifier failed, so nothing was scored: %s" % problem)
+ if not isinstance(verifier.server, dict) or not verifier.server.get("name"):
+ close_verifier(verifier)
+ sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine)
+ return verifier
+
+
+def close_verifier(verifier):
+ if hasattr(verifier, "close"):
+ verifier.close()
+
+
+# ------------------------------------------------------------------------------------------
+# reading the reply and the call logs
+# ------------------------------------------------------------------------------------------
+def _no_constant(name):
+ raise ValueError("%s is not a number" % name)
+
+
+def read_card(reply):
+ """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over."""
+ lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()]
+ while lines and lines[-1].startswith("```"):
+ lines.pop()
+ if not lines:
+ return None, "the reply is empty"
+ try:
+ card = json.loads(lines[-1], parse_constant=_no_constant)
+ except ValueError:
+ return None, "the last line is not one JSON object"
+ if not isinstance(card, dict):
+ return None, "the last line is not one JSON object"
+ return card, None
+
+
+def tool_name(name):
+ """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve)."""
+ if not isinstance(name, str):
+ return None
+ if name in VERIFIER_TOOLS:
+ return name
+ for tool in VERIFIER_TOOLS:
+ for joint in PREFIX_ENDS:
+ if name.endswith(joint + tool):
+ return tool
+ return name
+
+
+def without_readout(arguments):
+ """A run's arguments as sealed: a readout is not part of a run's seal."""
+ if not isinstance(arguments, dict):
+ return arguments
+ return {k: v for k, v in arguments.items() if k != "readout"}
+
+
+def numbers_by_value(value):
+ """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept."""
+ if isinstance(value, dict):
+ return {k: numbers_by_value(v) for k, v in value.items()}
+ if isinstance(value, list):
+ return [numbers_by_value(v) for v in value]
+ if isinstance(value, int) and not isinstance(value, bool):
+ return float(value)
+ return value
+
+
+def canonical(arguments):
+ """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value."""
+ return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":"))
+
+
+def _arguments(one):
+ arguments = one.get("arguments")
+ if isinstance(arguments, str):
+ try:
+ arguments = json.loads(arguments)
+ except ValueError:
+ arguments = {}
+ return arguments if isinstance(arguments, dict) else {}
+
+
+def read_calls(path):
+ """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log."""
+ if not path or not os.path.isfile(path):
+ return None
+ calls = []
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for line in f:
+ line = line.strip()
+ if not line:
+ continue
+ try:
+ one = json.loads(line)
+ except ValueError:
+ continue
+ if isinstance(one, dict):
+ calls.append((tool_name(one.get("tool")), _arguments(one)))
+ return calls
+
+
+def chain_of(previous, entry):
+ payload = json.dumps(entry, sort_keys=True, separators=(",", ":"))
+ return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest()
+
+
+def read_harness_log(path):
+ """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log;
+ problem names the first line whose chain does not follow (an edit, a line taken out or put in)."""
+ if not path or not os.path.isfile(path):
+ return None, None
+ calls, previous = [], None
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for number_, line in enumerate(f, 1):
+ if not line.strip():
+ continue
+ try:
+ entry = json.loads(line)
+ except ValueError:
+ return calls, "line %d of the harness log is not JSON" % number_
+ if not isinstance(entry, dict) or "chain" not in entry:
+ return calls, "line %d of the harness log carries no chain" % number_
+ chain = entry.pop("chain")
+ if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1:
+ return calls, "the harness log's chain breaks at line %d" % number_
+ previous = chain
+ calls.append((tool_name(entry.get("tool")), _arguments(entry)))
+ return calls, None
+
+
+def write_harness_log(path, calls):
+ """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)]."""
+ previous = None
+ with open(path, "w", encoding="utf-8") as f:
+ for seq, (tool, arguments) in enumerate(calls, 1):
+ entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None,
+ "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False}
+ entry["chain"] = chain_of(previous, entry)
+ previous = entry["chain"]
+ f.write(json.dumps(entry, sort_keys=True) + "\n")
+
+
+# ------------------------------------------------------------------------------------------
+# the verifier, asked again
+# ------------------------------------------------------------------------------------------
+def stop_name_in(sentence):
+ names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "")
+ return names[-1] if names else None
+
+
+class Replay:
+ """The verifier, with every answer remembered: the same request is sent once."""
+
+ def __init__(self, verifier):
+ self.verifier = verifier
+ self.seen = {}
+ server = getattr(verifier, "server", None) or {}
+ self.version = server.get("version")
+ self.binary_sha256 = getattr(verifier, "binary_sha256", None)
+
+ def call(self, tool, arguments):
+ key = tool + "\x00" + json.dumps(arguments, sort_keys=True)
+ if key not in self.seen:
+ try:
+ self.seen[key] = self.verifier.call_json(tool, arguments)
+ except McpError as problem:
+ if not str(problem).startswith("protocol error"):
+ raise SystemExit("the verifier failed, so nothing was scored: %s" % problem)
+ self.seen[key] = ("the verifier did not take the request: %s" % problem, True)
+ return self.seen[key]
+
+ def answer(self, tool, arguments, readout=None):
+ """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}."""
+ arguments = copy.deepcopy(without_readout(arguments))
+ if readout is not None and tool == "run_trajectory":
+ arguments["readout"] = readout
+ body, is_error = self.call(tool, arguments)
+ if is_error or not isinstance(body, dict):
+ sentence = body if isinstance(body, str) else json.dumps(body)
+ return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence),
+ "proof": None, "body": None, "sentence": sentence}
+ outcome = body.get("outcome")
+ stopped = outcome not in NOT_STOPPED
+ return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None,
+ "proof": body.get("run_seal") or body.get("solution_seal"), "body": body,
+ "sentence": body.get("reject_detail")}
+
+ def proof_holds(self, tool, arguments, proof):
+ """(holds, words): the card's seal verified by verify_tape or verify_solution, short form."""
+ if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof):
+ return False, "the proof is not a SHA-384 seal of 96 hex digits"
+ if tool == "run_trajectory":
+ body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof})
+ elif tool == "solve":
+ body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof})
+ else:
+ return False, "a proof is verified for run_trajectory or solve only, not %s" % tool
+ if is_error or not isinstance(body, dict):
+ return False, "the verifier would not verify it: %s" % (str(body)[:200])
+ if body.get("holds") is True:
+ return True, None
+ return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause")
+
+
+def engine_problem(env, replay):
+ """None when the verifier is the engine the task was built on; else what differs."""
+ ref = env.get("reference") or {}
+ tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v")
+ if not tag:
+ return "the task names no engine it was built on"
+ if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag:
+ return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version"))
+ if replay.version != tag:
+ return "the task was built on engine %s; the verifier is %s" % (tag, replay.version)
+ want = ref.get("engine_binary_sha256")
+ if replay.binary_sha256 and want and replay.binary_sha256 != want:
+ return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12])
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# requests and their inputs
+# ------------------------------------------------------------------------------------------
+_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)")
+
+
+def get_path(obj, path):
+ here = obj
+ for part in path.split("."):
+ found = _PART.fullmatch(part)
+ if not found or not isinstance(here, dict) or found.group(1) not in here:
+ return None
+ here = here[found.group(1)]
+ for index in re.findall(r"\[(\d+)\]", found.group(2)):
+ if not isinstance(here, list) or int(index) >= len(here):
+ return None
+ here = here[int(index)]
+ return here
+
+
+def set_path(obj, path, value):
+ parts = path.split(".")
+ here = obj
+ for i, part in enumerate(parts):
+ m = _PART.fullmatch(part)
+ name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))]
+ last = i == len(parts) - 1
+ if not idx:
+ if last:
+ here[name] = value
+ else:
+ here = here[name]
+ else:
+ here = here[name]
+ for j, k in enumerate(idx):
+ if last and j == len(idx) - 1:
+ here[k] = value
+ else:
+ here = here[k]
+
+
+def number(value):
+ return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value)
+
+
+def differs(template, given, free, where=""):
+ """The first place where a request differs from the task's, other than the free places. None when none."""
+ if where in free:
+ return None
+ if isinstance(template, dict):
+ if not isinstance(given, dict):
+ return where or "the request"
+ for key in set(template) | set(given):
+ place = "%s.%s" % (where, key) if where else key
+ if place in free:
+ continue
+ if key not in given or key not in template:
+ return place
+ found = differs(template[key], given[key], free, place)
+ if found:
+ return found
+ return None
+ if isinstance(template, list):
+ if not isinstance(given, list) or len(given) != len(template):
+ return where
+ for index, (a, b) in enumerate(zip(template, given)):
+ found = differs(a, b, free, "%s[%d]" % (where, index))
+ if found:
+ return found
+ return None
+ if number(template) and number(given):
+ return None if float(template) == float(given) else where
+ return None if template == given else where
+
+
+def design_value(variable, run_arguments, solve_arguments, next_arguments=None):
+ """The design variable of one design, read from its requests (on: run, solve, or next, a continued run)."""
+ kind = variable["kind"]
+ if kind == "path":
+ on = variable.get("on", "run")
+ source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {}
+ value = get_path(source, variable["path"])
+ for place in variable.get("also") or []:
+ again = get_path(source, place)
+ if not (number(again) and number(value) and float(again) == float(value)):
+ return None
+ return float(value) if number(value) else None
+ if kind == "entry_angle_deg":
+ radial = get_path(run_arguments or {}, "initial.radial_speed_m_s")
+ transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s")
+ if not (number(radial) and number(transverse)) or transverse <= 0:
+ return None
+ speed = math.hypot(radial, transverse)
+ if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]:
+ return None
+ return math.degrees(math.atan2(-radial, transverse))
+ return None
+
+
+def variable_places(variable):
+ if variable["kind"] == "entry_angle_deg":
+ return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"}
+ if variable["kind"] == "path" and variable.get("on", "run") == "run":
+ return {variable["path"]} | set(variable.get("also") or [])
+ return set()
+
+
+def read_value(read, answer):
+ """One number from a replayed answer: final, result, or the extreme of a run's readout."""
+ body = answer["body"]
+ if body is None:
+ return None
+ kind = read["kind"]
+ value = None
+ if kind == "final":
+ value = (body.get("final_state") or {}).get(read["quantity"])
+ elif kind == "result":
+ value = (body.get("result") or {}).get(read["quantity"])
+ elif kind == "flag_extent":
+ # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it
+ value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or []
+ if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0])
+ elif kind == "extreme":
+ for quantity in (body.get("readout") or {}).get("quantities") or []:
+ if quantity.get("quantity") == read["quantity"]:
+ value = quantity.get(read["which"])
+ if "index" in read:
+ # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points)
+ k = read["index"]
+ value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None
+ return value if number(value) else None
+
+
+def readout_for(constraints, on="run"):
+ """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key)."""
+ quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"})
+ return {"quantities": quantities} if quantities else None
+
+
+def design_shape(spec):
+ """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged."""
+ if spec.get("stages"):
+ return "staged"
+ if spec.get("tool") == "solve" or spec.get("kind") == "solve":
+ return "solve"
+ chain = spec.get("chain") or {}
+ if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue":
+ return "continued"
+ return "coupled" if chain else "run"
+
+
+def continuation_of(spec):
+ """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it},
+ next outcomes, the next run's places that also hold a first-run design value)."""
+ chain = spec["chain"]
+ template = chain.get("next_template") or chain.get("template") or chain.get("next")
+ if "carried" in chain: # group 1
+ carried = dict(chain["carried"])
+ elif "handed" in chain: # group 4
+ named = chain.get("handed_from") or {}
+ carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]}
+ else: # group 5
+ carried = {k: "final_state." + k for k in chain.get("carry") or []}
+ if chain.get("clock"):
+ carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"]
+ outcomes = chain.get("next_outcomes") or spec["run_outcomes"]
+ return template, carried, outcomes, list(chain.get("next_also") or [])
+
+
+def meets(constraint, value):
+ if value is None:
+ return False
+ return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"]
+
+
+def history_layout_problem(layout, parameters, frames_count):
+ """None when the arrays of a chained solve are laid out as the task states; else what is not."""
+ if layout is None:
+ return None
+ if layout["kind"] == "stardust_slab":
+ names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s",
+ "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2")
+ columns = [parameters.get(name) for name in names]
+ if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns):
+ return "the history columns are not all lists of numbers"
+ time, pressure, coefficient, enthalpy, radiative = columns
+ rows = frames_count + 3
+ if any(len(c) != rows for c in columns):
+ return "the history has not one row before the %d frames handed and two after them" % frames_count
+ if time[0] != 0.0 or coefficient[0] != 0.0:
+ return "row 0 is not at 0 s with no heating"
+ if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]:
+ return "row 0 does not repeat the first frame's pressure and enthalpy"
+ if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]:
+ return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"]
+ if coefficient[-2] != 0.0 or coefficient[-1] != 0.0:
+ return "the stream is not off after the frames"
+ if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]:
+ return "the rows after the frames do not hold the last frame's pressure and enthalpy"
+ if any(v != 0.0 for v in radiative):
+ return "a row of the history holds radiative heating"
+ return None
+ if layout["kind"] == "triga_element":
+ return None # every array is handed by the coupling and held to its bits by the verifier
+ return "an unknown layout"
+
+
+# ------------------------------------------------------------------------------------------
+# the call record
+# ------------------------------------------------------------------------------------------
+def card_requests(env, card):
+ """Every request on the card, [(tool, arguments)], read leniently (for the call log)."""
+ out = []
+
+ def take(part):
+ if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict):
+ out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"]))
+
+ if env["family"] in ("tradeoff", "chain_design"):
+ stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []]
+ for side in ("passing", "failing"):
+ design = card.get(side) if isinstance(card.get(side), dict) else {}
+ for key in stages or ("run", "solve", "next"):
+ take(design.get(key))
+ elif env["family"] == "budget":
+ take(card.get("holds"))
+ take(card.get("stops"))
+ return out
+
+
+def sequence(calls):
+ return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls]
+
+
+def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row):
+ """None when the call record holds; else why not (an integrity failure)."""
+ check = env["check"]
+ if calls_from == "harness":
+ if calls is None:
+ return "no harness call log: every attempt is scored with the calls the harness recorded"
+ if log_problem:
+ return log_problem
+ if reply_calls is not None and sequence(reply_calls) != sequence(calls):
+ return "the call log beside the reply differs from the harness log"
+ elif calls is None:
+ return "no call log: every environment is scored with the agent's calls"
+ calls = [(tool_name(t), a) for t, a in calls]
+ banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])})
+ if banned:
+ return "the log holds calls of %s, which the task rules out" % ", ".join(banned)
+ computing = [(t, a) for t, a in calls if t not in FREE_TOOLS]
+ row["computing_calls"] = len(computing)
+ if check.get("budget") and len(computing) > check["budget"]:
+ return "%d computing calls; the budget is %d" % (len(computing), check["budget"])
+ sent = {(t, canonical(a)) for t, a in computing}
+ for tool, arguments in card_requests(env, card):
+ if (tool, canonical(arguments)) not in sent:
+ return "a %s request on the card is not among the calls in the log" % tool
+ if env["family"] == "forensics" and not computing:
+ return "no computing call behind the answer: the table was not put to the verifier"
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# the families
+# ------------------------------------------------------------------------------------------
+def request_of(part, tool, what):
+ """The arguments of one request on the card (Integrity when it is not one)."""
+ if not isinstance(part, dict):
+ raise Integrity("%s is missing" % what)
+ request = part.get("request")
+ if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)):
+ raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what)
+ if tool_name(request.get("tool")) != tool:
+ raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool))
+ return request["arguments"]
+
+
+def score_design(env, design, which, replay, proofs):
+ """One design of a boundary family: facts {x, met, values, stopped, steps_landed}."""
+ check = env["check"]
+ spec = check["design"]
+ shape = design_shape(spec)
+ if shape in ("solve", "staged", "continued") and not isinstance(design, dict):
+ raise Integrity("the %s design is missing" % which)
+ if shape == "solve":
+ return score_solve_design(env, design, which, replay, proofs)
+ if shape == "staged":
+ return score_staged_design(env, design, which, replay, proofs)
+ if shape == "continued":
+ return score_continued_design(env, design, which, replay, proofs)
+ chain = spec.get("chain")
+ run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory",
+ "the %s design's run" % which)
+ free = set(spec.get("free") or []) | variable_places(spec["variable"])
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ for place in spec.get("free") or []:
+ if place.endswith(".steps"):
+ steps = get_path(run_args, place)
+ if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)):
+ raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"]))
+ stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"]
+ stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names
+ if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name:
+ raise Wrong("the %s design's run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ solve_args, solve = None, None
+ if chain:
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != chain["solver"]:
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ handed = solve_args.get("from")
+ if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]:
+ raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"]))
+ if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof:
+ raise Integrity("the %s design's solve is not handed the design's own sealed run" % which)
+ parameters = solve_args.get("parameters")
+ if not isinstance(parameters, dict):
+ raise Integrity("the %s design's solve has no parameters" % which)
+ solve_free = set(chain.get("handed") or [])
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ solve_free.add(spec["variable"]["path"].split(".", 1)[1])
+ where = differs(chain["parameters"], parameters, solve_free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where))
+ frames = len((run["body"] or {}).get("frames") or [])
+ problem = history_layout_problem(chain.get("layout"), parameters, frames)
+ if problem:
+ raise Integrity("the %s design's solve: %s" % (which, problem))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] != "converged":
+ raise Wrong("the %s design's solve comes back %s%s, not converged" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else ""))
+ x = design_value(spec["variable"], run_args, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", "")))
+ met, values = {}, {}
+ for constraint in check["constraints"]:
+ if constraint["on"] == "outcome":
+ values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"])
+ met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"])
+ continue
+ value = read_value(constraint["read"], run if constraint["on"] == "run" else solve)
+ values[constraint["id"]] = value
+ met[constraint["id"]] = meets(constraint, value)
+ facts = {"x": x, "met": met, "values": values}
+ if run["outcome"] not in NOT_STOPPED and run["body"]:
+ facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed")
+ return facts
+
+
+def halted(answer, stop, staged=False):
+ """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that
+ is not completed or converged (group 3's rule, kept as built)."""
+ if staged:
+ return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop
+ return answer["outcome"] == "refused" and answer["stop"] == stop
+
+
+def constraint_facts(check, answers, judged, staged=False):
+ """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop
+ constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design."""
+ met, values = {}, {}
+ for c in check["constraints"]:
+ if c["on"] == "outcome":
+ a = answers.get(c["stage"]) if c.get("stage") else judged
+ values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"]))
+ met[c["id"]] = a is not None and not halted(a, c["stop"], staged)
+ continue
+ a = answers.get(c["on"])
+ value = read_value(c["read"], a) if a is not None else None
+ values[c["id"]] = value
+ met[c["id"]] = meets(c, value) if c.get("limit") is not None else None
+ return met, values
+
+
+def stopped_by(answer, constraints, stage=None):
+ """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given)."""
+ return any(halted(answer, c["stop"], stage is not None) for c in constraints
+ if c["on"] == "outcome" and (stage is None or c.get("stage") == stage))
+
+
+def score_solve_design(env, design, which, replay, proofs):
+ """One design that is one solve and no run (check.design.tool or kind "solve")."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != spec["template"].get("solver"):
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or [])
+ where = differs(spec["template"], solve_args, free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at %s" % (which, where))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]):
+ raise Wrong("the %s design's solve comes back %s%s, not %s" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"])))
+ x = design_value(dict(var, on="solve"), None, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, {"solve": solve}, solve)
+ facts = {"x": x, "met": met, "values": values}
+ if solve["outcome"] not in NOT_STOPPED and solve["body"]:
+ facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True
+ return facts
+
+
+def score_continued_design(env, design, which, replay, proofs):
+ """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes
+ the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer
+ also holds each carried start field to the first run's answer, bit for bit."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ on_next = var["kind"] == "path" and var.get("on") == "next"
+ template, carried, next_outcomes, next_also = continuation_of(spec)
+ run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which)
+ free = set(spec.get("free") or []) | (set() if on_next else variable_places(var))
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run"))
+ if run["outcome"] not in spec["run_outcomes"]:
+ raise Wrong("the %s design's first run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which)
+ handed = next_args.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args)
+ or handed.get("run_seal") != run_proof):
+ raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which)
+ next_free = {"initial." + name for name in carried} | {"from"} | set(next_also)
+ if on_next:
+ next_free |= {var["path"]} | set(var.get("also") or [])
+ where = differs(template, without_readout(next_args), next_free)
+ if where:
+ raise Integrity("the %s design's next run differs from the task's at %s" % (which, where))
+ start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {}
+ for name, source in carried.items():
+ held, given = get_path(run["body"] or {}, source), start.get(name)
+ if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))):
+ raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source))
+ holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's next run_seal: %s" % (which, words))
+ nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next"))
+ if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]):
+ raise Wrong("the %s design's next run comes back %s%s, not %s" % (
+ which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes)))
+ x = design_value(var, run_args, None, next_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ for place in next_also:
+ again = get_path(next_args, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place))
+ met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt)
+ facts = {"x": x, "met": met, "values": values}
+ if nxt["outcome"] not in NOT_STOPPED and nxt["body"]:
+ facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed")
+ return facts
+
+
+def build_stage_request(spec, stage, x, answers, requests):
+ """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from
+ earlier stages' answers, and a continuation's start and from (used by run_reference.py)."""
+ q = copy.deepcopy(stage["template"])
+ var = spec["variable"]
+ if var.get("stage") == stage["key"]:
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(q, place, x)
+ for h in stage.get("handed") or []:
+ set_path(q, h["to"], read_value(h["read"], answers[h["from"]]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ final = answers[parent]["body"]["final_state"]
+ q["initial"] = {k: final[k] for k in stage["template"]["initial"]}
+ q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]}
+ return q
+
+
+def score_staged_design(env, design, which, replay, proofs):
+ """One staged design (check.design.stages): each stage a run or a solve, in order."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ stages = spec["stages"]
+ answers, requests, facts = {}, {}, {}
+ for i, stage in enumerate(stages):
+ key, tool = stage["key"], stage["tool"]
+ sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key)))
+ free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []}
+ if var.get("stage") == key:
+ free |= {var["path"]} | set(var.get("also") or [])
+ if stage.get("continues"):
+ free |= {"initial", "from"}
+ where = differs(stage["template"], sent, free)
+ if where:
+ raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where))
+ for h in stage.get("handed") or []:
+ want = read_value(h["read"], answers[h["from"]])
+ got = get_path(sent, h["to"])
+ if want is None or not number(got) or float(got) != float(want):
+ raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % (
+ which, key, h["from"], h["read"]["quantity"], h["to"]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ handed = sent.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent])
+ or handed.get("run_seal") != design[parent].get("proof")):
+ raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent))
+ final = (answers[parent]["body"] or {}).get("final_state") or {}
+ start = sent.get("initial")
+ keys = set(stage["template"]["initial"])
+ if not isinstance(start, dict) or set(start) != keys or any(
+ not number(start[k]) or float(start[k]) != final.get(k) for k in keys):
+ raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent))
+ holds, words = replay.proof_holds(tool, sent, design[key].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's %s proof: %s" % (which, key, words))
+ answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None)
+ named = stopped_by(answer, check["constraints"], stage=key)
+ if answer["outcome"] not in stage["outcomes"] and not named:
+ raise Wrong("the %s design's %s comes back %s%s, not %s" % (
+ which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"])))
+ answers[key], requests[key] = answer, sent
+ if named:
+ facts["stopped"], facts["stopped_stage"] = answer["stop"], key
+ facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None
+ facts["no_step"] = tool != "run_trajectory"
+ if i != len(stages) - 1:
+ raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"]))
+ x = design_value(dict(var, on="run"), requests.get(var["stage"]), None)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, answers, None, staged=True)
+ facts.update({"x": x, "met": met, "values": values})
+ return facts
+
+
+def grade_bracket(a, b, star, tol, slack, row):
+ """(reward_ok, graded) for a bracket [a, b] with its sides right."""
+ width = abs(b - a)
+ straddles = min(a, b) - slack <= star <= max(a, b) + slack
+ within = width <= tol * (1 + 1e-9)
+ e = max(a, b, star) - min(a, b, star)
+ r = e / tol if tol > 0 else float("inf")
+ row["width"], row["width_ratio"] = width, r
+ if within and straddles:
+ return True, 1.0
+ if r <= 1:
+ return False, OTHER_CROSSING
+ return False, GRADED_DECAY ** math.log10(r)
+
+
+def score_boundary(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ passing = score_design(env, card.get("passing"), "passing", replay, proofs)
+ failing = score_design(env, card.get("failing"), "failing", replay, proofs)
+ row["passing"], row["failing"] = passing, failing
+ span = check["design"].get("range")
+ if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])):
+ raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span))
+ broken = [c for c, ok in passing["met"].items() if not ok]
+ if broken:
+ raise Wrong("the passing design breaks %s" % ", ".join(broken))
+ broken = [c for c, ok in failing["met"].items() if not ok]
+ if not broken:
+ raise Wrong("the failing design meets every constraint")
+ binding = card.get("binding")
+ if binding != reference["binding"]:
+ raise Wrong("binding names %r; the constraint that binds is another" % (binding,))
+ if binding not in broken:
+ raise Wrong("the failing design does not break %s, the constraint named binding" % binding)
+ if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]:
+ said = card.get("failing") or {}
+ if said.get("stopped") != failing.get("stopped"):
+ raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped")))
+ if failing.get("no_step"):
+ pass # a solve that is refused has no step: its stop's name is stated
+ elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")):
+ raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step")))
+ spec = check["design"]
+ xp, xf = passing["x"], failing["x"]
+ if spec["direction"] == "largest" and not xf > xp:
+ raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one")
+ if spec["direction"] == "smallest" and not xf < xp:
+ raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one")
+ ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row)
+ if not ok:
+ return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % (
+ abs(xf - xp), spec["tolerance"])
+ return 1.0, None
+
+
+def score_budget(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ template, path, tool = check["template"], check["variable"], check["tool"]
+ sides = {}
+ for side in ("holds", "stops"):
+ arguments = request_of(card.get(side), tool, side)
+ also = check.get("also") or []
+ where = differs(template, without_readout(arguments), {path} | set(also))
+ if where:
+ raise Integrity("the %s request differs from the task's at %s" % (side, where))
+ x = get_path(arguments, path)
+ if not number(x):
+ raise Integrity("the %s request has no number at %s" % (side, path))
+ for place in also:
+ again = get_path(arguments, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path))
+ holds, words = replay.proof_holds(tool, arguments, card[side].get("proof"))
+ proofs.append(holds)
+ sides[side] = (float(x), arguments, holds, words)
+ for side in ("holds", "stops"):
+ if not sides[side][2]:
+ raise Integrity("the %s seal: %s" % (side, sides[side][3]))
+ held = replay.answer(tool, sides["holds"][1])
+ stopped = replay.answer(tool, sides["stops"][1])
+ row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"])
+ if held["outcome"] not in NOT_STOPPED:
+ raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"]))
+ if stopped["stop"] != check["stop"]:
+ raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"]))
+ if card["stops"].get("stopped") != check["stop"]:
+ raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"]))
+ xh, xs = sides["holds"][0], sides["stops"][0]
+ star = reference["boundary"]
+ row["holds_value"], row["stops_value"] = xh, xs
+ tol = check["relative_width"] * abs(star)
+ ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row)
+ if not ok:
+ return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % (
+ abs(xs - xh), check["relative_width"])
+ return 1.0, None
+
+
+def forensics_f1(env, named):
+ """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer."""
+ if not isinstance(named, dict):
+ return 0.0, "false_rows is not an object of row and reason"
+ rows = [c["row"] for c in env["check"]["rows"]]
+ truth = env["reference"]["false_rows"]
+ unknown = [r for r in named if r not in set(rows)]
+ if unknown:
+ return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown))
+ reasons = env["check"].get("reasons") or REASONS
+ bad = [r for r, why in named.items() if why not in reasons]
+ if bad:
+ return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons))
+ if rows and set(named) == set(rows):
+ return 0.0, "every row of the table is named false: a blanket answer"
+ found = sum(1 for r, why in named.items() if truth.get(r) == why)
+ if not truth and not named:
+ return 1.0, None
+ precision = found / len(named) if named else 0.0
+ recall = found / len(truth) if truth else 0.0
+ f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0
+ if f1 >= 1.0:
+ return 1.0, None
+ missed = sorted(set(truth) - set(named))
+ wrongly = sorted(set(named) - set(truth))
+ wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r])
+ said = []
+ if missed:
+ said.append("%d false row(s) not named" % len(missed))
+ if wrongly:
+ said.append("%d genuine row(s) named false" % len(wrongly))
+ if wrong_reason:
+ said.append("%d false row(s) with another reason" % len(wrong_reason))
+ return f1, "; ".join(said)
+
+
+def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None):
+ """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record);
+ reply_calls: the reply-side log, compared with calls under calls_from="harness"."""
+ row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from,
+ "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None}
+ card, problem = read_card(reply)
+ if problem:
+ row.update(verdict="no_card", reason=problem)
+ return row
+ proofs = []
+ try:
+ problem = engine_problem(env, replay)
+ if problem:
+ raise Integrity(problem)
+ problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row)
+ if problem:
+ raise Integrity(problem)
+ family = env["family"]
+ if family in ("tradeoff", "chain_design"):
+ graded, reason = score_boundary(env, card, replay, row, proofs)
+ elif family == "budget":
+ graded, reason = score_budget(env, card, replay, row, proofs)
+ elif family == "forensics":
+ named = card.get("false_rows")
+ if isinstance(named, dict):
+ row["named"] = named
+ graded, reason = forensics_f1(env, named)
+ proofs = [True]
+ if reason and graded == 0.0 and not isinstance(named, dict):
+ raise Wrong(reason)
+ else:
+ raise Wrong("unknown family %s" % family)
+ except Integrity as problem:
+ row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ except Wrong as problem:
+ row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ proofs_hold = int(bool(proofs) and all(proofs))
+ correct = int(graded >= 1.0 and reason is None)
+ row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1),
+ graded=round(graded, 6) if proofs_hold else 0.0,
+ verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason)
+ return row
+
+
+def records_for(folder, env_id, calls_from, harness_dir=None):
+ """(calls, reply_calls, log_problem) for one environment's reply in folder."""
+ reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl"))
+ if calls_from == "harness":
+ calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl"))
+ return calls, reply_calls, log_problem
+ return reply_calls, None, None
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
+ parser.add_argument("replies")
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out")
+ parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness")
+ parser.add_argument("--harness-dir")
+ parser.add_argument("--quiet", action="store_true")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ missing = wanted - {e["id"] for e in environments}
+ if missing:
+ sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments))
+ for env in environments:
+ for problem in row_problems(env):
+ print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr)
+ verifier = open_verifier(args.engine)
+ replay = Replay(verifier)
+ rows = []
+ try:
+ for env in environments:
+ path = os.path.join(args.replies, env["id"] + ".txt")
+ reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else ""
+ calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir)
+ row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem)
+ rows.append(row)
+ if not args.quiet:
+ print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"],
+ row["reason"] or ""), flush=True)
+ replay.seen.clear()
+ finally:
+ close_verifier(verifier)
+ if args.out:
+ with open(args.out, "w", encoding="utf-8") as f:
+ for row in rows:
+ f.write(json.dumps(row) + "\n")
+ total = len(rows)
+ print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % (
+ total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows),
+ sum(r["graded"] for r in rows) / total if total else 0.0,
+ sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows)))
+ by = {}
+ for r in rows:
+ by.setdefault(r["family"], []).append(r)
+ for family in FAMILIES:
+ if family in by:
+ print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]),
+ sum(r["graded"] for r in by[family]) / len(by[family])))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/solve.sh b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/solve.sh
new file mode 100644
index 0000000000000000000000000000000000000000..72cbff6116b4373dcb5a275b10f1ea91c863186a
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/solve.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+# Harbor's oracle agent copies solution/ to /solution and runs this.
+#
+# It makes the reference answer card here, on the verifier of this machine: the
+# dataset's own run_reference.py sends this environment's reference requests to
+# /usr/local/bin/mcp_stdio (and, for a chained design, hands each run to its solve
+# through the task's coupling) and writes a reply that ends with the card. The card
+# is saved where the instruction asks for it, and the calls it made beside it, so
+# that a call-budget environment is scored on them: the oracle runs no model, and
+# Harbor's record of its run holds no tool call.
+#
+# The four paths can be moved with environment variables, so this runs outside a container.
+set -euo pipefail
+HERE="${ZTP_SOLUTION_DIR:-$(cd "$(dirname "$0")" && pwd)}"
+ENGINE="${ZTP_ENGINE:-/usr/local/bin/mcp_stdio}"
+ANSWER="${ZTP_ANSWER_FILE:-/app/answer.json}"
+CALLS="${ZTP_CALLS_FILE:-/app/calls.jsonl}"
+WORK="$(mktemp -d)"
+trap 'rm -rf "$WORK"' EXIT
+
+cd "$HERE"
+FLAGS=()
+grep -q -- '"--environments"' run_reference.py && FLAGS+=(--environments data/environments.jsonl)
+grep -q -- '"--direct"' run_reference.py && FLAGS+=(--direct) # no proxy in here: the oracle's own call log
+python3 -B run_reference.py --engine "$ENGINE" ${FLAGS[@]+"${FLAGS[@]}"} --out "$WORK/replies"
+REPLY="$(ls "$WORK"/replies/*.txt)" # one environment here, so one reply
+cat "$REPLY"
+mkdir -p "$(dirname "$ANSWER")" "$(dirname "$CALLS")"
+tail -n 1 "$REPLY" > "$ANSWER"
+cp "$WORK"/replies/*.calls.jsonl "$CALLS"
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/ztp_mcp.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/ztp_mcp.py
new file mode 100644
index 0000000000000000000000000000000000000000..1afbc12d8c05d8c143563152ffae500e8052a6db
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/solution/ztp_mcp.py
@@ -0,0 +1,188 @@
+"""A small Model Context Protocol client for the Zero-Trust Physics verifier.
+
+Standard library only. It speaks MCP two ways:
+
+ stdio to a verifier built from the public source and started here as a program
+ (target/release/mcp_stdio): one JSON-RPC message a line, no network.
+ HTTP to an MCP address (JSON-RPC in a POST), such as
+
+ https://mcp.zerotrustphysics.com/mcp/open Open to any agent.
+
+The open address gives each network address one place in the physics pool at a
+time and answers "Too many concurrent physics tasks." or HTTP 429 when it is
+busy; nothing waits on the server, so this client sends one request at a time
+and, when it is told to come back, waits and sends the same request again.
+
+Licence: Apache-2.0.
+"""
+import json
+import select
+import shlex
+import subprocess
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+
+
+class McpError(RuntimeError):
+ pass
+
+
+class Verifier:
+ """One MCP endpoint. call(tool, arguments) returns (text, is_error)."""
+
+ def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True):
+ self.url = url
+ self.timeout_s = timeout_s
+ self.patience_s = patience_s # how long to keep asking politely before giving up on one request
+ self.pause_s = pause_s # a fixed pause after every request, for a shared address
+ self.headers = dict(headers or {})
+ self.quiet = quiet
+ self.session = None
+ self.server = None
+ self.requests_sent = 0
+ self.times_asked_to_wait = 0
+ self._id = 0
+
+ # -- transport -------------------------------------------------------------------------
+ def _post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-environments/1.0", **self.headers}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ self.requests_sent += 1
+ with urllib.request.urlopen(request, timeout=self.timeout_s) as response:
+ session = response.headers.get("Mcp-Session-Id")
+ if session:
+ self.session = session
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ raise McpError("the event stream held no answer to the request")
+ return json.loads(raw) if raw.strip() else {}
+
+ def _ask(self, method, params=None):
+ """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again."""
+ self._id += 1
+ message = {"jsonrpc": "2.0", "id": self._id, "method": method}
+ if params is not None:
+ message["params"] = params
+ started, wait = time.time(), 2.0
+ while True:
+ reason = None
+ try:
+ answer = self._post(message)
+ if "error" in answer:
+ raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300])
+ result = answer.get("result", {})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ if method == "tools/call" and BUSY in text and len(text) < 400:
+ reason = "the physics pool is busy"
+ else:
+ if self.pause_s:
+ time.sleep(self.pause_s)
+ return result
+ except urllib.error.HTTPError as problem:
+ if problem.code == 429 or problem.code >= 500:
+ after = problem.headers.get("Retry-After")
+ reason = "HTTP %d" % problem.code
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ else:
+ raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300]))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem:
+ reason = "no connection (%s)" % problem
+ self.times_asked_to_wait += 1
+ if time.time() - started + wait > self.patience_s:
+ raise McpError("gave up after %d s: %s" % (self.patience_s, reason))
+ if not self.quiet:
+ print(" %s; asking again in %.0f s" % (reason, wait), flush=True)
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+ # -- protocol --------------------------------------------------------------------------
+ def connect(self):
+ result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {},
+ "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}})
+ self.server = result.get("serverInfo")
+ try:
+ self._post({"jsonrpc": "2.0", "method": "notifications/initialized"})
+ except Exception: # a notification has no answer; some servers close without one
+ pass
+ return result
+
+ def tools(self):
+ """The tool declarations exactly as the endpoint gives them."""
+ return self._ask("tools/list").get("tools", [])
+
+ def call(self, tool, arguments=None):
+ """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag."""
+ result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ return text, bool(result.get("isError"))
+
+ def call_json(self, tool, arguments=None):
+ """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON."""
+ text, is_error = self.call(tool, arguments)
+ try:
+ return json.loads(text), is_error
+ except ValueError:
+ return text, is_error
+
+
+class StdioVerifier(Verifier):
+ """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line.
+ For anyone who holds an MCP server as a program; the open address needs none of this."""
+
+ def __init__(self, command, timeout_s=600, **kwargs):
+ super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs)
+ self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+
+ def _post(self, message):
+ self.requests_sent += 1
+ try:
+ self.proc.stdin.write((json.dumps(message) + "\n").encode())
+ self.proc.stdin.flush()
+ except OSError: # a program that has stopped reading will not start again
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ raise McpError("the program stopped reading")
+ if "id" not in message:
+ return {}
+ while True:
+ ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s)
+ if not ready:
+ raise McpError("no answer in %d s" % self.timeout_s)
+ line = self.proc.stdout.readline()
+ if not line:
+ raise McpError("the program closed its output")
+ found = json.loads(line)
+ if found.get("id") == message["id"]:
+ return found
+
+ def close(self):
+ self.proc.terminate()
+ try:
+ self.proc.wait(timeout=5)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def connect(endpoint=OPEN_ADDRESS, **kwargs):
+ """A connected verifier: an http(s) address, or "stdio:" for a program."""
+ verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs)
+ verifier.connect()
+ return verifier
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/task.toml b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/task.toml
new file mode 100644
index 0000000000000000000000000000000000000000..8c52b5cdf3937d74f5d127d31b92016b7c51839b
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/task.toml
@@ -0,0 +1,40 @@
+schema_version = "1.4"
+artifacts = ["/app/answer.json", "/app/calls.jsonl", "/logs/agent/trajectory.json", "/logs/agent/oracle.txt"]
+
+[task]
+name = "protocol-company/g1d-budget5-cell1000-current-16min-11c"
+version = "1.0.0"
+description = "Budgeted search: a named physical stop bracketed to the task's width within the task's call budget, scored on the bracket and the call log."
+authors = [{ name = "Protocol Company" }]
+keywords = ["zero-trust-physics", "physics", "mcp", "tool-use", "verifier", "multi-step", "budgeted_search"]
+
+[metadata]
+environment_id = "g1d-budget5-cell1000-current-16min-11c"
+family = "budget"
+kind = "budgeted_search"
+engine_source = "https://github.com/johnkruze/zero-trust-physics-engine"
+engine_tag = "v0.15.3"
+engine_commit = "664d68f426ccdfd0159e5f91857edba3872390d1"
+engine_binary_sha256 = "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"
+gateway_version = "0.15.3"
+scores = ["correct", "proofs_hold"]
+
+[agent]
+timeout_sec = 1200.0
+
+[verifier]
+timeout_sec = 900.0
+environment_mode = "separate"
+
+[environment]
+build_timeout_sec = 1800.0
+cpus = 1
+memory_mb = 2048
+storage_mb = 10240
+workdir = "/app"
+
+[[environment.mcp_servers]]
+name = "verifier"
+transport = "stdio"
+command = "/usr/local/bin/mcp_stdio"
+args = []
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/Dockerfile b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..56b2bc42ad98e27839b60a61ac8e4aaa87966424
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/Dockerfile
@@ -0,0 +1,11 @@
+# The grader's image: the task's tests at /tests and the verifier of release v0.15.3 as an MCP stdio server at
+# /usr/local/bin/mcp_stdio (a bridge to its address).
+FROM python:3.12-slim-bookworm
+ARG ZTP_ENGINE_TAG=v0.15.3
+ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1
+COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py
+RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "${ZTP_VERIFIER_URL:-https://mcp.zerotrustphysics.com/mcp/open}"\n' > /usr/local/bin/mcp_stdio \
+ && chmod +x /usr/local/bin/mcp_stdio
+COPY . /tests
+RUN mkdir -p /logs/verifier /logs/agent /logs/artifacts /app
+WORKDIR /app
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/environment.jsonl b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/environment.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..2c36d88221986f254d807a1e554c196291528586
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/environment.jsonl
@@ -0,0 +1 @@
+{"id": "g1d-budget5-cell1000-current-16min-11c", "family": "budget", "kind": "budgeted_search", "models": ["energy/cell_2170_model3"], "real_thing": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.", "task": "Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.62 Ah, rested at 93 percent charge with its case at 11 degrees Celsius, is discharged at one constant current for 16 minutes (960 steps of 1 s), its case held at 11 degrees Celsius. Above some current it reaches its lower voltage limit before the 16 minutes are up (UndervoltageLimit). Find that current, in amps.\n\nFind it to five significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.001 percent of the value apart. It lies between 10 and 15 A.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.93, \"capacity_ah\": 4.62, \"case_temperature_least_c\": 11.0, \"case_temperature_most_c\": 11.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 960, \"load\": {\"current_a\": \"\", \"case_temperature_c\": 11.0}}], \"record_every\": 960}}\n\nBudget: at most 5 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.", "check": {"tool": "run_trajectory", "template": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": null, "case_temperature_c": 11.0}}], "record_every": 960}, "variable": "segments[0].load.current_a", "also": [], "stop": "UndervoltageLimit", "relative_width": 1e-05, "budget": 5, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "A stop located by halving on the local 0.15.3 build; the task rules the search tools out and allows 5 computing calls."}, "reference": {"boundary": 12.05958181564474, "bisect_width": 6.9118044621063746e-12, "holds": {"x": 12.059545636899294, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059545636899294, "case_temperature_c": 11.0}}], "record_every": 960}}, "proof": "74bbb04a7f1ce03d8d60aa42063b094b0e66f03d602d37398911e7486b803eec45399df2c82f1bfb7fdce1ae655c33d4", "outcome": "completed", "steps_landed": 960}, "stops": {"x": 12.059617994390187, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.93, "capacity_ah": 4.62, "case_temperature_least_c": 11.0, "case_temperature_most_c": 11.0}, "dt_s": 1.0, "segments": [{"steps": 960, "load": {"current_a": 12.059617994390187, "case_temperature_c": 11.0}}], "record_every": 960}}, "proof": "3a8d1ae90c4ebcdab0950a9aa2280bbf270ed5acd8fcfecac04daf6c8b9091c28c269d997e47ce4a851c879dfd6de519", "outcome": "refused", "steps_landed": 959}, "span_pattern": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhssssssssssssssssssssssssssssssssssss", "span": [10.0, 15.0], "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/grade.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/grade.py
new file mode 100644
index 0000000000000000000000000000000000000000..88564e4e42982627e805eb8e50bd600ae052dd80
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/grade.py
@@ -0,0 +1,272 @@
+"""Harbor glue: find the agent's reply and its calls, hand them to the dataset's score.py, write the reward.
+
+Standard library only. Every path can be moved with an environment variable, so the
+same file runs outside a container:
+
+ ZTP_TESTS_DIR this folder: environment.jsonl (and score.py, ztp_mcp.py) (default: where this file is)
+ ZTP_SCORER_DIR where score.py and ztp_mcp.py sit (default: ZTP_TESTS_DIR)
+ ZTP_ANSWER_FILE the card the instruction asks the agent to save (default /app/answer.json)
+ ZTP_CALLS_FILE a call log written by the oracle's solve.sh (default /app/calls.jsonl)
+ ZTP_ORACLE_LOG Harbor's log of the oracle agent's run (default /logs/agent/oracle.txt)
+ ZTP_TRAJECTORY_FILE Harbor's record of the run, in ATIF (default /logs/agent/trajectory.json)
+ ZTP_VERIFIER_DIR where the reward is written (default /logs/verifier)
+ ZTP_ENGINE the verifier, MCP over stdio (default /usr/local/bin/mcp_stdio)
+ ZTP_SCORE_TIMEOUT_S how long the scorer may take, in seconds (default 600)
+
+The reply, first found: the answer file when it is there and not empty (one JSON object over
+several lines is put on one line first); else the last agent message with text in the
+trajectory; else none, and the scorer gives 0.
+
+The calls, for every environment (a call budget, and a forensics answer, are scored on them): the agent's calls of the
+verifier's own tools in the trajectory's agent steps, in order, by function name and arguments (mcp__verifier__solve is
+read as solve). The agent's other tools (a shell, a file editor, writing /app/answer.json) are left out of the record:
+they are not verifier calls and are not counted against a budget. When there is no trajectory file at all and Harbor's
+oracle has run (its log /logs/agent/oracle.txt is there), the log solution/solve.sh wrote is read instead: the oracle
+runs no model, so Harbor records no tool call for it. Any other run with no trajectory is scored with no call record,
+and a budget or forensics answer then scores 0.
+
+The verifier is held to its release by what it answers (version 0.15.3, kernel genesis_kernel_v0.13.1); the binary's
+sha256 is recorded on the score row. pack_score.py, beside score.py, holds that rule; --strict-binary is not used here
+because this image builds the verifier from source, a different file from the served build.
+
+The reward, reward.json in ZTP_VERIFIER_DIR: {"reward": 0 or 1, "correct": 0 or 1, "proofs_hold": 0 or 1}.
+reward is 1 only when both scores are 1. score.json holds the scorer's line (the reason for a 0).
+If the scorer itself fails, no reward is written and this exits non-zero.
+"""
+import json
+import os
+import re
+import signal
+import subprocess
+import sys
+import tempfile
+
+TESTS = os.environ.get("ZTP_TESTS_DIR") or os.path.dirname(os.path.abspath(__file__))
+SCORER = os.environ.get("ZTP_SCORER_DIR") or TESTS
+ANSWER = os.environ.get("ZTP_ANSWER_FILE") or "/app/answer.json"
+CALLS = os.environ.get("ZTP_CALLS_FILE") or "/app/calls.jsonl"
+TRAJECTORY = os.environ.get("ZTP_TRAJECTORY_FILE") or "/logs/agent/trajectory.json"
+ORACLE_LOG = os.environ.get("ZTP_ORACLE_LOG") or "/logs/agent/oracle.txt"
+OUT = os.environ.get("ZTP_VERIFIER_DIR") or "/logs/verifier"
+ENGINE = os.environ.get("ZTP_ENGINE") or "/usr/local/bin/mcp_stdio"
+TIMEOUT_S = float(os.environ.get("ZTP_SCORE_TIMEOUT_S") or 600)
+SCORES = ("correct", "proofs_hold")
+
+
+class ScorerFailed(Exception):
+ """The check could not be made. No reward is written."""
+
+
+def on_one_line(text):
+ try:
+ whole = json.loads(text)
+ except ValueError:
+ return text
+ if not isinstance(whole, dict):
+ return text
+ return re.sub(r"[\r\n]+", " ", text.strip())
+
+
+def text_of(message):
+ if isinstance(message, str):
+ return message
+ if isinstance(message, list):
+ return "\n".join(part.get("text") or "" for part in message if isinstance(part, dict) and part.get("type") == "text")
+ return ""
+
+
+def trajectory_steps():
+ try:
+ with open(TRAJECTORY, encoding="utf-8", errors="replace") as f:
+ return json.load(f).get("steps") or []
+ except (OSError, ValueError, AttributeError, TypeError):
+ return []
+
+
+def find_reply():
+ try:
+ with open(ANSWER, encoding="utf-8-sig", errors="replace") as f:
+ text = f.read()
+ if text.strip():
+ return on_one_line(text), "the answer file %s" % ANSWER
+ except OSError:
+ pass
+ for step in reversed(trajectory_steps()):
+ if isinstance(step, dict) and step.get("source") == "agent" and text_of(step.get("message")).strip():
+ return text_of(step["message"]), "the last agent message in %s" % TRAJECTORY
+ return None, "nowhere: no answer file and no agent message in a trajectory file"
+
+
+def verifier_tool(name):
+ """The verifier's own name for a tool call (mcp__verifier__solve -> solve), or None for any other tool."""
+ sys.path.insert(0, SCORER)
+ from score import VERIFIER_TOOLS, tool_name
+ tool = tool_name(name)
+ return tool if tool in VERIFIER_TOOLS else None
+
+
+def find_calls():
+ """(list of {"tool", "arguments"} or None, where they were found)."""
+ if os.path.isfile(TRAJECTORY):
+ calls, other = [], 0
+ for step in trajectory_steps():
+ if not isinstance(step, dict) or step.get("source") != "agent":
+ continue
+ for call in step.get("tool_calls") or []:
+ if not isinstance(call, dict):
+ continue
+ tool = verifier_tool(call.get("function_name"))
+ if tool is None:
+ other += 1
+ continue
+ arguments = call.get("arguments")
+ if isinstance(arguments, str):
+ try:
+ arguments = json.loads(arguments)
+ except ValueError:
+ arguments = {}
+ calls.append({"tool": tool, "arguments": arguments if isinstance(arguments, dict) else {}})
+ return calls, "%d verifier calls in %s (%d calls of other tools left out)" % (len(calls), TRAJECTORY, other)
+ if os.path.isfile(ORACLE_LOG):
+ try:
+ with open(CALLS, encoding="utf-8", errors="replace") as f:
+ logged = [json.loads(line) for line in f if line.strip()]
+ return logged, "the oracle's call log %s (no trajectory; %s is there)" % (CALLS, ORACLE_LOG)
+ except (OSError, ValueError):
+ return None, "nowhere: the oracle ran and wrote no call log"
+ return None, "nowhere: no trajectory file, and the oracle did not run"
+
+
+def the_environment():
+ path = os.path.join(TESTS, "environment.jsonl")
+ try:
+ with open(path, encoding="utf-8") as f:
+ rows = [json.loads(line) for line in f if line.strip()]
+ except (OSError, ValueError) as problem:
+ raise ScorerFailed("%s cannot be read: %s" % (path, problem))
+ if len(rows) != 1 or not isinstance(rows[0], dict) or not isinstance(rows[0].get("id"), str):
+ raise ScorerFailed("%s does not hold exactly one environment" % path)
+ return rows[0], path
+
+
+def verifier_answers():
+ if ENGINE.startswith("http://") or ENGINE.startswith("https://"):
+ return "an MCP address, not asked here"
+ if not os.path.isfile(ENGINE):
+ raise ScorerFailed("there is no verifier at %s" % ENGINE)
+ sys.path.insert(0, SCORER)
+ try:
+ from ztp_mcp import StdioVerifier
+ verifier = StdioVerifier([ENGINE], timeout_s=60, patience_s=0)
+ try:
+ verifier.connect()
+ server = verifier.server
+ finally:
+ verifier.close()
+ except Exception as problem:
+ raise ScorerFailed("the verifier at %s did not answer as an MCP server: %s" % (ENGINE, problem))
+ if not isinstance(server, dict) or not server.get("name"):
+ raise ScorerFailed("the program at %s answered and did not say what it is; it is not the verifier" % ENGINE)
+ return "%s %s" % (server.get("name"), server.get("version"))
+
+
+def run_scorer(command):
+ environment = dict(os.environ, PYTHONIOENCODING="utf-8")
+ process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environment,
+ encoding="utf-8", errors="replace", start_new_session=True)
+ try:
+ stdout, stderr = process.communicate(timeout=TIMEOUT_S)
+ except subprocess.TimeoutExpired:
+ try:
+ os.killpg(process.pid, signal.SIGKILL)
+ except OSError:
+ process.kill()
+ stdout, stderr = process.communicate()
+ return None, stdout, stderr
+ return process.returncode, stdout, stderr
+
+
+def grade(log):
+ environment, environment_path = the_environment()
+ name = environment["id"]
+ reply, found = find_reply()
+ log.append("environment: %s" % name)
+ log.append("reply from: %s" % found)
+ log.append("verifier: %s (%s)" % (ENGINE, verifier_answers()))
+ with tempfile.TemporaryDirectory() as work:
+ replies = os.path.join(work, "replies")
+ os.mkdir(replies)
+ if reply is not None:
+ with open(os.path.join(replies, name + ".txt"), "w", encoding="utf-8") as f:
+ f.write(reply)
+ calls, where = find_calls()
+ log.append("calls from: %s" % where)
+ if calls is not None:
+ with open(os.path.join(replies, name + ".calls.jsonl"), "w", encoding="utf-8") as f:
+ for call in calls:
+ f.write(json.dumps(call) + "\n")
+ scores_path = os.path.join(work, "scores.jsonl")
+ score_py = os.path.join(SCORER, "score.py")
+ entry = os.path.join(SCORER, "pack_score.py")
+ command = [sys.executable, "-B", entry if os.path.isfile(entry) else score_py, replies, "--engine", ENGINE,
+ "--environments", environment_path, "--only", name, "--out", scores_path]
+ with open(score_py, encoding="utf-8") as f:
+ if "--calls-from" in f.read():
+ # the call record here is the one this file found: Harbor's trajectory, or the oracle's log
+ command += ["--calls-from", "reply"]
+ code, stdout, stderr = run_scorer(command)
+ log.append("score.py exit: %s" % ("none, ended after %g s" % TIMEOUT_S if code is None else code))
+ log.append("score.py stdout:\n%s" % stdout)
+ log.append("score.py stderr:\n%s" % stderr)
+ if code is None:
+ raise ScorerFailed("score.py did not finish in %g s" % TIMEOUT_S)
+ if code != 0:
+ raise ScorerFailed("score.py exited %d: %s" % (code, (stderr.strip().splitlines() or ["no message"])[-1]))
+ try:
+ with open(scores_path, encoding="utf-8") as f:
+ rows = [json.loads(line) for line in f if line.strip()]
+ except (OSError, ValueError) as problem:
+ raise ScorerFailed("score.py wrote no scores that can be read: %s" % problem)
+ if len(rows) != 1 or not isinstance(rows[0], dict) or rows[0].get("id") != name:
+ raise ScorerFailed("score.py did not write one line for %s" % name)
+ row = rows[0]
+ if any(type(row.get(score)) is not int or row[score] not in (0, 1) for score in SCORES):
+ raise ScorerFailed("score.py did not give %s as 0 or 1" % " and ".join(SCORES))
+ row["reply_from"] = found
+ reward = {"reward": int(all(row[score] == 1 for score in SCORES))}
+ reward.update((score, row[score]) for score in SCORES)
+ if isinstance(row.get("graded"), (int, float)):
+ reward["graded"] = row["graded"]
+ return reward, row
+
+
+def main():
+ os.makedirs(OUT, exist_ok=True)
+ for name in ("reward.json", "reward.txt", "score.json"):
+ try:
+ os.remove(os.path.join(OUT, name))
+ except OSError:
+ pass
+ log, failure = [], None
+ try:
+ reward, row = grade(log)
+ except ScorerFailed as problem:
+ failure = "the scorer failed, no reward written: %s" % problem
+ log.append(failure)
+ with open(os.path.join(OUT, "score.log"), "w", encoding="utf-8") as f:
+ f.write("\n".join(log) + "\n")
+ if failure:
+ sys.exit(failure)
+ with open(os.path.join(OUT, "score.json"), "w", encoding="utf-8") as f:
+ json.dump(row, f)
+ f.write("\n")
+ with open(os.path.join(OUT, "reward.json"), "w", encoding="utf-8") as f:
+ json.dump(reward, f)
+ f.write("\n")
+ print(json.dumps(reward))
+ if row.get("reason"):
+ print(row["reason"].encode("ascii", "backslashreplace").decode("ascii"))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/pack_score.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/pack_score.py
new file mode 100644
index 0000000000000000000000000000000000000000..b41382aa52ca13dbeccd56097b08175a0fed19a2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/pack_score.py
@@ -0,0 +1,105 @@
+"""Cross-platform release-pinned scorer wrapper for Zero-Trust Physics packs (macOS arm64, Linux amd64, Linux arm64, HTTP).
+
+ python3 pack_score.py REPLIES --engine ENGINE --environments F [score.py's options] [--strict-binary]
+ python3 pack_score.py --run run_cheat_suite.py [its options] [--strict-binary]
+
+Verifies that the target verifier answers MCP initialize as release 0.15.3 (matching reference.gateway_version and
+engine_tag) on kernel genesis_kernel_v0.13.1, while recording engine_binary_sha256_seen and engine_binary_is_reference on
+every score row. Pass --strict-binary to additionally require exact SHA-256 identity with reference.engine_binary_sha256.
+All deterministic recomputation, seal, budget, and grading invariants of score.py apply unchanged.
+
+Standard library only. Licence: Apache-2.0.
+"""
+import inspect
+import os
+import re
+import runpy
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+if HERE not in sys.path:
+ sys.path.insert(0, HERE)
+
+KERNEL = "genesis_kernel_v0.13.1"
+STRICT = False
+
+
+def _kernel_of(replay):
+ """The kernel the verifier names: its serverInfo.description is the kernel's name (0.15.2), or one line that ends
+ with it ("... Cards: genesis_kernel_v0.13.1", 0.15.3)."""
+ server = getattr(getattr(replay, "verifier", None), "server", None) or {}
+ found = re.findall(r"genesis_kernel_v[0-9][0-9.]*[0-9]", server.get("description") or "")
+ return found[-1] if found else server.get("description")
+
+
+def install(strict=False):
+ """Configure cross-platform release identity verification on score (idempotent). Returns the score module."""
+ global STRICT
+ STRICT = bool(strict)
+ import score
+ if getattr(score, "_pack_engine_identity", False):
+ return score
+ original = score.engine_problem
+ original_score = score.score
+
+ def engine_problem(env, replay):
+ ref = env.get("reference") or {}
+ want = ref.get("engine_binary_sha256")
+ seen = getattr(replay, "binary_sha256", None)
+ if STRICT or not (seen and want and seen != want):
+ return original(env, replay)
+ # a different file: held to the release by what it says it is, every other rule as score.py's
+ saved = replay.binary_sha256
+ replay.binary_sha256 = None
+ try:
+ problem = original(env, replay)
+ finally:
+ replay.binary_sha256 = saved
+ if problem:
+ return problem
+ kernel = _kernel_of(replay)
+ if kernel != KERNEL:
+ return "the verifier reports kernel %s; release %s runs %s" % (kernel, replay.version, KERNEL)
+ return None
+
+ def scored(env, reply, replay, *args, **kwargs):
+ row = original_score(env, reply, replay, *args, **kwargs)
+ if isinstance(row, dict):
+ want = (env.get("reference") or {}).get("engine_binary_sha256")
+ seen = getattr(replay, "binary_sha256", None)
+ row["engine_binary_sha256_seen"] = seen
+ row["engine_binary_is_reference"] = None if not seen else (seen == want)
+ return row
+
+ # score.py may one day hold its own source-build rule; then it is left as it is
+ if "strict" in inspect.getsource(original).lower():
+ return score
+ score.engine_problem = engine_problem
+ score.score = scored
+ score._pack_engine_identity = True
+ return score
+
+
+def main():
+ argv = sys.argv[1:]
+ strict = "--strict-binary" in argv
+ argv = [a for a in argv if a != "--strict-binary"]
+ if argv[:1] == ["--run"]:
+ if len(argv) < 2:
+ sys.exit("give the program: --run run_cheat_suite.py [options]")
+ program = argv[1] if os.path.isabs(argv[1]) or os.path.isfile(argv[1]) else os.path.join(HERE, argv[1])
+ folder = os.path.dirname(os.path.abspath(program))
+ if folder not in sys.path:
+ sys.path.insert(0, folder)
+ install(strict)
+ # a program that does `from score import score` takes the replaced function, as the module now holds it
+ sys.argv = [program] + argv[2:]
+ runpy.run_path(program, run_name="__main__")
+ return
+ score = install(strict)
+ sys.argv = [os.path.join(HERE, "score.py")] + argv
+ score.main()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/score.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/score.py
new file mode 100644
index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/score.py
@@ -0,0 +1,1199 @@
+"""Score replies to the multi-step environments with no judge: a program and the verifier.
+
+ python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F]
+ [--calls-from reply|harness] [--harness-dir DIR]
+
+ REPLIES is a folder with one file per environment, .txt, the whole text of a reply.
+ --calls-from harness the call record is the harness's own: .harness.jsonl, written by
+ harness/mcp_log_proxy.py outside the solver's working directory (in
+ --harness-dir, default REPLIES). A .calls.jsonl beside the reply,
+ when there is one, is read only to catch an edit: it must equal the
+ harness log call for call.
+ --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply:
+ one JSON object a line, {"tool": "", "arguments": {...}}.
+
+ ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address
+ beginning http. A task is scored only on the engine it was built on: the verifier's version must
+ be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's
+ reference.engine_binary_sha256.
+
+The answer card is one JSON object on the reply's last line. Its shape is the family's:
+
+ tradeoff, chain_design (kind design_to_limit, chained_design)
+ {"passing": DESIGN, "failing": DESIGN, "binding": ""}
+ DESIGN = {"run": {"request": R, "proof": ""},
+ "solve": {"request": R, "proof": ""}} (solve only where the task has one)
+ Where a constraint is that the run completes and it binds, the failing DESIGN also carries
+ "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}}
+ The design shapes, one scorer for every group (check.design says which):
+ run a run alone.
+ coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run.
+ continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of
+ the same card that continues it through from, starting from its sealed final state,
+ DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template
+ is chain.next_template, chain.template or chain.next; its start fields are chain.carried
+ ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or
+ chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on
+ "next" reads the next run, and a stop constraint judges it.
+ solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no
+ run. A binding refusal is named ("stopped") with no step.
+ staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per
+ stage in order; a later stage carries an earlier stage's answer at a named input (handed) or
+ continues an earlier run (continues), bit for bit.
+ A constraint's read may carry "index": one entry of an output the verifier returns as a list.
+ budget (kind budgeted_search)
+ {"holds": {"request": R, "proof": ""},
+ "stops": {"request": R, "proof": "", "stopped": ""}}
+ forensics
+ {"false_rows": {"": "", ...}} ({} when every row is genuine)
+
+Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a
+solution_seal, short form) and every number judged is read from the verifier's own answer to the
+card's request, sent again here, never from the reply.
+
+Scores per environment
+----------------------
+reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1.
+ proofs_hold: every proof on the card verifies. correct: the card is the right answer and
+ nothing below under "integrity" failed.
+graded in [0, 1], beside reward.
+
+ Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not
+ verify (a copied, nudged, edited or stale proof); a request differs from the task's template other
+ than at the design variable; a chained solve not handed its own design's sealed run; no call log;
+ a call log beside the reply that differs from the harness log; a harness log whose chain breaks;
+ a forbidden tool called; more computing calls than the budget; a request on the card that is not
+ among the calls; a forensics answer with no computing call behind it; a task built on another
+ engine than the verifier.
+
+ tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the
+ passing design meets every constraint and the failing one breaks the named binding constraint
+ (budget: holds completes, stops ends with the task's stop, named on the card), on the side the
+ task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0.
+ With the sides right:
+
+ e = the length of the smallest interval holding both designs' values and the reference
+ boundary (for a bracket that straddles the boundary, its width)
+ tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget)
+ r = e / tol
+ graded = 1 when reward is 1 (r <= 1 and the bracket straddles it)
+ = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score
+ (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25)
+ = 0.5 when r <= 1 but the bracket misses the reference boundary
+ by more than the slack (another crossing than the one asked)
+
+ The decay is smooth and falls monotonically with r, and a near miss scores near the top.
+
+ forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found
+ only with its right reason. precision = found / named, recall = found / false rows; an empty
+ answer to a table with no false row scores 1. A card that names every row of the table false is
+ a blanket answer and scores 0, as do unknown rows and reasons outside the task's list.
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import hashlib
+import json
+import math
+import os
+import re
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402
+
+FAMILIES = ("tradeoff", "chain_design", "budget", "forensics")
+KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"}
+NOT_STOPPED = ("completed", "converged")
+PREFIX_ENDS = ("__", ".", ":", "/")
+VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite",
+ "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset",
+ "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip")
+# Calls that read the catalogue compute nothing and are free in a call budget.
+FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt")
+REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden")
+GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r)
+OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary
+
+
+class Integrity(Exception):
+ """The answer cannot be trusted: graded 0 and reward 0."""
+
+
+class Wrong(Exception):
+ """The answer is trusted and wrong: graded 0 and reward 0."""
+
+
+def load_environments(path):
+ with open(path, encoding="utf-8") as f:
+ return [json.loads(line) for line in f if line.strip()]
+
+
+def row_problems(env):
+ """What a task row lacks against the shared row contract (empty when none)."""
+ out = []
+ for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"):
+ if key not in env:
+ out.append("no %s" % key)
+ family = env.get("family")
+ if family not in FAMILIES:
+ out.append("family %r" % family)
+ elif "kind" in env and env["kind"] != KINDS[family]:
+ out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family]))
+ ref = env.get("reference") or {}
+ for key in ("engine_tag", "engine_commit", "engine_binary_sha256"):
+ if not ref.get(key):
+ out.append("reference.%s missing" % key)
+ return out
+
+
+def file_sha256(path):
+ h = hashlib.sha256()
+ with open(path, "rb") as f:
+ for block in iter(lambda: f.read(1 << 20), b""):
+ h.update(block)
+ return h.hexdigest()
+
+
+def open_verifier(engine):
+ if engine.startswith("http://") or engine.startswith("https://"):
+ verifier = Verifier(engine, pause_s=0.5)
+ verifier.binary_sha256 = None
+ else:
+ if not os.path.isfile(engine):
+ sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine)
+ verifier = StdioVerifier([engine])
+ verifier.binary_sha256 = file_sha256(engine)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the verifier failed, so nothing was scored: %s" % problem)
+ if not isinstance(verifier.server, dict) or not verifier.server.get("name"):
+ close_verifier(verifier)
+ sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine)
+ return verifier
+
+
+def close_verifier(verifier):
+ if hasattr(verifier, "close"):
+ verifier.close()
+
+
+# ------------------------------------------------------------------------------------------
+# reading the reply and the call logs
+# ------------------------------------------------------------------------------------------
+def _no_constant(name):
+ raise ValueError("%s is not a number" % name)
+
+
+def read_card(reply):
+ """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over."""
+ lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()]
+ while lines and lines[-1].startswith("```"):
+ lines.pop()
+ if not lines:
+ return None, "the reply is empty"
+ try:
+ card = json.loads(lines[-1], parse_constant=_no_constant)
+ except ValueError:
+ return None, "the last line is not one JSON object"
+ if not isinstance(card, dict):
+ return None, "the last line is not one JSON object"
+ return card, None
+
+
+def tool_name(name):
+ """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve)."""
+ if not isinstance(name, str):
+ return None
+ if name in VERIFIER_TOOLS:
+ return name
+ for tool in VERIFIER_TOOLS:
+ for joint in PREFIX_ENDS:
+ if name.endswith(joint + tool):
+ return tool
+ return name
+
+
+def without_readout(arguments):
+ """A run's arguments as sealed: a readout is not part of a run's seal."""
+ if not isinstance(arguments, dict):
+ return arguments
+ return {k: v for k, v in arguments.items() if k != "readout"}
+
+
+def numbers_by_value(value):
+ """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept."""
+ if isinstance(value, dict):
+ return {k: numbers_by_value(v) for k, v in value.items()}
+ if isinstance(value, list):
+ return [numbers_by_value(v) for v in value]
+ if isinstance(value, int) and not isinstance(value, bool):
+ return float(value)
+ return value
+
+
+def canonical(arguments):
+ """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value."""
+ return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":"))
+
+
+def _arguments(one):
+ arguments = one.get("arguments")
+ if isinstance(arguments, str):
+ try:
+ arguments = json.loads(arguments)
+ except ValueError:
+ arguments = {}
+ return arguments if isinstance(arguments, dict) else {}
+
+
+def read_calls(path):
+ """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log."""
+ if not path or not os.path.isfile(path):
+ return None
+ calls = []
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for line in f:
+ line = line.strip()
+ if not line:
+ continue
+ try:
+ one = json.loads(line)
+ except ValueError:
+ continue
+ if isinstance(one, dict):
+ calls.append((tool_name(one.get("tool")), _arguments(one)))
+ return calls
+
+
+def chain_of(previous, entry):
+ payload = json.dumps(entry, sort_keys=True, separators=(",", ":"))
+ return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest()
+
+
+def read_harness_log(path):
+ """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log;
+ problem names the first line whose chain does not follow (an edit, a line taken out or put in)."""
+ if not path or not os.path.isfile(path):
+ return None, None
+ calls, previous = [], None
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for number_, line in enumerate(f, 1):
+ if not line.strip():
+ continue
+ try:
+ entry = json.loads(line)
+ except ValueError:
+ return calls, "line %d of the harness log is not JSON" % number_
+ if not isinstance(entry, dict) or "chain" not in entry:
+ return calls, "line %d of the harness log carries no chain" % number_
+ chain = entry.pop("chain")
+ if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1:
+ return calls, "the harness log's chain breaks at line %d" % number_
+ previous = chain
+ calls.append((tool_name(entry.get("tool")), _arguments(entry)))
+ return calls, None
+
+
+def write_harness_log(path, calls):
+ """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)]."""
+ previous = None
+ with open(path, "w", encoding="utf-8") as f:
+ for seq, (tool, arguments) in enumerate(calls, 1):
+ entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None,
+ "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False}
+ entry["chain"] = chain_of(previous, entry)
+ previous = entry["chain"]
+ f.write(json.dumps(entry, sort_keys=True) + "\n")
+
+
+# ------------------------------------------------------------------------------------------
+# the verifier, asked again
+# ------------------------------------------------------------------------------------------
+def stop_name_in(sentence):
+ names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "")
+ return names[-1] if names else None
+
+
+class Replay:
+ """The verifier, with every answer remembered: the same request is sent once."""
+
+ def __init__(self, verifier):
+ self.verifier = verifier
+ self.seen = {}
+ server = getattr(verifier, "server", None) or {}
+ self.version = server.get("version")
+ self.binary_sha256 = getattr(verifier, "binary_sha256", None)
+
+ def call(self, tool, arguments):
+ key = tool + "\x00" + json.dumps(arguments, sort_keys=True)
+ if key not in self.seen:
+ try:
+ self.seen[key] = self.verifier.call_json(tool, arguments)
+ except McpError as problem:
+ if not str(problem).startswith("protocol error"):
+ raise SystemExit("the verifier failed, so nothing was scored: %s" % problem)
+ self.seen[key] = ("the verifier did not take the request: %s" % problem, True)
+ return self.seen[key]
+
+ def answer(self, tool, arguments, readout=None):
+ """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}."""
+ arguments = copy.deepcopy(without_readout(arguments))
+ if readout is not None and tool == "run_trajectory":
+ arguments["readout"] = readout
+ body, is_error = self.call(tool, arguments)
+ if is_error or not isinstance(body, dict):
+ sentence = body if isinstance(body, str) else json.dumps(body)
+ return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence),
+ "proof": None, "body": None, "sentence": sentence}
+ outcome = body.get("outcome")
+ stopped = outcome not in NOT_STOPPED
+ return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None,
+ "proof": body.get("run_seal") or body.get("solution_seal"), "body": body,
+ "sentence": body.get("reject_detail")}
+
+ def proof_holds(self, tool, arguments, proof):
+ """(holds, words): the card's seal verified by verify_tape or verify_solution, short form."""
+ if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof):
+ return False, "the proof is not a SHA-384 seal of 96 hex digits"
+ if tool == "run_trajectory":
+ body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof})
+ elif tool == "solve":
+ body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof})
+ else:
+ return False, "a proof is verified for run_trajectory or solve only, not %s" % tool
+ if is_error or not isinstance(body, dict):
+ return False, "the verifier would not verify it: %s" % (str(body)[:200])
+ if body.get("holds") is True:
+ return True, None
+ return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause")
+
+
+def engine_problem(env, replay):
+ """None when the verifier is the engine the task was built on; else what differs."""
+ ref = env.get("reference") or {}
+ tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v")
+ if not tag:
+ return "the task names no engine it was built on"
+ if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag:
+ return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version"))
+ if replay.version != tag:
+ return "the task was built on engine %s; the verifier is %s" % (tag, replay.version)
+ want = ref.get("engine_binary_sha256")
+ if replay.binary_sha256 and want and replay.binary_sha256 != want:
+ return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12])
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# requests and their inputs
+# ------------------------------------------------------------------------------------------
+_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)")
+
+
+def get_path(obj, path):
+ here = obj
+ for part in path.split("."):
+ found = _PART.fullmatch(part)
+ if not found or not isinstance(here, dict) or found.group(1) not in here:
+ return None
+ here = here[found.group(1)]
+ for index in re.findall(r"\[(\d+)\]", found.group(2)):
+ if not isinstance(here, list) or int(index) >= len(here):
+ return None
+ here = here[int(index)]
+ return here
+
+
+def set_path(obj, path, value):
+ parts = path.split(".")
+ here = obj
+ for i, part in enumerate(parts):
+ m = _PART.fullmatch(part)
+ name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))]
+ last = i == len(parts) - 1
+ if not idx:
+ if last:
+ here[name] = value
+ else:
+ here = here[name]
+ else:
+ here = here[name]
+ for j, k in enumerate(idx):
+ if last and j == len(idx) - 1:
+ here[k] = value
+ else:
+ here = here[k]
+
+
+def number(value):
+ return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value)
+
+
+def differs(template, given, free, where=""):
+ """The first place where a request differs from the task's, other than the free places. None when none."""
+ if where in free:
+ return None
+ if isinstance(template, dict):
+ if not isinstance(given, dict):
+ return where or "the request"
+ for key in set(template) | set(given):
+ place = "%s.%s" % (where, key) if where else key
+ if place in free:
+ continue
+ if key not in given or key not in template:
+ return place
+ found = differs(template[key], given[key], free, place)
+ if found:
+ return found
+ return None
+ if isinstance(template, list):
+ if not isinstance(given, list) or len(given) != len(template):
+ return where
+ for index, (a, b) in enumerate(zip(template, given)):
+ found = differs(a, b, free, "%s[%d]" % (where, index))
+ if found:
+ return found
+ return None
+ if number(template) and number(given):
+ return None if float(template) == float(given) else where
+ return None if template == given else where
+
+
+def design_value(variable, run_arguments, solve_arguments, next_arguments=None):
+ """The design variable of one design, read from its requests (on: run, solve, or next, a continued run)."""
+ kind = variable["kind"]
+ if kind == "path":
+ on = variable.get("on", "run")
+ source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {}
+ value = get_path(source, variable["path"])
+ for place in variable.get("also") or []:
+ again = get_path(source, place)
+ if not (number(again) and number(value) and float(again) == float(value)):
+ return None
+ return float(value) if number(value) else None
+ if kind == "entry_angle_deg":
+ radial = get_path(run_arguments or {}, "initial.radial_speed_m_s")
+ transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s")
+ if not (number(radial) and number(transverse)) or transverse <= 0:
+ return None
+ speed = math.hypot(radial, transverse)
+ if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]:
+ return None
+ return math.degrees(math.atan2(-radial, transverse))
+ return None
+
+
+def variable_places(variable):
+ if variable["kind"] == "entry_angle_deg":
+ return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"}
+ if variable["kind"] == "path" and variable.get("on", "run") == "run":
+ return {variable["path"]} | set(variable.get("also") or [])
+ return set()
+
+
+def read_value(read, answer):
+ """One number from a replayed answer: final, result, or the extreme of a run's readout."""
+ body = answer["body"]
+ if body is None:
+ return None
+ kind = read["kind"]
+ value = None
+ if kind == "final":
+ value = (body.get("final_state") or {}).get(read["quantity"])
+ elif kind == "result":
+ value = (body.get("result") or {}).get(read["quantity"])
+ elif kind == "flag_extent":
+ # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it
+ value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or []
+ if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0])
+ elif kind == "extreme":
+ for quantity in (body.get("readout") or {}).get("quantities") or []:
+ if quantity.get("quantity") == read["quantity"]:
+ value = quantity.get(read["which"])
+ if "index" in read:
+ # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points)
+ k = read["index"]
+ value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None
+ return value if number(value) else None
+
+
+def readout_for(constraints, on="run"):
+ """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key)."""
+ quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"})
+ return {"quantities": quantities} if quantities else None
+
+
+def design_shape(spec):
+ """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged."""
+ if spec.get("stages"):
+ return "staged"
+ if spec.get("tool") == "solve" or spec.get("kind") == "solve":
+ return "solve"
+ chain = spec.get("chain") or {}
+ if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue":
+ return "continued"
+ return "coupled" if chain else "run"
+
+
+def continuation_of(spec):
+ """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it},
+ next outcomes, the next run's places that also hold a first-run design value)."""
+ chain = spec["chain"]
+ template = chain.get("next_template") or chain.get("template") or chain.get("next")
+ if "carried" in chain: # group 1
+ carried = dict(chain["carried"])
+ elif "handed" in chain: # group 4
+ named = chain.get("handed_from") or {}
+ carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]}
+ else: # group 5
+ carried = {k: "final_state." + k for k in chain.get("carry") or []}
+ if chain.get("clock"):
+ carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"]
+ outcomes = chain.get("next_outcomes") or spec["run_outcomes"]
+ return template, carried, outcomes, list(chain.get("next_also") or [])
+
+
+def meets(constraint, value):
+ if value is None:
+ return False
+ return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"]
+
+
+def history_layout_problem(layout, parameters, frames_count):
+ """None when the arrays of a chained solve are laid out as the task states; else what is not."""
+ if layout is None:
+ return None
+ if layout["kind"] == "stardust_slab":
+ names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s",
+ "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2")
+ columns = [parameters.get(name) for name in names]
+ if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns):
+ return "the history columns are not all lists of numbers"
+ time, pressure, coefficient, enthalpy, radiative = columns
+ rows = frames_count + 3
+ if any(len(c) != rows for c in columns):
+ return "the history has not one row before the %d frames handed and two after them" % frames_count
+ if time[0] != 0.0 or coefficient[0] != 0.0:
+ return "row 0 is not at 0 s with no heating"
+ if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]:
+ return "row 0 does not repeat the first frame's pressure and enthalpy"
+ if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]:
+ return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"]
+ if coefficient[-2] != 0.0 or coefficient[-1] != 0.0:
+ return "the stream is not off after the frames"
+ if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]:
+ return "the rows after the frames do not hold the last frame's pressure and enthalpy"
+ if any(v != 0.0 for v in radiative):
+ return "a row of the history holds radiative heating"
+ return None
+ if layout["kind"] == "triga_element":
+ return None # every array is handed by the coupling and held to its bits by the verifier
+ return "an unknown layout"
+
+
+# ------------------------------------------------------------------------------------------
+# the call record
+# ------------------------------------------------------------------------------------------
+def card_requests(env, card):
+ """Every request on the card, [(tool, arguments)], read leniently (for the call log)."""
+ out = []
+
+ def take(part):
+ if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict):
+ out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"]))
+
+ if env["family"] in ("tradeoff", "chain_design"):
+ stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []]
+ for side in ("passing", "failing"):
+ design = card.get(side) if isinstance(card.get(side), dict) else {}
+ for key in stages or ("run", "solve", "next"):
+ take(design.get(key))
+ elif env["family"] == "budget":
+ take(card.get("holds"))
+ take(card.get("stops"))
+ return out
+
+
+def sequence(calls):
+ return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls]
+
+
+def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row):
+ """None when the call record holds; else why not (an integrity failure)."""
+ check = env["check"]
+ if calls_from == "harness":
+ if calls is None:
+ return "no harness call log: every attempt is scored with the calls the harness recorded"
+ if log_problem:
+ return log_problem
+ if reply_calls is not None and sequence(reply_calls) != sequence(calls):
+ return "the call log beside the reply differs from the harness log"
+ elif calls is None:
+ return "no call log: every environment is scored with the agent's calls"
+ calls = [(tool_name(t), a) for t, a in calls]
+ banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])})
+ if banned:
+ return "the log holds calls of %s, which the task rules out" % ", ".join(banned)
+ computing = [(t, a) for t, a in calls if t not in FREE_TOOLS]
+ row["computing_calls"] = len(computing)
+ if check.get("budget") and len(computing) > check["budget"]:
+ return "%d computing calls; the budget is %d" % (len(computing), check["budget"])
+ sent = {(t, canonical(a)) for t, a in computing}
+ for tool, arguments in card_requests(env, card):
+ if (tool, canonical(arguments)) not in sent:
+ return "a %s request on the card is not among the calls in the log" % tool
+ if env["family"] == "forensics" and not computing:
+ return "no computing call behind the answer: the table was not put to the verifier"
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# the families
+# ------------------------------------------------------------------------------------------
+def request_of(part, tool, what):
+ """The arguments of one request on the card (Integrity when it is not one)."""
+ if not isinstance(part, dict):
+ raise Integrity("%s is missing" % what)
+ request = part.get("request")
+ if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)):
+ raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what)
+ if tool_name(request.get("tool")) != tool:
+ raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool))
+ return request["arguments"]
+
+
+def score_design(env, design, which, replay, proofs):
+ """One design of a boundary family: facts {x, met, values, stopped, steps_landed}."""
+ check = env["check"]
+ spec = check["design"]
+ shape = design_shape(spec)
+ if shape in ("solve", "staged", "continued") and not isinstance(design, dict):
+ raise Integrity("the %s design is missing" % which)
+ if shape == "solve":
+ return score_solve_design(env, design, which, replay, proofs)
+ if shape == "staged":
+ return score_staged_design(env, design, which, replay, proofs)
+ if shape == "continued":
+ return score_continued_design(env, design, which, replay, proofs)
+ chain = spec.get("chain")
+ run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory",
+ "the %s design's run" % which)
+ free = set(spec.get("free") or []) | variable_places(spec["variable"])
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ for place in spec.get("free") or []:
+ if place.endswith(".steps"):
+ steps = get_path(run_args, place)
+ if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)):
+ raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"]))
+ stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"]
+ stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names
+ if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name:
+ raise Wrong("the %s design's run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ solve_args, solve = None, None
+ if chain:
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != chain["solver"]:
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ handed = solve_args.get("from")
+ if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]:
+ raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"]))
+ if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof:
+ raise Integrity("the %s design's solve is not handed the design's own sealed run" % which)
+ parameters = solve_args.get("parameters")
+ if not isinstance(parameters, dict):
+ raise Integrity("the %s design's solve has no parameters" % which)
+ solve_free = set(chain.get("handed") or [])
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ solve_free.add(spec["variable"]["path"].split(".", 1)[1])
+ where = differs(chain["parameters"], parameters, solve_free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where))
+ frames = len((run["body"] or {}).get("frames") or [])
+ problem = history_layout_problem(chain.get("layout"), parameters, frames)
+ if problem:
+ raise Integrity("the %s design's solve: %s" % (which, problem))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] != "converged":
+ raise Wrong("the %s design's solve comes back %s%s, not converged" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else ""))
+ x = design_value(spec["variable"], run_args, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", "")))
+ met, values = {}, {}
+ for constraint in check["constraints"]:
+ if constraint["on"] == "outcome":
+ values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"])
+ met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"])
+ continue
+ value = read_value(constraint["read"], run if constraint["on"] == "run" else solve)
+ values[constraint["id"]] = value
+ met[constraint["id"]] = meets(constraint, value)
+ facts = {"x": x, "met": met, "values": values}
+ if run["outcome"] not in NOT_STOPPED and run["body"]:
+ facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed")
+ return facts
+
+
+def halted(answer, stop, staged=False):
+ """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that
+ is not completed or converged (group 3's rule, kept as built)."""
+ if staged:
+ return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop
+ return answer["outcome"] == "refused" and answer["stop"] == stop
+
+
+def constraint_facts(check, answers, judged, staged=False):
+ """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop
+ constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design."""
+ met, values = {}, {}
+ for c in check["constraints"]:
+ if c["on"] == "outcome":
+ a = answers.get(c["stage"]) if c.get("stage") else judged
+ values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"]))
+ met[c["id"]] = a is not None and not halted(a, c["stop"], staged)
+ continue
+ a = answers.get(c["on"])
+ value = read_value(c["read"], a) if a is not None else None
+ values[c["id"]] = value
+ met[c["id"]] = meets(c, value) if c.get("limit") is not None else None
+ return met, values
+
+
+def stopped_by(answer, constraints, stage=None):
+ """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given)."""
+ return any(halted(answer, c["stop"], stage is not None) for c in constraints
+ if c["on"] == "outcome" and (stage is None or c.get("stage") == stage))
+
+
+def score_solve_design(env, design, which, replay, proofs):
+ """One design that is one solve and no run (check.design.tool or kind "solve")."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != spec["template"].get("solver"):
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or [])
+ where = differs(spec["template"], solve_args, free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at %s" % (which, where))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]):
+ raise Wrong("the %s design's solve comes back %s%s, not %s" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"])))
+ x = design_value(dict(var, on="solve"), None, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, {"solve": solve}, solve)
+ facts = {"x": x, "met": met, "values": values}
+ if solve["outcome"] not in NOT_STOPPED and solve["body"]:
+ facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True
+ return facts
+
+
+def score_continued_design(env, design, which, replay, proofs):
+ """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes
+ the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer
+ also holds each carried start field to the first run's answer, bit for bit."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ on_next = var["kind"] == "path" and var.get("on") == "next"
+ template, carried, next_outcomes, next_also = continuation_of(spec)
+ run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which)
+ free = set(spec.get("free") or []) | (set() if on_next else variable_places(var))
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run"))
+ if run["outcome"] not in spec["run_outcomes"]:
+ raise Wrong("the %s design's first run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which)
+ handed = next_args.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args)
+ or handed.get("run_seal") != run_proof):
+ raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which)
+ next_free = {"initial." + name for name in carried} | {"from"} | set(next_also)
+ if on_next:
+ next_free |= {var["path"]} | set(var.get("also") or [])
+ where = differs(template, without_readout(next_args), next_free)
+ if where:
+ raise Integrity("the %s design's next run differs from the task's at %s" % (which, where))
+ start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {}
+ for name, source in carried.items():
+ held, given = get_path(run["body"] or {}, source), start.get(name)
+ if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))):
+ raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source))
+ holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's next run_seal: %s" % (which, words))
+ nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next"))
+ if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]):
+ raise Wrong("the %s design's next run comes back %s%s, not %s" % (
+ which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes)))
+ x = design_value(var, run_args, None, next_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ for place in next_also:
+ again = get_path(next_args, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place))
+ met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt)
+ facts = {"x": x, "met": met, "values": values}
+ if nxt["outcome"] not in NOT_STOPPED and nxt["body"]:
+ facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed")
+ return facts
+
+
+def build_stage_request(spec, stage, x, answers, requests):
+ """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from
+ earlier stages' answers, and a continuation's start and from (used by run_reference.py)."""
+ q = copy.deepcopy(stage["template"])
+ var = spec["variable"]
+ if var.get("stage") == stage["key"]:
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(q, place, x)
+ for h in stage.get("handed") or []:
+ set_path(q, h["to"], read_value(h["read"], answers[h["from"]]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ final = answers[parent]["body"]["final_state"]
+ q["initial"] = {k: final[k] for k in stage["template"]["initial"]}
+ q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]}
+ return q
+
+
+def score_staged_design(env, design, which, replay, proofs):
+ """One staged design (check.design.stages): each stage a run or a solve, in order."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ stages = spec["stages"]
+ answers, requests, facts = {}, {}, {}
+ for i, stage in enumerate(stages):
+ key, tool = stage["key"], stage["tool"]
+ sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key)))
+ free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []}
+ if var.get("stage") == key:
+ free |= {var["path"]} | set(var.get("also") or [])
+ if stage.get("continues"):
+ free |= {"initial", "from"}
+ where = differs(stage["template"], sent, free)
+ if where:
+ raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where))
+ for h in stage.get("handed") or []:
+ want = read_value(h["read"], answers[h["from"]])
+ got = get_path(sent, h["to"])
+ if want is None or not number(got) or float(got) != float(want):
+ raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % (
+ which, key, h["from"], h["read"]["quantity"], h["to"]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ handed = sent.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent])
+ or handed.get("run_seal") != design[parent].get("proof")):
+ raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent))
+ final = (answers[parent]["body"] or {}).get("final_state") or {}
+ start = sent.get("initial")
+ keys = set(stage["template"]["initial"])
+ if not isinstance(start, dict) or set(start) != keys or any(
+ not number(start[k]) or float(start[k]) != final.get(k) for k in keys):
+ raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent))
+ holds, words = replay.proof_holds(tool, sent, design[key].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's %s proof: %s" % (which, key, words))
+ answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None)
+ named = stopped_by(answer, check["constraints"], stage=key)
+ if answer["outcome"] not in stage["outcomes"] and not named:
+ raise Wrong("the %s design's %s comes back %s%s, not %s" % (
+ which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"])))
+ answers[key], requests[key] = answer, sent
+ if named:
+ facts["stopped"], facts["stopped_stage"] = answer["stop"], key
+ facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None
+ facts["no_step"] = tool != "run_trajectory"
+ if i != len(stages) - 1:
+ raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"]))
+ x = design_value(dict(var, on="run"), requests.get(var["stage"]), None)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, answers, None, staged=True)
+ facts.update({"x": x, "met": met, "values": values})
+ return facts
+
+
+def grade_bracket(a, b, star, tol, slack, row):
+ """(reward_ok, graded) for a bracket [a, b] with its sides right."""
+ width = abs(b - a)
+ straddles = min(a, b) - slack <= star <= max(a, b) + slack
+ within = width <= tol * (1 + 1e-9)
+ e = max(a, b, star) - min(a, b, star)
+ r = e / tol if tol > 0 else float("inf")
+ row["width"], row["width_ratio"] = width, r
+ if within and straddles:
+ return True, 1.0
+ if r <= 1:
+ return False, OTHER_CROSSING
+ return False, GRADED_DECAY ** math.log10(r)
+
+
+def score_boundary(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ passing = score_design(env, card.get("passing"), "passing", replay, proofs)
+ failing = score_design(env, card.get("failing"), "failing", replay, proofs)
+ row["passing"], row["failing"] = passing, failing
+ span = check["design"].get("range")
+ if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])):
+ raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span))
+ broken = [c for c, ok in passing["met"].items() if not ok]
+ if broken:
+ raise Wrong("the passing design breaks %s" % ", ".join(broken))
+ broken = [c for c, ok in failing["met"].items() if not ok]
+ if not broken:
+ raise Wrong("the failing design meets every constraint")
+ binding = card.get("binding")
+ if binding != reference["binding"]:
+ raise Wrong("binding names %r; the constraint that binds is another" % (binding,))
+ if binding not in broken:
+ raise Wrong("the failing design does not break %s, the constraint named binding" % binding)
+ if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]:
+ said = card.get("failing") or {}
+ if said.get("stopped") != failing.get("stopped"):
+ raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped")))
+ if failing.get("no_step"):
+ pass # a solve that is refused has no step: its stop's name is stated
+ elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")):
+ raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step")))
+ spec = check["design"]
+ xp, xf = passing["x"], failing["x"]
+ if spec["direction"] == "largest" and not xf > xp:
+ raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one")
+ if spec["direction"] == "smallest" and not xf < xp:
+ raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one")
+ ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row)
+ if not ok:
+ return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % (
+ abs(xf - xp), spec["tolerance"])
+ return 1.0, None
+
+
+def score_budget(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ template, path, tool = check["template"], check["variable"], check["tool"]
+ sides = {}
+ for side in ("holds", "stops"):
+ arguments = request_of(card.get(side), tool, side)
+ also = check.get("also") or []
+ where = differs(template, without_readout(arguments), {path} | set(also))
+ if where:
+ raise Integrity("the %s request differs from the task's at %s" % (side, where))
+ x = get_path(arguments, path)
+ if not number(x):
+ raise Integrity("the %s request has no number at %s" % (side, path))
+ for place in also:
+ again = get_path(arguments, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path))
+ holds, words = replay.proof_holds(tool, arguments, card[side].get("proof"))
+ proofs.append(holds)
+ sides[side] = (float(x), arguments, holds, words)
+ for side in ("holds", "stops"):
+ if not sides[side][2]:
+ raise Integrity("the %s seal: %s" % (side, sides[side][3]))
+ held = replay.answer(tool, sides["holds"][1])
+ stopped = replay.answer(tool, sides["stops"][1])
+ row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"])
+ if held["outcome"] not in NOT_STOPPED:
+ raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"]))
+ if stopped["stop"] != check["stop"]:
+ raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"]))
+ if card["stops"].get("stopped") != check["stop"]:
+ raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"]))
+ xh, xs = sides["holds"][0], sides["stops"][0]
+ star = reference["boundary"]
+ row["holds_value"], row["stops_value"] = xh, xs
+ tol = check["relative_width"] * abs(star)
+ ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row)
+ if not ok:
+ return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % (
+ abs(xs - xh), check["relative_width"])
+ return 1.0, None
+
+
+def forensics_f1(env, named):
+ """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer."""
+ if not isinstance(named, dict):
+ return 0.0, "false_rows is not an object of row and reason"
+ rows = [c["row"] for c in env["check"]["rows"]]
+ truth = env["reference"]["false_rows"]
+ unknown = [r for r in named if r not in set(rows)]
+ if unknown:
+ return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown))
+ reasons = env["check"].get("reasons") or REASONS
+ bad = [r for r, why in named.items() if why not in reasons]
+ if bad:
+ return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons))
+ if rows and set(named) == set(rows):
+ return 0.0, "every row of the table is named false: a blanket answer"
+ found = sum(1 for r, why in named.items() if truth.get(r) == why)
+ if not truth and not named:
+ return 1.0, None
+ precision = found / len(named) if named else 0.0
+ recall = found / len(truth) if truth else 0.0
+ f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0
+ if f1 >= 1.0:
+ return 1.0, None
+ missed = sorted(set(truth) - set(named))
+ wrongly = sorted(set(named) - set(truth))
+ wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r])
+ said = []
+ if missed:
+ said.append("%d false row(s) not named" % len(missed))
+ if wrongly:
+ said.append("%d genuine row(s) named false" % len(wrongly))
+ if wrong_reason:
+ said.append("%d false row(s) with another reason" % len(wrong_reason))
+ return f1, "; ".join(said)
+
+
+def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None):
+ """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record);
+ reply_calls: the reply-side log, compared with calls under calls_from="harness"."""
+ row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from,
+ "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None}
+ card, problem = read_card(reply)
+ if problem:
+ row.update(verdict="no_card", reason=problem)
+ return row
+ proofs = []
+ try:
+ problem = engine_problem(env, replay)
+ if problem:
+ raise Integrity(problem)
+ problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row)
+ if problem:
+ raise Integrity(problem)
+ family = env["family"]
+ if family in ("tradeoff", "chain_design"):
+ graded, reason = score_boundary(env, card, replay, row, proofs)
+ elif family == "budget":
+ graded, reason = score_budget(env, card, replay, row, proofs)
+ elif family == "forensics":
+ named = card.get("false_rows")
+ if isinstance(named, dict):
+ row["named"] = named
+ graded, reason = forensics_f1(env, named)
+ proofs = [True]
+ if reason and graded == 0.0 and not isinstance(named, dict):
+ raise Wrong(reason)
+ else:
+ raise Wrong("unknown family %s" % family)
+ except Integrity as problem:
+ row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ except Wrong as problem:
+ row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ proofs_hold = int(bool(proofs) and all(proofs))
+ correct = int(graded >= 1.0 and reason is None)
+ row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1),
+ graded=round(graded, 6) if proofs_hold else 0.0,
+ verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason)
+ return row
+
+
+def records_for(folder, env_id, calls_from, harness_dir=None):
+ """(calls, reply_calls, log_problem) for one environment's reply in folder."""
+ reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl"))
+ if calls_from == "harness":
+ calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl"))
+ return calls, reply_calls, log_problem
+ return reply_calls, None, None
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
+ parser.add_argument("replies")
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out")
+ parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness")
+ parser.add_argument("--harness-dir")
+ parser.add_argument("--quiet", action="store_true")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ missing = wanted - {e["id"] for e in environments}
+ if missing:
+ sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments))
+ for env in environments:
+ for problem in row_problems(env):
+ print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr)
+ verifier = open_verifier(args.engine)
+ replay = Replay(verifier)
+ rows = []
+ try:
+ for env in environments:
+ path = os.path.join(args.replies, env["id"] + ".txt")
+ reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else ""
+ calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir)
+ row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem)
+ rows.append(row)
+ if not args.quiet:
+ print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"],
+ row["reason"] or ""), flush=True)
+ replay.seen.clear()
+ finally:
+ close_verifier(verifier)
+ if args.out:
+ with open(args.out, "w", encoding="utf-8") as f:
+ for row in rows:
+ f.write(json.dumps(row) + "\n")
+ total = len(rows)
+ print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % (
+ total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows),
+ sum(r["graded"] for r in rows) / total if total else 0.0,
+ sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows)))
+ by = {}
+ for r in rows:
+ by.setdefault(r["family"], []).append(r)
+ for family in FAMILIES:
+ if family in by:
+ print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]),
+ sum(r["graded"] for r in by[family]) / len(by[family])))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/test.sh b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/test.sh
new file mode 100644
index 0000000000000000000000000000000000000000..4e4008f0a93d9c230856a9c0e0ecf5cd5cef1066
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/test.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Harbor runs this after the agent has finished, in a fresh copy of the image
+# (task.toml: [verifier] environment_mode = "separate"). By then Harbor has
+# copied tests/ to /tests and the declared artifacts, where they exist, to
+# their own paths: /app/answer.json and /logs/agent/trajectory.json.
+# grade.py writes /logs/verifier/reward.json. If the scorer itself fails it
+# writes no reward and this script exits non-zero.
+HERE="$(cd "$(dirname "$0")" && pwd)"
+exec python3 -B "$HERE/grade.py"
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_mcp.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_mcp.py
new file mode 100644
index 0000000000000000000000000000000000000000..1afbc12d8c05d8c143563152ffae500e8052a6db
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_mcp.py
@@ -0,0 +1,188 @@
+"""A small Model Context Protocol client for the Zero-Trust Physics verifier.
+
+Standard library only. It speaks MCP two ways:
+
+ stdio to a verifier built from the public source and started here as a program
+ (target/release/mcp_stdio): one JSON-RPC message a line, no network.
+ HTTP to an MCP address (JSON-RPC in a POST), such as
+
+ https://mcp.zerotrustphysics.com/mcp/open Open to any agent.
+
+The open address gives each network address one place in the physics pool at a
+time and answers "Too many concurrent physics tasks." or HTTP 429 when it is
+busy; nothing waits on the server, so this client sends one request at a time
+and, when it is told to come back, waits and sends the same request again.
+
+Licence: Apache-2.0.
+"""
+import json
+import select
+import shlex
+import subprocess
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+
+
+class McpError(RuntimeError):
+ pass
+
+
+class Verifier:
+ """One MCP endpoint. call(tool, arguments) returns (text, is_error)."""
+
+ def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True):
+ self.url = url
+ self.timeout_s = timeout_s
+ self.patience_s = patience_s # how long to keep asking politely before giving up on one request
+ self.pause_s = pause_s # a fixed pause after every request, for a shared address
+ self.headers = dict(headers or {})
+ self.quiet = quiet
+ self.session = None
+ self.server = None
+ self.requests_sent = 0
+ self.times_asked_to_wait = 0
+ self._id = 0
+
+ # -- transport -------------------------------------------------------------------------
+ def _post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-environments/1.0", **self.headers}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ self.requests_sent += 1
+ with urllib.request.urlopen(request, timeout=self.timeout_s) as response:
+ session = response.headers.get("Mcp-Session-Id")
+ if session:
+ self.session = session
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ raise McpError("the event stream held no answer to the request")
+ return json.loads(raw) if raw.strip() else {}
+
+ def _ask(self, method, params=None):
+ """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again."""
+ self._id += 1
+ message = {"jsonrpc": "2.0", "id": self._id, "method": method}
+ if params is not None:
+ message["params"] = params
+ started, wait = time.time(), 2.0
+ while True:
+ reason = None
+ try:
+ answer = self._post(message)
+ if "error" in answer:
+ raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300])
+ result = answer.get("result", {})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ if method == "tools/call" and BUSY in text and len(text) < 400:
+ reason = "the physics pool is busy"
+ else:
+ if self.pause_s:
+ time.sleep(self.pause_s)
+ return result
+ except urllib.error.HTTPError as problem:
+ if problem.code == 429 or problem.code >= 500:
+ after = problem.headers.get("Retry-After")
+ reason = "HTTP %d" % problem.code
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ else:
+ raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300]))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem:
+ reason = "no connection (%s)" % problem
+ self.times_asked_to_wait += 1
+ if time.time() - started + wait > self.patience_s:
+ raise McpError("gave up after %d s: %s" % (self.patience_s, reason))
+ if not self.quiet:
+ print(" %s; asking again in %.0f s" % (reason, wait), flush=True)
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+ # -- protocol --------------------------------------------------------------------------
+ def connect(self):
+ result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {},
+ "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}})
+ self.server = result.get("serverInfo")
+ try:
+ self._post({"jsonrpc": "2.0", "method": "notifications/initialized"})
+ except Exception: # a notification has no answer; some servers close without one
+ pass
+ return result
+
+ def tools(self):
+ """The tool declarations exactly as the endpoint gives them."""
+ return self._ask("tools/list").get("tools", [])
+
+ def call(self, tool, arguments=None):
+ """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag."""
+ result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ return text, bool(result.get("isError"))
+
+ def call_json(self, tool, arguments=None):
+ """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON."""
+ text, is_error = self.call(tool, arguments)
+ try:
+ return json.loads(text), is_error
+ except ValueError:
+ return text, is_error
+
+
+class StdioVerifier(Verifier):
+ """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line.
+ For anyone who holds an MCP server as a program; the open address needs none of this."""
+
+ def __init__(self, command, timeout_s=600, **kwargs):
+ super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs)
+ self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+
+ def _post(self, message):
+ self.requests_sent += 1
+ try:
+ self.proc.stdin.write((json.dumps(message) + "\n").encode())
+ self.proc.stdin.flush()
+ except OSError: # a program that has stopped reading will not start again
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ raise McpError("the program stopped reading")
+ if "id" not in message:
+ return {}
+ while True:
+ ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s)
+ if not ready:
+ raise McpError("no answer in %d s" % self.timeout_s)
+ line = self.proc.stdout.readline()
+ if not line:
+ raise McpError("the program closed its output")
+ found = json.loads(line)
+ if found.get("id") == message["id"]:
+ return found
+
+ def close(self):
+ self.proc.terminate()
+ try:
+ self.proc.wait(timeout=5)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def connect(endpoint=OPEN_ADDRESS, **kwargs):
+ """A connected verifier: an http(s) address, or "stdio:" for a program."""
+ verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs)
+ verifier.connect()
+ return verifier
diff --git a/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_open_bridge.py
new file mode 100644
index 0000000000000000000000000000000000000000..bc0e20b469db24286278a387680ad8d3898f0661
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-budget5-cell1000-current-16min-11c/tests/ztp_open_bridge.py
@@ -0,0 +1,109 @@
+"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's
+MCP address, and its answer written back on stdout, one line each. Standard library only.
+
+ python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp/open
+
+It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio
+server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds
+nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a
+notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for
+every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same
+message again, as ztp_mcp.Verifier does, so a client sees one answer per request.
+
+Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no
+key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image.
+
+Licence: Apache-2.0.
+"""
+import json
+import os
+import sys
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900"))
+API_KEY = os.environ.get("ZTP_API_KEY") or None
+
+
+class Bridge:
+ def __init__(self, url):
+ self.url = url
+ self.session = None
+ self.extra_headers = {}
+
+ def post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-bridge/1.0"}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ if API_KEY:
+ headers["Authorization"] = "Bearer " + API_KEY
+ headers.update(self.extra_headers)
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ with urllib.request.urlopen(request, timeout=600) as response:
+ if response.headers.get("Mcp-Session-Id"):
+ self.session = response.headers["Mcp-Session-Id"]
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "id" not in message:
+ return None
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}}
+ return json.loads(raw) if raw.strip() else None
+
+ def forward(self, message):
+ started, wait = time.time(), 2.0
+ while True:
+ try:
+ answer = self.post(message)
+ text = ""
+ if isinstance(answer, dict) and isinstance(answer.get("result"), dict):
+ text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict))
+ if not (BUSY in text and len(text) < 400):
+ return answer
+ except urllib.error.HTTPError as problem:
+ if not (problem.code == 429 or problem.code >= 500):
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}}
+ after = problem.headers.get("Retry-After")
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError):
+ pass
+ if time.time() - started + wait > PATIENCE_S:
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}}
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+
+def main():
+ bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS)
+ for line in sys.stdin:
+ if not line.strip():
+ continue
+ try:
+ message = json.loads(line)
+ except ValueError:
+ continue
+ answer = bridge.forward(message)
+ if answer is not None:
+ sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n")
+ sys.stdout.flush()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/Dockerfile b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..568742bebe61fc9c90daad15a6ed51c93a294086
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/Dockerfile
@@ -0,0 +1,14 @@
+# Harbor environment image for Zero-Trust Physics release v0.15.3 (commit 664d68f4).
+# Public 5-crate Rust engine reference source is at https://github.com/johnkruze/zero-trust-physics-engine (tag v0.15.2);
+# read-only source audit of the pack verifier build is available under NDA (https://zerotrustphysics.com/offers/#licence).
+# In this free evaluation sample, /usr/local/bin/mcp_stdio bridges JSON-RPC over stdio to the public MCP endpoint
+# (ztp_open_bridge.py), and the scorer verifies release 0.15.3 version and kernel invariants on every reply.
+# Paid Domain Packs ship compiled static Linux/macOS rollout binaries for --network none execution.
+FROM python:3.12-slim-bookworm
+ARG ZTP_ENGINE_TAG=v0.15.3
+ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1
+ARG ZTP_VERIFIER_URL=https://mcp.zerotrustphysics.com/mcp/open
+COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py
+RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "%s"\n' "$ZTP_VERIFIER_URL" > /usr/local/bin/mcp_stdio \
+ && chmod +x /usr/local/bin/mcp_stdio
+WORKDIR /app
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/ztp_open_bridge.py
new file mode 100644
index 0000000000000000000000000000000000000000..bc0e20b469db24286278a387680ad8d3898f0661
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/environment/ztp_open_bridge.py
@@ -0,0 +1,109 @@
+"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's
+MCP address, and its answer written back on stdout, one line each. Standard library only.
+
+ python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp/open
+
+It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio
+server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds
+nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a
+notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for
+every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same
+message again, as ztp_mcp.Verifier does, so a client sees one answer per request.
+
+Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no
+key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image.
+
+Licence: Apache-2.0.
+"""
+import json
+import os
+import sys
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900"))
+API_KEY = os.environ.get("ZTP_API_KEY") or None
+
+
+class Bridge:
+ def __init__(self, url):
+ self.url = url
+ self.session = None
+ self.extra_headers = {}
+
+ def post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-bridge/1.0"}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ if API_KEY:
+ headers["Authorization"] = "Bearer " + API_KEY
+ headers.update(self.extra_headers)
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ with urllib.request.urlopen(request, timeout=600) as response:
+ if response.headers.get("Mcp-Session-Id"):
+ self.session = response.headers["Mcp-Session-Id"]
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "id" not in message:
+ return None
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}}
+ return json.loads(raw) if raw.strip() else None
+
+ def forward(self, message):
+ started, wait = time.time(), 2.0
+ while True:
+ try:
+ answer = self.post(message)
+ text = ""
+ if isinstance(answer, dict) and isinstance(answer.get("result"), dict):
+ text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict))
+ if not (BUSY in text and len(text) < 400):
+ return answer
+ except urllib.error.HTTPError as problem:
+ if not (problem.code == 429 or problem.code >= 500):
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}}
+ after = problem.headers.get("Retry-After")
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError):
+ pass
+ if time.time() - started + wait > PATIENCE_S:
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}}
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+
+def main():
+ bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS)
+ for line in sys.stdin:
+ if not line.strip():
+ continue
+ try:
+ message = json.loads(line)
+ except ValueError:
+ continue
+ answer = bridge.forward(message)
+ if answer is not None:
+ sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n")
+ sys.stdout.flush()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/instruction.md b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/instruction.md
new file mode 100644
index 0000000000000000000000000000000000000000..72cae47b905b93637bec06d02d3452acc0dd629a
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/instruction.md
@@ -0,0 +1,24 @@
+Cell m448 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.47 Ah, with its case at 18 degrees Celsius, is rested at a state of charge that you choose and then discharged at 9.6 A for eleven minutes (660 steps of 1 s), its case held at 18 degrees Celsius.
+
+Find the smallest starting state of charge (a fraction of full charge), from 0.25 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 1e-06 apart, and name the constraint that binds.
+
+Constraints (id, what, limit):
+- end_voltage, the cell's terminal voltage at the end of the run, in volts at or above 2.8012 V
+- core_hottest, the hottest the cell's core gets over the run, in degrees Celsius at or below 26.174 degC
+- completes, the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold
+Each design is one run:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": "", "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}}
+This task has no solve: leave "solve" out of each design.
+
+Budget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": ""}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out "solve" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it, and "step": the last step its run is sealed to (steps_landed), a whole number: {"run": {...}, "stopped": "", "step": }. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+
+Also write that answer card, by itself, to the file `/app/answer.json`.
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/chainlib.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/chainlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/chainlib.py
@@ -0,0 +1,63 @@
+"""Build the solve request of a chained design from a run's answer: the history its coupling hands over.
+
+A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's
+32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This
+module reads the slots from frame_hex with the standard library and lays the history out the way a
+task states it.
+
+ chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from
+
+layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or
+{"kind": "triga_element"}.
+
+Licence: Apache-2.0.
+"""
+import copy
+import struct
+
+
+def _slots(run_answer, f64_at, f32_at):
+ """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened."""
+ out = [[] for _ in range(1 + len(f32_at))]
+ for frame in run_answer["frames"]:
+ raw = bytes.fromhex(frame["frame_hex"])
+ out[0].append(struct.unpack("\", \"capacity_ah\": 4.47, \"case_temperature_least_c\": 18.0, \"case_temperature_most_c\": 18.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 660, \"load\": {\"current_a\": 9.6, \"case_temperature_c\": 18.0}}], \"record_every\": 660}}\nThis task has no solve: leave \"solve\" out of each design.\n\nBudget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "path", "on": "run", "path": "initial.state_of_charge", "words": "the starting state of charge (a fraction of full charge)"}, "template": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": null, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "free": [], "run_outcomes": ["completed"], "direction": "smallest", "units": "", "chain": null, "range": [0.25, 1.0], "tolerance": 1e-06}, "constraints": [{"id": "end_voltage", "on": "run", "read": {"kind": "final", "quantity": "terminal_v"}, "op": ">=", "words": "the cell's terminal voltage at the end of the run, in volts", "unit": "V", "limit": 2.8012}, {"id": "core_hottest", "on": "run", "read": {"kind": "extreme", "quantity": "core_temperature_c", "which": "maximum"}, "op": "<=", "words": "the hottest the cell's core gets over the run, in degrees Celsius", "unit": "degC", "limit": 26.174}, {"id": "completes", "on": "outcome", "words": "the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold", "stop": "UndervoltageLimit"}], "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "Limits read at seeded designs; the window sampled at 61 designs and the boundary bisected on the local 0.15.3 build."}, "reference": {"boundary": 0.5465609150325692, "binding": "core_hottest", "window_pattern": "........................HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", "constraint_patterns": {"end_voltage": "-+-----+-+--+------++++++++++++++++++++++++++++++++++++++++++", "core_hottest": "+++++++++++++++---------+++++++++++++++++++++++++++++++++++++", "completes": "-----------------------++++++++++++++++++++++++++++++++++++++"}, "band": [0.55, 1.0], "near_pattern": "....................HHHHHHHHHHHHHHHHHHHHH", "passing": {"x": 0.5465612150325692, "values": {"end_voltage": 2.8349093713245175, "core_hottest": 26.173992565002724, "completes": "completed"}, "run": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465612150325692, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "run_seal": "5409934b45e2559467989bb1cf922deb3a8a3c075c638a6bae4a4379cdb10e0e0e099537ca7e24a95f7f0f1f21baf887", "solve": null, "solution_seal": null, "next": null, "next_seal": null}, "failing": {"x": 0.5465606150325693, "values": {"end_voltage": 2.8349079479164936, "core_hottest": 26.174007434990113, "completes": "completed"}, "run": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465606150325693, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "run_seal": "baa948ee323f2595cb5a4109e49a1926d9de0ff6fc428024cd6e6d9ca23e6de522a52c96a4f23d40eeabddb7920c2a85", "solve": null, "solution_seal": null, "next": null, "next_seal": null, "outcome": "completed", "stopped": null, "steps_landed": 660}, "limit_targets": {"end_voltage": 0.4670589356940773, "core_hottest": 0.4267557164426305}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/run_reference.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/run_reference.py
new file mode 100644
index 0000000000000000000000000000000000000000..0dc7d591e31fb27d4a9ccc2c2a50f5436eb503b2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/run_reference.py
@@ -0,0 +1,208 @@
+"""An agent with no model in it: answer every environment from its reference, through the harness proxy.
+
+ python3 run_reference.py --engine ENGINE --environments F --out DIR [--only id,id] [--direct]
+
+For a tradeoff or chain_design environment it sends the reference passing and failing runs to the
+verifier, hands each run to its solve through the task's coupling where the task has one, and writes
+the card with the seals this verifier gives. For a budget environment it sends the two reference
+requests. For a forensics table it puts the table to the verifier (each row's request as sent, up to
+the task's budget) and names the false rows the build recorded.
+
+Every call goes through harness/mcp_log_proxy.py, started in an empty working folder, so the
+authoritative call record is DIR/.harness.jsonl, as in a pass@k attempt. The same calls are also
+written beside the reply, DIR/.calls.jsonl. --direct talks to ENGINE with no proxy and writes the
+reply-side log only.
+
+ python3 score.py DIR --engine ENGINE --environments F --calls-from harness
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import json
+import os
+import subprocess
+import sys
+import tempfile
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+import chainlib # noqa: E402
+from score import (FREE_TOOLS, NOT_STOPPED, build_stage_request, close_verifier, continuation_of, design_shape, # noqa: E402
+ file_sha256, get_path, load_environments, open_verifier)
+from ztp_mcp import McpError, StdioVerifier # noqa: E402
+
+PROXY = os.path.join(HERE, "..", "harness", "mcp_log_proxy.py")
+
+
+class ProxiedVerifier(StdioVerifier):
+ """The engine behind the logging proxy, the proxy started in its own empty working folder."""
+
+ def __init__(self, engine, log, cwd=None, **kwargs):
+ self.cwd = cwd or tempfile.mkdtemp(prefix="ztp_ref_cwd_")
+ if engine.startswith("http://") or engine.startswith("https://"):
+ # an MCP address: the proxy runs the stdio bridge to it (ztp_open_bridge.py, beside this file)
+ child = [sys.executable, os.path.join(HERE, "ztp_open_bridge.py"), engine]
+ else:
+ child = [os.path.abspath(engine)]
+ command = [sys.executable, os.path.abspath(PROXY), "--log", os.path.abspath(log), "--"] + child
+ super(StdioVerifier, self).__init__(url="stdio: " + " ".join(command), timeout_s=600, **kwargs)
+ self.proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, cwd=self.cwd)
+ self.binary_sha256 = None if len(child) > 1 else file_sha256(engine)
+
+ def close(self):
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ try:
+ self.proc.wait(timeout=60)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def proxied(engine, log, cwd=None):
+ if os.path.exists(log):
+ os.remove(log)
+ verifier = ProxiedVerifier(engine, log, cwd)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the proxied verifier failed: %s" % problem)
+ return verifier
+
+
+class Logged:
+ def __init__(self, verifier):
+ self.verifier, self.calls, self.seen = verifier, [], {}
+
+ def call(self, tool, arguments, refused_ok=False):
+ # the same request twice is one call: a chain with its value in the next run has one first run for both designs
+ key = json.dumps([tool, arguments], sort_keys=True)
+ if key in self.seen and not self.seen[key][1]:
+ return self.seen[key][0]
+ self.calls.append({"tool": tool, "arguments": arguments})
+ body, is_error = self.verifier.call_json(tool, arguments)
+ self.seen[key] = (body, is_error)
+ if is_error and not refused_ok:
+ raise SystemExit("the reference request was refused: %s %s" % (tool, str(body)[:300]))
+ return body
+
+
+def design_staged(env, ref, agent):
+ """A staged design: each stage sent in order, handed values and continuations built from this verifier's answers."""
+ spec = env["check"]["design"]
+ answers, requests, out = {}, {}, {}
+ for stage in spec["stages"]:
+ q = build_stage_request(spec, stage, ref["x"], answers, requests)
+ body = agent.call(stage["tool"], q, refused_ok=True)
+ stopped = body.get("outcome") not in NOT_STOPPED
+ answers[stage["key"]] = {"body": body, "proof": body.get("run_seal") or body.get("solution_seal"),
+ "outcome": body.get("outcome"), "stop": body.get("reject") if stopped else None, "stopped": stopped}
+ requests[stage["key"]] = q
+ out[stage["key"]] = {"request": {"tool": stage["tool"], "arguments": q}, "proof": answers[stage["key"]]["proof"]}
+ return out
+
+
+def design(env, ref, agent):
+ spec = env["check"]["design"]
+ shape = design_shape(spec)
+ if shape == "staged":
+ return design_staged(env, ref, agent)
+ if shape == "solve":
+ solved = agent.call("solve", ref["solve"], refused_ok=True)
+ return {"solve": {"request": {"tool": "solve", "arguments": ref["solve"]}, "proof": solved["solution_seal"]}}
+ run_args = ref["run"]
+ run = agent.call("run_trajectory", run_args)
+ out = {"run": {"request": {"tool": "run_trajectory", "arguments": run_args}, "proof": run["run_seal"]}}
+ if shape == "continued":
+ # the run that continues this design's own sealed run: the reference's next run, its start fields and from
+ # set from this verifier's answer to the first run
+ _, carried, _, _ = continuation_of(spec)
+ next_args = copy.deepcopy(ref["next"])
+ next_args["initial"] = {name: get_path(run, source) for name, source in carried.items()}
+ next_args["from"] = {"request": run_args, "run_seal": run["run_seal"]}
+ nxt = agent.call("run_trajectory", next_args, refused_ok=True)
+ out["next"] = {"request": {"tool": "run_trajectory", "arguments": next_args}, "proof": nxt["run_seal"]}
+ elif spec.get("chain"):
+ overrides = {}
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ overrides[spec["variable"]["path"].split(".", 1)[1]] = ref["x"]
+ solve_args = chainlib.chained_solve(spec["chain"], run_args, run, overrides)
+ solved = agent.call("solve", solve_args)
+ out["solve"] = {"request": {"tool": "solve", "arguments": solve_args}, "proof": solved["solution_seal"]}
+ return out
+
+
+def reference_reply(env, verifier):
+ """(reply text, calls [{"tool", "arguments"}])."""
+ agent = Logged(verifier)
+ family, ref = env["family"], env["reference"]
+ if family in ("tradeoff", "chain_design"):
+ card = {"passing": design(env, ref["passing"], agent), "failing": design(env, ref["failing"], agent), "binding": ref["binding"]}
+ if ref["failing"].get("stopped"):
+ card["failing"]["stopped"] = ref["failing"]["stopped"]
+ if ref["failing"].get("steps_landed") is not None:
+ card["failing"]["step"] = ref["failing"]["steps_landed"]
+ words = "The boundary lies between the two designs below; %s binds." % ref["binding"]
+ elif family == "budget":
+ card = {}
+ for side in ("holds", "stops"):
+ request = ref[side]["request"]
+ answer = agent.call(request["tool"], request["arguments"])
+ card[side] = {"request": request, "proof": answer.get("run_seal") or answer.get("solution_seal")}
+ card["stops"]["stopped"] = env["check"]["stop"]
+ words = "The stop %s lies between the two requests below." % env["check"]["stop"]
+ else:
+ agent.call("list_cards", {}, refused_ok=True)
+ rows = env["check"]["rows"]
+ budget = env["check"].get("budget") or len(rows)
+ computing = 0
+ for row in rows:
+ request = row["request"]
+ if computing >= budget:
+ break
+ if request["tool"] in FREE_TOOLS:
+ continue
+ agent.call(request["tool"], request["arguments"], refused_ok=True)
+ computing += 1
+ card = {"false_rows": ref["false_rows"]}
+ words = "%d of the %d rows are false." % (len(ref["false_rows"]), len(rows))
+ return words + "\n\n" + json.dumps(card), agent.calls
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--direct", action="store_true", help="no proxy: the reply-side log only")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ os.makedirs(args.out, exist_ok=True)
+ shared = open_verifier(args.engine) if args.direct else None
+ try:
+ for env in environments:
+ verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl"))
+ try:
+ reply, calls = reference_reply(env, verifier)
+ finally:
+ if not shared:
+ close_verifier(verifier)
+ with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f:
+ f.write(reply + "\n")
+ with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f:
+ for c in calls:
+ f.write(json.dumps(c) + "\n")
+ print("%-60s %d calls" % (env["id"], len(calls)), flush=True)
+ finally:
+ if shared:
+ close_verifier(shared)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/score.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/score.py
new file mode 100644
index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/score.py
@@ -0,0 +1,1199 @@
+"""Score replies to the multi-step environments with no judge: a program and the verifier.
+
+ python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F]
+ [--calls-from reply|harness] [--harness-dir DIR]
+
+ REPLIES is a folder with one file per environment, .txt, the whole text of a reply.
+ --calls-from harness the call record is the harness's own: .harness.jsonl, written by
+ harness/mcp_log_proxy.py outside the solver's working directory (in
+ --harness-dir, default REPLIES). A .calls.jsonl beside the reply,
+ when there is one, is read only to catch an edit: it must equal the
+ harness log call for call.
+ --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply:
+ one JSON object a line, {"tool": "", "arguments": {...}}.
+
+ ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address
+ beginning http. A task is scored only on the engine it was built on: the verifier's version must
+ be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's
+ reference.engine_binary_sha256.
+
+The answer card is one JSON object on the reply's last line. Its shape is the family's:
+
+ tradeoff, chain_design (kind design_to_limit, chained_design)
+ {"passing": DESIGN, "failing": DESIGN, "binding": ""}
+ DESIGN = {"run": {"request": R, "proof": ""},
+ "solve": {"request": R, "proof": ""}} (solve only where the task has one)
+ Where a constraint is that the run completes and it binds, the failing DESIGN also carries
+ "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}}
+ The design shapes, one scorer for every group (check.design says which):
+ run a run alone.
+ coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run.
+ continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of
+ the same card that continues it through from, starting from its sealed final state,
+ DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template
+ is chain.next_template, chain.template or chain.next; its start fields are chain.carried
+ ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or
+ chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on
+ "next" reads the next run, and a stop constraint judges it.
+ solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no
+ run. A binding refusal is named ("stopped") with no step.
+ staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per
+ stage in order; a later stage carries an earlier stage's answer at a named input (handed) or
+ continues an earlier run (continues), bit for bit.
+ A constraint's read may carry "index": one entry of an output the verifier returns as a list.
+ budget (kind budgeted_search)
+ {"holds": {"request": R, "proof": ""},
+ "stops": {"request": R, "proof": "", "stopped": ""}}
+ forensics
+ {"false_rows": {"": "", ...}} ({} when every row is genuine)
+
+Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a
+solution_seal, short form) and every number judged is read from the verifier's own answer to the
+card's request, sent again here, never from the reply.
+
+Scores per environment
+----------------------
+reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1.
+ proofs_hold: every proof on the card verifies. correct: the card is the right answer and
+ nothing below under "integrity" failed.
+graded in [0, 1], beside reward.
+
+ Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not
+ verify (a copied, nudged, edited or stale proof); a request differs from the task's template other
+ than at the design variable; a chained solve not handed its own design's sealed run; no call log;
+ a call log beside the reply that differs from the harness log; a harness log whose chain breaks;
+ a forbidden tool called; more computing calls than the budget; a request on the card that is not
+ among the calls; a forensics answer with no computing call behind it; a task built on another
+ engine than the verifier.
+
+ tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the
+ passing design meets every constraint and the failing one breaks the named binding constraint
+ (budget: holds completes, stops ends with the task's stop, named on the card), on the side the
+ task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0.
+ With the sides right:
+
+ e = the length of the smallest interval holding both designs' values and the reference
+ boundary (for a bracket that straddles the boundary, its width)
+ tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget)
+ r = e / tol
+ graded = 1 when reward is 1 (r <= 1 and the bracket straddles it)
+ = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score
+ (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25)
+ = 0.5 when r <= 1 but the bracket misses the reference boundary
+ by more than the slack (another crossing than the one asked)
+
+ The decay is smooth and falls monotonically with r, and a near miss scores near the top.
+
+ forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found
+ only with its right reason. precision = found / named, recall = found / false rows; an empty
+ answer to a table with no false row scores 1. A card that names every row of the table false is
+ a blanket answer and scores 0, as do unknown rows and reasons outside the task's list.
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import hashlib
+import json
+import math
+import os
+import re
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402
+
+FAMILIES = ("tradeoff", "chain_design", "budget", "forensics")
+KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"}
+NOT_STOPPED = ("completed", "converged")
+PREFIX_ENDS = ("__", ".", ":", "/")
+VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite",
+ "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset",
+ "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip")
+# Calls that read the catalogue compute nothing and are free in a call budget.
+FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt")
+REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden")
+GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r)
+OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary
+
+
+class Integrity(Exception):
+ """The answer cannot be trusted: graded 0 and reward 0."""
+
+
+class Wrong(Exception):
+ """The answer is trusted and wrong: graded 0 and reward 0."""
+
+
+def load_environments(path):
+ with open(path, encoding="utf-8") as f:
+ return [json.loads(line) for line in f if line.strip()]
+
+
+def row_problems(env):
+ """What a task row lacks against the shared row contract (empty when none)."""
+ out = []
+ for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"):
+ if key not in env:
+ out.append("no %s" % key)
+ family = env.get("family")
+ if family not in FAMILIES:
+ out.append("family %r" % family)
+ elif "kind" in env and env["kind"] != KINDS[family]:
+ out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family]))
+ ref = env.get("reference") or {}
+ for key in ("engine_tag", "engine_commit", "engine_binary_sha256"):
+ if not ref.get(key):
+ out.append("reference.%s missing" % key)
+ return out
+
+
+def file_sha256(path):
+ h = hashlib.sha256()
+ with open(path, "rb") as f:
+ for block in iter(lambda: f.read(1 << 20), b""):
+ h.update(block)
+ return h.hexdigest()
+
+
+def open_verifier(engine):
+ if engine.startswith("http://") or engine.startswith("https://"):
+ verifier = Verifier(engine, pause_s=0.5)
+ verifier.binary_sha256 = None
+ else:
+ if not os.path.isfile(engine):
+ sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine)
+ verifier = StdioVerifier([engine])
+ verifier.binary_sha256 = file_sha256(engine)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the verifier failed, so nothing was scored: %s" % problem)
+ if not isinstance(verifier.server, dict) or not verifier.server.get("name"):
+ close_verifier(verifier)
+ sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine)
+ return verifier
+
+
+def close_verifier(verifier):
+ if hasattr(verifier, "close"):
+ verifier.close()
+
+
+# ------------------------------------------------------------------------------------------
+# reading the reply and the call logs
+# ------------------------------------------------------------------------------------------
+def _no_constant(name):
+ raise ValueError("%s is not a number" % name)
+
+
+def read_card(reply):
+ """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over."""
+ lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()]
+ while lines and lines[-1].startswith("```"):
+ lines.pop()
+ if not lines:
+ return None, "the reply is empty"
+ try:
+ card = json.loads(lines[-1], parse_constant=_no_constant)
+ except ValueError:
+ return None, "the last line is not one JSON object"
+ if not isinstance(card, dict):
+ return None, "the last line is not one JSON object"
+ return card, None
+
+
+def tool_name(name):
+ """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve)."""
+ if not isinstance(name, str):
+ return None
+ if name in VERIFIER_TOOLS:
+ return name
+ for tool in VERIFIER_TOOLS:
+ for joint in PREFIX_ENDS:
+ if name.endswith(joint + tool):
+ return tool
+ return name
+
+
+def without_readout(arguments):
+ """A run's arguments as sealed: a readout is not part of a run's seal."""
+ if not isinstance(arguments, dict):
+ return arguments
+ return {k: v for k, v in arguments.items() if k != "readout"}
+
+
+def numbers_by_value(value):
+ """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept."""
+ if isinstance(value, dict):
+ return {k: numbers_by_value(v) for k, v in value.items()}
+ if isinstance(value, list):
+ return [numbers_by_value(v) for v in value]
+ if isinstance(value, int) and not isinstance(value, bool):
+ return float(value)
+ return value
+
+
+def canonical(arguments):
+ """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value."""
+ return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":"))
+
+
+def _arguments(one):
+ arguments = one.get("arguments")
+ if isinstance(arguments, str):
+ try:
+ arguments = json.loads(arguments)
+ except ValueError:
+ arguments = {}
+ return arguments if isinstance(arguments, dict) else {}
+
+
+def read_calls(path):
+ """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log."""
+ if not path or not os.path.isfile(path):
+ return None
+ calls = []
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for line in f:
+ line = line.strip()
+ if not line:
+ continue
+ try:
+ one = json.loads(line)
+ except ValueError:
+ continue
+ if isinstance(one, dict):
+ calls.append((tool_name(one.get("tool")), _arguments(one)))
+ return calls
+
+
+def chain_of(previous, entry):
+ payload = json.dumps(entry, sort_keys=True, separators=(",", ":"))
+ return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest()
+
+
+def read_harness_log(path):
+ """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log;
+ problem names the first line whose chain does not follow (an edit, a line taken out or put in)."""
+ if not path or not os.path.isfile(path):
+ return None, None
+ calls, previous = [], None
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for number_, line in enumerate(f, 1):
+ if not line.strip():
+ continue
+ try:
+ entry = json.loads(line)
+ except ValueError:
+ return calls, "line %d of the harness log is not JSON" % number_
+ if not isinstance(entry, dict) or "chain" not in entry:
+ return calls, "line %d of the harness log carries no chain" % number_
+ chain = entry.pop("chain")
+ if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1:
+ return calls, "the harness log's chain breaks at line %d" % number_
+ previous = chain
+ calls.append((tool_name(entry.get("tool")), _arguments(entry)))
+ return calls, None
+
+
+def write_harness_log(path, calls):
+ """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)]."""
+ previous = None
+ with open(path, "w", encoding="utf-8") as f:
+ for seq, (tool, arguments) in enumerate(calls, 1):
+ entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None,
+ "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False}
+ entry["chain"] = chain_of(previous, entry)
+ previous = entry["chain"]
+ f.write(json.dumps(entry, sort_keys=True) + "\n")
+
+
+# ------------------------------------------------------------------------------------------
+# the verifier, asked again
+# ------------------------------------------------------------------------------------------
+def stop_name_in(sentence):
+ names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "")
+ return names[-1] if names else None
+
+
+class Replay:
+ """The verifier, with every answer remembered: the same request is sent once."""
+
+ def __init__(self, verifier):
+ self.verifier = verifier
+ self.seen = {}
+ server = getattr(verifier, "server", None) or {}
+ self.version = server.get("version")
+ self.binary_sha256 = getattr(verifier, "binary_sha256", None)
+
+ def call(self, tool, arguments):
+ key = tool + "\x00" + json.dumps(arguments, sort_keys=True)
+ if key not in self.seen:
+ try:
+ self.seen[key] = self.verifier.call_json(tool, arguments)
+ except McpError as problem:
+ if not str(problem).startswith("protocol error"):
+ raise SystemExit("the verifier failed, so nothing was scored: %s" % problem)
+ self.seen[key] = ("the verifier did not take the request: %s" % problem, True)
+ return self.seen[key]
+
+ def answer(self, tool, arguments, readout=None):
+ """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}."""
+ arguments = copy.deepcopy(without_readout(arguments))
+ if readout is not None and tool == "run_trajectory":
+ arguments["readout"] = readout
+ body, is_error = self.call(tool, arguments)
+ if is_error or not isinstance(body, dict):
+ sentence = body if isinstance(body, str) else json.dumps(body)
+ return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence),
+ "proof": None, "body": None, "sentence": sentence}
+ outcome = body.get("outcome")
+ stopped = outcome not in NOT_STOPPED
+ return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None,
+ "proof": body.get("run_seal") or body.get("solution_seal"), "body": body,
+ "sentence": body.get("reject_detail")}
+
+ def proof_holds(self, tool, arguments, proof):
+ """(holds, words): the card's seal verified by verify_tape or verify_solution, short form."""
+ if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof):
+ return False, "the proof is not a SHA-384 seal of 96 hex digits"
+ if tool == "run_trajectory":
+ body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof})
+ elif tool == "solve":
+ body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof})
+ else:
+ return False, "a proof is verified for run_trajectory or solve only, not %s" % tool
+ if is_error or not isinstance(body, dict):
+ return False, "the verifier would not verify it: %s" % (str(body)[:200])
+ if body.get("holds") is True:
+ return True, None
+ return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause")
+
+
+def engine_problem(env, replay):
+ """None when the verifier is the engine the task was built on; else what differs."""
+ ref = env.get("reference") or {}
+ tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v")
+ if not tag:
+ return "the task names no engine it was built on"
+ if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag:
+ return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version"))
+ if replay.version != tag:
+ return "the task was built on engine %s; the verifier is %s" % (tag, replay.version)
+ want = ref.get("engine_binary_sha256")
+ if replay.binary_sha256 and want and replay.binary_sha256 != want:
+ return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12])
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# requests and their inputs
+# ------------------------------------------------------------------------------------------
+_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)")
+
+
+def get_path(obj, path):
+ here = obj
+ for part in path.split("."):
+ found = _PART.fullmatch(part)
+ if not found or not isinstance(here, dict) or found.group(1) not in here:
+ return None
+ here = here[found.group(1)]
+ for index in re.findall(r"\[(\d+)\]", found.group(2)):
+ if not isinstance(here, list) or int(index) >= len(here):
+ return None
+ here = here[int(index)]
+ return here
+
+
+def set_path(obj, path, value):
+ parts = path.split(".")
+ here = obj
+ for i, part in enumerate(parts):
+ m = _PART.fullmatch(part)
+ name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))]
+ last = i == len(parts) - 1
+ if not idx:
+ if last:
+ here[name] = value
+ else:
+ here = here[name]
+ else:
+ here = here[name]
+ for j, k in enumerate(idx):
+ if last and j == len(idx) - 1:
+ here[k] = value
+ else:
+ here = here[k]
+
+
+def number(value):
+ return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value)
+
+
+def differs(template, given, free, where=""):
+ """The first place where a request differs from the task's, other than the free places. None when none."""
+ if where in free:
+ return None
+ if isinstance(template, dict):
+ if not isinstance(given, dict):
+ return where or "the request"
+ for key in set(template) | set(given):
+ place = "%s.%s" % (where, key) if where else key
+ if place in free:
+ continue
+ if key not in given or key not in template:
+ return place
+ found = differs(template[key], given[key], free, place)
+ if found:
+ return found
+ return None
+ if isinstance(template, list):
+ if not isinstance(given, list) or len(given) != len(template):
+ return where
+ for index, (a, b) in enumerate(zip(template, given)):
+ found = differs(a, b, free, "%s[%d]" % (where, index))
+ if found:
+ return found
+ return None
+ if number(template) and number(given):
+ return None if float(template) == float(given) else where
+ return None if template == given else where
+
+
+def design_value(variable, run_arguments, solve_arguments, next_arguments=None):
+ """The design variable of one design, read from its requests (on: run, solve, or next, a continued run)."""
+ kind = variable["kind"]
+ if kind == "path":
+ on = variable.get("on", "run")
+ source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {}
+ value = get_path(source, variable["path"])
+ for place in variable.get("also") or []:
+ again = get_path(source, place)
+ if not (number(again) and number(value) and float(again) == float(value)):
+ return None
+ return float(value) if number(value) else None
+ if kind == "entry_angle_deg":
+ radial = get_path(run_arguments or {}, "initial.radial_speed_m_s")
+ transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s")
+ if not (number(radial) and number(transverse)) or transverse <= 0:
+ return None
+ speed = math.hypot(radial, transverse)
+ if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]:
+ return None
+ return math.degrees(math.atan2(-radial, transverse))
+ return None
+
+
+def variable_places(variable):
+ if variable["kind"] == "entry_angle_deg":
+ return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"}
+ if variable["kind"] == "path" and variable.get("on", "run") == "run":
+ return {variable["path"]} | set(variable.get("also") or [])
+ return set()
+
+
+def read_value(read, answer):
+ """One number from a replayed answer: final, result, or the extreme of a run's readout."""
+ body = answer["body"]
+ if body is None:
+ return None
+ kind = read["kind"]
+ value = None
+ if kind == "final":
+ value = (body.get("final_state") or {}).get(read["quantity"])
+ elif kind == "result":
+ value = (body.get("result") or {}).get(read["quantity"])
+ elif kind == "flag_extent":
+ # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it
+ value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or []
+ if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0])
+ elif kind == "extreme":
+ for quantity in (body.get("readout") or {}).get("quantities") or []:
+ if quantity.get("quantity") == read["quantity"]:
+ value = quantity.get(read["which"])
+ if "index" in read:
+ # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points)
+ k = read["index"]
+ value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None
+ return value if number(value) else None
+
+
+def readout_for(constraints, on="run"):
+ """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key)."""
+ quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"})
+ return {"quantities": quantities} if quantities else None
+
+
+def design_shape(spec):
+ """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged."""
+ if spec.get("stages"):
+ return "staged"
+ if spec.get("tool") == "solve" or spec.get("kind") == "solve":
+ return "solve"
+ chain = spec.get("chain") or {}
+ if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue":
+ return "continued"
+ return "coupled" if chain else "run"
+
+
+def continuation_of(spec):
+ """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it},
+ next outcomes, the next run's places that also hold a first-run design value)."""
+ chain = spec["chain"]
+ template = chain.get("next_template") or chain.get("template") or chain.get("next")
+ if "carried" in chain: # group 1
+ carried = dict(chain["carried"])
+ elif "handed" in chain: # group 4
+ named = chain.get("handed_from") or {}
+ carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]}
+ else: # group 5
+ carried = {k: "final_state." + k for k in chain.get("carry") or []}
+ if chain.get("clock"):
+ carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"]
+ outcomes = chain.get("next_outcomes") or spec["run_outcomes"]
+ return template, carried, outcomes, list(chain.get("next_also") or [])
+
+
+def meets(constraint, value):
+ if value is None:
+ return False
+ return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"]
+
+
+def history_layout_problem(layout, parameters, frames_count):
+ """None when the arrays of a chained solve are laid out as the task states; else what is not."""
+ if layout is None:
+ return None
+ if layout["kind"] == "stardust_slab":
+ names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s",
+ "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2")
+ columns = [parameters.get(name) for name in names]
+ if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns):
+ return "the history columns are not all lists of numbers"
+ time, pressure, coefficient, enthalpy, radiative = columns
+ rows = frames_count + 3
+ if any(len(c) != rows for c in columns):
+ return "the history has not one row before the %d frames handed and two after them" % frames_count
+ if time[0] != 0.0 or coefficient[0] != 0.0:
+ return "row 0 is not at 0 s with no heating"
+ if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]:
+ return "row 0 does not repeat the first frame's pressure and enthalpy"
+ if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]:
+ return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"]
+ if coefficient[-2] != 0.0 or coefficient[-1] != 0.0:
+ return "the stream is not off after the frames"
+ if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]:
+ return "the rows after the frames do not hold the last frame's pressure and enthalpy"
+ if any(v != 0.0 for v in radiative):
+ return "a row of the history holds radiative heating"
+ return None
+ if layout["kind"] == "triga_element":
+ return None # every array is handed by the coupling and held to its bits by the verifier
+ return "an unknown layout"
+
+
+# ------------------------------------------------------------------------------------------
+# the call record
+# ------------------------------------------------------------------------------------------
+def card_requests(env, card):
+ """Every request on the card, [(tool, arguments)], read leniently (for the call log)."""
+ out = []
+
+ def take(part):
+ if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict):
+ out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"]))
+
+ if env["family"] in ("tradeoff", "chain_design"):
+ stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []]
+ for side in ("passing", "failing"):
+ design = card.get(side) if isinstance(card.get(side), dict) else {}
+ for key in stages or ("run", "solve", "next"):
+ take(design.get(key))
+ elif env["family"] == "budget":
+ take(card.get("holds"))
+ take(card.get("stops"))
+ return out
+
+
+def sequence(calls):
+ return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls]
+
+
+def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row):
+ """None when the call record holds; else why not (an integrity failure)."""
+ check = env["check"]
+ if calls_from == "harness":
+ if calls is None:
+ return "no harness call log: every attempt is scored with the calls the harness recorded"
+ if log_problem:
+ return log_problem
+ if reply_calls is not None and sequence(reply_calls) != sequence(calls):
+ return "the call log beside the reply differs from the harness log"
+ elif calls is None:
+ return "no call log: every environment is scored with the agent's calls"
+ calls = [(tool_name(t), a) for t, a in calls]
+ banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])})
+ if banned:
+ return "the log holds calls of %s, which the task rules out" % ", ".join(banned)
+ computing = [(t, a) for t, a in calls if t not in FREE_TOOLS]
+ row["computing_calls"] = len(computing)
+ if check.get("budget") and len(computing) > check["budget"]:
+ return "%d computing calls; the budget is %d" % (len(computing), check["budget"])
+ sent = {(t, canonical(a)) for t, a in computing}
+ for tool, arguments in card_requests(env, card):
+ if (tool, canonical(arguments)) not in sent:
+ return "a %s request on the card is not among the calls in the log" % tool
+ if env["family"] == "forensics" and not computing:
+ return "no computing call behind the answer: the table was not put to the verifier"
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# the families
+# ------------------------------------------------------------------------------------------
+def request_of(part, tool, what):
+ """The arguments of one request on the card (Integrity when it is not one)."""
+ if not isinstance(part, dict):
+ raise Integrity("%s is missing" % what)
+ request = part.get("request")
+ if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)):
+ raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what)
+ if tool_name(request.get("tool")) != tool:
+ raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool))
+ return request["arguments"]
+
+
+def score_design(env, design, which, replay, proofs):
+ """One design of a boundary family: facts {x, met, values, stopped, steps_landed}."""
+ check = env["check"]
+ spec = check["design"]
+ shape = design_shape(spec)
+ if shape in ("solve", "staged", "continued") and not isinstance(design, dict):
+ raise Integrity("the %s design is missing" % which)
+ if shape == "solve":
+ return score_solve_design(env, design, which, replay, proofs)
+ if shape == "staged":
+ return score_staged_design(env, design, which, replay, proofs)
+ if shape == "continued":
+ return score_continued_design(env, design, which, replay, proofs)
+ chain = spec.get("chain")
+ run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory",
+ "the %s design's run" % which)
+ free = set(spec.get("free") or []) | variable_places(spec["variable"])
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ for place in spec.get("free") or []:
+ if place.endswith(".steps"):
+ steps = get_path(run_args, place)
+ if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)):
+ raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"]))
+ stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"]
+ stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names
+ if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name:
+ raise Wrong("the %s design's run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ solve_args, solve = None, None
+ if chain:
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != chain["solver"]:
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ handed = solve_args.get("from")
+ if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]:
+ raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"]))
+ if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof:
+ raise Integrity("the %s design's solve is not handed the design's own sealed run" % which)
+ parameters = solve_args.get("parameters")
+ if not isinstance(parameters, dict):
+ raise Integrity("the %s design's solve has no parameters" % which)
+ solve_free = set(chain.get("handed") or [])
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ solve_free.add(spec["variable"]["path"].split(".", 1)[1])
+ where = differs(chain["parameters"], parameters, solve_free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where))
+ frames = len((run["body"] or {}).get("frames") or [])
+ problem = history_layout_problem(chain.get("layout"), parameters, frames)
+ if problem:
+ raise Integrity("the %s design's solve: %s" % (which, problem))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] != "converged":
+ raise Wrong("the %s design's solve comes back %s%s, not converged" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else ""))
+ x = design_value(spec["variable"], run_args, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", "")))
+ met, values = {}, {}
+ for constraint in check["constraints"]:
+ if constraint["on"] == "outcome":
+ values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"])
+ met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"])
+ continue
+ value = read_value(constraint["read"], run if constraint["on"] == "run" else solve)
+ values[constraint["id"]] = value
+ met[constraint["id"]] = meets(constraint, value)
+ facts = {"x": x, "met": met, "values": values}
+ if run["outcome"] not in NOT_STOPPED and run["body"]:
+ facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed")
+ return facts
+
+
+def halted(answer, stop, staged=False):
+ """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that
+ is not completed or converged (group 3's rule, kept as built)."""
+ if staged:
+ return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop
+ return answer["outcome"] == "refused" and answer["stop"] == stop
+
+
+def constraint_facts(check, answers, judged, staged=False):
+ """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop
+ constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design."""
+ met, values = {}, {}
+ for c in check["constraints"]:
+ if c["on"] == "outcome":
+ a = answers.get(c["stage"]) if c.get("stage") else judged
+ values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"]))
+ met[c["id"]] = a is not None and not halted(a, c["stop"], staged)
+ continue
+ a = answers.get(c["on"])
+ value = read_value(c["read"], a) if a is not None else None
+ values[c["id"]] = value
+ met[c["id"]] = meets(c, value) if c.get("limit") is not None else None
+ return met, values
+
+
+def stopped_by(answer, constraints, stage=None):
+ """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given)."""
+ return any(halted(answer, c["stop"], stage is not None) for c in constraints
+ if c["on"] == "outcome" and (stage is None or c.get("stage") == stage))
+
+
+def score_solve_design(env, design, which, replay, proofs):
+ """One design that is one solve and no run (check.design.tool or kind "solve")."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != spec["template"].get("solver"):
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or [])
+ where = differs(spec["template"], solve_args, free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at %s" % (which, where))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]):
+ raise Wrong("the %s design's solve comes back %s%s, not %s" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"])))
+ x = design_value(dict(var, on="solve"), None, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, {"solve": solve}, solve)
+ facts = {"x": x, "met": met, "values": values}
+ if solve["outcome"] not in NOT_STOPPED and solve["body"]:
+ facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True
+ return facts
+
+
+def score_continued_design(env, design, which, replay, proofs):
+ """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes
+ the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer
+ also holds each carried start field to the first run's answer, bit for bit."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ on_next = var["kind"] == "path" and var.get("on") == "next"
+ template, carried, next_outcomes, next_also = continuation_of(spec)
+ run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which)
+ free = set(spec.get("free") or []) | (set() if on_next else variable_places(var))
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run"))
+ if run["outcome"] not in spec["run_outcomes"]:
+ raise Wrong("the %s design's first run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which)
+ handed = next_args.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args)
+ or handed.get("run_seal") != run_proof):
+ raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which)
+ next_free = {"initial." + name for name in carried} | {"from"} | set(next_also)
+ if on_next:
+ next_free |= {var["path"]} | set(var.get("also") or [])
+ where = differs(template, without_readout(next_args), next_free)
+ if where:
+ raise Integrity("the %s design's next run differs from the task's at %s" % (which, where))
+ start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {}
+ for name, source in carried.items():
+ held, given = get_path(run["body"] or {}, source), start.get(name)
+ if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))):
+ raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source))
+ holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's next run_seal: %s" % (which, words))
+ nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next"))
+ if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]):
+ raise Wrong("the %s design's next run comes back %s%s, not %s" % (
+ which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes)))
+ x = design_value(var, run_args, None, next_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ for place in next_also:
+ again = get_path(next_args, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place))
+ met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt)
+ facts = {"x": x, "met": met, "values": values}
+ if nxt["outcome"] not in NOT_STOPPED and nxt["body"]:
+ facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed")
+ return facts
+
+
+def build_stage_request(spec, stage, x, answers, requests):
+ """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from
+ earlier stages' answers, and a continuation's start and from (used by run_reference.py)."""
+ q = copy.deepcopy(stage["template"])
+ var = spec["variable"]
+ if var.get("stage") == stage["key"]:
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(q, place, x)
+ for h in stage.get("handed") or []:
+ set_path(q, h["to"], read_value(h["read"], answers[h["from"]]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ final = answers[parent]["body"]["final_state"]
+ q["initial"] = {k: final[k] for k in stage["template"]["initial"]}
+ q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]}
+ return q
+
+
+def score_staged_design(env, design, which, replay, proofs):
+ """One staged design (check.design.stages): each stage a run or a solve, in order."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ stages = spec["stages"]
+ answers, requests, facts = {}, {}, {}
+ for i, stage in enumerate(stages):
+ key, tool = stage["key"], stage["tool"]
+ sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key)))
+ free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []}
+ if var.get("stage") == key:
+ free |= {var["path"]} | set(var.get("also") or [])
+ if stage.get("continues"):
+ free |= {"initial", "from"}
+ where = differs(stage["template"], sent, free)
+ if where:
+ raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where))
+ for h in stage.get("handed") or []:
+ want = read_value(h["read"], answers[h["from"]])
+ got = get_path(sent, h["to"])
+ if want is None or not number(got) or float(got) != float(want):
+ raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % (
+ which, key, h["from"], h["read"]["quantity"], h["to"]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ handed = sent.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent])
+ or handed.get("run_seal") != design[parent].get("proof")):
+ raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent))
+ final = (answers[parent]["body"] or {}).get("final_state") or {}
+ start = sent.get("initial")
+ keys = set(stage["template"]["initial"])
+ if not isinstance(start, dict) or set(start) != keys or any(
+ not number(start[k]) or float(start[k]) != final.get(k) for k in keys):
+ raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent))
+ holds, words = replay.proof_holds(tool, sent, design[key].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's %s proof: %s" % (which, key, words))
+ answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None)
+ named = stopped_by(answer, check["constraints"], stage=key)
+ if answer["outcome"] not in stage["outcomes"] and not named:
+ raise Wrong("the %s design's %s comes back %s%s, not %s" % (
+ which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"])))
+ answers[key], requests[key] = answer, sent
+ if named:
+ facts["stopped"], facts["stopped_stage"] = answer["stop"], key
+ facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None
+ facts["no_step"] = tool != "run_trajectory"
+ if i != len(stages) - 1:
+ raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"]))
+ x = design_value(dict(var, on="run"), requests.get(var["stage"]), None)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, answers, None, staged=True)
+ facts.update({"x": x, "met": met, "values": values})
+ return facts
+
+
+def grade_bracket(a, b, star, tol, slack, row):
+ """(reward_ok, graded) for a bracket [a, b] with its sides right."""
+ width = abs(b - a)
+ straddles = min(a, b) - slack <= star <= max(a, b) + slack
+ within = width <= tol * (1 + 1e-9)
+ e = max(a, b, star) - min(a, b, star)
+ r = e / tol if tol > 0 else float("inf")
+ row["width"], row["width_ratio"] = width, r
+ if within and straddles:
+ return True, 1.0
+ if r <= 1:
+ return False, OTHER_CROSSING
+ return False, GRADED_DECAY ** math.log10(r)
+
+
+def score_boundary(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ passing = score_design(env, card.get("passing"), "passing", replay, proofs)
+ failing = score_design(env, card.get("failing"), "failing", replay, proofs)
+ row["passing"], row["failing"] = passing, failing
+ span = check["design"].get("range")
+ if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])):
+ raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span))
+ broken = [c for c, ok in passing["met"].items() if not ok]
+ if broken:
+ raise Wrong("the passing design breaks %s" % ", ".join(broken))
+ broken = [c for c, ok in failing["met"].items() if not ok]
+ if not broken:
+ raise Wrong("the failing design meets every constraint")
+ binding = card.get("binding")
+ if binding != reference["binding"]:
+ raise Wrong("binding names %r; the constraint that binds is another" % (binding,))
+ if binding not in broken:
+ raise Wrong("the failing design does not break %s, the constraint named binding" % binding)
+ if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]:
+ said = card.get("failing") or {}
+ if said.get("stopped") != failing.get("stopped"):
+ raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped")))
+ if failing.get("no_step"):
+ pass # a solve that is refused has no step: its stop's name is stated
+ elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")):
+ raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step")))
+ spec = check["design"]
+ xp, xf = passing["x"], failing["x"]
+ if spec["direction"] == "largest" and not xf > xp:
+ raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one")
+ if spec["direction"] == "smallest" and not xf < xp:
+ raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one")
+ ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row)
+ if not ok:
+ return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % (
+ abs(xf - xp), spec["tolerance"])
+ return 1.0, None
+
+
+def score_budget(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ template, path, tool = check["template"], check["variable"], check["tool"]
+ sides = {}
+ for side in ("holds", "stops"):
+ arguments = request_of(card.get(side), tool, side)
+ also = check.get("also") or []
+ where = differs(template, without_readout(arguments), {path} | set(also))
+ if where:
+ raise Integrity("the %s request differs from the task's at %s" % (side, where))
+ x = get_path(arguments, path)
+ if not number(x):
+ raise Integrity("the %s request has no number at %s" % (side, path))
+ for place in also:
+ again = get_path(arguments, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path))
+ holds, words = replay.proof_holds(tool, arguments, card[side].get("proof"))
+ proofs.append(holds)
+ sides[side] = (float(x), arguments, holds, words)
+ for side in ("holds", "stops"):
+ if not sides[side][2]:
+ raise Integrity("the %s seal: %s" % (side, sides[side][3]))
+ held = replay.answer(tool, sides["holds"][1])
+ stopped = replay.answer(tool, sides["stops"][1])
+ row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"])
+ if held["outcome"] not in NOT_STOPPED:
+ raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"]))
+ if stopped["stop"] != check["stop"]:
+ raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"]))
+ if card["stops"].get("stopped") != check["stop"]:
+ raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"]))
+ xh, xs = sides["holds"][0], sides["stops"][0]
+ star = reference["boundary"]
+ row["holds_value"], row["stops_value"] = xh, xs
+ tol = check["relative_width"] * abs(star)
+ ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row)
+ if not ok:
+ return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % (
+ abs(xs - xh), check["relative_width"])
+ return 1.0, None
+
+
+def forensics_f1(env, named):
+ """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer."""
+ if not isinstance(named, dict):
+ return 0.0, "false_rows is not an object of row and reason"
+ rows = [c["row"] for c in env["check"]["rows"]]
+ truth = env["reference"]["false_rows"]
+ unknown = [r for r in named if r not in set(rows)]
+ if unknown:
+ return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown))
+ reasons = env["check"].get("reasons") or REASONS
+ bad = [r for r, why in named.items() if why not in reasons]
+ if bad:
+ return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons))
+ if rows and set(named) == set(rows):
+ return 0.0, "every row of the table is named false: a blanket answer"
+ found = sum(1 for r, why in named.items() if truth.get(r) == why)
+ if not truth and not named:
+ return 1.0, None
+ precision = found / len(named) if named else 0.0
+ recall = found / len(truth) if truth else 0.0
+ f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0
+ if f1 >= 1.0:
+ return 1.0, None
+ missed = sorted(set(truth) - set(named))
+ wrongly = sorted(set(named) - set(truth))
+ wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r])
+ said = []
+ if missed:
+ said.append("%d false row(s) not named" % len(missed))
+ if wrongly:
+ said.append("%d genuine row(s) named false" % len(wrongly))
+ if wrong_reason:
+ said.append("%d false row(s) with another reason" % len(wrong_reason))
+ return f1, "; ".join(said)
+
+
+def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None):
+ """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record);
+ reply_calls: the reply-side log, compared with calls under calls_from="harness"."""
+ row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from,
+ "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None}
+ card, problem = read_card(reply)
+ if problem:
+ row.update(verdict="no_card", reason=problem)
+ return row
+ proofs = []
+ try:
+ problem = engine_problem(env, replay)
+ if problem:
+ raise Integrity(problem)
+ problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row)
+ if problem:
+ raise Integrity(problem)
+ family = env["family"]
+ if family in ("tradeoff", "chain_design"):
+ graded, reason = score_boundary(env, card, replay, row, proofs)
+ elif family == "budget":
+ graded, reason = score_budget(env, card, replay, row, proofs)
+ elif family == "forensics":
+ named = card.get("false_rows")
+ if isinstance(named, dict):
+ row["named"] = named
+ graded, reason = forensics_f1(env, named)
+ proofs = [True]
+ if reason and graded == 0.0 and not isinstance(named, dict):
+ raise Wrong(reason)
+ else:
+ raise Wrong("unknown family %s" % family)
+ except Integrity as problem:
+ row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ except Wrong as problem:
+ row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ proofs_hold = int(bool(proofs) and all(proofs))
+ correct = int(graded >= 1.0 and reason is None)
+ row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1),
+ graded=round(graded, 6) if proofs_hold else 0.0,
+ verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason)
+ return row
+
+
+def records_for(folder, env_id, calls_from, harness_dir=None):
+ """(calls, reply_calls, log_problem) for one environment's reply in folder."""
+ reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl"))
+ if calls_from == "harness":
+ calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl"))
+ return calls, reply_calls, log_problem
+ return reply_calls, None, None
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
+ parser.add_argument("replies")
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out")
+ parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness")
+ parser.add_argument("--harness-dir")
+ parser.add_argument("--quiet", action="store_true")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ missing = wanted - {e["id"] for e in environments}
+ if missing:
+ sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments))
+ for env in environments:
+ for problem in row_problems(env):
+ print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr)
+ verifier = open_verifier(args.engine)
+ replay = Replay(verifier)
+ rows = []
+ try:
+ for env in environments:
+ path = os.path.join(args.replies, env["id"] + ".txt")
+ reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else ""
+ calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir)
+ row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem)
+ rows.append(row)
+ if not args.quiet:
+ print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"],
+ row["reason"] or ""), flush=True)
+ replay.seen.clear()
+ finally:
+ close_verifier(verifier)
+ if args.out:
+ with open(args.out, "w", encoding="utf-8") as f:
+ for row in rows:
+ f.write(json.dumps(row) + "\n")
+ total = len(rows)
+ print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % (
+ total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows),
+ sum(r["graded"] for r in rows) / total if total else 0.0,
+ sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows)))
+ by = {}
+ for r in rows:
+ by.setdefault(r["family"], []).append(r)
+ for family in FAMILIES:
+ if family in by:
+ print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]),
+ sum(r["graded"] for r in by[family]) / len(by[family])))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/solve.sh b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/solve.sh
new file mode 100644
index 0000000000000000000000000000000000000000..72cbff6116b4373dcb5a275b10f1ea91c863186a
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/solve.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+# Harbor's oracle agent copies solution/ to /solution and runs this.
+#
+# It makes the reference answer card here, on the verifier of this machine: the
+# dataset's own run_reference.py sends this environment's reference requests to
+# /usr/local/bin/mcp_stdio (and, for a chained design, hands each run to its solve
+# through the task's coupling) and writes a reply that ends with the card. The card
+# is saved where the instruction asks for it, and the calls it made beside it, so
+# that a call-budget environment is scored on them: the oracle runs no model, and
+# Harbor's record of its run holds no tool call.
+#
+# The four paths can be moved with environment variables, so this runs outside a container.
+set -euo pipefail
+HERE="${ZTP_SOLUTION_DIR:-$(cd "$(dirname "$0")" && pwd)}"
+ENGINE="${ZTP_ENGINE:-/usr/local/bin/mcp_stdio}"
+ANSWER="${ZTP_ANSWER_FILE:-/app/answer.json}"
+CALLS="${ZTP_CALLS_FILE:-/app/calls.jsonl}"
+WORK="$(mktemp -d)"
+trap 'rm -rf "$WORK"' EXIT
+
+cd "$HERE"
+FLAGS=()
+grep -q -- '"--environments"' run_reference.py && FLAGS+=(--environments data/environments.jsonl)
+grep -q -- '"--direct"' run_reference.py && FLAGS+=(--direct) # no proxy in here: the oracle's own call log
+python3 -B run_reference.py --engine "$ENGINE" ${FLAGS[@]+"${FLAGS[@]}"} --out "$WORK/replies"
+REPLY="$(ls "$WORK"/replies/*.txt)" # one environment here, so one reply
+cat "$REPLY"
+mkdir -p "$(dirname "$ANSWER")" "$(dirname "$CALLS")"
+tail -n 1 "$REPLY" > "$ANSWER"
+cp "$WORK"/replies/*.calls.jsonl "$CALLS"
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/ztp_mcp.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/ztp_mcp.py
new file mode 100644
index 0000000000000000000000000000000000000000..1afbc12d8c05d8c143563152ffae500e8052a6db
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/solution/ztp_mcp.py
@@ -0,0 +1,188 @@
+"""A small Model Context Protocol client for the Zero-Trust Physics verifier.
+
+Standard library only. It speaks MCP two ways:
+
+ stdio to a verifier built from the public source and started here as a program
+ (target/release/mcp_stdio): one JSON-RPC message a line, no network.
+ HTTP to an MCP address (JSON-RPC in a POST), such as
+
+ https://mcp.zerotrustphysics.com/mcp/open Open to any agent.
+
+The open address gives each network address one place in the physics pool at a
+time and answers "Too many concurrent physics tasks." or HTTP 429 when it is
+busy; nothing waits on the server, so this client sends one request at a time
+and, when it is told to come back, waits and sends the same request again.
+
+Licence: Apache-2.0.
+"""
+import json
+import select
+import shlex
+import subprocess
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+
+
+class McpError(RuntimeError):
+ pass
+
+
+class Verifier:
+ """One MCP endpoint. call(tool, arguments) returns (text, is_error)."""
+
+ def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True):
+ self.url = url
+ self.timeout_s = timeout_s
+ self.patience_s = patience_s # how long to keep asking politely before giving up on one request
+ self.pause_s = pause_s # a fixed pause after every request, for a shared address
+ self.headers = dict(headers or {})
+ self.quiet = quiet
+ self.session = None
+ self.server = None
+ self.requests_sent = 0
+ self.times_asked_to_wait = 0
+ self._id = 0
+
+ # -- transport -------------------------------------------------------------------------
+ def _post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-environments/1.0", **self.headers}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ self.requests_sent += 1
+ with urllib.request.urlopen(request, timeout=self.timeout_s) as response:
+ session = response.headers.get("Mcp-Session-Id")
+ if session:
+ self.session = session
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ raise McpError("the event stream held no answer to the request")
+ return json.loads(raw) if raw.strip() else {}
+
+ def _ask(self, method, params=None):
+ """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again."""
+ self._id += 1
+ message = {"jsonrpc": "2.0", "id": self._id, "method": method}
+ if params is not None:
+ message["params"] = params
+ started, wait = time.time(), 2.0
+ while True:
+ reason = None
+ try:
+ answer = self._post(message)
+ if "error" in answer:
+ raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300])
+ result = answer.get("result", {})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ if method == "tools/call" and BUSY in text and len(text) < 400:
+ reason = "the physics pool is busy"
+ else:
+ if self.pause_s:
+ time.sleep(self.pause_s)
+ return result
+ except urllib.error.HTTPError as problem:
+ if problem.code == 429 or problem.code >= 500:
+ after = problem.headers.get("Retry-After")
+ reason = "HTTP %d" % problem.code
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ else:
+ raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300]))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem:
+ reason = "no connection (%s)" % problem
+ self.times_asked_to_wait += 1
+ if time.time() - started + wait > self.patience_s:
+ raise McpError("gave up after %d s: %s" % (self.patience_s, reason))
+ if not self.quiet:
+ print(" %s; asking again in %.0f s" % (reason, wait), flush=True)
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+ # -- protocol --------------------------------------------------------------------------
+ def connect(self):
+ result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {},
+ "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}})
+ self.server = result.get("serverInfo")
+ try:
+ self._post({"jsonrpc": "2.0", "method": "notifications/initialized"})
+ except Exception: # a notification has no answer; some servers close without one
+ pass
+ return result
+
+ def tools(self):
+ """The tool declarations exactly as the endpoint gives them."""
+ return self._ask("tools/list").get("tools", [])
+
+ def call(self, tool, arguments=None):
+ """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag."""
+ result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ return text, bool(result.get("isError"))
+
+ def call_json(self, tool, arguments=None):
+ """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON."""
+ text, is_error = self.call(tool, arguments)
+ try:
+ return json.loads(text), is_error
+ except ValueError:
+ return text, is_error
+
+
+class StdioVerifier(Verifier):
+ """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line.
+ For anyone who holds an MCP server as a program; the open address needs none of this."""
+
+ def __init__(self, command, timeout_s=600, **kwargs):
+ super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs)
+ self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+
+ def _post(self, message):
+ self.requests_sent += 1
+ try:
+ self.proc.stdin.write((json.dumps(message) + "\n").encode())
+ self.proc.stdin.flush()
+ except OSError: # a program that has stopped reading will not start again
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ raise McpError("the program stopped reading")
+ if "id" not in message:
+ return {}
+ while True:
+ ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s)
+ if not ready:
+ raise McpError("no answer in %d s" % self.timeout_s)
+ line = self.proc.stdout.readline()
+ if not line:
+ raise McpError("the program closed its output")
+ found = json.loads(line)
+ if found.get("id") == message["id"]:
+ return found
+
+ def close(self):
+ self.proc.terminate()
+ try:
+ self.proc.wait(timeout=5)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def connect(endpoint=OPEN_ADDRESS, **kwargs):
+ """A connected verifier: an http(s) address, or "stdio:" for a program."""
+ verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs)
+ verifier.connect()
+ return verifier
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/task.toml b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/task.toml
new file mode 100644
index 0000000000000000000000000000000000000000..8a48020b6330da68601dbc45b3627080f3602c0d
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/task.toml
@@ -0,0 +1,40 @@
+schema_version = "1.4"
+artifacts = ["/app/answer.json", "/app/calls.jsonl", "/logs/agent/trajectory.json", "/logs/agent/oracle.txt"]
+
+[task]
+name = "protocol-company/g1d-limit-cell448-lowest-start-charge-11min-18c"
+version = "1.0.0"
+description = "Design to a limit: a design pushed to the edge of its physical limits, found by verifier runs and scored by computing both designs again."
+authors = [{ name = "Protocol Company" }]
+keywords = ["zero-trust-physics", "physics", "mcp", "tool-use", "verifier", "multi-step", "design_to_limit"]
+
+[metadata]
+environment_id = "g1d-limit-cell448-lowest-start-charge-11min-18c"
+family = "tradeoff"
+kind = "design_to_limit"
+engine_source = "https://github.com/johnkruze/zero-trust-physics-engine"
+engine_tag = "v0.15.3"
+engine_commit = "664d68f426ccdfd0159e5f91857edba3872390d1"
+engine_binary_sha256 = "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"
+gateway_version = "0.15.3"
+scores = ["correct", "proofs_hold"]
+
+[agent]
+timeout_sec = 3600.0
+
+[verifier]
+timeout_sec = 900.0
+environment_mode = "separate"
+
+[environment]
+build_timeout_sec = 1800.0
+cpus = 1
+memory_mb = 2048
+storage_mb = 10240
+workdir = "/app"
+
+[[environment.mcp_servers]]
+name = "verifier"
+transport = "stdio"
+command = "/usr/local/bin/mcp_stdio"
+args = []
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/Dockerfile b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..56b2bc42ad98e27839b60a61ac8e4aaa87966424
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/Dockerfile
@@ -0,0 +1,11 @@
+# The grader's image: the task's tests at /tests and the verifier of release v0.15.3 as an MCP stdio server at
+# /usr/local/bin/mcp_stdio (a bridge to its address).
+FROM python:3.12-slim-bookworm
+ARG ZTP_ENGINE_TAG=v0.15.3
+ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1
+COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py
+RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "${ZTP_VERIFIER_URL:-https://mcp.zerotrustphysics.com/mcp/open}"\n' > /usr/local/bin/mcp_stdio \
+ && chmod +x /usr/local/bin/mcp_stdio
+COPY . /tests
+RUN mkdir -p /logs/verifier /logs/agent /logs/artifacts /app
+WORKDIR /app
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/environment.jsonl b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/environment.jsonl
new file mode 100644
index 0000000000000000000000000000000000000000..73fbbe4414d2c1f3ca63e85354f9792cad90d7e7
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/environment.jsonl
@@ -0,0 +1 @@
+{"id": "g1d-limit-cell448-lowest-start-charge-11min-18c", "family": "tradeoff", "kind": "design_to_limit", "models": ["energy/cell_2170_model3"], "real_thing": "Terminal voltage and core temperature of one Tesla Model 3 2170 lithium-ion cell, cell m80, m1000 or m448-N, as one physical model with memory from -20 to 40 degC, from a terminal current and a measured case temperature, a step of one second: Butler-Volmer charge transfer with Arrhenius kinetics read at the core, the salt's transport limit, and the core warmed by the cell's own heat. Compared with each cell left out of the fit in turn, its 234 runs not in the fit: within 20.2 mV RMS; at -20 degC 67.9, 47.9, 68.7, 47.0 mV RMS at C/3, C/2, 1C and on drive cycles, at -10 degC 29.6, 41.0, 50.9, 25.2. Gap: the discharge at the rated current at -20 degC, 68.7 mV RMS on cells left out (49.6 fitted); the hill cycle 39.3 mV RMS.", "task": "Cell m448 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, 4.47 Ah, with its case at 18 degrees Celsius, is rested at a state of charge that you choose and then discharged at 9.6 A for eleven minutes (660 steps of 1 s), its case held at 18 degrees Celsius.\n\nFind the smallest starting state of charge (a fraction of full charge), from 0.25 to 1, for which every constraint below holds. Give the passing design and the first failing design, no more than 1e-06 apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- end_voltage, the cell's terminal voltage at the end of the run, in volts at or above 2.8012 V\n- core_hottest, the hottest the cell's core gets over the run, in degrees Celsius at or below 26.174 degC\n- completes, the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold\nEach design is one run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 448.0, \"state_of_charge\": \"\", \"capacity_ah\": 4.47, \"case_temperature_least_c\": 18.0, \"case_temperature_most_c\": 18.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 660, \"load\": {\"current_a\": 9.6, \"case_temperature_c\": 18.0}}], \"record_every\": 660}}\nThis task has no solve: leave \"solve\" out of each design.\n\nBudget: at most 4 calls that compute, counted over every call you make, each run one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "path", "on": "run", "path": "initial.state_of_charge", "words": "the starting state of charge (a fraction of full charge)"}, "template": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": null, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "free": [], "run_outcomes": ["completed"], "direction": "smallest", "units": "", "chain": null, "range": [0.25, 1.0], "tolerance": 1e-06}, "constraints": [{"id": "end_voltage", "on": "run", "read": {"kind": "final", "quantity": "terminal_v"}, "op": ">=", "words": "the cell's terminal voltage at the end of the run, in volts", "unit": "V", "limit": 2.8012}, {"id": "core_hottest", "on": "run", "read": {"kind": "extreme", "quantity": "core_temperature_c", "which": "maximum"}, "op": "<=", "words": "the hottest the cell's core gets over the run, in degrees Celsius", "unit": "degC", "limit": 26.174}, {"id": "completes", "on": "outcome", "words": "the run completes every step: a run that the verifier stops part way (UndervoltageLimit) does not hold", "stop": "UndervoltageLimit"}], "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "Limits read at seeded designs; the window sampled at 61 designs and the boundary bisected on the local 0.15.3 build."}, "reference": {"boundary": 0.5465609150325692, "binding": "core_hottest", "window_pattern": "........................HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", "constraint_patterns": {"end_voltage": "-+-----+-+--+------++++++++++++++++++++++++++++++++++++++++++", "core_hottest": "+++++++++++++++---------+++++++++++++++++++++++++++++++++++++", "completes": "-----------------------++++++++++++++++++++++++++++++++++++++"}, "band": [0.55, 1.0], "near_pattern": "....................HHHHHHHHHHHHHHHHHHHHH", "passing": {"x": 0.5465612150325692, "values": {"end_voltage": 2.8349093713245175, "core_hottest": 26.173992565002724, "completes": "completed"}, "run": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465612150325692, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "run_seal": "5409934b45e2559467989bb1cf922deb3a8a3c075c638a6bae4a4379cdb10e0e0e099537ca7e24a95f7f0f1f21baf887", "solve": null, "solution_seal": null, "next": null, "next_seal": null}, "failing": {"x": 0.5465606150325693, "values": {"end_voltage": 2.8349079479164936, "core_hottest": 26.174007434990113, "completes": "completed"}, "run": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 448.0, "state_of_charge": 0.5465606150325693, "capacity_ah": 4.47, "case_temperature_least_c": 18.0, "case_temperature_most_c": 18.0}, "dt_s": 1.0, "segments": [{"steps": 660, "load": {"current_a": 9.6, "case_temperature_c": 18.0}}], "record_every": 660}, "run_seal": "baa948ee323f2595cb5a4109e49a1926d9de0ff6fc428024cd6e6d9ca23e6de522a52c96a4f23d40eeabddb7920c2a85", "solve": null, "solution_seal": null, "next": null, "next_seal": null, "outcome": "completed", "stopped": null, "steps_landed": 660}, "limit_targets": {"end_voltage": 0.4670589356940773, "core_hottest": 0.4267557164426305}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/grade.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/grade.py
new file mode 100644
index 0000000000000000000000000000000000000000..88564e4e42982627e805eb8e50bd600ae052dd80
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/grade.py
@@ -0,0 +1,272 @@
+"""Harbor glue: find the agent's reply and its calls, hand them to the dataset's score.py, write the reward.
+
+Standard library only. Every path can be moved with an environment variable, so the
+same file runs outside a container:
+
+ ZTP_TESTS_DIR this folder: environment.jsonl (and score.py, ztp_mcp.py) (default: where this file is)
+ ZTP_SCORER_DIR where score.py and ztp_mcp.py sit (default: ZTP_TESTS_DIR)
+ ZTP_ANSWER_FILE the card the instruction asks the agent to save (default /app/answer.json)
+ ZTP_CALLS_FILE a call log written by the oracle's solve.sh (default /app/calls.jsonl)
+ ZTP_ORACLE_LOG Harbor's log of the oracle agent's run (default /logs/agent/oracle.txt)
+ ZTP_TRAJECTORY_FILE Harbor's record of the run, in ATIF (default /logs/agent/trajectory.json)
+ ZTP_VERIFIER_DIR where the reward is written (default /logs/verifier)
+ ZTP_ENGINE the verifier, MCP over stdio (default /usr/local/bin/mcp_stdio)
+ ZTP_SCORE_TIMEOUT_S how long the scorer may take, in seconds (default 600)
+
+The reply, first found: the answer file when it is there and not empty (one JSON object over
+several lines is put on one line first); else the last agent message with text in the
+trajectory; else none, and the scorer gives 0.
+
+The calls, for every environment (a call budget, and a forensics answer, are scored on them): the agent's calls of the
+verifier's own tools in the trajectory's agent steps, in order, by function name and arguments (mcp__verifier__solve is
+read as solve). The agent's other tools (a shell, a file editor, writing /app/answer.json) are left out of the record:
+they are not verifier calls and are not counted against a budget. When there is no trajectory file at all and Harbor's
+oracle has run (its log /logs/agent/oracle.txt is there), the log solution/solve.sh wrote is read instead: the oracle
+runs no model, so Harbor records no tool call for it. Any other run with no trajectory is scored with no call record,
+and a budget or forensics answer then scores 0.
+
+The verifier is held to its release by what it answers (version 0.15.3, kernel genesis_kernel_v0.13.1); the binary's
+sha256 is recorded on the score row. pack_score.py, beside score.py, holds that rule; --strict-binary is not used here
+because this image builds the verifier from source, a different file from the served build.
+
+The reward, reward.json in ZTP_VERIFIER_DIR: {"reward": 0 or 1, "correct": 0 or 1, "proofs_hold": 0 or 1}.
+reward is 1 only when both scores are 1. score.json holds the scorer's line (the reason for a 0).
+If the scorer itself fails, no reward is written and this exits non-zero.
+"""
+import json
+import os
+import re
+import signal
+import subprocess
+import sys
+import tempfile
+
+TESTS = os.environ.get("ZTP_TESTS_DIR") or os.path.dirname(os.path.abspath(__file__))
+SCORER = os.environ.get("ZTP_SCORER_DIR") or TESTS
+ANSWER = os.environ.get("ZTP_ANSWER_FILE") or "/app/answer.json"
+CALLS = os.environ.get("ZTP_CALLS_FILE") or "/app/calls.jsonl"
+TRAJECTORY = os.environ.get("ZTP_TRAJECTORY_FILE") or "/logs/agent/trajectory.json"
+ORACLE_LOG = os.environ.get("ZTP_ORACLE_LOG") or "/logs/agent/oracle.txt"
+OUT = os.environ.get("ZTP_VERIFIER_DIR") or "/logs/verifier"
+ENGINE = os.environ.get("ZTP_ENGINE") or "/usr/local/bin/mcp_stdio"
+TIMEOUT_S = float(os.environ.get("ZTP_SCORE_TIMEOUT_S") or 600)
+SCORES = ("correct", "proofs_hold")
+
+
+class ScorerFailed(Exception):
+ """The check could not be made. No reward is written."""
+
+
+def on_one_line(text):
+ try:
+ whole = json.loads(text)
+ except ValueError:
+ return text
+ if not isinstance(whole, dict):
+ return text
+ return re.sub(r"[\r\n]+", " ", text.strip())
+
+
+def text_of(message):
+ if isinstance(message, str):
+ return message
+ if isinstance(message, list):
+ return "\n".join(part.get("text") or "" for part in message if isinstance(part, dict) and part.get("type") == "text")
+ return ""
+
+
+def trajectory_steps():
+ try:
+ with open(TRAJECTORY, encoding="utf-8", errors="replace") as f:
+ return json.load(f).get("steps") or []
+ except (OSError, ValueError, AttributeError, TypeError):
+ return []
+
+
+def find_reply():
+ try:
+ with open(ANSWER, encoding="utf-8-sig", errors="replace") as f:
+ text = f.read()
+ if text.strip():
+ return on_one_line(text), "the answer file %s" % ANSWER
+ except OSError:
+ pass
+ for step in reversed(trajectory_steps()):
+ if isinstance(step, dict) and step.get("source") == "agent" and text_of(step.get("message")).strip():
+ return text_of(step["message"]), "the last agent message in %s" % TRAJECTORY
+ return None, "nowhere: no answer file and no agent message in a trajectory file"
+
+
+def verifier_tool(name):
+ """The verifier's own name for a tool call (mcp__verifier__solve -> solve), or None for any other tool."""
+ sys.path.insert(0, SCORER)
+ from score import VERIFIER_TOOLS, tool_name
+ tool = tool_name(name)
+ return tool if tool in VERIFIER_TOOLS else None
+
+
+def find_calls():
+ """(list of {"tool", "arguments"} or None, where they were found)."""
+ if os.path.isfile(TRAJECTORY):
+ calls, other = [], 0
+ for step in trajectory_steps():
+ if not isinstance(step, dict) or step.get("source") != "agent":
+ continue
+ for call in step.get("tool_calls") or []:
+ if not isinstance(call, dict):
+ continue
+ tool = verifier_tool(call.get("function_name"))
+ if tool is None:
+ other += 1
+ continue
+ arguments = call.get("arguments")
+ if isinstance(arguments, str):
+ try:
+ arguments = json.loads(arguments)
+ except ValueError:
+ arguments = {}
+ calls.append({"tool": tool, "arguments": arguments if isinstance(arguments, dict) else {}})
+ return calls, "%d verifier calls in %s (%d calls of other tools left out)" % (len(calls), TRAJECTORY, other)
+ if os.path.isfile(ORACLE_LOG):
+ try:
+ with open(CALLS, encoding="utf-8", errors="replace") as f:
+ logged = [json.loads(line) for line in f if line.strip()]
+ return logged, "the oracle's call log %s (no trajectory; %s is there)" % (CALLS, ORACLE_LOG)
+ except (OSError, ValueError):
+ return None, "nowhere: the oracle ran and wrote no call log"
+ return None, "nowhere: no trajectory file, and the oracle did not run"
+
+
+def the_environment():
+ path = os.path.join(TESTS, "environment.jsonl")
+ try:
+ with open(path, encoding="utf-8") as f:
+ rows = [json.loads(line) for line in f if line.strip()]
+ except (OSError, ValueError) as problem:
+ raise ScorerFailed("%s cannot be read: %s" % (path, problem))
+ if len(rows) != 1 or not isinstance(rows[0], dict) or not isinstance(rows[0].get("id"), str):
+ raise ScorerFailed("%s does not hold exactly one environment" % path)
+ return rows[0], path
+
+
+def verifier_answers():
+ if ENGINE.startswith("http://") or ENGINE.startswith("https://"):
+ return "an MCP address, not asked here"
+ if not os.path.isfile(ENGINE):
+ raise ScorerFailed("there is no verifier at %s" % ENGINE)
+ sys.path.insert(0, SCORER)
+ try:
+ from ztp_mcp import StdioVerifier
+ verifier = StdioVerifier([ENGINE], timeout_s=60, patience_s=0)
+ try:
+ verifier.connect()
+ server = verifier.server
+ finally:
+ verifier.close()
+ except Exception as problem:
+ raise ScorerFailed("the verifier at %s did not answer as an MCP server: %s" % (ENGINE, problem))
+ if not isinstance(server, dict) or not server.get("name"):
+ raise ScorerFailed("the program at %s answered and did not say what it is; it is not the verifier" % ENGINE)
+ return "%s %s" % (server.get("name"), server.get("version"))
+
+
+def run_scorer(command):
+ environment = dict(os.environ, PYTHONIOENCODING="utf-8")
+ process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environment,
+ encoding="utf-8", errors="replace", start_new_session=True)
+ try:
+ stdout, stderr = process.communicate(timeout=TIMEOUT_S)
+ except subprocess.TimeoutExpired:
+ try:
+ os.killpg(process.pid, signal.SIGKILL)
+ except OSError:
+ process.kill()
+ stdout, stderr = process.communicate()
+ return None, stdout, stderr
+ return process.returncode, stdout, stderr
+
+
+def grade(log):
+ environment, environment_path = the_environment()
+ name = environment["id"]
+ reply, found = find_reply()
+ log.append("environment: %s" % name)
+ log.append("reply from: %s" % found)
+ log.append("verifier: %s (%s)" % (ENGINE, verifier_answers()))
+ with tempfile.TemporaryDirectory() as work:
+ replies = os.path.join(work, "replies")
+ os.mkdir(replies)
+ if reply is not None:
+ with open(os.path.join(replies, name + ".txt"), "w", encoding="utf-8") as f:
+ f.write(reply)
+ calls, where = find_calls()
+ log.append("calls from: %s" % where)
+ if calls is not None:
+ with open(os.path.join(replies, name + ".calls.jsonl"), "w", encoding="utf-8") as f:
+ for call in calls:
+ f.write(json.dumps(call) + "\n")
+ scores_path = os.path.join(work, "scores.jsonl")
+ score_py = os.path.join(SCORER, "score.py")
+ entry = os.path.join(SCORER, "pack_score.py")
+ command = [sys.executable, "-B", entry if os.path.isfile(entry) else score_py, replies, "--engine", ENGINE,
+ "--environments", environment_path, "--only", name, "--out", scores_path]
+ with open(score_py, encoding="utf-8") as f:
+ if "--calls-from" in f.read():
+ # the call record here is the one this file found: Harbor's trajectory, or the oracle's log
+ command += ["--calls-from", "reply"]
+ code, stdout, stderr = run_scorer(command)
+ log.append("score.py exit: %s" % ("none, ended after %g s" % TIMEOUT_S if code is None else code))
+ log.append("score.py stdout:\n%s" % stdout)
+ log.append("score.py stderr:\n%s" % stderr)
+ if code is None:
+ raise ScorerFailed("score.py did not finish in %g s" % TIMEOUT_S)
+ if code != 0:
+ raise ScorerFailed("score.py exited %d: %s" % (code, (stderr.strip().splitlines() or ["no message"])[-1]))
+ try:
+ with open(scores_path, encoding="utf-8") as f:
+ rows = [json.loads(line) for line in f if line.strip()]
+ except (OSError, ValueError) as problem:
+ raise ScorerFailed("score.py wrote no scores that can be read: %s" % problem)
+ if len(rows) != 1 or not isinstance(rows[0], dict) or rows[0].get("id") != name:
+ raise ScorerFailed("score.py did not write one line for %s" % name)
+ row = rows[0]
+ if any(type(row.get(score)) is not int or row[score] not in (0, 1) for score in SCORES):
+ raise ScorerFailed("score.py did not give %s as 0 or 1" % " and ".join(SCORES))
+ row["reply_from"] = found
+ reward = {"reward": int(all(row[score] == 1 for score in SCORES))}
+ reward.update((score, row[score]) for score in SCORES)
+ if isinstance(row.get("graded"), (int, float)):
+ reward["graded"] = row["graded"]
+ return reward, row
+
+
+def main():
+ os.makedirs(OUT, exist_ok=True)
+ for name in ("reward.json", "reward.txt", "score.json"):
+ try:
+ os.remove(os.path.join(OUT, name))
+ except OSError:
+ pass
+ log, failure = [], None
+ try:
+ reward, row = grade(log)
+ except ScorerFailed as problem:
+ failure = "the scorer failed, no reward written: %s" % problem
+ log.append(failure)
+ with open(os.path.join(OUT, "score.log"), "w", encoding="utf-8") as f:
+ f.write("\n".join(log) + "\n")
+ if failure:
+ sys.exit(failure)
+ with open(os.path.join(OUT, "score.json"), "w", encoding="utf-8") as f:
+ json.dump(row, f)
+ f.write("\n")
+ with open(os.path.join(OUT, "reward.json"), "w", encoding="utf-8") as f:
+ json.dump(reward, f)
+ f.write("\n")
+ print(json.dumps(reward))
+ if row.get("reason"):
+ print(row["reason"].encode("ascii", "backslashreplace").decode("ascii"))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/pack_score.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/pack_score.py
new file mode 100644
index 0000000000000000000000000000000000000000..b41382aa52ca13dbeccd56097b08175a0fed19a2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/pack_score.py
@@ -0,0 +1,105 @@
+"""Cross-platform release-pinned scorer wrapper for Zero-Trust Physics packs (macOS arm64, Linux amd64, Linux arm64, HTTP).
+
+ python3 pack_score.py REPLIES --engine ENGINE --environments F [score.py's options] [--strict-binary]
+ python3 pack_score.py --run run_cheat_suite.py [its options] [--strict-binary]
+
+Verifies that the target verifier answers MCP initialize as release 0.15.3 (matching reference.gateway_version and
+engine_tag) on kernel genesis_kernel_v0.13.1, while recording engine_binary_sha256_seen and engine_binary_is_reference on
+every score row. Pass --strict-binary to additionally require exact SHA-256 identity with reference.engine_binary_sha256.
+All deterministic recomputation, seal, budget, and grading invariants of score.py apply unchanged.
+
+Standard library only. Licence: Apache-2.0.
+"""
+import inspect
+import os
+import re
+import runpy
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+if HERE not in sys.path:
+ sys.path.insert(0, HERE)
+
+KERNEL = "genesis_kernel_v0.13.1"
+STRICT = False
+
+
+def _kernel_of(replay):
+ """The kernel the verifier names: its serverInfo.description is the kernel's name (0.15.2), or one line that ends
+ with it ("... Cards: genesis_kernel_v0.13.1", 0.15.3)."""
+ server = getattr(getattr(replay, "verifier", None), "server", None) or {}
+ found = re.findall(r"genesis_kernel_v[0-9][0-9.]*[0-9]", server.get("description") or "")
+ return found[-1] if found else server.get("description")
+
+
+def install(strict=False):
+ """Configure cross-platform release identity verification on score (idempotent). Returns the score module."""
+ global STRICT
+ STRICT = bool(strict)
+ import score
+ if getattr(score, "_pack_engine_identity", False):
+ return score
+ original = score.engine_problem
+ original_score = score.score
+
+ def engine_problem(env, replay):
+ ref = env.get("reference") or {}
+ want = ref.get("engine_binary_sha256")
+ seen = getattr(replay, "binary_sha256", None)
+ if STRICT or not (seen and want and seen != want):
+ return original(env, replay)
+ # a different file: held to the release by what it says it is, every other rule as score.py's
+ saved = replay.binary_sha256
+ replay.binary_sha256 = None
+ try:
+ problem = original(env, replay)
+ finally:
+ replay.binary_sha256 = saved
+ if problem:
+ return problem
+ kernel = _kernel_of(replay)
+ if kernel != KERNEL:
+ return "the verifier reports kernel %s; release %s runs %s" % (kernel, replay.version, KERNEL)
+ return None
+
+ def scored(env, reply, replay, *args, **kwargs):
+ row = original_score(env, reply, replay, *args, **kwargs)
+ if isinstance(row, dict):
+ want = (env.get("reference") or {}).get("engine_binary_sha256")
+ seen = getattr(replay, "binary_sha256", None)
+ row["engine_binary_sha256_seen"] = seen
+ row["engine_binary_is_reference"] = None if not seen else (seen == want)
+ return row
+
+ # score.py may one day hold its own source-build rule; then it is left as it is
+ if "strict" in inspect.getsource(original).lower():
+ return score
+ score.engine_problem = engine_problem
+ score.score = scored
+ score._pack_engine_identity = True
+ return score
+
+
+def main():
+ argv = sys.argv[1:]
+ strict = "--strict-binary" in argv
+ argv = [a for a in argv if a != "--strict-binary"]
+ if argv[:1] == ["--run"]:
+ if len(argv) < 2:
+ sys.exit("give the program: --run run_cheat_suite.py [options]")
+ program = argv[1] if os.path.isabs(argv[1]) or os.path.isfile(argv[1]) else os.path.join(HERE, argv[1])
+ folder = os.path.dirname(os.path.abspath(program))
+ if folder not in sys.path:
+ sys.path.insert(0, folder)
+ install(strict)
+ # a program that does `from score import score` takes the replaced function, as the module now holds it
+ sys.argv = [program] + argv[2:]
+ runpy.run_path(program, run_name="__main__")
+ return
+ score = install(strict)
+ sys.argv = [os.path.join(HERE, "score.py")] + argv
+ score.main()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/score.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/score.py
new file mode 100644
index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/score.py
@@ -0,0 +1,1199 @@
+"""Score replies to the multi-step environments with no judge: a program and the verifier.
+
+ python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F]
+ [--calls-from reply|harness] [--harness-dir DIR]
+
+ REPLIES is a folder with one file per environment, .txt, the whole text of a reply.
+ --calls-from harness the call record is the harness's own: .harness.jsonl, written by
+ harness/mcp_log_proxy.py outside the solver's working directory (in
+ --harness-dir, default REPLIES). A .calls.jsonl beside the reply,
+ when there is one, is read only to catch an edit: it must equal the
+ harness log call for call.
+ --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply:
+ one JSON object a line, {"tool": "", "arguments": {...}}.
+
+ ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address
+ beginning http. A task is scored only on the engine it was built on: the verifier's version must
+ be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's
+ reference.engine_binary_sha256.
+
+The answer card is one JSON object on the reply's last line. Its shape is the family's:
+
+ tradeoff, chain_design (kind design_to_limit, chained_design)
+ {"passing": DESIGN, "failing": DESIGN, "binding": ""}
+ DESIGN = {"run": {"request": R, "proof": ""},
+ "solve": {"request": R, "proof": ""}} (solve only where the task has one)
+ Where a constraint is that the run completes and it binds, the failing DESIGN also carries
+ "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}}
+ The design shapes, one scorer for every group (check.design says which):
+ run a run alone.
+ coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run.
+ continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of
+ the same card that continues it through from, starting from its sealed final state,
+ DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template
+ is chain.next_template, chain.template or chain.next; its start fields are chain.carried
+ ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or
+ chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on
+ "next" reads the next run, and a stop constraint judges it.
+ solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no
+ run. A binding refusal is named ("stopped") with no step.
+ staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per
+ stage in order; a later stage carries an earlier stage's answer at a named input (handed) or
+ continues an earlier run (continues), bit for bit.
+ A constraint's read may carry "index": one entry of an output the verifier returns as a list.
+ budget (kind budgeted_search)
+ {"holds": {"request": R, "proof": ""},
+ "stops": {"request": R, "proof": "", "stopped": ""}}
+ forensics
+ {"false_rows": {"": "", ...}} ({} when every row is genuine)
+
+Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a
+solution_seal, short form) and every number judged is read from the verifier's own answer to the
+card's request, sent again here, never from the reply.
+
+Scores per environment
+----------------------
+reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1.
+ proofs_hold: every proof on the card verifies. correct: the card is the right answer and
+ nothing below under "integrity" failed.
+graded in [0, 1], beside reward.
+
+ Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not
+ verify (a copied, nudged, edited or stale proof); a request differs from the task's template other
+ than at the design variable; a chained solve not handed its own design's sealed run; no call log;
+ a call log beside the reply that differs from the harness log; a harness log whose chain breaks;
+ a forbidden tool called; more computing calls than the budget; a request on the card that is not
+ among the calls; a forensics answer with no computing call behind it; a task built on another
+ engine than the verifier.
+
+ tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the
+ passing design meets every constraint and the failing one breaks the named binding constraint
+ (budget: holds completes, stops ends with the task's stop, named on the card), on the side the
+ task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0.
+ With the sides right:
+
+ e = the length of the smallest interval holding both designs' values and the reference
+ boundary (for a bracket that straddles the boundary, its width)
+ tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget)
+ r = e / tol
+ graded = 1 when reward is 1 (r <= 1 and the bracket straddles it)
+ = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score
+ (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25)
+ = 0.5 when r <= 1 but the bracket misses the reference boundary
+ by more than the slack (another crossing than the one asked)
+
+ The decay is smooth and falls monotonically with r, and a near miss scores near the top.
+
+ forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found
+ only with its right reason. precision = found / named, recall = found / false rows; an empty
+ answer to a table with no false row scores 1. A card that names every row of the table false is
+ a blanket answer and scores 0, as do unknown rows and reasons outside the task's list.
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import hashlib
+import json
+import math
+import os
+import re
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402
+
+FAMILIES = ("tradeoff", "chain_design", "budget", "forensics")
+KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"}
+NOT_STOPPED = ("completed", "converged")
+PREFIX_ENDS = ("__", ".", ":", "/")
+VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite",
+ "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset",
+ "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip")
+# Calls that read the catalogue compute nothing and are free in a call budget.
+FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt")
+REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden")
+GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r)
+OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary
+
+
+class Integrity(Exception):
+ """The answer cannot be trusted: graded 0 and reward 0."""
+
+
+class Wrong(Exception):
+ """The answer is trusted and wrong: graded 0 and reward 0."""
+
+
+def load_environments(path):
+ with open(path, encoding="utf-8") as f:
+ return [json.loads(line) for line in f if line.strip()]
+
+
+def row_problems(env):
+ """What a task row lacks against the shared row contract (empty when none)."""
+ out = []
+ for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"):
+ if key not in env:
+ out.append("no %s" % key)
+ family = env.get("family")
+ if family not in FAMILIES:
+ out.append("family %r" % family)
+ elif "kind" in env and env["kind"] != KINDS[family]:
+ out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family]))
+ ref = env.get("reference") or {}
+ for key in ("engine_tag", "engine_commit", "engine_binary_sha256"):
+ if not ref.get(key):
+ out.append("reference.%s missing" % key)
+ return out
+
+
+def file_sha256(path):
+ h = hashlib.sha256()
+ with open(path, "rb") as f:
+ for block in iter(lambda: f.read(1 << 20), b""):
+ h.update(block)
+ return h.hexdigest()
+
+
+def open_verifier(engine):
+ if engine.startswith("http://") or engine.startswith("https://"):
+ verifier = Verifier(engine, pause_s=0.5)
+ verifier.binary_sha256 = None
+ else:
+ if not os.path.isfile(engine):
+ sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine)
+ verifier = StdioVerifier([engine])
+ verifier.binary_sha256 = file_sha256(engine)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the verifier failed, so nothing was scored: %s" % problem)
+ if not isinstance(verifier.server, dict) or not verifier.server.get("name"):
+ close_verifier(verifier)
+ sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine)
+ return verifier
+
+
+def close_verifier(verifier):
+ if hasattr(verifier, "close"):
+ verifier.close()
+
+
+# ------------------------------------------------------------------------------------------
+# reading the reply and the call logs
+# ------------------------------------------------------------------------------------------
+def _no_constant(name):
+ raise ValueError("%s is not a number" % name)
+
+
+def read_card(reply):
+ """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over."""
+ lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()]
+ while lines and lines[-1].startswith("```"):
+ lines.pop()
+ if not lines:
+ return None, "the reply is empty"
+ try:
+ card = json.loads(lines[-1], parse_constant=_no_constant)
+ except ValueError:
+ return None, "the last line is not one JSON object"
+ if not isinstance(card, dict):
+ return None, "the last line is not one JSON object"
+ return card, None
+
+
+def tool_name(name):
+ """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve)."""
+ if not isinstance(name, str):
+ return None
+ if name in VERIFIER_TOOLS:
+ return name
+ for tool in VERIFIER_TOOLS:
+ for joint in PREFIX_ENDS:
+ if name.endswith(joint + tool):
+ return tool
+ return name
+
+
+def without_readout(arguments):
+ """A run's arguments as sealed: a readout is not part of a run's seal."""
+ if not isinstance(arguments, dict):
+ return arguments
+ return {k: v for k, v in arguments.items() if k != "readout"}
+
+
+def numbers_by_value(value):
+ """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept."""
+ if isinstance(value, dict):
+ return {k: numbers_by_value(v) for k, v in value.items()}
+ if isinstance(value, list):
+ return [numbers_by_value(v) for v in value]
+ if isinstance(value, int) and not isinstance(value, bool):
+ return float(value)
+ return value
+
+
+def canonical(arguments):
+ """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value."""
+ return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":"))
+
+
+def _arguments(one):
+ arguments = one.get("arguments")
+ if isinstance(arguments, str):
+ try:
+ arguments = json.loads(arguments)
+ except ValueError:
+ arguments = {}
+ return arguments if isinstance(arguments, dict) else {}
+
+
+def read_calls(path):
+ """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log."""
+ if not path or not os.path.isfile(path):
+ return None
+ calls = []
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for line in f:
+ line = line.strip()
+ if not line:
+ continue
+ try:
+ one = json.loads(line)
+ except ValueError:
+ continue
+ if isinstance(one, dict):
+ calls.append((tool_name(one.get("tool")), _arguments(one)))
+ return calls
+
+
+def chain_of(previous, entry):
+ payload = json.dumps(entry, sort_keys=True, separators=(",", ":"))
+ return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest()
+
+
+def read_harness_log(path):
+ """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log;
+ problem names the first line whose chain does not follow (an edit, a line taken out or put in)."""
+ if not path or not os.path.isfile(path):
+ return None, None
+ calls, previous = [], None
+ with open(path, encoding="utf-8", errors="replace") as f:
+ for number_, line in enumerate(f, 1):
+ if not line.strip():
+ continue
+ try:
+ entry = json.loads(line)
+ except ValueError:
+ return calls, "line %d of the harness log is not JSON" % number_
+ if not isinstance(entry, dict) or "chain" not in entry:
+ return calls, "line %d of the harness log carries no chain" % number_
+ chain = entry.pop("chain")
+ if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1:
+ return calls, "the harness log's chain breaks at line %d" % number_
+ previous = chain
+ calls.append((tool_name(entry.get("tool")), _arguments(entry)))
+ return calls, None
+
+
+def write_harness_log(path, calls):
+ """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)]."""
+ previous = None
+ with open(path, "w", encoding="utf-8") as f:
+ for seq, (tool, arguments) in enumerate(calls, 1):
+ entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None,
+ "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False}
+ entry["chain"] = chain_of(previous, entry)
+ previous = entry["chain"]
+ f.write(json.dumps(entry, sort_keys=True) + "\n")
+
+
+# ------------------------------------------------------------------------------------------
+# the verifier, asked again
+# ------------------------------------------------------------------------------------------
+def stop_name_in(sentence):
+ names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "")
+ return names[-1] if names else None
+
+
+class Replay:
+ """The verifier, with every answer remembered: the same request is sent once."""
+
+ def __init__(self, verifier):
+ self.verifier = verifier
+ self.seen = {}
+ server = getattr(verifier, "server", None) or {}
+ self.version = server.get("version")
+ self.binary_sha256 = getattr(verifier, "binary_sha256", None)
+
+ def call(self, tool, arguments):
+ key = tool + "\x00" + json.dumps(arguments, sort_keys=True)
+ if key not in self.seen:
+ try:
+ self.seen[key] = self.verifier.call_json(tool, arguments)
+ except McpError as problem:
+ if not str(problem).startswith("protocol error"):
+ raise SystemExit("the verifier failed, so nothing was scored: %s" % problem)
+ self.seen[key] = ("the verifier did not take the request: %s" % problem, True)
+ return self.seen[key]
+
+ def answer(self, tool, arguments, readout=None):
+ """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}."""
+ arguments = copy.deepcopy(without_readout(arguments))
+ if readout is not None and tool == "run_trajectory":
+ arguments["readout"] = readout
+ body, is_error = self.call(tool, arguments)
+ if is_error or not isinstance(body, dict):
+ sentence = body if isinstance(body, str) else json.dumps(body)
+ return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence),
+ "proof": None, "body": None, "sentence": sentence}
+ outcome = body.get("outcome")
+ stopped = outcome not in NOT_STOPPED
+ return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None,
+ "proof": body.get("run_seal") or body.get("solution_seal"), "body": body,
+ "sentence": body.get("reject_detail")}
+
+ def proof_holds(self, tool, arguments, proof):
+ """(holds, words): the card's seal verified by verify_tape or verify_solution, short form."""
+ if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof):
+ return False, "the proof is not a SHA-384 seal of 96 hex digits"
+ if tool == "run_trajectory":
+ body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof})
+ elif tool == "solve":
+ body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof})
+ else:
+ return False, "a proof is verified for run_trajectory or solve only, not %s" % tool
+ if is_error or not isinstance(body, dict):
+ return False, "the verifier would not verify it: %s" % (str(body)[:200])
+ if body.get("holds") is True:
+ return True, None
+ return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause")
+
+
+def engine_problem(env, replay):
+ """None when the verifier is the engine the task was built on; else what differs."""
+ ref = env.get("reference") or {}
+ tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v")
+ if not tag:
+ return "the task names no engine it was built on"
+ if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag:
+ return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version"))
+ if replay.version != tag:
+ return "the task was built on engine %s; the verifier is %s" % (tag, replay.version)
+ want = ref.get("engine_binary_sha256")
+ if replay.binary_sha256 and want and replay.binary_sha256 != want:
+ return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12])
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# requests and their inputs
+# ------------------------------------------------------------------------------------------
+_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)")
+
+
+def get_path(obj, path):
+ here = obj
+ for part in path.split("."):
+ found = _PART.fullmatch(part)
+ if not found or not isinstance(here, dict) or found.group(1) not in here:
+ return None
+ here = here[found.group(1)]
+ for index in re.findall(r"\[(\d+)\]", found.group(2)):
+ if not isinstance(here, list) or int(index) >= len(here):
+ return None
+ here = here[int(index)]
+ return here
+
+
+def set_path(obj, path, value):
+ parts = path.split(".")
+ here = obj
+ for i, part in enumerate(parts):
+ m = _PART.fullmatch(part)
+ name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))]
+ last = i == len(parts) - 1
+ if not idx:
+ if last:
+ here[name] = value
+ else:
+ here = here[name]
+ else:
+ here = here[name]
+ for j, k in enumerate(idx):
+ if last and j == len(idx) - 1:
+ here[k] = value
+ else:
+ here = here[k]
+
+
+def number(value):
+ return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value)
+
+
+def differs(template, given, free, where=""):
+ """The first place where a request differs from the task's, other than the free places. None when none."""
+ if where in free:
+ return None
+ if isinstance(template, dict):
+ if not isinstance(given, dict):
+ return where or "the request"
+ for key in set(template) | set(given):
+ place = "%s.%s" % (where, key) if where else key
+ if place in free:
+ continue
+ if key not in given or key not in template:
+ return place
+ found = differs(template[key], given[key], free, place)
+ if found:
+ return found
+ return None
+ if isinstance(template, list):
+ if not isinstance(given, list) or len(given) != len(template):
+ return where
+ for index, (a, b) in enumerate(zip(template, given)):
+ found = differs(a, b, free, "%s[%d]" % (where, index))
+ if found:
+ return found
+ return None
+ if number(template) and number(given):
+ return None if float(template) == float(given) else where
+ return None if template == given else where
+
+
+def design_value(variable, run_arguments, solve_arguments, next_arguments=None):
+ """The design variable of one design, read from its requests (on: run, solve, or next, a continued run)."""
+ kind = variable["kind"]
+ if kind == "path":
+ on = variable.get("on", "run")
+ source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {}
+ value = get_path(source, variable["path"])
+ for place in variable.get("also") or []:
+ again = get_path(source, place)
+ if not (number(again) and number(value) and float(again) == float(value)):
+ return None
+ return float(value) if number(value) else None
+ if kind == "entry_angle_deg":
+ radial = get_path(run_arguments or {}, "initial.radial_speed_m_s")
+ transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s")
+ if not (number(radial) and number(transverse)) or transverse <= 0:
+ return None
+ speed = math.hypot(radial, transverse)
+ if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]:
+ return None
+ return math.degrees(math.atan2(-radial, transverse))
+ return None
+
+
+def variable_places(variable):
+ if variable["kind"] == "entry_angle_deg":
+ return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"}
+ if variable["kind"] == "path" and variable.get("on", "run") == "run":
+ return {variable["path"]} | set(variable.get("also") or [])
+ return set()
+
+
+def read_value(read, answer):
+ """One number from a replayed answer: final, result, or the extreme of a run's readout."""
+ body = answer["body"]
+ if body is None:
+ return None
+ kind = read["kind"]
+ value = None
+ if kind == "final":
+ value = (body.get("final_state") or {}).get(read["quantity"])
+ elif kind == "result":
+ value = (body.get("result") or {}).get(read["quantity"])
+ elif kind == "flag_extent":
+ # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it
+ value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or []
+ if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0])
+ elif kind == "extreme":
+ for quantity in (body.get("readout") or {}).get("quantities") or []:
+ if quantity.get("quantity") == read["quantity"]:
+ value = quantity.get(read["which"])
+ if "index" in read:
+ # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points)
+ k = read["index"]
+ value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None
+ return value if number(value) else None
+
+
+def readout_for(constraints, on="run"):
+ """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key)."""
+ quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"})
+ return {"quantities": quantities} if quantities else None
+
+
+def design_shape(spec):
+ """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged."""
+ if spec.get("stages"):
+ return "staged"
+ if spec.get("tool") == "solve" or spec.get("kind") == "solve":
+ return "solve"
+ chain = spec.get("chain") or {}
+ if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue":
+ return "continued"
+ return "coupled" if chain else "run"
+
+
+def continuation_of(spec):
+ """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it},
+ next outcomes, the next run's places that also hold a first-run design value)."""
+ chain = spec["chain"]
+ template = chain.get("next_template") or chain.get("template") or chain.get("next")
+ if "carried" in chain: # group 1
+ carried = dict(chain["carried"])
+ elif "handed" in chain: # group 4
+ named = chain.get("handed_from") or {}
+ carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]}
+ else: # group 5
+ carried = {k: "final_state." + k for k in chain.get("carry") or []}
+ if chain.get("clock"):
+ carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"]
+ outcomes = chain.get("next_outcomes") or spec["run_outcomes"]
+ return template, carried, outcomes, list(chain.get("next_also") or [])
+
+
+def meets(constraint, value):
+ if value is None:
+ return False
+ return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"]
+
+
+def history_layout_problem(layout, parameters, frames_count):
+ """None when the arrays of a chained solve are laid out as the task states; else what is not."""
+ if layout is None:
+ return None
+ if layout["kind"] == "stardust_slab":
+ names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s",
+ "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2")
+ columns = [parameters.get(name) for name in names]
+ if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns):
+ return "the history columns are not all lists of numbers"
+ time, pressure, coefficient, enthalpy, radiative = columns
+ rows = frames_count + 3
+ if any(len(c) != rows for c in columns):
+ return "the history has not one row before the %d frames handed and two after them" % frames_count
+ if time[0] != 0.0 or coefficient[0] != 0.0:
+ return "row 0 is not at 0 s with no heating"
+ if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]:
+ return "row 0 does not repeat the first frame's pressure and enthalpy"
+ if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]:
+ return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"]
+ if coefficient[-2] != 0.0 or coefficient[-1] != 0.0:
+ return "the stream is not off after the frames"
+ if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]:
+ return "the rows after the frames do not hold the last frame's pressure and enthalpy"
+ if any(v != 0.0 for v in radiative):
+ return "a row of the history holds radiative heating"
+ return None
+ if layout["kind"] == "triga_element":
+ return None # every array is handed by the coupling and held to its bits by the verifier
+ return "an unknown layout"
+
+
+# ------------------------------------------------------------------------------------------
+# the call record
+# ------------------------------------------------------------------------------------------
+def card_requests(env, card):
+ """Every request on the card, [(tool, arguments)], read leniently (for the call log)."""
+ out = []
+
+ def take(part):
+ if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict):
+ out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"]))
+
+ if env["family"] in ("tradeoff", "chain_design"):
+ stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []]
+ for side in ("passing", "failing"):
+ design = card.get(side) if isinstance(card.get(side), dict) else {}
+ for key in stages or ("run", "solve", "next"):
+ take(design.get(key))
+ elif env["family"] == "budget":
+ take(card.get("holds"))
+ take(card.get("stops"))
+ return out
+
+
+def sequence(calls):
+ return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls]
+
+
+def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row):
+ """None when the call record holds; else why not (an integrity failure)."""
+ check = env["check"]
+ if calls_from == "harness":
+ if calls is None:
+ return "no harness call log: every attempt is scored with the calls the harness recorded"
+ if log_problem:
+ return log_problem
+ if reply_calls is not None and sequence(reply_calls) != sequence(calls):
+ return "the call log beside the reply differs from the harness log"
+ elif calls is None:
+ return "no call log: every environment is scored with the agent's calls"
+ calls = [(tool_name(t), a) for t, a in calls]
+ banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])})
+ if banned:
+ return "the log holds calls of %s, which the task rules out" % ", ".join(banned)
+ computing = [(t, a) for t, a in calls if t not in FREE_TOOLS]
+ row["computing_calls"] = len(computing)
+ if check.get("budget") and len(computing) > check["budget"]:
+ return "%d computing calls; the budget is %d" % (len(computing), check["budget"])
+ sent = {(t, canonical(a)) for t, a in computing}
+ for tool, arguments in card_requests(env, card):
+ if (tool, canonical(arguments)) not in sent:
+ return "a %s request on the card is not among the calls in the log" % tool
+ if env["family"] == "forensics" and not computing:
+ return "no computing call behind the answer: the table was not put to the verifier"
+ return None
+
+
+# ------------------------------------------------------------------------------------------
+# the families
+# ------------------------------------------------------------------------------------------
+def request_of(part, tool, what):
+ """The arguments of one request on the card (Integrity when it is not one)."""
+ if not isinstance(part, dict):
+ raise Integrity("%s is missing" % what)
+ request = part.get("request")
+ if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)):
+ raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what)
+ if tool_name(request.get("tool")) != tool:
+ raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool))
+ return request["arguments"]
+
+
+def score_design(env, design, which, replay, proofs):
+ """One design of a boundary family: facts {x, met, values, stopped, steps_landed}."""
+ check = env["check"]
+ spec = check["design"]
+ shape = design_shape(spec)
+ if shape in ("solve", "staged", "continued") and not isinstance(design, dict):
+ raise Integrity("the %s design is missing" % which)
+ if shape == "solve":
+ return score_solve_design(env, design, which, replay, proofs)
+ if shape == "staged":
+ return score_staged_design(env, design, which, replay, proofs)
+ if shape == "continued":
+ return score_continued_design(env, design, which, replay, proofs)
+ chain = spec.get("chain")
+ run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory",
+ "the %s design's run" % which)
+ free = set(spec.get("free") or []) | variable_places(spec["variable"])
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ for place in spec.get("free") or []:
+ if place.endswith(".steps"):
+ steps = get_path(run_args, place)
+ if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)):
+ raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"]))
+ stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"]
+ stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names
+ if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name:
+ raise Wrong("the %s design's run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ solve_args, solve = None, None
+ if chain:
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != chain["solver"]:
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ handed = solve_args.get("from")
+ if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]:
+ raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"]))
+ if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof:
+ raise Integrity("the %s design's solve is not handed the design's own sealed run" % which)
+ parameters = solve_args.get("parameters")
+ if not isinstance(parameters, dict):
+ raise Integrity("the %s design's solve has no parameters" % which)
+ solve_free = set(chain.get("handed") or [])
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ solve_free.add(spec["variable"]["path"].split(".", 1)[1])
+ where = differs(chain["parameters"], parameters, solve_free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where))
+ frames = len((run["body"] or {}).get("frames") or [])
+ problem = history_layout_problem(chain.get("layout"), parameters, frames)
+ if problem:
+ raise Integrity("the %s design's solve: %s" % (which, problem))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] != "converged":
+ raise Wrong("the %s design's solve comes back %s%s, not converged" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else ""))
+ x = design_value(spec["variable"], run_args, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", "")))
+ met, values = {}, {}
+ for constraint in check["constraints"]:
+ if constraint["on"] == "outcome":
+ values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"])
+ met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"])
+ continue
+ value = read_value(constraint["read"], run if constraint["on"] == "run" else solve)
+ values[constraint["id"]] = value
+ met[constraint["id"]] = meets(constraint, value)
+ facts = {"x": x, "met": met, "values": values}
+ if run["outcome"] not in NOT_STOPPED and run["body"]:
+ facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed")
+ return facts
+
+
+def halted(answer, stop, staged=False):
+ """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that
+ is not completed or converged (group 3's rule, kept as built)."""
+ if staged:
+ return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop
+ return answer["outcome"] == "refused" and answer["stop"] == stop
+
+
+def constraint_facts(check, answers, judged, staged=False):
+ """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop
+ constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design."""
+ met, values = {}, {}
+ for c in check["constraints"]:
+ if c["on"] == "outcome":
+ a = answers.get(c["stage"]) if c.get("stage") else judged
+ values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"]))
+ met[c["id"]] = a is not None and not halted(a, c["stop"], staged)
+ continue
+ a = answers.get(c["on"])
+ value = read_value(c["read"], a) if a is not None else None
+ values[c["id"]] = value
+ met[c["id"]] = meets(c, value) if c.get("limit") is not None else None
+ return met, values
+
+
+def stopped_by(answer, constraints, stage=None):
+ """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given)."""
+ return any(halted(answer, c["stop"], stage is not None) for c in constraints
+ if c["on"] == "outcome" and (stage is None or c.get("stage") == stage))
+
+
+def score_solve_design(env, design, which, replay, proofs):
+ """One design that is one solve and no run (check.design.tool or kind "solve")."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which)
+ if solve_args.get("solver") != spec["template"].get("solver"):
+ raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver")))
+ free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or [])
+ where = differs(spec["template"], solve_args, free)
+ if where:
+ raise Integrity("the %s design's solve differs from the task's at %s" % (which, where))
+ holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's solution_seal: %s" % (which, words))
+ solve = replay.answer("solve", solve_args)
+ if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]):
+ raise Wrong("the %s design's solve comes back %s%s, not %s" % (
+ which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"])))
+ x = design_value(dict(var, on="solve"), None, solve_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, {"solve": solve}, solve)
+ facts = {"x": x, "met": met, "values": values}
+ if solve["outcome"] not in NOT_STOPPED and solve["body"]:
+ facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True
+ return facts
+
+
+def score_continued_design(env, design, which, replay, proofs):
+ """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes
+ the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer
+ also holds each carried start field to the first run's answer, bit for bit."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ on_next = var["kind"] == "path" and var.get("on") == "next"
+ template, carried, next_outcomes, next_also = continuation_of(spec)
+ run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which)
+ free = set(spec.get("free") or []) | (set() if on_next else variable_places(var))
+ where = differs(spec["template"], without_readout(run_args), free)
+ if where:
+ raise Integrity("the %s design's run differs from the task's at %s" % (which, where))
+ run_proof = design["run"].get("proof")
+ holds, words = replay.proof_holds("run_trajectory", run_args, run_proof)
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's run_seal: %s" % (which, words))
+ run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run"))
+ if run["outcome"] not in spec["run_outcomes"]:
+ raise Wrong("the %s design's first run comes back %s%s, not %s" % (
+ which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"])))
+ next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which)
+ handed = next_args.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args)
+ or handed.get("run_seal") != run_proof):
+ raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which)
+ next_free = {"initial." + name for name in carried} | {"from"} | set(next_also)
+ if on_next:
+ next_free |= {var["path"]} | set(var.get("also") or [])
+ where = differs(template, without_readout(next_args), next_free)
+ if where:
+ raise Integrity("the %s design's next run differs from the task's at %s" % (which, where))
+ start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {}
+ for name, source in carried.items():
+ held, given = get_path(run["body"] or {}, source), start.get(name)
+ if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))):
+ raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source))
+ holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's next run_seal: %s" % (which, words))
+ nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next"))
+ if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]):
+ raise Wrong("the %s design's next run comes back %s%s, not %s" % (
+ which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes)))
+ x = design_value(var, run_args, None, next_args)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ for place in next_also:
+ again = get_path(next_args, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place))
+ met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt)
+ facts = {"x": x, "met": met, "values": values}
+ if nxt["outcome"] not in NOT_STOPPED and nxt["body"]:
+ facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed")
+ return facts
+
+
+def build_stage_request(spec, stage, x, answers, requests):
+ """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from
+ earlier stages' answers, and a continuation's start and from (used by run_reference.py)."""
+ q = copy.deepcopy(stage["template"])
+ var = spec["variable"]
+ if var.get("stage") == stage["key"]:
+ for place in [var["path"]] + list(var.get("also") or []):
+ set_path(q, place, x)
+ for h in stage.get("handed") or []:
+ set_path(q, h["to"], read_value(h["read"], answers[h["from"]]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ final = answers[parent]["body"]["final_state"]
+ q["initial"] = {k: final[k] for k in stage["template"]["initial"]}
+ q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]}
+ return q
+
+
+def score_staged_design(env, design, which, replay, proofs):
+ """One staged design (check.design.stages): each stage a run or a solve, in order."""
+ check = env["check"]
+ spec = check["design"]
+ var = spec["variable"]
+ stages = spec["stages"]
+ answers, requests, facts = {}, {}, {}
+ for i, stage in enumerate(stages):
+ key, tool = stage["key"], stage["tool"]
+ sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key)))
+ free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []}
+ if var.get("stage") == key:
+ free |= {var["path"]} | set(var.get("also") or [])
+ if stage.get("continues"):
+ free |= {"initial", "from"}
+ where = differs(stage["template"], sent, free)
+ if where:
+ raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where))
+ for h in stage.get("handed") or []:
+ want = read_value(h["read"], answers[h["from"]])
+ got = get_path(sent, h["to"])
+ if want is None or not number(got) or float(got) != float(want):
+ raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % (
+ which, key, h["from"], h["read"]["quantity"], h["to"]))
+ if stage.get("continues"):
+ parent = stage["continues"]
+ handed = sent.get("from")
+ if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent])
+ or handed.get("run_seal") != design[parent].get("proof")):
+ raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent))
+ final = (answers[parent]["body"] or {}).get("final_state") or {}
+ start = sent.get("initial")
+ keys = set(stage["template"]["initial"])
+ if not isinstance(start, dict) or set(start) != keys or any(
+ not number(start[k]) or float(start[k]) != final.get(k) for k in keys):
+ raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent))
+ holds, words = replay.proof_holds(tool, sent, design[key].get("proof"))
+ proofs.append(holds)
+ if not holds:
+ raise Integrity("the %s design's %s proof: %s" % (which, key, words))
+ answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None)
+ named = stopped_by(answer, check["constraints"], stage=key)
+ if answer["outcome"] not in stage["outcomes"] and not named:
+ raise Wrong("the %s design's %s comes back %s%s, not %s" % (
+ which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"])))
+ answers[key], requests[key] = answer, sent
+ if named:
+ facts["stopped"], facts["stopped_stage"] = answer["stop"], key
+ facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None
+ facts["no_step"] = tool != "run_trajectory"
+ if i != len(stages) - 1:
+ raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"]))
+ x = design_value(dict(var, on="run"), requests.get(var["stage"]), None)
+ if x is None:
+ raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", "")))
+ met, values = constraint_facts(check, answers, None, staged=True)
+ facts.update({"x": x, "met": met, "values": values})
+ return facts
+
+
+def grade_bracket(a, b, star, tol, slack, row):
+ """(reward_ok, graded) for a bracket [a, b] with its sides right."""
+ width = abs(b - a)
+ straddles = min(a, b) - slack <= star <= max(a, b) + slack
+ within = width <= tol * (1 + 1e-9)
+ e = max(a, b, star) - min(a, b, star)
+ r = e / tol if tol > 0 else float("inf")
+ row["width"], row["width_ratio"] = width, r
+ if within and straddles:
+ return True, 1.0
+ if r <= 1:
+ return False, OTHER_CROSSING
+ return False, GRADED_DECAY ** math.log10(r)
+
+
+def score_boundary(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ passing = score_design(env, card.get("passing"), "passing", replay, proofs)
+ failing = score_design(env, card.get("failing"), "failing", replay, proofs)
+ row["passing"], row["failing"] = passing, failing
+ span = check["design"].get("range")
+ if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])):
+ raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span))
+ broken = [c for c, ok in passing["met"].items() if not ok]
+ if broken:
+ raise Wrong("the passing design breaks %s" % ", ".join(broken))
+ broken = [c for c, ok in failing["met"].items() if not ok]
+ if not broken:
+ raise Wrong("the failing design meets every constraint")
+ binding = card.get("binding")
+ if binding != reference["binding"]:
+ raise Wrong("binding names %r; the constraint that binds is another" % (binding,))
+ if binding not in broken:
+ raise Wrong("the failing design does not break %s, the constraint named binding" % binding)
+ if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]:
+ said = card.get("failing") or {}
+ if said.get("stopped") != failing.get("stopped"):
+ raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped")))
+ if failing.get("no_step"):
+ pass # a solve that is refused has no step: its stop's name is stated
+ elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")):
+ raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step")))
+ spec = check["design"]
+ xp, xf = passing["x"], failing["x"]
+ if spec["direction"] == "largest" and not xf > xp:
+ raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one")
+ if spec["direction"] == "smallest" and not xf < xp:
+ raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one")
+ ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row)
+ if not ok:
+ return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % (
+ abs(xf - xp), spec["tolerance"])
+ return 1.0, None
+
+
+def score_budget(env, card, replay, row, proofs):
+ check, reference = env["check"], env["reference"]
+ template, path, tool = check["template"], check["variable"], check["tool"]
+ sides = {}
+ for side in ("holds", "stops"):
+ arguments = request_of(card.get(side), tool, side)
+ also = check.get("also") or []
+ where = differs(template, without_readout(arguments), {path} | set(also))
+ if where:
+ raise Integrity("the %s request differs from the task's at %s" % (side, where))
+ x = get_path(arguments, path)
+ if not number(x):
+ raise Integrity("the %s request has no number at %s" % (side, path))
+ for place in also:
+ again = get_path(arguments, place)
+ if not (number(again) and float(again) == float(x)):
+ raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path))
+ holds, words = replay.proof_holds(tool, arguments, card[side].get("proof"))
+ proofs.append(holds)
+ sides[side] = (float(x), arguments, holds, words)
+ for side in ("holds", "stops"):
+ if not sides[side][2]:
+ raise Integrity("the %s seal: %s" % (side, sides[side][3]))
+ held = replay.answer(tool, sides["holds"][1])
+ stopped = replay.answer(tool, sides["stops"][1])
+ row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"])
+ if held["outcome"] not in NOT_STOPPED:
+ raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"]))
+ if stopped["stop"] != check["stop"]:
+ raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"]))
+ if card["stops"].get("stopped") != check["stop"]:
+ raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"]))
+ xh, xs = sides["holds"][0], sides["stops"][0]
+ star = reference["boundary"]
+ row["holds_value"], row["stops_value"] = xh, xs
+ tol = check["relative_width"] * abs(star)
+ ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row)
+ if not ok:
+ return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % (
+ abs(xs - xh), check["relative_width"])
+ return 1.0, None
+
+
+def forensics_f1(env, named):
+ """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer."""
+ if not isinstance(named, dict):
+ return 0.0, "false_rows is not an object of row and reason"
+ rows = [c["row"] for c in env["check"]["rows"]]
+ truth = env["reference"]["false_rows"]
+ unknown = [r for r in named if r not in set(rows)]
+ if unknown:
+ return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown))
+ reasons = env["check"].get("reasons") or REASONS
+ bad = [r for r, why in named.items() if why not in reasons]
+ if bad:
+ return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons))
+ if rows and set(named) == set(rows):
+ return 0.0, "every row of the table is named false: a blanket answer"
+ found = sum(1 for r, why in named.items() if truth.get(r) == why)
+ if not truth and not named:
+ return 1.0, None
+ precision = found / len(named) if named else 0.0
+ recall = found / len(truth) if truth else 0.0
+ f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0
+ if f1 >= 1.0:
+ return 1.0, None
+ missed = sorted(set(truth) - set(named))
+ wrongly = sorted(set(named) - set(truth))
+ wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r])
+ said = []
+ if missed:
+ said.append("%d false row(s) not named" % len(missed))
+ if wrongly:
+ said.append("%d genuine row(s) named false" % len(wrongly))
+ if wrong_reason:
+ said.append("%d false row(s) with another reason" % len(wrong_reason))
+ return f1, "; ".join(said)
+
+
+def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None):
+ """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record);
+ reply_calls: the reply-side log, compared with calls under calls_from="harness"."""
+ row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from,
+ "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None}
+ card, problem = read_card(reply)
+ if problem:
+ row.update(verdict="no_card", reason=problem)
+ return row
+ proofs = []
+ try:
+ problem = engine_problem(env, replay)
+ if problem:
+ raise Integrity(problem)
+ problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row)
+ if problem:
+ raise Integrity(problem)
+ family = env["family"]
+ if family in ("tradeoff", "chain_design"):
+ graded, reason = score_boundary(env, card, replay, row, proofs)
+ elif family == "budget":
+ graded, reason = score_budget(env, card, replay, row, proofs)
+ elif family == "forensics":
+ named = card.get("false_rows")
+ if isinstance(named, dict):
+ row["named"] = named
+ graded, reason = forensics_f1(env, named)
+ proofs = [True]
+ if reason and graded == 0.0 and not isinstance(named, dict):
+ raise Wrong(reason)
+ else:
+ raise Wrong("unknown family %s" % family)
+ except Integrity as problem:
+ row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ except Wrong as problem:
+ row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs)))
+ return row
+ proofs_hold = int(bool(proofs) and all(proofs))
+ correct = int(graded >= 1.0 and reason is None)
+ row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1),
+ graded=round(graded, 6) if proofs_hold else 0.0,
+ verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason)
+ return row
+
+
+def records_for(folder, env_id, calls_from, harness_dir=None):
+ """(calls, reply_calls, log_problem) for one environment's reply in folder."""
+ reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl"))
+ if calls_from == "harness":
+ calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl"))
+ return calls, reply_calls, log_problem
+ return reply_calls, None, None
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
+ parser.add_argument("replies")
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out")
+ parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness")
+ parser.add_argument("--harness-dir")
+ parser.add_argument("--quiet", action="store_true")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ missing = wanted - {e["id"] for e in environments}
+ if missing:
+ sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments))
+ for env in environments:
+ for problem in row_problems(env):
+ print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr)
+ verifier = open_verifier(args.engine)
+ replay = Replay(verifier)
+ rows = []
+ try:
+ for env in environments:
+ path = os.path.join(args.replies, env["id"] + ".txt")
+ reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else ""
+ calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir)
+ row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem)
+ rows.append(row)
+ if not args.quiet:
+ print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"],
+ row["reason"] or ""), flush=True)
+ replay.seen.clear()
+ finally:
+ close_verifier(verifier)
+ if args.out:
+ with open(args.out, "w", encoding="utf-8") as f:
+ for row in rows:
+ f.write(json.dumps(row) + "\n")
+ total = len(rows)
+ print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % (
+ total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows),
+ sum(r["graded"] for r in rows) / total if total else 0.0,
+ sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows)))
+ by = {}
+ for r in rows:
+ by.setdefault(r["family"], []).append(r)
+ for family in FAMILIES:
+ if family in by:
+ print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]),
+ sum(r["graded"] for r in by[family]) / len(by[family])))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/test.sh b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/test.sh
new file mode 100644
index 0000000000000000000000000000000000000000..4e4008f0a93d9c230856a9c0e0ecf5cd5cef1066
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/test.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Harbor runs this after the agent has finished, in a fresh copy of the image
+# (task.toml: [verifier] environment_mode = "separate"). By then Harbor has
+# copied tests/ to /tests and the declared artifacts, where they exist, to
+# their own paths: /app/answer.json and /logs/agent/trajectory.json.
+# grade.py writes /logs/verifier/reward.json. If the scorer itself fails it
+# writes no reward and this script exits non-zero.
+HERE="$(cd "$(dirname "$0")" && pwd)"
+exec python3 -B "$HERE/grade.py"
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_mcp.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_mcp.py
new file mode 100644
index 0000000000000000000000000000000000000000..1afbc12d8c05d8c143563152ffae500e8052a6db
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_mcp.py
@@ -0,0 +1,188 @@
+"""A small Model Context Protocol client for the Zero-Trust Physics verifier.
+
+Standard library only. It speaks MCP two ways:
+
+ stdio to a verifier built from the public source and started here as a program
+ (target/release/mcp_stdio): one JSON-RPC message a line, no network.
+ HTTP to an MCP address (JSON-RPC in a POST), such as
+
+ https://mcp.zerotrustphysics.com/mcp/open Open to any agent.
+
+The open address gives each network address one place in the physics pool at a
+time and answers "Too many concurrent physics tasks." or HTTP 429 when it is
+busy; nothing waits on the server, so this client sends one request at a time
+and, when it is told to come back, waits and sends the same request again.
+
+Licence: Apache-2.0.
+"""
+import json
+import select
+import shlex
+import subprocess
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+
+
+class McpError(RuntimeError):
+ pass
+
+
+class Verifier:
+ """One MCP endpoint. call(tool, arguments) returns (text, is_error)."""
+
+ def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True):
+ self.url = url
+ self.timeout_s = timeout_s
+ self.patience_s = patience_s # how long to keep asking politely before giving up on one request
+ self.pause_s = pause_s # a fixed pause after every request, for a shared address
+ self.headers = dict(headers or {})
+ self.quiet = quiet
+ self.session = None
+ self.server = None
+ self.requests_sent = 0
+ self.times_asked_to_wait = 0
+ self._id = 0
+
+ # -- transport -------------------------------------------------------------------------
+ def _post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-environments/1.0", **self.headers}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ self.requests_sent += 1
+ with urllib.request.urlopen(request, timeout=self.timeout_s) as response:
+ session = response.headers.get("Mcp-Session-Id")
+ if session:
+ self.session = session
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ raise McpError("the event stream held no answer to the request")
+ return json.loads(raw) if raw.strip() else {}
+
+ def _ask(self, method, params=None):
+ """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again."""
+ self._id += 1
+ message = {"jsonrpc": "2.0", "id": self._id, "method": method}
+ if params is not None:
+ message["params"] = params
+ started, wait = time.time(), 2.0
+ while True:
+ reason = None
+ try:
+ answer = self._post(message)
+ if "error" in answer:
+ raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300])
+ result = answer.get("result", {})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ if method == "tools/call" and BUSY in text and len(text) < 400:
+ reason = "the physics pool is busy"
+ else:
+ if self.pause_s:
+ time.sleep(self.pause_s)
+ return result
+ except urllib.error.HTTPError as problem:
+ if problem.code == 429 or problem.code >= 500:
+ after = problem.headers.get("Retry-After")
+ reason = "HTTP %d" % problem.code
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ else:
+ raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300]))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem:
+ reason = "no connection (%s)" % problem
+ self.times_asked_to_wait += 1
+ if time.time() - started + wait > self.patience_s:
+ raise McpError("gave up after %d s: %s" % (self.patience_s, reason))
+ if not self.quiet:
+ print(" %s; asking again in %.0f s" % (reason, wait), flush=True)
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+ # -- protocol --------------------------------------------------------------------------
+ def connect(self):
+ result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {},
+ "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}})
+ self.server = result.get("serverInfo")
+ try:
+ self._post({"jsonrpc": "2.0", "method": "notifications/initialized"})
+ except Exception: # a notification has no answer; some servers close without one
+ pass
+ return result
+
+ def tools(self):
+ """The tool declarations exactly as the endpoint gives them."""
+ return self._ask("tools/list").get("tools", [])
+
+ def call(self, tool, arguments=None):
+ """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag."""
+ result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}})
+ text = "".join(c.get("text", "") for c in result.get("content", []) or [])
+ return text, bool(result.get("isError"))
+
+ def call_json(self, tool, arguments=None):
+ """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON."""
+ text, is_error = self.call(tool, arguments)
+ try:
+ return json.loads(text), is_error
+ except ValueError:
+ return text, is_error
+
+
+class StdioVerifier(Verifier):
+ """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line.
+ For anyone who holds an MCP server as a program; the open address needs none of this."""
+
+ def __init__(self, command, timeout_s=600, **kwargs):
+ super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs)
+ self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+
+ def _post(self, message):
+ self.requests_sent += 1
+ try:
+ self.proc.stdin.write((json.dumps(message) + "\n").encode())
+ self.proc.stdin.flush()
+ except OSError: # a program that has stopped reading will not start again
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ raise McpError("the program stopped reading")
+ if "id" not in message:
+ return {}
+ while True:
+ ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s)
+ if not ready:
+ raise McpError("no answer in %d s" % self.timeout_s)
+ line = self.proc.stdout.readline()
+ if not line:
+ raise McpError("the program closed its output")
+ found = json.loads(line)
+ if found.get("id") == message["id"]:
+ return found
+
+ def close(self):
+ self.proc.terminate()
+ try:
+ self.proc.wait(timeout=5)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def connect(endpoint=OPEN_ADDRESS, **kwargs):
+ """A connected verifier: an http(s) address, or "stdio:" for a program."""
+ verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs)
+ verifier.connect()
+ return verifier
diff --git a/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_open_bridge.py
new file mode 100644
index 0000000000000000000000000000000000000000..bc0e20b469db24286278a387680ad8d3898f0661
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1d-limit-cell448-lowest-start-charge-11min-18c/tests/ztp_open_bridge.py
@@ -0,0 +1,109 @@
+"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's
+MCP address, and its answer written back on stdout, one line each. Standard library only.
+
+ python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp/open
+
+It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio
+server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds
+nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a
+notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for
+every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same
+message again, as ztp_mcp.Verifier does, so a client sees one answer per request.
+
+Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no
+key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image.
+
+Licence: Apache-2.0.
+"""
+import json
+import os
+import sys
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900"))
+API_KEY = os.environ.get("ZTP_API_KEY") or None
+
+
+class Bridge:
+ def __init__(self, url):
+ self.url = url
+ self.session = None
+ self.extra_headers = {}
+
+ def post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-bridge/1.0"}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ if API_KEY:
+ headers["Authorization"] = "Bearer " + API_KEY
+ headers.update(self.extra_headers)
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ with urllib.request.urlopen(request, timeout=600) as response:
+ if response.headers.get("Mcp-Session-Id"):
+ self.session = response.headers["Mcp-Session-Id"]
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "id" not in message:
+ return None
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}}
+ return json.loads(raw) if raw.strip() else None
+
+ def forward(self, message):
+ started, wait = time.time(), 2.0
+ while True:
+ try:
+ answer = self.post(message)
+ text = ""
+ if isinstance(answer, dict) and isinstance(answer.get("result"), dict):
+ text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict))
+ if not (BUSY in text and len(text) < 400):
+ return answer
+ except urllib.error.HTTPError as problem:
+ if not (problem.code == 429 or problem.code >= 500):
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}}
+ after = problem.headers.get("Retry-After")
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError):
+ pass
+ if time.time() - started + wait > PATIENCE_S:
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}}
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+
+def main():
+ bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS)
+ for line in sys.stdin:
+ if not line.strip():
+ continue
+ try:
+ message = json.loads(line)
+ except ValueError:
+ continue
+ answer = bridge.forward(message)
+ if answer is not None:
+ sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n")
+ sys.stdout.flush()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/Dockerfile b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..568742bebe61fc9c90daad15a6ed51c93a294086
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/Dockerfile
@@ -0,0 +1,14 @@
+# Harbor environment image for Zero-Trust Physics release v0.15.3 (commit 664d68f4).
+# Public 5-crate Rust engine reference source is at https://github.com/johnkruze/zero-trust-physics-engine (tag v0.15.2);
+# read-only source audit of the pack verifier build is available under NDA (https://zerotrustphysics.com/offers/#licence).
+# In this free evaluation sample, /usr/local/bin/mcp_stdio bridges JSON-RPC over stdio to the public MCP endpoint
+# (ztp_open_bridge.py), and the scorer verifies release 0.15.3 version and kernel invariants on every reply.
+# Paid Domain Packs ship compiled static Linux/macOS rollout binaries for --network none execution.
+FROM python:3.12-slim-bookworm
+ARG ZTP_ENGINE_TAG=v0.15.3
+ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1
+ARG ZTP_VERIFIER_URL=https://mcp.zerotrustphysics.com/mcp/open
+COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py
+RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "%s"\n' "$ZTP_VERIFIER_URL" > /usr/local/bin/mcp_stdio \
+ && chmod +x /usr/local/bin/mcp_stdio
+WORKDIR /app
diff --git a/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/ztp_open_bridge.py
new file mode 100644
index 0000000000000000000000000000000000000000..bc0e20b469db24286278a387680ad8d3898f0661
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/environment/ztp_open_bridge.py
@@ -0,0 +1,109 @@
+"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's
+MCP address, and its answer written back on stdout, one line each. Standard library only.
+
+ python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp/open
+
+It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio
+server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds
+nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a
+notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for
+every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same
+message again, as ztp_mcp.Verifier does, so a client sees one answer per request.
+
+Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no
+key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image.
+
+Licence: Apache-2.0.
+"""
+import json
+import os
+import sys
+import time
+import urllib.error
+import urllib.request
+
+OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp/open"
+BUSY = "Too many concurrent physics tasks."
+PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900"))
+API_KEY = os.environ.get("ZTP_API_KEY") or None
+
+
+class Bridge:
+ def __init__(self, url):
+ self.url = url
+ self.session = None
+ self.extra_headers = {}
+
+ def post(self, message):
+ body = json.dumps(message).encode()
+ headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
+ "User-Agent": "zero-trust-physics-bridge/1.0"}
+ if self.session:
+ headers["Mcp-Session-Id"] = self.session
+ if API_KEY:
+ headers["Authorization"] = "Bearer " + API_KEY
+ headers.update(self.extra_headers)
+ request = urllib.request.Request(self.url, data=body, headers=headers, method="POST")
+ with urllib.request.urlopen(request, timeout=600) as response:
+ if response.headers.get("Mcp-Session-Id"):
+ self.session = response.headers["Mcp-Session-Id"]
+ raw = response.read().decode("utf-8")
+ kind = response.headers.get("Content-Type", "")
+ if "id" not in message:
+ return None
+ if "text/event-stream" in kind:
+ for line in raw.splitlines():
+ if line.startswith("data:"):
+ found = json.loads(line[5:].strip())
+ if found.get("id") == message.get("id"):
+ return found
+ return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}}
+ return json.loads(raw) if raw.strip() else None
+
+ def forward(self, message):
+ started, wait = time.time(), 2.0
+ while True:
+ try:
+ answer = self.post(message)
+ text = ""
+ if isinstance(answer, dict) and isinstance(answer.get("result"), dict):
+ text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict))
+ if not (BUSY in text and len(text) < 400):
+ return answer
+ except urllib.error.HTTPError as problem:
+ if not (problem.code == 429 or problem.code >= 500):
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}}
+ after = problem.headers.get("Retry-After")
+ if after and after.isdigit():
+ wait = max(wait, float(after))
+ except (urllib.error.URLError, TimeoutError, ConnectionError, OSError):
+ pass
+ if time.time() - started + wait > PATIENCE_S:
+ if "id" not in message:
+ return None
+ return {"jsonrpc": "2.0", "id": message.get("id"),
+ "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}}
+ time.sleep(wait)
+ wait = min(wait * 1.6, 30.0)
+
+
+def main():
+ bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS)
+ for line in sys.stdin:
+ if not line.strip():
+ continue
+ try:
+ message = json.loads(line)
+ except ValueError:
+ continue
+ answer = bridge.forward(message)
+ if answer is not None:
+ sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n")
+ sys.stdout.flush()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/instruction.md b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/instruction.md
new file mode 100644
index 0000000000000000000000000000000000000000..367b7ef7bf9a3ce9541db9bebb213d1a55066ed7
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/instruction.md
@@ -0,0 +1,19 @@
+Cell m1000 of the Tesla Model 3 2170 lithium-ion cell dataset of Kollmeyer and others, rested at 88 percent charge with its case at 31 degrees Celsius, is discharged at 15 A for 10 minutes (600 steps of 1 s), its case held at 31 degrees Celsius. Its capacity (capacity_ah) is the one input you change: an aged cell holds less. Below some capacity it reaches its lower voltage limit before the 10 minutes are up (UndervoltageLimit). Find that capacity, in ampere-hours.
+
+Find it to four significant figures: a value that completes and a value that stops with UndervoltageLimit, no more than 0.01 percent of the value apart. It lies between 2.5 and 4.1 Ah.
+
+The request, with the one input you change:
+{"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": "", "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}
+
+Budget: at most 4 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"holds": {"request": ..., "proof": ...}, "stops": {"request": ..., "proof": ..., "stopped": ""}}
+
+holds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+
+Also write that answer card, by itself, to the file `/app/answer.json`.
diff --git a/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/chainlib.py b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/chainlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/chainlib.py
@@ -0,0 +1,63 @@
+"""Build the solve request of a chained design from a run's answer: the history its coupling hands over.
+
+A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's
+32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This
+module reads the slots from frame_hex with the standard library and lays the history out the way a
+task states it.
+
+ chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from
+
+layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or
+{"kind": "triga_element"}.
+
+Licence: Apache-2.0.
+"""
+import copy
+import struct
+
+
+def _slots(run_answer, f64_at, f32_at):
+ """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened."""
+ out = [[] for _ in range(1 + len(f32_at))]
+ for frame in run_answer["frames"]:
+ raw = bytes.fromhex(frame["frame_hex"])
+ out[0].append(struct.unpack(" the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"energy\", \"card\": \"cell_2170_model3\", \"initial\": {\"cell_number\": 1000.0, \"state_of_charge\": 0.88, \"capacity_ah\": \"\", \"case_temperature_least_c\": 31.0, \"case_temperature_most_c\": 31.0}, \"dt_s\": 1.0, \"segments\": [{\"steps\": 600, \"load\": {\"current_a\": 15.0, \"case_temperature_c\": 31.0}}], \"record_every\": 600}}\n\nBudget: at most 4 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.", "check": {"tool": "run_trajectory", "template": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": null, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}, "variable": "initial.capacity_ah", "also": [], "stop": "UndervoltageLimit", "relative_width": 0.0001, "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "rl_pack_2026-10-29_batteries_thermal_runaway_grid_frequency", "seed": 2026102901, "note": "A stop located by halving on the local 0.15.3 build; the task rules the search tools out and allows 4 computing calls."}, "reference": {"boundary": 3.269654713737237, "bisect_width": 1.928235349168972e-12, "holds": {"x": 3.269752803378649, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": 3.269752803378649, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}, "proof": "cb1bd559d1d2265454e621416c6f462276b545f87432504b9e4ef59fd7b3dd88fa72d7c68c299fb3d8310399fbece51b", "outcome": "completed", "steps_landed": 600}, "stops": {"x": 3.269556624095825, "request": {"tool": "run_trajectory", "arguments": {"domain": "energy", "card": "cell_2170_model3", "initial": {"cell_number": 1000.0, "state_of_charge": 0.88, "capacity_ah": 3.269556624095825, "case_temperature_least_c": 31.0, "case_temperature_most_c": 31.0}, "dt_s": 1.0, "segments": [{"steps": 600, "load": {"current_a": 15.0, "case_temperature_c": 31.0}}], "record_every": 600}}, "proof": "1380e70918c6bec508ee957298bf797f296ef625ee93de955ffbd69e23bf3d12a48082e658a7d880638373e8ba6c78c2", "outcome": "refused", "steps_landed": 599}, "span_pattern": "sssssssssssssssssssssssssssssssshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", "span": [2.5, 4.1], "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}}
diff --git a/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/run_reference.py b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/run_reference.py
new file mode 100644
index 0000000000000000000000000000000000000000..0dc7d591e31fb27d4a9ccc2c2a50f5436eb503b2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/run_reference.py
@@ -0,0 +1,208 @@
+"""An agent with no model in it: answer every environment from its reference, through the harness proxy.
+
+ python3 run_reference.py --engine ENGINE --environments F --out DIR [--only id,id] [--direct]
+
+For a tradeoff or chain_design environment it sends the reference passing and failing runs to the
+verifier, hands each run to its solve through the task's coupling where the task has one, and writes
+the card with the seals this verifier gives. For a budget environment it sends the two reference
+requests. For a forensics table it puts the table to the verifier (each row's request as sent, up to
+the task's budget) and names the false rows the build recorded.
+
+Every call goes through harness/mcp_log_proxy.py, started in an empty working folder, so the
+authoritative call record is DIR/.harness.jsonl, as in a pass@k attempt. The same calls are also
+written beside the reply, DIR/.calls.jsonl. --direct talks to ENGINE with no proxy and writes the
+reply-side log only.
+
+ python3 score.py DIR --engine ENGINE --environments F --calls-from harness
+
+Licence: Apache-2.0.
+"""
+import argparse
+import copy
+import json
+import os
+import subprocess
+import sys
+import tempfile
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, HERE)
+import chainlib # noqa: E402
+from score import (FREE_TOOLS, NOT_STOPPED, build_stage_request, close_verifier, continuation_of, design_shape, # noqa: E402
+ file_sha256, get_path, load_environments, open_verifier)
+from ztp_mcp import McpError, StdioVerifier # noqa: E402
+
+PROXY = os.path.join(HERE, "..", "harness", "mcp_log_proxy.py")
+
+
+class ProxiedVerifier(StdioVerifier):
+ """The engine behind the logging proxy, the proxy started in its own empty working folder."""
+
+ def __init__(self, engine, log, cwd=None, **kwargs):
+ self.cwd = cwd or tempfile.mkdtemp(prefix="ztp_ref_cwd_")
+ if engine.startswith("http://") or engine.startswith("https://"):
+ # an MCP address: the proxy runs the stdio bridge to it (ztp_open_bridge.py, beside this file)
+ child = [sys.executable, os.path.join(HERE, "ztp_open_bridge.py"), engine]
+ else:
+ child = [os.path.abspath(engine)]
+ command = [sys.executable, os.path.abspath(PROXY), "--log", os.path.abspath(log), "--"] + child
+ super(StdioVerifier, self).__init__(url="stdio: " + " ".join(command), timeout_s=600, **kwargs)
+ self.proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, cwd=self.cwd)
+ self.binary_sha256 = None if len(child) > 1 else file_sha256(engine)
+
+ def close(self):
+ try:
+ self.proc.stdin.close()
+ except OSError:
+ pass
+ try:
+ self.proc.wait(timeout=60)
+ except subprocess.TimeoutExpired:
+ self.proc.kill()
+
+
+def proxied(engine, log, cwd=None):
+ if os.path.exists(log):
+ os.remove(log)
+ verifier = ProxiedVerifier(engine, log, cwd)
+ try:
+ verifier.connect()
+ except McpError as problem:
+ sys.exit("the proxied verifier failed: %s" % problem)
+ return verifier
+
+
+class Logged:
+ def __init__(self, verifier):
+ self.verifier, self.calls, self.seen = verifier, [], {}
+
+ def call(self, tool, arguments, refused_ok=False):
+ # the same request twice is one call: a chain with its value in the next run has one first run for both designs
+ key = json.dumps([tool, arguments], sort_keys=True)
+ if key in self.seen and not self.seen[key][1]:
+ return self.seen[key][0]
+ self.calls.append({"tool": tool, "arguments": arguments})
+ body, is_error = self.verifier.call_json(tool, arguments)
+ self.seen[key] = (body, is_error)
+ if is_error and not refused_ok:
+ raise SystemExit("the reference request was refused: %s %s" % (tool, str(body)[:300]))
+ return body
+
+
+def design_staged(env, ref, agent):
+ """A staged design: each stage sent in order, handed values and continuations built from this verifier's answers."""
+ spec = env["check"]["design"]
+ answers, requests, out = {}, {}, {}
+ for stage in spec["stages"]:
+ q = build_stage_request(spec, stage, ref["x"], answers, requests)
+ body = agent.call(stage["tool"], q, refused_ok=True)
+ stopped = body.get("outcome") not in NOT_STOPPED
+ answers[stage["key"]] = {"body": body, "proof": body.get("run_seal") or body.get("solution_seal"),
+ "outcome": body.get("outcome"), "stop": body.get("reject") if stopped else None, "stopped": stopped}
+ requests[stage["key"]] = q
+ out[stage["key"]] = {"request": {"tool": stage["tool"], "arguments": q}, "proof": answers[stage["key"]]["proof"]}
+ return out
+
+
+def design(env, ref, agent):
+ spec = env["check"]["design"]
+ shape = design_shape(spec)
+ if shape == "staged":
+ return design_staged(env, ref, agent)
+ if shape == "solve":
+ solved = agent.call("solve", ref["solve"], refused_ok=True)
+ return {"solve": {"request": {"tool": "solve", "arguments": ref["solve"]}, "proof": solved["solution_seal"]}}
+ run_args = ref["run"]
+ run = agent.call("run_trajectory", run_args)
+ out = {"run": {"request": {"tool": "run_trajectory", "arguments": run_args}, "proof": run["run_seal"]}}
+ if shape == "continued":
+ # the run that continues this design's own sealed run: the reference's next run, its start fields and from
+ # set from this verifier's answer to the first run
+ _, carried, _, _ = continuation_of(spec)
+ next_args = copy.deepcopy(ref["next"])
+ next_args["initial"] = {name: get_path(run, source) for name, source in carried.items()}
+ next_args["from"] = {"request": run_args, "run_seal": run["run_seal"]}
+ nxt = agent.call("run_trajectory", next_args, refused_ok=True)
+ out["next"] = {"request": {"tool": "run_trajectory", "arguments": next_args}, "proof": nxt["run_seal"]}
+ elif spec.get("chain"):
+ overrides = {}
+ if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve":
+ overrides[spec["variable"]["path"].split(".", 1)[1]] = ref["x"]
+ solve_args = chainlib.chained_solve(spec["chain"], run_args, run, overrides)
+ solved = agent.call("solve", solve_args)
+ out["solve"] = {"request": {"tool": "solve", "arguments": solve_args}, "proof": solved["solution_seal"]}
+ return out
+
+
+def reference_reply(env, verifier):
+ """(reply text, calls [{"tool", "arguments"}])."""
+ agent = Logged(verifier)
+ family, ref = env["family"], env["reference"]
+ if family in ("tradeoff", "chain_design"):
+ card = {"passing": design(env, ref["passing"], agent), "failing": design(env, ref["failing"], agent), "binding": ref["binding"]}
+ if ref["failing"].get("stopped"):
+ card["failing"]["stopped"] = ref["failing"]["stopped"]
+ if ref["failing"].get("steps_landed") is not None:
+ card["failing"]["step"] = ref["failing"]["steps_landed"]
+ words = "The boundary lies between the two designs below; %s binds." % ref["binding"]
+ elif family == "budget":
+ card = {}
+ for side in ("holds", "stops"):
+ request = ref[side]["request"]
+ answer = agent.call(request["tool"], request["arguments"])
+ card[side] = {"request": request, "proof": answer.get("run_seal") or answer.get("solution_seal")}
+ card["stops"]["stopped"] = env["check"]["stop"]
+ words = "The stop %s lies between the two requests below." % env["check"]["stop"]
+ else:
+ agent.call("list_cards", {}, refused_ok=True)
+ rows = env["check"]["rows"]
+ budget = env["check"].get("budget") or len(rows)
+ computing = 0
+ for row in rows:
+ request = row["request"]
+ if computing >= budget:
+ break
+ if request["tool"] in FREE_TOOLS:
+ continue
+ agent.call(request["tool"], request["arguments"], refused_ok=True)
+ computing += 1
+ card = {"false_rows": ref["false_rows"]}
+ words = "%d of the %d rows are false." % (len(ref["false_rows"]), len(rows))
+ return words + "\n\n" + json.dumps(card), agent.calls
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--engine", required=True)
+ parser.add_argument("--environments", required=True)
+ parser.add_argument("--out", required=True)
+ parser.add_argument("--only")
+ parser.add_argument("--direct", action="store_true", help="no proxy: the reply-side log only")
+ args = parser.parse_args()
+ environments = load_environments(args.environments)
+ if args.only:
+ wanted = set(args.only.split(","))
+ environments = [e for e in environments if e["id"] in wanted]
+ os.makedirs(args.out, exist_ok=True)
+ shared = open_verifier(args.engine) if args.direct else None
+ try:
+ for env in environments:
+ verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl"))
+ try:
+ reply, calls = reference_reply(env, verifier)
+ finally:
+ if not shared:
+ close_verifier(verifier)
+ with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f:
+ f.write(reply + "\n")
+ with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f:
+ for c in calls:
+ f.write(json.dumps(c) + "\n")
+ print("%-60s %d calls" % (env["id"], len(calls)), flush=True)
+ finally:
+ if shared:
+ close_verifier(shared)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/score.py b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/score.py
new file mode 100644
index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2
--- /dev/null
+++ b/sample/tasks/harbor/tasks/g1f-budget4-cell1000-least-capacity-15a-31c/solution/score.py
@@ -0,0 +1,1199 @@
+"""Score replies to the multi-step environments with no judge: a program and the verifier.
+
+ python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F]
+ [--calls-from reply|harness] [--harness-dir DIR]
+
+ REPLIES is a folder with one file per environment, .txt, the whole text of a reply.
+ --calls-from harness the call record is the harness's own: .harness.jsonl, written by
+ harness/mcp_log_proxy.py outside the solver's working directory (in
+ --harness-dir, default REPLIES). A .calls.jsonl beside the reply,
+ when there is one, is read only to catch an edit: it must equal the
+ harness log call for call.
+ --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply:
+ one JSON object a line, {"tool": "", "arguments": {...}}.
+
+ ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address
+ beginning http. A task is scored only on the engine it was built on: the verifier's version must
+ be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's
+ reference.engine_binary_sha256.
+
+The answer card is one JSON object on the reply's last line. Its shape is the family's:
+
+ tradeoff, chain_design (kind design_to_limit, chained_design)
+ {"passing": DESIGN, "failing": DESIGN, "binding": ""}
+ DESIGN = {"run": {"request": R, "proof": ""},
+ "solve": {"request": R, "proof": ""}} (solve only where the task has one)
+ Where a constraint is that the run completes and it binds, the failing DESIGN also carries
+ "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}}
+ The design shapes, one scorer for every group (check.design says which):
+ run a run alone.
+ coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run.
+ continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of
+ the same card that continues it through from, starting from its sealed final state,
+ DESIGN = {"run": {...}, "next": {"request": R, "proof": "