@tangle-network/agent-bench 0.1.0 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/HARNESS.md +302 -0
  3. package/README.md +39 -2
  4. package/dist/adapters.d.ts +15 -0
  5. package/dist/adapters.js +43 -0
  6. package/dist/adapters.js.map +1 -0
  7. package/dist/benchmarks/_harness.d.ts +125 -0
  8. package/dist/benchmarks/_harness.js +33 -0
  9. package/dist/benchmarks/_harness.js.map +1 -0
  10. package/dist/benchmarks/aec-bench.d.ts +27 -0
  11. package/dist/benchmarks/aec-bench.js +8 -0
  12. package/dist/benchmarks/aec-bench.js.map +1 -0
  13. package/dist/benchmarks/agentbench.d.ts +16 -0
  14. package/dist/benchmarks/agentbench.js +10 -0
  15. package/dist/benchmarks/agentbench.js.map +1 -0
  16. package/dist/benchmarks/appworld.d.ts +37 -0
  17. package/dist/benchmarks/appworld.js +14 -0
  18. package/dist/benchmarks/appworld.js.map +1 -0
  19. package/dist/benchmarks/bfcl.d.ts +18 -0
  20. package/dist/benchmarks/bfcl.js +10 -0
  21. package/dist/benchmarks/bfcl.js.map +1 -0
  22. package/dist/benchmarks/cad-design.d.ts +45 -0
  23. package/dist/benchmarks/cad-design.js +7 -0
  24. package/dist/benchmarks/cad-design.js.map +1 -0
  25. package/dist/benchmarks/cadbench.d.ts +19 -0
  26. package/dist/benchmarks/cadbench.js +8 -0
  27. package/dist/benchmarks/cadbench.js.map +1 -0
  28. package/dist/benchmarks/cadgenbench.d.ts +22 -0
  29. package/dist/benchmarks/cadgenbench.js +8 -0
  30. package/dist/benchmarks/cadgenbench.js.map +1 -0
  31. package/dist/benchmarks/commit0.d.ts +31 -0
  32. package/dist/benchmarks/commit0.js +10 -0
  33. package/dist/benchmarks/commit0.js.map +1 -0
  34. package/dist/benchmarks/crag.d.ts +14 -0
  35. package/dist/benchmarks/crag.js +9 -0
  36. package/dist/benchmarks/crag.js.map +1 -0
  37. package/dist/benchmarks/dabstep.d.ts +18 -0
  38. package/dist/benchmarks/dabstep.js +10 -0
  39. package/dist/benchmarks/dabstep.js.map +1 -0
  40. package/dist/benchmarks/enterpriseops-gym.d.ts +38 -0
  41. package/dist/benchmarks/enterpriseops-gym.js +10 -0
  42. package/dist/benchmarks/enterpriseops-gym.js.map +1 -0
  43. package/dist/benchmarks/finresearchbench.d.ts +15 -0
  44. package/dist/benchmarks/finresearchbench.js +8 -0
  45. package/dist/benchmarks/finresearchbench.js.map +1 -0
  46. package/dist/benchmarks/finsearchcomp.d.ts +49 -0
  47. package/dist/benchmarks/finsearchcomp.js +7 -0
  48. package/dist/benchmarks/finsearchcomp.js.map +1 -0
  49. package/dist/benchmarks/frames.d.ts +59 -0
  50. package/dist/benchmarks/frames.js +13 -0
  51. package/dist/benchmarks/frames.js.map +1 -0
  52. package/dist/benchmarks/hotpotqa.d.ts +48 -0
  53. package/dist/benchmarks/hotpotqa.js +15 -0
  54. package/dist/benchmarks/hotpotqa.js.map +1 -0
  55. package/dist/benchmarks/humaneval.d.ts +53 -0
  56. package/dist/benchmarks/humaneval.js +15 -0
  57. package/dist/benchmarks/humaneval.js.map +1 -0
  58. package/dist/benchmarks/mind2web.d.ts +41 -0
  59. package/dist/benchmarks/mind2web.js +9 -0
  60. package/dist/benchmarks/mind2web.js.map +1 -0
  61. package/dist/benchmarks/nomiracl.d.ts +15 -0
  62. package/dist/benchmarks/nomiracl.js +9 -0
  63. package/dist/benchmarks/nomiracl.js.map +1 -0
  64. package/dist/benchmarks/open-rag-bench.d.ts +14 -0
  65. package/dist/benchmarks/open-rag-bench.js +9 -0
  66. package/dist/benchmarks/open-rag-bench.js.map +1 -0
  67. package/dist/benchmarks/programbench.d.ts +38 -0
  68. package/dist/benchmarks/programbench.js +10 -0
  69. package/dist/benchmarks/programbench.js.map +1 -0
  70. package/dist/benchmarks/rag-shared.d.ts +42 -0
  71. package/dist/benchmarks/rag-shared.js +39 -0
  72. package/dist/benchmarks/rag-shared.js.map +1 -0
  73. package/dist/benchmarks/ragbench.d.ts +16 -0
  74. package/dist/benchmarks/ragbench.js +9 -0
  75. package/dist/benchmarks/ragbench.js.map +1 -0
  76. package/dist/benchmarks/simpleqa.d.ts +64 -0
  77. package/dist/benchmarks/simpleqa.js +11 -0
  78. package/dist/benchmarks/simpleqa.js.map +1 -0
  79. package/dist/benchmarks/swe-bench.d.ts +56 -0
  80. package/dist/benchmarks/swe-bench.js +14 -0
  81. package/dist/benchmarks/swe-bench.js.map +1 -0
  82. package/dist/benchmarks/t2-ragbench.d.ts +14 -0
  83. package/dist/benchmarks/t2-ragbench.js +9 -0
  84. package/dist/benchmarks/t2-ragbench.js.map +1 -0
  85. package/dist/benchmarks/tau-bench-shared.d.ts +26 -0
  86. package/dist/benchmarks/tau-bench-shared.js +10 -0
  87. package/dist/benchmarks/tau-bench-shared.js.map +1 -0
  88. package/dist/benchmarks/tau2-bench.d.ts +7 -0
  89. package/dist/benchmarks/tau2-bench.js +11 -0
  90. package/dist/benchmarks/tau2-bench.js.map +1 -0
  91. package/dist/benchmarks/tau3-banking.d.ts +15 -0
  92. package/dist/benchmarks/tau3-banking.js +9 -0
  93. package/dist/benchmarks/tau3-banking.js.map +1 -0
  94. package/dist/benchmarks/terminal-bench.d.ts +24 -0
  95. package/dist/benchmarks/terminal-bench.js +8 -0
  96. package/dist/benchmarks/terminal-bench.js.map +1 -0
  97. package/dist/benchmarks/toollm.d.ts +16 -0
  98. package/dist/benchmarks/toollm.js +10 -0
  99. package/dist/benchmarks/toollm.js.map +1 -0
  100. package/dist/benchmarks/trata-hedge.d.ts +32 -0
  101. package/dist/benchmarks/trata-hedge.js +7 -0
  102. package/dist/benchmarks/trata-hedge.js.map +1 -0
  103. package/dist/benchmarks/types.d.ts +107 -0
  104. package/dist/benchmarks/types.js +1 -0
  105. package/dist/benchmarks/types.js.map +1 -0
  106. package/dist/benchmarks/webarena-verified.d.ts +16 -0
  107. package/dist/benchmarks/webarena-verified.js +10 -0
  108. package/dist/benchmarks/webarena-verified.js.map +1 -0
  109. package/dist/chunk-2PVVP7GN.js +197 -0
  110. package/dist/chunk-2PVVP7GN.js.map +1 -0
  111. package/dist/chunk-2XU6OGEN.js +170 -0
  112. package/dist/chunk-2XU6OGEN.js.map +1 -0
  113. package/dist/chunk-53UPUNBZ.js +325 -0
  114. package/dist/chunk-53UPUNBZ.js.map +1 -0
  115. package/dist/chunk-5SBJCB6W.js +144 -0
  116. package/dist/chunk-5SBJCB6W.js.map +1 -0
  117. package/dist/chunk-7WSD27QQ.js +118 -0
  118. package/dist/chunk-7WSD27QQ.js.map +1 -0
  119. package/dist/chunk-C7T7WEK2.js +103 -0
  120. package/dist/chunk-C7T7WEK2.js.map +1 -0
  121. package/dist/chunk-CKUVRZ2T.js +251 -0
  122. package/dist/chunk-CKUVRZ2T.js.map +1 -0
  123. package/dist/chunk-HBSWHQNJ.js +30 -0
  124. package/dist/chunk-HBSWHQNJ.js.map +1 -0
  125. package/dist/chunk-HHXFIHXC.js +116 -0
  126. package/dist/chunk-HHXFIHXC.js.map +1 -0
  127. package/dist/chunk-IFAV6KEM.js +276 -0
  128. package/dist/chunk-IFAV6KEM.js.map +1 -0
  129. package/dist/chunk-INNOYXCP.js +387 -0
  130. package/dist/chunk-INNOYXCP.js.map +1 -0
  131. package/dist/chunk-J3KDJNX2.js +182 -0
  132. package/dist/chunk-J3KDJNX2.js.map +1 -0
  133. package/dist/chunk-JRWWGMK7.js +148 -0
  134. package/dist/chunk-JRWWGMK7.js.map +1 -0
  135. package/dist/chunk-JTHWEDEW.js +32 -0
  136. package/dist/chunk-JTHWEDEW.js.map +1 -0
  137. package/dist/chunk-KDIKRJGB.js +120 -0
  138. package/dist/chunk-KDIKRJGB.js.map +1 -0
  139. package/dist/chunk-LRRD7NAG.js +301 -0
  140. package/dist/chunk-LRRD7NAG.js.map +1 -0
  141. package/dist/chunk-ODT47UAY.js +221 -0
  142. package/dist/chunk-ODT47UAY.js.map +1 -0
  143. package/dist/chunk-PA2ZKHJC.js +230 -0
  144. package/dist/chunk-PA2ZKHJC.js.map +1 -0
  145. package/dist/chunk-PPYSEKFM.js +182 -0
  146. package/dist/chunk-PPYSEKFM.js.map +1 -0
  147. package/dist/chunk-PUIRNYI7.js +189 -0
  148. package/dist/chunk-PUIRNYI7.js.map +1 -0
  149. package/dist/chunk-R36V2VP7.js +169 -0
  150. package/dist/chunk-R36V2VP7.js.map +1 -0
  151. package/dist/chunk-R67DFVLO.js +142 -0
  152. package/dist/chunk-R67DFVLO.js.map +1 -0
  153. package/dist/chunk-SEVJPLZC.js +260 -0
  154. package/dist/chunk-SEVJPLZC.js.map +1 -0
  155. package/dist/chunk-SYDW647C.js +318 -0
  156. package/dist/chunk-SYDW647C.js.map +1 -0
  157. package/dist/chunk-TBKU5XQI.js +228 -0
  158. package/dist/chunk-TBKU5XQI.js.map +1 -0
  159. package/dist/chunk-TSWPNOYM.js +147 -0
  160. package/dist/chunk-TSWPNOYM.js.map +1 -0
  161. package/dist/chunk-UAIOHCUK.js +27 -0
  162. package/dist/chunk-UAIOHCUK.js.map +1 -0
  163. package/dist/chunk-UPAMRDX4.js +233 -0
  164. package/dist/chunk-UPAMRDX4.js.map +1 -0
  165. package/dist/chunk-VQRS7VUC.js +342 -0
  166. package/dist/chunk-VQRS7VUC.js.map +1 -0
  167. package/dist/chunk-X3BTXCJ4.js +262 -0
  168. package/dist/chunk-X3BTXCJ4.js.map +1 -0
  169. package/dist/chunk-X5YKXC6V.js +211 -0
  170. package/dist/chunk-X5YKXC6V.js.map +1 -0
  171. package/dist/chunk-Y6O2OCUO.js +130 -0
  172. package/dist/chunk-Y6O2OCUO.js.map +1 -0
  173. package/dist/chunk-YCGY7UIZ.js +208 -0
  174. package/dist/chunk-YCGY7UIZ.js.map +1 -0
  175. package/dist/chunk-Z7ML6L77.js +162 -0
  176. package/dist/chunk-Z7ML6L77.js.map +1 -0
  177. package/dist/chunk-ZEWMTR5M.js +136 -0
  178. package/dist/chunk-ZEWMTR5M.js.map +1 -0
  179. package/dist/index.d.ts +355 -0
  180. package/dist/index.js +1908 -0
  181. package/dist/index.js.map +1 -0
  182. package/fixtures/aec-bench.json +18 -0
  183. package/fixtures/agentbench-dbbench.json +22 -0
  184. package/fixtures/bfcl.json +45 -0
  185. package/fixtures/commit0.json +72 -0
  186. package/fixtures/crag.json +10 -0
  187. package/fixtures/dabstep.json +22 -0
  188. package/fixtures/enterpriseops-gym.json +103 -0
  189. package/fixtures/finresearchbench.json +21 -0
  190. package/fixtures/finsearchcomp.json +66 -0
  191. package/fixtures/frames.json +26 -0
  192. package/fixtures/hotpotqa.json +182 -0
  193. package/fixtures/nomiracl.json +26 -0
  194. package/fixtures/open-rag-bench.json +16 -0
  195. package/fixtures/pier-agent/no-model-task/environment/Dockerfile +16 -0
  196. package/fixtures/pier-agent/no-model-task/environment/seed/src/status.txt +1 -0
  197. package/fixtures/pier-agent/no-model-task/instruction.md +6 -0
  198. package/fixtures/pier-agent/no-model-task/pre_artifacts.sh +6 -0
  199. package/fixtures/pier-agent/no-model-task/task.toml +35 -0
  200. package/fixtures/pier-agent/no-model-task/tests/Dockerfile +17 -0
  201. package/fixtures/pier-agent/no-model-task/tests/seed/src/status.txt +1 -0
  202. package/fixtures/pier-agent/no-model-task/tests/test.sh +19 -0
  203. package/fixtures/programbench.json +17 -0
  204. package/fixtures/ragbench.json +21 -0
  205. package/fixtures/simpleqa.json +121 -0
  206. package/fixtures/t2-ragbench.json +13 -0
  207. package/fixtures/tau2-bench.json +16 -0
  208. package/fixtures/tau3-banking.json +16 -0
  209. package/fixtures/toollm.json +28 -0
  210. package/fixtures/webarena-verified.json +20 -0
  211. package/package.json +60 -20
  212. package/pier_agents/__init__.py +18 -0
  213. package/pier_agents/candidate_contract.py +755 -0
  214. package/pier_agents/process_boundary.py +321 -0
  215. package/pier_agents/tangle_candidate.py +907 -0
  216. package/pier_agents/workspace_boundary.py +368 -0
  217. package/scripts/appworld_driver.py +359 -0
  218. package/scripts/cadbench_prepare.py +22 -0
  219. package/scripts/cadgenbench_hard_parts.py +48 -0
  220. package/scripts/clbench_codebase_judge.py +73 -0
  221. package/scripts/commit0_judge.py +170 -0
  222. package/scripts/dabstep_judge.py +42 -0
  223. package/scripts/enterpriseops_gym_judge.py +281 -0
  224. package/scripts/programbench_judge.py +120 -0
  225. package/scripts/render-gate-chart.mjs +176 -0
  226. package/scripts/run-package-tests.mjs +56 -0
  227. package/scripts/terminate-pier-trial.mts +66 -0
  228. package/scripts/trata-hedge/README.md +56 -0
  229. package/scripts/trata-hedge/run.sh +60 -0
  230. package/scripts/trata-hedge/solve.py +83 -0
  231. package/scripts/verify-packed-consumer.mjs +235 -0
  232. package/scripts/verify-pier-agent.mts +715 -0
  233. package/scripts/verify-pier-pair.mts +74 -0
  234. package/scripts/verify-pier-recovery.mts +139 -0
  235. package/src/adapters.ts +26 -0
  236. package/src/benchmarks/_harness.test.mts +178 -0
  237. package/src/benchmarks/_harness.ts +239 -16
  238. package/src/benchmarks/agentbench.ts +163 -0
  239. package/src/benchmarks/appworld.test.mts +15 -9
  240. package/src/benchmarks/bfcl.ts +346 -0
  241. package/src/benchmarks/crag.ts +137 -0
  242. package/src/benchmarks/dabstep.test.mts +70 -0
  243. package/src/benchmarks/dabstep.ts +212 -0
  244. package/src/benchmarks/external-adapters.test.mts +150 -0
  245. package/src/benchmarks/finresearchbench.ts +269 -0
  246. package/src/benchmarks/humaneval.ts +20 -8
  247. package/src/benchmarks/nomiracl.ts +180 -0
  248. package/src/benchmarks/open-rag-bench.ts +153 -0
  249. package/src/benchmarks/rag-benchmarks.test.mts +138 -0
  250. package/src/benchmarks/rag-shared.ts +327 -0
  251. package/src/benchmarks/ragbench.ts +171 -0
  252. package/src/benchmarks/swe-bench.test.mts +61 -0
  253. package/src/benchmarks/swe-bench.ts +201 -19
  254. package/src/benchmarks/t2-ragbench.ts +166 -0
  255. package/src/benchmarks/tau-bench-shared.ts +214 -0
  256. package/src/benchmarks/tau2-bench.ts +30 -0
  257. package/src/benchmarks/tau3-banking.ts +29 -0
  258. package/src/benchmarks/terminal-bench.test.mts +33 -0
  259. package/src/benchmarks/terminal-bench.ts +23 -8
  260. package/src/benchmarks/toollm.ts +254 -0
  261. package/src/benchmarks/types.ts +42 -0
  262. package/src/benchmarks/webarena-verified.ts +200 -0
  263. package/src/commit0-prereqs.sh +0 -0
  264. package/src/coordination-mcp-container-reach.mts +181 -0
  265. package/src/decoder-live.mts +1 -1
  266. package/src/examples/README.md +103 -39
  267. package/src/examples/benchmark-matrix.mts +101 -0
  268. package/src/examples/lean-proof-gate.README.md +77 -0
  269. package/src/examples/lean-proof-gate.mts +162 -0
  270. package/src/examples/lean-verify.ts +95 -0
  271. package/src/examples/lean.Dockerfile +12 -0
  272. package/src/examples/math-demo.mts +9 -7
  273. package/src/examples/strategy-demo.mts +10 -12
  274. package/src/gate.ts +3 -2
  275. package/src/hev-eval.mts +69 -0
  276. package/src/hev-improve.mts +169 -0
  277. package/src/hev-structural.mts +688 -0
  278. package/src/index.ts +73 -0
  279. package/src/mbpp-structural.mts +662 -0
  280. package/src/pier-agent.test-fixtures.mts +19 -0
  281. package/src/pier-agent.test.mts +363 -0
  282. package/src/pier-agent.ts +657 -0
  283. package/src/pier-result-grader.mjs +30 -0
  284. package/src/pier-result-grader.test.mts +62 -0
  285. package/src/pier-result-grader.ts +108 -0
  286. package/src/pier-task-outcome.test.mts +117 -0
  287. package/src/pier-task-outcome.ts +240 -0
  288. package/src/pier-trial-controller.test.mts +412 -0
  289. package/src/pier-trial-controller.ts +858 -0
  290. package/src/pier-trial-supervisor.mjs +352 -0
  291. package/src/resolve-client.ts +25 -2
  292. package/src/run-benchmarks-cli.mts +72 -0
  293. package/src/run-benchmarks-report.ts +66 -0
  294. package/src/run-benchmarks.test.mts +231 -0
  295. package/src/run-benchmarks.ts +589 -0
  296. package/src/smoke-structural-rollout.mts +393 -0
  297. package/src/swe-bench-env.test.ts +207 -0
  298. package/src/swe-bench-env.ts +554 -0
  299. package/src/swe-jail.ts +293 -0
  300. package/src/swe-self-improve.mts +84 -0
  301. package/src/swe-structural-judge-policy.test.ts +117 -0
  302. package/src/swe-structural-judge-policy.ts +133 -0
  303. package/src/swe-structural-policy.test.ts +124 -0
  304. package/src/swe-structural-policy.ts +132 -0
  305. package/src/swe-structural-provenance.test.ts +93 -0
  306. package/src/swe-structural-provenance.ts +138 -0
  307. package/src/swe-structural.mts +1260 -0
  308. package/src/swe-temp.ts +14 -0
  309. package/src/tb-container-executor.mts +234 -0
  310. package/src/tb-container-executor.test.mts +99 -0
  311. package/src/tb-supervisor-sidecar.mts +222 -0
  312. package/src/trata-gepa.mts +1 -1
  313. package/steerers/eops-itsm-population.json +1 -0
  314. package/tb_agents/opencode_refine_agent.py +117 -0
  315. package/tb_agents/opencode_router_agent.py +406 -0
  316. package/tb_agents/opencode_supervisor_agent.py +239 -0
  317. package/tb_agents/script_agent.py +66 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## 0.3.6
4
+
5
+ - Ship compiled ESM and declarations so Node can import the installed package without a TypeScript runtime.
6
+ - Check root, registry, and benchmark subpath imports with plain Node in addition to TypeScript 5, TypeScript 6, and Python package checks.
7
+ - Build explicitly before verification and publication so disabled lifecycle scripts cannot produce a package without compiled output.
8
+
9
+ ## 0.3.5
10
+
11
+ - Build the workspace runtime before source type checks so the published-package verification command works from a clean checkout; the packed consumer still installs `@tangle-network/agent-runtime@0.97.0` from npm.
12
+
13
+ ## 0.3.4
14
+
15
+ - Publish the current benchmark suite against `@tangle-network/agent-runtime@0.97.0` and align its evaluation dependency with runtime and knowledge at `@tangle-network/agent-eval@0.122.8`.
16
+
17
+ ## 0.3.3
18
+
19
+ - Consume `@tangle-network/agent-runtime@0.94.9` so large candidate task-outcome and isolated-memory archives are validated before persistence, then recorded as artifact references instead of oversized embedded payloads.
20
+
21
+ ## 0.3.2
22
+
23
+ - Run large Pier workspace identity checks from a hash-verified evaluator file, avoiding Linux command-size limits while preserving exact path, type, mode, length, hardlink, and content checks.
package/HARNESS.md ADDED
@@ -0,0 +1,302 @@
1
+ # bench harness — START HERE (the map, so you don't re-read 15 files)
2
+
3
+ If you're an agent picking this up: read this page, then run `pnpm help` + `pnpm gate` —
4
+ do NOT re-derive the harness from source. This map is SHORT on purpose; if it disagrees
5
+ with the code, the code wins — fix this page in the same turn (the anti-rediscovery law).
6
+ Verified against source 2026-07-18 · agent-eval pinned `0.122.8`. The CANONICAL surface is now
7
+ the published optimization suite (`@tangle-network/agent-runtime/loops`): `Environment` +
8
+ `Strategy`/`defineStrategy` + `runBenchmark` — see the section below FIRST. The recursive
9
+ diverse-vs-blind gate runs through the keystone (`gate-cli.mts` → `runGate`);
10
+ the offline selector replay (`corpus-replay.mts` / `corpus-report.mts`) gates the legacy corpora.
11
+
12
+ ## What this harness answers
13
+ **The success criterion is Gate B** (docs/learning-flywheel.md, docs/architecture.md §2): across
14
+ repeated runs on a persistent, checkable task family, the deployed policy's verifier-graded
15
+ **multi-objective** score (correct · fast · secure · cheap, each its own deployable checker)
16
+ improves **run-over-run** at matched per-run compute, surviving a frozen-policy control, significant
17
+ at adequate n. That across-run slope is RSI. **The harness has NOT yet run Gate B** — see the durable
18
+ gap below.
19
+
20
+ What the harness measures **today is Gate A** (docs/roadmap-rsi.md — the inner GO/NO-GO for the
21
+ within-run adaptive-driver layer): **does any non-blind topology beat blind compute at EQUAL COMPUTE
22
+ (Σ rollouts × turns — `k` counts rollouts, each may be multi-turn/stateful), under a DEPLOYABLE
23
+ (non-oracle) selector, at significant n?** Gate A is a **narrow diagnostic** — the cost-justification
24
+ for parallel/adaptive topology, **NOT** the product verdict. A failed Gate A deletes within-run
25
+ steering only; it never touches the corpus+policy product (Gate B). The invariant is equal-COMPUTE,
26
+ not equal-k-on-stateless-samples.
27
+
28
+ **Terminology (one word, used consistently).** A **rollout** (≡ a "shot") is ONE agent running an
29
+ `AgentProfile` to completion — a full, possibly **multi-turn / stateful** trajectory. `k` counts
30
+ *rollouts*; **turns live *inside* a rollout**, never as separate shots. A single **stateless
31
+ completion** (`maxTurns=0`, `harness: null`, one model call, no persistent workspace) is the
32
+ *degenerate* rollout — fine as a selector **lower bound**, never the canonical unit. The HumanEval
33
+ probe (`bench/src/humaneval-gate.mts`) uses exactly that degenerate shape — it calls the router
34
+ directly and does **not** route through `AgentProfile` / the sandbox / the keystone — so its numbers
35
+ are the **no-self-correction lower bound** on the selector, distinct from the rollout-based keystone
36
+ gate above. Bridge it to the product by running the same arms with real rollouts (an `AgentProfile`
37
+ through `runLoop`), dialing `maxTurns`.
38
+
39
+ Two things to keep straight: today's judges grade a single
40
+ *correctness* scalar (the multi-objective vector is the open contract, architecture.md §6), and every
41
+ number below is single-objective + within-run — read them as Gate-A diagnostics, not Gate-B results.
42
+ - Within-run STEER (verify-and-revise family) **LOSES** (rung-0, n=40: blind 37.5% →
43
+ random@3 60.0% → refineGepa@3 45.0%; the earlier +20pp was confounded compute).
44
+ - On the COMMITTED finsearch corpus, the self-consistency selector also **loses**:
45
+ selector@k − random@k = **−8.2pp** (n=51). So "pick the consensus among k identical-ish
46
+ attempts" does not beat a random draw here.
47
+ - **VERIFIER-GROUNDED selection is the one selector that wins** — but ONLY where a domain has
48
+ WITHIN-TASK graded variance. Proven POSITIVE on HumanEval (deployable-checker, binary, n=50:
49
+ verifier−sc = +12.0pp CI[+4,+22]). The continuous-reward generalization (`selector.ts`
50
+ `summarizeVerifierSelector`, `corpus-replay --selector=verifier`) ranks k attempts by their
51
+ stored deployable-checker `score` and reports selector(=best-of-k) vs random(=mean-of-k) with a
52
+ paired bootstrap CI. **aec-bench is structurally DEAD for it** (n=12 gpt-4.1, **0/12 random +
53
+ 1/12 diverse tasks have any within-task score spread**): closed-form engineering calcs score
54
+ deterministically w.r.t. sampling — across-task difficulty (33% resolve) but ~0 within-task
55
+ selection headroom. The gpt-5 null (oracle 2.5%) was a worker artifact (no JSON emission);
56
+ gpt-4.1 fixes the band (mean 36.1%) but the selector gate stays flat. **commit0 is the right
57
+ Layer-1 domain** (different impls pass different test subsets → real within-task spread).
58
+ - **UNTESTED (still Gate A):** parallel **DIVERSE strategies** (different reasoning paths,
59
+ `directives.ts` → `DIVERSE_STRATEGY_LENSES` / `composeStrategies`) @k vs blind sample(n=k). A
60
+ distinct family from what rung-0 falsified — the open *within-run* question, and what runProgram's
61
+ `parallel` is built to deploy.
62
+ - **UNBUILT (Gate B):** the across-run policy-improvement curve on a multi-objective task stream.
63
+ No harness runs it yet; it is the durable next step, not a corpus-replay over the existing
64
+ single-objective records.
65
+
66
+ ## The run archive (where results LIVE)
67
+
68
+ Every run's full artifact is committed under `agent-lab/runs/<date>/` — self-describing JSON
69
+ (models + config + per-task cells + gate verdicts with CIs), portable to any repo without
70
+ this codebase. `agent-lab/runs/RUNS.md` is the index mapping artifacts → verdicts → the
71
+ findings gist. **Set `OUT=runs/<date>/<name>.json` (in agent-lab) on every run — never `/tmp`**
72
+ (a reboot erases ramdisk; ~20 runs nearly died there once).
73
+
74
+ ## Data flow (the whole experiment in one line)
75
+ `rollout (worker → answer) → adapter.judge (valid?) → CORPUS RunRecord (k attempts, output+valid each) → corpus-replay --selector (pick WITHOUT the judge) → corpus-report CI → gate verdict`
76
+ The expensive part (rollouts) produces a **reusable corpus**; selection + stats are free
77
+ and offline (zero new rollouts, zero judge calls).
78
+
79
+ ## THE CANONICAL SUITE (2026-06-10) — the published path; start here
80
+
81
+ The optimization layer ships from the package; bench scripts compose it. A domain = an
82
+ `Environment` (5 hooks); a strategy = how budget is spent to beat its check; `runBenchmark`
83
+ returns per-strategy means + the per-task LOSSES table + the (score,$) Pareto frontier.
84
+ Promotion is the package gate (`promotionGate` — seeded paired bootstrap, evidence floor,
85
+ two modes: **superiority** and **non-inferiority** = score CI low > −tolerance AND cost
86
+ savings CI low > 0, the "same quality, cheaper" gate; verdicts carry paired Δlatency).
87
+ Authoring is `authorStrategy` (named `fallbackModel` retry). **Funnel-alignment law**: the
88
+ search-side champion tie-band must be no stricter than the gate's tolerance (under
89
+ `OBJECTIVE=cost` it defaults to it). Endurance envs on the evolve runner: `CHECKPOINT=path`
90
+ (phase ledger + resume — a killed run re-pays ONE phase), `GYM_RECREATE='docker …'`
91
+ (recreate the container at phase boundaries — the wedge killer). Observability:
92
+ `createWaterfallCollector` (every spawn billed+timed) + `anytimeReport` (TTT / shots-to-
93
+ target / COCO ERT / hill-climb AUC per satisficing target). Models policy: cheap router
94
+ models only (defaults `deepseek-v4-pro`/`deepseek-v4-flash`; compressor = flash with
95
+ `gpt-4o-mini` fallback) — never CC models; every verdict banner + artifact is
96
+ self-describing (models + config).
97
+
98
+ | entry point | what it answers | one-liner |
99
+ |---|---|---|
100
+ | **the research lines** | the flywheel/evolution runs, σ×κ factor grid, steering hypercube, model matrix, E3 certified memory, depth-vs-breadth, corpus A/Bs — **moved to [tangle-network/agent-lab](https://github.com/tangle-network/agent-lab) (private)** with the EOPS/math domains and the run archive | `~/code/agent-lab` — map in its README |
101
+ | `src/commit0-env-run.mts` | the HARD domain (implement whole libraries vs their test suites) through `runBenchmark` | `IDS=commit-0/wcwidth BUDGET=3 INNER_TURNS=10 tsx src/commit0-env-run.mts` |
102
+ | `src/examples/strategy-demo.mts` | the 3-layer API demo (gym-free) | `WORKER_MODEL=gpt-4o-mini tsx src/examples/strategy-demo.mts` |
103
+ | `src/examples/math-demo.mts` | any-domain proof: math via `createVerifierEnvironment` (the tax/legal/gtm answer-shape) | `BUDGET=3 tsx src/examples/math-demo.mts` |
104
+
105
+ `run-benchmarks-cli.mts` can run a bounded per-task refinement loop with
106
+ `LOOP_ATTEMPTS=N`: attempt 1 answers the original task; later attempts receive previous artifacts
107
+ plus redacted checker feedback; the loop stops early on pass. This is for testing whether agents can
108
+ use the benchmark's own feedback to solve the task, not for leaking gold answers into prompts.
109
+ For local subscription-backed workers, set `BACKEND=bridge`, `BRIDGE_URL`, `BRIDGE_BEARER`, and pass
110
+ the full bridge model id in `CELLS`, e.g. `CELLS=opencode/deepseek/deepseek-v4-pro`.
111
+
112
+ EOPS standup (one container): `docker run -d --rm --name eops -p 8006:8005
113
+ shivakrishnareddyma225/enterpriseops-gym-mcp-itsm:latest` + `EOPS_GYM_DBS_DIR=<unzipped
114
+ gym_dbs.zip from github.com/ServiceNow/EnterpriseOps-Gym>`; restart it FRESH per big run
115
+ (it wedges under load); `EOPS_SPLIT=csm|hr|…` selects other domains (their gym containers
116
+ not yet sourced). **Parallel lanes:** tasks carry the dataset's literal gym URL
117
+ (`http://localhost:8006`); `EOPS_GYM_URL=http://localhost:8007` rebases every server URL,
118
+ so N concurrent runs use N containers (`-p 8007:8005`, `-p 8008:8005`, …) instead of
119
+ serializing on one wedge-prone gym. Bring-up check: `agent-lab/domains/lane-probe.mts`. Cross-cutting laws baked into the suite: keep-best checkpoint scoring
120
+ (final-state scoring is biased −6–8pp), equal compute via the conserved pool, the analyst
121
+ is firewalled (trace-only), costs are real (router usage → `{usd, ms, tokens}`).
122
+
123
+ ### The QUEUED runs for the test fleet (wired, one command each, unrun)
124
+ 1. **Relevance-primed corpus A/B** — `PRIME_MODE=relevance K_FACTS=2 N=16 HOLDOUT=4` (the read-side design that survived the naive-priming negative).
125
+ 2. ~~Strategy tournament at power~~ — RAN (n=24, budget 4, ×3 configs): HOLD verdicts; the cost-frontier finding ×3 + the funnel-alignment law came out of these. Live ledger: `.evolve/current.json` + the findings gist.
126
+ 3. **Commit0 at real budget** — `BUDGET=3 INNER_TURNS=12 N=3` sample-vs-refine on the hard domain.
127
+ 4. **Cross-domain replication** — blocked on sourcing the csm/hr gym containers (`EOPS_SPLIT` is wired).
128
+
129
+ ## Commands (the standalone tools — each its own `main`)
130
+ the gate + measurement tools:
131
+ corpus-replay.mts --selector: selector@k vs random@k vs oracle@k over a corpus (THE offline gate)
132
+ corpus-report.mts paired-bootstrap CI + Benjamini-Hochberg over corpora
133
+ gate-cli.mts the recursive diverse-vs-blind gate through `runGate` (Supervisor)
134
+ run-benchmarks-cli.mts runBenchmarks: any subset of the ADAPTERS registry × model/harness cells, one combined ranked report (#420)
135
+ commit0-env-run.mts the HARD domain through `runBenchmark` (the optimization suite)
136
+ terminal-compare.ts Terminal-Bench compare (own main)
137
+ pnpm verify:pier zero-model failure/pass Pier controls through a separate verifier
138
+ unit tests (the only fully-green, cred-free runnable surface besides offline replay):
139
+ node --test --import tsx src/{selector,refine-loop}.test.mts
140
+ tsx src/gate.test.mts # offline plumbing test (no creds)
141
+
142
+ ## Run the GATE — today, zero creds (it already runs)
143
+ ```
144
+ cd bench
145
+ pnpm gate # = corpus-replay.mts corpus/finsearch.jsonl --selector
146
+ tsx src/corpus-replay.mts corpus/finsearch.jsonl --selector --condition=refine # other arms
147
+ tsx src/corpus-replay.mts <corpus.jsonl> --selector=verifier # GRADED domains: rank k by deployable-checker score
148
+ pnpm gate-report # paired-bootstrap CI + BH-FDR
149
+ ```
150
+ `--selector=verifier` is for corpora whose attempts carry a continuous `score` (commit0
151
+ pytest pass-rate / aec verify.py partial credit) and where text doesn't cluster: it ranks by
152
+ the deployable checker (argmax score) and reports selector vs random with a paired bootstrap CI.
153
+ It needs WITHIN-TASK score spread to move — flat on aec (closed-form), live on commit0 (code).
154
+ The committed `corpus/finsearch.jsonl` (152 records: random@3 / refineHand@3 / refineGepa@3)
155
+ makes the gate replayable with no rollouts. To gate the DIVERSE arm you generate a
156
+ diverse-strategy corpus (k different `composeStrategies` prefixes per instance) by running
157
+ `gate-cli.mts` with the distinct-directive arms — the blind (identical-children) arm is the
158
+ control on the same run.
159
+
160
+ ## Run the DIVERSE-vs-blind gate THROUGH the keystone (the recursive runtime, live)
161
+ ```
162
+ cd bench
163
+ export TANGLE_API_KEY=… # router + the deployable judge
164
+ BENCH=enterpriseops-gym EOPS_FIXTURES=1 N=20 K=4 pnpm gate-cli
165
+ ```
166
+ `gate-cli.mts` → `runGate` (`src/gate.ts`): a `Persona` + the generic
167
+ `fanout` combinator over the budget-conserving `Supervisor`. Blind = K identical children, diverse
168
+ = K distinct strategy directives — equal-k by construction (conserved pool), proven by
169
+ `equalKOnCost`. The DEPLOYABLE selector is the benchmark's OWN `adapter.judge` (each child solves
170
+ via the router, is graded by the runnable checker, and that `BenchScore` is the child's verdict
171
+ `defaultSelectWinner` ranks on — selector ≠ oracle/LLM-judge). Pick a deployable-checker bench
172
+ (enterpriseops-gym / swe-bench / terminal-bench), NOT finsearchcomp (LLM-judge → not deployable).
173
+ Offline plumbing test (no creds): `tsx src/gate.test.mts`. The gate runs through the SAME recursive
174
+ atom every personified loop uses.
175
+
176
+ ## "Supervisor" (iterate/decompose) vs blind — through the PUBLISHED suite
177
+ The supervisor-vs-blind gate is NOT a bespoke harness: it is `runBenchmark([sample, refine, …])`
178
+ over an Environment. blind = `sample` (best-of-k); "supervisor" = `refine`/`sampleThenRefine`
179
+ (depth: attempt→firewalled-analyst-steer→retry — *"a multi-agent team is just a Strategy whose driver
180
+ spawns several agents"*). Equal compute by the substrate's CONSERVED budget; the deployable check is
181
+ the Environment's `score`; the can't-fake-the-check firewall is built in. Run it on the HARD real
182
+ domain via `commit0-env-run.mts` (above) or the toy `strategy-demo.mts` (offline). The LLM
183
+ agent-driver (an LLM that itself decides spawns via the coordination MCP) is the SEPARATE product
184
+ path — `atom-mcp-e2e.mts` / `atom-commit0.mts` — not a strategy. Evolve any strategy on a frozen
185
+ holdout with `runStrategyEvolution`.
186
+
187
+ ## Generate a fresh corpus + gate it
188
+ The rollout generators now live with their domains: the recursive gate
189
+ (`gate-cli.mts`) and the optimization-suite env runs (`commit0-env-run.mts`,
190
+ `research-gate.mts` for the off-sandbox RAG baseline) each append corpus `RunRecord`s. Gate any
191
+ written corpus offline with the selector:
192
+ ```
193
+ tsx src/corpus-replay.mts <corpus.jsonl> --selector
194
+ ```
195
+ (hotpotqa is cheap + deterministic-judge but near-ceiling/weak-signal; simpleqa similar;
196
+ finsearchcomp is the strong-signal domain but needs the sandbox/local-web worker.)
197
+
198
+ ## Optimize the strategy/prompt (so the gate tests BEST-effort, not strawman)
199
+ Strategy-space search is the package's `runStrategyEvolution` (the optimization suite); the diverse
200
+ lenses (`directives.ts`) layer on top of the shared base directive consumed by the gate arms.
201
+
202
+ ## Workers (the rollout substrate)
203
+ The gate solves each child via the router and grades it with the benchmark's own
204
+ deployable `adapter.judge`; `research-gate.mts` is the off-sandbox retrieve→answer baseline
205
+ (`SEARCH=<provider>` selects the web-search arm). The steer text lives in `directives.ts`, NOT in the
206
+ worker (the worker is substrate). A strategy is a prompt PREFIX; the judge is unchanged.
207
+
208
+ ## Adapters (benchmarks/) — honest state (the code wins over this line; verified 2026-06-04)
209
+ The code-benches share `benchmarks/_harness.ts` (stage artifact → run the bench's OWN evaluator
210
+ in a `.venv`/Docker subprocess → parse its JSON report → `{resolved,score}`). No per-adapter
211
+ copy of the process/venv/Docker/temp/report plumbing; commit0+appworld also share its
212
+ stdin-piping runner (`runVenvScriptStdin`).
213
+ Published-package consumers set `AGENT_BENCH_PYTHON` to the absolute path of an interpreter containing the benchmark dependencies.
214
+ If unset, source checkouts keep using `bench/.venv/bin/python`.
215
+ SWE-bench callers that need a hard evaluation deadline construct `createSweBenchAdapter({ timeoutMs })`; evaluator errors and incomplete or ambiguous reports throw instead of scoring zero.
216
+ Callers that must inspect the exact per-task image after scoring pass `cacheLevel: 'instance'`; the default remains `'env'`.
217
+ Callers retain the complete official evaluator tree plus raw process output with `captureEvaluatorArtifacts: ({ taskId, attemptSequence }) => ({ destination })`; the returned score (or `StagedJudgeError`) carries a receipt with every file hash and a whole-tree hash.
218
+ - **Real, runnable with ZERO extra deps:** finsearchcomp (GitHub dataset + fixtures + LLM judge — the gate bench), hotpotqa + simpleqa + frames (HF/web QA + F1/LLM judge; `*_FIXTURES=1` offline), **ragbench**, **crag**, **nomiracl**, **open-rag-bench**, **t2-ragbench** (SOTA RAG/knowledge benchmarks with committed fixtures and deterministic answer/relevance judges; live mode reads explicit `*_DATA_FILE` JSON/JSONL exports), **aec-bench** (real GitHub task tree + fixtures; judge = the task's own `tests/verify.py` over python3 stdlib — **deterministic, graded per-field partial credit, no Docker, no LLM** → the candidate non-oracle correctable-middle-band bench for the open gate).
219
+ - **Real code, needs an external harness/tools to run (fail loud with the exact install/Docker fix; never a fabricated score):** swe-bench + terminal-bench (`bench/.venv` + Docker), **commit0** (ISOLATED `bench/.venv-commit0` via `python3 -m venv bench/.venv-commit0 && bench/.venv-commit0/bin/pip install commit0 datasets` — its deps conflict with the shared `.venv`; override dir with `COMMIT0_VENV` — plus Docker; judge = official pytest harness, graded (passed+xfail)/total; the rollout prompt stages in-box (clones `commit-0/<repo>` @ `base_commit`, emits `git diff`); `COMMIT0_FIXTURES=1` for offline listing), **programbench** (`pip install programbench` + Docker on linux/amd64 + HF blobs; judge = official cleanroom eval, graded passed/total; `PROGRAMBENCH_FIXTURES=1` offline), **appworld** (`pip install appworld` + `appworld install` + `appworld download data`; judge = AppWorld's own `world.evaluate()`, graded passes/num_tests — NO committed fixture: task data exists only after `download data`, so loadTasks fails loud rather than fabricate a task), **dabstep** (`DABSTEP_DIR=/path/to/EnvCommons/DABStep` with the released `dataset.csv`, `splits/*.txt`, `files/*`, and `grade.py`; judge delegates to official `grade.py`; `DABSTEP_FIXTURES=1` only tests adapter plumbing and does not fabricate benchmark scores), **webarena-verified** (`WEBARENA_VERIFIED_DIR=/path/to/webarena-verified`; judge delegates to official `eval-tasks` over a run output directory), **tau2-bench** (`TAU2_BENCH_DIR=/path/to/tau2-bench`; judge recomputes tau2 trajectory rewards), **tau3-banking** (`TAU3_BENCH_DIR=/path/to/tau2-bench`; default domain `banking_knowledge`; judge recomputes tau trajectory rewards through the upstream tau3 package), **agentbench** DBBench subset (`AGENTBENCH_DIR=/path/to/AgentBench`; exact-match deterministic label judge), **bfcl** deterministic function-call subset (`BFCL_DIR=/path/to/gorilla/berkeley-function-call-leaderboard`; loads official BFCL JSONL + `possible_answer`; score = structured call/argument match, not the full BFCL leaderboard evaluator), **toollm** API-selection subset (`TOOLBENCH_DIR=/path/to/ToolBench`; score = recall of ToolBench `relevant APIs` labels, resolved only when the worker emits the requested structured JSON call list; official ToolEval pass rate remains LLM-judged/stochastic), **finresearchbench** (`FINRESEARCHBENCH_DATA_FILE=/path/to/export.jsonl`; rows must carry official `judge_system_prompt` + `judge_prompt_template`; no self-authored live judge), mind2web, cad-design + cadbench + cadgenbench (openscad/blender/build123d).
220
+ - **goldArtifact:** aec-bench returns the task's real `golden_pass.md` (verify-judge works fully offline). commit0 / programbench / appworld return `undefined` — the oracle is a git ref / stripped source / engine-bundled solution, not a portable string; judge correctness is proven by a real solve through the harness, not a synthetic gold (documented + fail-loud, not a fake).
221
+ - **Absent (not built):** swe-gym, swe-bench-multimodal, and the rest of the survey set.
222
+ Every unbuilt/scaffold adapter fails LOUD (throws with the integration step) rather than faking a score — no silent zeros in any corpus. Offline fixture tests: `benchmarks/{aec-bench,commit0,programbench,appworld,rag-benchmarks}.test.mts` (`tsx --test`).
223
+
224
+ ## Pier candidate bridge
225
+
226
+ `pier_agents.tangle_candidate:TangleCandidateAgent` is the reusable Pier custom-agent path for frozen Tangle candidates.
227
+ `executePreparedPierCandidate()` is the only public entry point; its private staging step writes the runtime's execution-plan and materialization-receipt bytes verbatim.
228
+ The Python bridge rechecks those bytes and their signed task, candidate, profile, repository, instruction, and workspace identities before launch.
229
+ It rejects a raw candidate bundle, never projects an `AgentProfile`, and leaves task isolation, patch transfer, verification, retries, and result storage to Pier.
230
+
231
+ The adapter fails the trial when any prepared identity drifts, when the task checkout or immutable OCI image differs from the signed identity, or when the candidate exits nonzero or exceeds its signed deadline.
232
+ Candidate code runs as an unprivileged numeric user, while evaluator inputs and timeout evidence remain root-owned.
233
+ It never accepts candidate-authored token, cost, or trace receipts; `executePreparedPierCandidate()` uses the runtime's atomic execution path and reconciles the protected `TraceStore` with the model-gateway ledger before returning a gradable receipt.
234
+ The prepared object contains no credentials.
235
+ The runtime passes model and trace bindings only to the trusted executor request.
236
+ The Pier launcher inherits their values through its protected process environment and passes only `${NAME}` references on the command line, so credentials never enter prepared bytes, CLI arguments, or job files.
237
+ The executor builds fresh task, candidate, and profile trees from the request's exact verified file bytes; prepared staging directories are never launch authority.
238
+ Isolated memory and knowledge-bearing candidates currently fail closed until Pier has executor-owned mount and after-state capture.
239
+ The signed wall deadline is a hard stop: the runtime aborts, Pier kills the process tree, and the executor acknowledges process and container death.
240
+ The signed tool-step count is a post-run validity check over protected traces, not a pre-tool stop; generic black-box Pier processes cannot honestly prevent step N+1.
241
+ The executable zero-model fixture is `fixtures/pier-agent/`; run it against the R360 Pier checkout with `PIER_REPO=/path/to/pier pnpm verify:pier`.
242
+ That command runs a no-change candidate that must score 0/1, proves a fresh evaluator process can kill a persisted child and remove its real Docker container, and runs a known-good candidate that must score 1/1.
243
+ It then checks that each official result and exact task patch is bound into its own runtime receipt with zero model usage.
244
+
245
+ For a real frozen candidate, use `FilePierCandidateTrialController`, append `agentArgs` and `attemptArgs`, and pass each executor-only `evaluatorEnv` entry through Pier's evaluator-owned environment mechanism.
246
+ The launch callback's second argument carries the signed runtime `request`, protected `traceStore`, cancellation `signal`, and absolute `deadlineAtMs`; production launchers must use that context rather than reconstructing it.
247
+ The controller sends secrets to its supervisor over a pipe, while its durable files contain only process and Docker-project identities:
248
+ The supervisor never inherits `process.env`; non-default Docker connections use a stable `dockerConnection.id` plus the exact environment injected into both Pier and cleanup.
249
+ Fresh recovery workers must reconstruct that same named connection; `terminate-pier-trial.mts` selects only the comma-delimited variables named by `PIER_DOCKER_ENV_NAMES` when `PIER_DOCKER_CONNECTION_ID` is set.
250
+ `jobName` must be unique per prepared execution; the controller atomically reserves that job directory so recovery can remove only containers owned by that execution.
251
+
252
+ ```ts
253
+ const controller = new FilePierCandidateTrialController({
254
+ directory: '/var/lib/tangle/pier-control',
255
+ launch: (staged, { request }) => {
256
+ const jobName = request.executionId
257
+ return {
258
+ command: 'uv',
259
+ args: ['run', 'pier', 'run', ...staged.agentArgs, ...staged.attemptArgs],
260
+ cwd: pierCheckout,
261
+ env: { ...evaluatorEnvironment, ...staged.evaluatorEnv },
262
+ jobsDirectory,
263
+ jobName,
264
+ readResult: () => readOfficialPierResult(jobsDirectory, jobName),
265
+ }
266
+ },
267
+ })
268
+
269
+ const result = await executePreparedPierCandidate({
270
+ prepared,
271
+ directory: '/sealed/candidate',
272
+ pierVersion: '0.3.0',
273
+ traceStore,
274
+ claimStore,
275
+ outputArtifacts,
276
+ grader,
277
+ controller,
278
+ })
279
+ ```
280
+
281
+ The controller's result resolves only after normal process/container cleanup.
282
+ On a signed deadline, external abort, or recovery by another evaluator process, the adapter waits for `terminateAndWait()` to acknowledge both process exit and container removal before it returns control to the runtime.
283
+
284
+ One prepared execution always maps to one Pier attempt (`--n-attempts 1 --max-retries 0`).
285
+ Production callers pass a long-lived `FileAgentCandidateExecutionClaimStore`; an in-memory claim store is test-only and cannot prevent a second process from replaying the same attempt.
286
+ Any allowed pre-model infrastructure retry is a new prepared execution with its own counted attempt identity.
287
+
288
+ ## Is it runnable RIGHT NOW? (verify the map, don't trust it blindly)
289
+ ```
290
+ ls src/*.mts src/*.ts # the real tool list (each its own main — source of truth)
291
+ tsx src/gate.test.mts # offline plumbing test (no creds)
292
+ ```
293
+ Creds: the router/sandbox paths read `ROUTER_KEY`/`SANDBOX_KEY` (+ `ROUTER_BASE`/`SANDBOX_BASE_URL`)
294
+ from the environment. Source them from the operator's private secret store (documented in the
295
+ global agent config, NOT here — this repo is public) into the run process; never print them.
296
+ NOT needed for the offline selector gate, the hotpotqa/swe-bench deterministic judges, or
297
+ RESEARCH=1 local-opencode rollouts — if unset, those paths are cred-blocked, not code-blocked.
298
+
299
+ ## Durable next step (so this stops drifting)
300
+ The surviving tools are standalone `.mts` mains (no `run.ts` registry). Next: a manifest test that
301
+ asserts every committed tool + package.json script is named on this page, so the map can't silently
302
+ drift from the code again.
package/README.md CHANGED
@@ -1,8 +1,20 @@
1
1
  # agent-runtime-bench
2
2
 
3
- Private experiment workspace nested in agent-runtime; decoupled from its build/lint/release (the package builds `src/`, lints `src tests examples` — `bench/` is none of those).
3
+ Published as `@tangle-network/agent-bench`, with independent CI and release checks for its TypeScript and Python surfaces.
4
4
 
5
- **Read [`bench/HARNESS.md`](./HARNESS.md) FIRST.** It is the one maintained map: the commands, the `rollout → corpus → selector → CI → gate` data flow, the canonical-suite table, the wired/needs-creds/scaffolded matrix, and the gate one-liners kept verified against source.
5
+ **Read [`bench/HARNESS.md`](./HARNESS.md) FIRST.** It is the one maintained map: the commands, the `rollout → corpus → selector → CI → gate` data flow, the canonical-suite table, the wired/needs-creds/scaffolded matrix, and the gate one-liners, kept verified against source.
6
+
7
+ ## Use
8
+
9
+ ```bash
10
+ pnpm add -D @tangle-network/agent-bench
11
+ ```
12
+
13
+ ```ts
14
+ import { resolveAdapter } from '@tangle-network/agent-bench'
15
+
16
+ const crag = resolveAdapter('crag')
17
+ ```
6
18
 
7
19
  ## SWE-bench judge setup (the one block not in HARNESS.md)
8
20
 
@@ -13,3 +25,28 @@ pnpm install # tsx + link parent
13
25
  ```
14
26
 
15
27
  The judge needs only Docker; workers need a model key (Tangle router `TANGLE_API_KEY`, or a direct provider).
28
+
29
+ Retain every official per-test log and report before the temporary evaluator directory is removed:
30
+
31
+ ```ts
32
+ const adapter = createSweBenchAdapter({
33
+ captureEvaluatorArtifacts: ({ taskId, attemptSequence }) => ({
34
+ destination: path.join(runDirectory, taskId, String(attemptSequence)),
35
+ }),
36
+ })
37
+ const score = await adapter.judge(task, patch)
38
+ console.log(score.judgeArtifacts?.manifestPath)
39
+ ```
40
+
41
+ Each destination contains the untouched evaluator tree under `evaluator/`, raw `stdout.bin` and `stderr.bin` under `process/`, and `receipt.json` with per-file SHA-256 values plus a whole-tree SHA-256.
42
+ The destination must be unique and absent; an existing path fails loud instead of overwriting evidence.
43
+ Failed evaluators throw `StagedJudgeError` with the same `judgeArtifacts` receipt after retaining partial logs.
44
+
45
+ ## Pier custom candidates
46
+
47
+ The package executes a branded `PreparedAgentCandidateExecution` from `@tangle-network/agent-runtime` through one atomic API and ships `pier_agents.tangle_candidate:TangleCandidateAgent` as its thin Pier transport.
48
+ The executor recreates every input from runtime-verified file bytes and reveals model credentials only inside the claimed execution callback.
49
+ Pier owns the task container and verifier; protected model usage and traces stay in `@tangle-network/agent-eval` and are finalized by the shared runtime.
50
+ `FilePierCandidateTrialController` atomically reserves a unique Pier job, then persists the supervisor PID, process-session identity, and that job's exact Docker projects so a fresh evaluator process can stop and remove an abandoned trial.
51
+ Run `PIER_REPO=/path/to/pier pnpm verify:pier` for the zero-model failure/pass and fresh-process recovery proof, and see `HARNESS.md` for the exact invocation and failure contract.
52
+ From an installed npm package, expose the shipped Python module with `export PYTHONPATH="$(npm root)/@tangle-network/agent-bench${PYTHONPATH:+:$PYTHONPATH}"` before invoking Pier.
@@ -0,0 +1,15 @@
1
+ import { BenchmarkAdapter } from './benchmarks/types.js';
2
+ import '@tangle-network/agent-runtime/loops';
3
+
4
+ /**
5
+ * The benchmark registry — the single source of truth for every wired benchmark.
6
+ * One key per benchmark; the value is its `BenchmarkAdapter` factory. `runBenchmarks`
7
+ * (the unifier) maps over this; `run.ts`, `rsi.ts`, and `corpus-replay.mts` all read it
8
+ * here rather than each keeping their own copy.
9
+ */
10
+
11
+ declare const ADAPTERS: Record<string, () => BenchmarkAdapter>;
12
+ /** Resolve a benchmark key to its adapter, failing loud with the known keys. */
13
+ declare function resolveAdapter(key: string): BenchmarkAdapter;
14
+
15
+ export { ADAPTERS, resolveAdapter };
@@ -0,0 +1,43 @@
1
+ import {
2
+ ADAPTERS,
3
+ resolveAdapter
4
+ } from "./chunk-5SBJCB6W.js";
5
+ import "./chunk-2PVVP7GN.js";
6
+ import "./chunk-VQRS7VUC.js";
7
+ import "./chunk-Z7ML6L77.js";
8
+ import "./chunk-R67DFVLO.js";
9
+ import "./chunk-SEVJPLZC.js";
10
+ import "./chunk-CKUVRZ2T.js";
11
+ import "./chunk-Y6O2OCUO.js";
12
+ import "./chunk-HBSWHQNJ.js";
13
+ import "./chunk-UAIOHCUK.js";
14
+ import "./chunk-R36V2VP7.js";
15
+ import "./chunk-JRWWGMK7.js";
16
+ import "./chunk-INNOYXCP.js";
17
+ import "./chunk-PA2ZKHJC.js";
18
+ import "./chunk-PPYSEKFM.js";
19
+ import "./chunk-TBKU5XQI.js";
20
+ import "./chunk-TSWPNOYM.js";
21
+ import "./chunk-KDIKRJGB.js";
22
+ import "./chunk-ZEWMTR5M.js";
23
+ import "./chunk-PUIRNYI7.js";
24
+ import "./chunk-C7T7WEK2.js";
25
+ import "./chunk-JTHWEDEW.js";
26
+ import "./chunk-2XU6OGEN.js";
27
+ import "./chunk-HHXFIHXC.js";
28
+ import "./chunk-X3BTXCJ4.js";
29
+ import "./chunk-J3KDJNX2.js";
30
+ import "./chunk-X5YKXC6V.js";
31
+ import "./chunk-YCGY7UIZ.js";
32
+ import "./chunk-UPAMRDX4.js";
33
+ import "./chunk-ODT47UAY.js";
34
+ import "./chunk-7WSD27QQ.js";
35
+ import "./chunk-SYDW647C.js";
36
+ import "./chunk-IFAV6KEM.js";
37
+ import "./chunk-LRRD7NAG.js";
38
+ import "./chunk-53UPUNBZ.js";
39
+ export {
40
+ ADAPTERS,
41
+ resolveAdapter
42
+ };
43
+ //# sourceMappingURL=adapters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,125 @@
1
+ import { JudgeArtifactReceipt, BenchScore } from './types.js';
2
+ import '@tangle-network/agent-runtime/loops';
3
+
4
+ /**
5
+ * Shared code-bench harness. The "stage the artifact → run the benchmark's own
6
+ * evaluator in an external process (mkdtemp / execFile / .venv python / Docker)
7
+ * → read its JSON report → { resolved, score }" spine that swe-bench,
8
+ * terminal-bench, commit0, programbench and aec-bench all need. Factored out so
9
+ * the Docker/venv/report-reading logic lives in ONE place instead of being
10
+ * copy-pasted per adapter.
11
+ *
12
+ * It owns NO benchmark policy: each adapter passes the argv for its evaluator
13
+ * and a `parseReport` that maps that evaluator's report JSON → a BenchScore. The
14
+ * harness owns process spawning, temp-dir lifecycle, large-buffer/timeout config
15
+ * and fail-loud diagnostics.
16
+ *
17
+ * Fail-loud: an absent .venv / harness / Docker daemon THROWS from `preflight`
18
+ * (the adapter passes the import line + the exact fix). A staged run that exits
19
+ * nonzero throws with the captured stderr — never a fabricated score.
20
+ */
21
+
22
+ /** Repo root for the bench package (…/bench), so `.venv` and `fixtures` resolve. */
23
+ declare const benchRoot: string;
24
+ /** Resolve the shared interpreter without requiring an installed package to contain a venv. */
25
+ declare function resolveBenchPython(env?: Readonly<{
26
+ AGENT_BENCH_PYTHON?: string;
27
+ }>, root?: string): string;
28
+ /** The shared interpreter every Python-backed evaluator runs through. */
29
+ declare const venvPython: string;
30
+ /** Interpreter for a NAMED isolated venv (e.g. `.venv-commit0`). Benches whose pip
31
+ * deps conflict with the shared `.venv` (commit0 downgrades pydantic/sqlalchemy)
32
+ * get their own venv and pass its python explicitly — keeping the shared one clean. */
33
+ declare const venvPythonAt: (venvDir: string) => string;
34
+ /** Report/transcript reads are large; 256 MiB matches the SWE harness budget. */
35
+ declare const bigBuffer: number;
36
+ /** Path to a named executable inside the bench venv (e.g. `venvBin('tb')`). */
37
+ declare function venvBin(name: string): string;
38
+ /**
39
+ * Run the bench venv python with an inline script (`-c`); return stdout. Throws
40
+ * (with stderr) on a nonzero exit — the loaders rely on this to fail loud rather
41
+ * than parse a partial dump.
42
+ */
43
+ declare function runVenvPython(script: string, args?: string[], timeoutMs?: number, python?: string): Promise<string>;
44
+ /**
45
+ * Preflight a python-backed harness: import the module(s) and (optionally) ping
46
+ * Docker, all inside the bench venv. On failure THROWS the captured error joined
47
+ * to the adapter's `fix` guidance — the contract every code-bench preflight wants.
48
+ */
49
+ declare function preflightVenvImports(opts: {
50
+ /** Module names to `import` (e.g. ['swebench']); '' entries are ignored. */
51
+ modules: string[];
52
+ /** Also `docker.from_env().ping()` — true for Docker-backed evaluators. */
53
+ requireDocker?: boolean;
54
+ /** Actionable remediation appended to the thrown message. */
55
+ fix: string;
56
+ /** Override the interpreter (e.g. an isolated `.venv-commit0`). Default: shared `.venv`. */
57
+ python?: string;
58
+ }): Promise<void>;
59
+ /**
60
+ * Run a bench-local python driver script (in the bench venv) while piping
61
+ * `input` to its stdin, returning stdout. The driver's verdict JSON is its LAST
62
+ * stdout line; callers parse that and inspect an `error` field (fail loud).
63
+ *
64
+ * Uses spawn + an explicit `stdin.end(input)` rather than promisify(execFile)'s
65
+ * `input` option, because that option is NOT honored by async execFile — stdin
66
+ * is left open and a driver that does `sys.stdin.read()` blocks forever. The
67
+ * artifact-piping judges (commit0, appworld) MUST go through this.
68
+ */
69
+ declare function runVenvScriptStdin(scriptPath: string, args: string[], input: string, opts?: {
70
+ cwd?: string;
71
+ timeoutMs?: number;
72
+ python?: string;
73
+ }): Promise<string>;
74
+ interface StagedRunSpec {
75
+ /** mkdtemp prefix, e.g. 'swebench-' / 'commit0-'. */
76
+ tmpPrefix: string;
77
+ /**
78
+ * Write the artifact + any harness inputs into the temp dir. Returns nothing;
79
+ * `argv`/`cwd` consume `dir` to point the evaluator at what was written.
80
+ */
81
+ stage(dir: string): Promise<void>;
82
+ /** The external evaluator to spawn. `bin` defaults to the bench venv python. */
83
+ bin?: string;
84
+ /** argv for the evaluator, computed from the temp `dir`. */
85
+ argv(dir: string): string[];
86
+ /** Working directory for the evaluator. Defaults to the temp `dir`. */
87
+ cwd?(dir: string): string;
88
+ /** Hard timeout for the evaluator (ms); 0 = none. */
89
+ timeoutMs?: number;
90
+ /**
91
+ * Read the evaluator's report(s) out of `dir` and map to a BenchScore. Throws
92
+ * if the expected report is absent/malformed (fail loud — no default score).
93
+ */
94
+ parseReport(dir: string): Promise<BenchScore>;
95
+ /**
96
+ * Copy the complete evaluator directory plus raw process stdout/stderr to this
97
+ * caller-owned directory before cleanup. The destination must not exist.
98
+ */
99
+ capture?: StagedRunCaptureSpec;
100
+ /** Keep the temp dir on disk (debugging). Default false → always cleaned up. */
101
+ keepTmp?: boolean;
102
+ }
103
+ interface StagedRunCaptureSpec {
104
+ /** Destination for `evaluator/`, `process/`, and the hashed `receipt.json`. */
105
+ destination: string;
106
+ }
107
+ /** A staged run failed after any requested evidence was durably retained. */
108
+ declare class StagedJudgeError extends Error {
109
+ readonly judgeArtifacts?: JudgeArtifactReceipt;
110
+ constructor(message: string, judgeArtifacts?: JudgeArtifactReceipt, options?: ErrorOptions);
111
+ }
112
+ /**
113
+ * The shared judge body: mkdtemp → stage → spawn evaluator → parseReport →
114
+ * cleanup. The evaluator's stdout/stderr is surfaced on failure; the temp dir is
115
+ * always removed in `finally` unless `keepTmp`.
116
+ */
117
+ declare function runStagedJudge(spec: StagedRunSpec): Promise<BenchScore>;
118
+ /** Read + JSON.parse a report file from a staged run; throws with the path on failure. */
119
+ declare function readJsonReport<T>(path: string): Promise<T>;
120
+ /** Write a UTF-8 file into a staged dir (artifact / preds.json / attempt.sh / …). */
121
+ declare function stageFile(path: string, content: string): Promise<void>;
122
+ /** Sanitize an instance id into a filesystem/run-id-safe token. */
123
+ declare function safeRunId(prefix: string, id: string): string;
124
+
125
+ export { StagedJudgeError, type StagedRunCaptureSpec, type StagedRunSpec, benchRoot, bigBuffer, preflightVenvImports, readJsonReport, resolveBenchPython, runStagedJudge, runVenvPython, runVenvScriptStdin, safeRunId, stageFile, venvBin, venvPython, venvPythonAt };
@@ -0,0 +1,33 @@
1
+ import {
2
+ StagedJudgeError,
3
+ benchRoot,
4
+ bigBuffer,
5
+ preflightVenvImports,
6
+ readJsonReport,
7
+ resolveBenchPython,
8
+ runStagedJudge,
9
+ runVenvPython,
10
+ runVenvScriptStdin,
11
+ safeRunId,
12
+ stageFile,
13
+ venvBin,
14
+ venvPython,
15
+ venvPythonAt
16
+ } from "../chunk-LRRD7NAG.js";
17
+ export {
18
+ StagedJudgeError,
19
+ benchRoot,
20
+ bigBuffer,
21
+ preflightVenvImports,
22
+ readJsonReport,
23
+ resolveBenchPython,
24
+ runStagedJudge,
25
+ runVenvPython,
26
+ runVenvScriptStdin,
27
+ safeRunId,
28
+ stageFile,
29
+ venvBin,
30
+ venvPython,
31
+ venvPythonAt
32
+ };
33
+ //# sourceMappingURL=_harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,27 @@
1
+ import { BenchmarkAdapter } from './types.js';
2
+ import '@tangle-network/agent-runtime/loops';
3
+
4
+ /**
5
+ * AEC-Bench adapter (TheodoreGalanos/aec-bench, MIT) — closed-form
6
+ * Architecture/Engineering/Construction calculation tasks. Worker artifact = a
7
+ * markdown solution ending in a fenced ```json block with the required numeric
8
+ * fields. Judge = the task's OWN `tests/verify.py`, run with python3: it
9
+ * recomputes ground truth from the embedded engineering formulas, extracts the
10
+ * last JSON block from the artifact, scores each field by math.isclose within a
11
+ * per-field rel_tol, and writes {"reward": mean} + per-field details.json.
12
+ * GRADED / partial-credit, FULLY DETERMINISTIC — no LLM judge.
13
+ *
14
+ * Distinct from the multimodal nomic-ai/aec-bench; this is the deterministic
15
+ * calculation platform. The runnable-instance verify.py only needs python3 (no
16
+ * Docker, no Harbor) for the pure-calc disciplines, so the local gate runs at
17
+ * conc<=2 without a container backend.
18
+ *
19
+ * Requires for a live run: network to raw.githubusercontent.com /
20
+ * api.github.com (the in-repo tasks tree) + a python3 interpreter (the bench
21
+ * venv) to run verify.py. For offline/CI, set AEC_FIXTURES=1 to load the
22
+ * committed fixtures (bench/fixtures/aec-bench.json) — never a silent fallback.
23
+ */
24
+
25
+ declare function createAecBenchAdapter(): BenchmarkAdapter;
26
+
27
+ export { createAecBenchAdapter };