probity-ratchet 0.1.0__tar.gz

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 (369) hide show
  1. probity_ratchet-0.1.0/.github/workflows/ci.yml +82 -0
  2. probity_ratchet-0.1.0/.gitignore +14 -0
  3. probity_ratchet-0.1.0/LICENSE +202 -0
  4. probity_ratchet-0.1.0/PKG-INFO +96 -0
  5. probity_ratchet-0.1.0/README.md +70 -0
  6. probity_ratchet-0.1.0/docker/compose.yaml +31 -0
  7. probity_ratchet-0.1.0/docs/ADMISSION.md +59 -0
  8. probity_ratchet-0.1.0/docs/ARCHITECTURE.md +85 -0
  9. probity_ratchet-0.1.0/docs/CONTRACT.md +348 -0
  10. probity_ratchet-0.1.0/docs/RESULTS.md +20 -0
  11. probity_ratchet-0.1.0/docs/RUNNING.md +86 -0
  12. probity_ratchet-0.1.0/docs/VERIFY.md +166 -0
  13. probity_ratchet-0.1.0/docs/demo/.gitignore +4 -0
  14. probity_ratchet-0.1.0/docs/demo/DEMO-SCRIPT.md +187 -0
  15. probity_ratchet-0.1.0/docs/demo/VIDEO-PLAN.md +105 -0
  16. probity_ratchet-0.1.0/docs/demo/demo.py +303 -0
  17. probity_ratchet-0.1.0/docs/demo/denied_read.py +43 -0
  18. probity_ratchet-0.1.0/docs/demo/derive_ids.py +836 -0
  19. probity_ratchet-0.1.0/docs/demo/steps.demo.toml +101 -0
  20. probity_ratchet-0.1.0/docs/demo/video/check.py +100 -0
  21. probity_ratchet-0.1.0/docs/demo/video/drive.py +206 -0
  22. probity_ratchet-0.1.0/docs/demo/video/narrate.sh +10 -0
  23. probity_ratchet-0.1.0/docs/demo/video/pipeline_fixture.py +72 -0
  24. probity_ratchet-0.1.0/docs/demo/video/record.sh +85 -0
  25. probity_ratchet-0.1.0/docs/demo/video/render.py +349 -0
  26. probity_ratchet-0.1.0/docs/demo/video/setup.sh +42 -0
  27. probity_ratchet-0.1.0/docs/demo/video/steps.submission.toml +131 -0
  28. probity_ratchet-0.1.0/docs/demo/video/steps.test.toml +25 -0
  29. probity_ratchet-0.1.0/docs/results/agentdojo.md +392 -0
  30. probity_ratchet-0.1.0/docs/results/archive.json +2389 -0
  31. probity_ratchet-0.1.0/docs/results/atlas-probes.md +246 -0
  32. probity_ratchet-0.1.0/docs/results/hooks-replay.md +17 -0
  33. probity_ratchet-0.1.0/docs/results/tau-airline.md +76 -0
  34. probity_ratchet-0.1.0/docs/results/tau-retail.md +85 -0
  35. probity_ratchet-0.1.0/docs/results/terminal-bench.md +104 -0
  36. probity_ratchet-0.1.0/docs/results/transfer.md +227 -0
  37. probity_ratchet-0.1.0/docs/results/v3-live.md +20 -0
  38. probity_ratchet-0.1.0/examples/claude-code/README.md +112 -0
  39. probity_ratchet-0.1.0/examples/claude-code/build.py +83 -0
  40. probity_ratchet-0.1.0/examples/claude-code/expected_fires.txt +3 -0
  41. probity_ratchet-0.1.0/examples/claude-code/harness.json +17 -0
  42. probity_ratchet-0.1.0/examples/claude-code/hooks/ratchet_no_force_push_main.py +1522 -0
  43. probity_ratchet-0.1.0/examples/claude-code/no_force_push_main.py +281 -0
  44. probity_ratchet-0.1.0/examples/claude-code/public_key.txt +1 -0
  45. probity_ratchet-0.1.0/examples/claude-code/receipt.json +1 -0
  46. probity_ratchet-0.1.0/examples/claude-code/replay.json +56 -0
  47. probity_ratchet-0.1.0/examples/claude-code/settings.json +19 -0
  48. probity_ratchet-0.1.0/examples/claude-code/transcripts/force-push-feature-branch.jsonl +9 -0
  49. probity_ratchet-0.1.0/examples/claude-code/transcripts/force-push-on-main.jsonl +9 -0
  50. probity_ratchet-0.1.0/examples/claude-code/transcripts/mentions-only.jsonl +9 -0
  51. probity_ratchet-0.1.0/examples/claude-code/transcripts/prune-branches/subagents/agent-a1b2c3.jsonl +5 -0
  52. probity_ratchet-0.1.0/examples/claude-code/transcripts/prune-branches.jsonl +3 -0
  53. probity_ratchet-0.1.0/examples/claude-code/transcripts/refspec-onto-main.jsonl +3 -0
  54. probity_ratchet-0.1.0/keys/ratchet-decisions.pub +3 -0
  55. probity_ratchet-0.1.0/pyproject.toml +125 -0
  56. probity_ratchet-0.1.0/scripts/check-docs.py +191 -0
  57. probity_ratchet-0.1.0/scripts/readme-lint.py +123 -0
  58. probity_ratchet-0.1.0/src/ratchet/__init__.py +1 -0
  59. probity_ratchet-0.1.0/src/ratchet/agent/__init__.py +0 -0
  60. probity_ratchet-0.1.0/src/ratchet/agent/_guard_child.py +393 -0
  61. probity_ratchet-0.1.0/src/ratchet/agent/guards.py +494 -0
  62. probity_ratchet-0.1.0/src/ratchet/agent/model.py +324 -0
  63. probity_ratchet-0.1.0/src/ratchet/agent/seed.py +52 -0
  64. probity_ratchet-0.1.0/src/ratchet/agent/worker.py +407 -0
  65. probity_ratchet-0.1.0/src/ratchet/atlas_features/__init__.py +1 -0
  66. probity_ratchet-0.1.0/src/ratchet/atlas_features/agent_engine.py +362 -0
  67. probity_ratchet-0.1.0/src/ratchet/atlas_features/autoembed.py +194 -0
  68. probity_ratchet-0.1.0/src/ratchet/atlas_features/common.py +171 -0
  69. probity_ratchet-0.1.0/src/ratchet/atlas_features/dataset.py +268 -0
  70. probity_ratchet-0.1.0/src/ratchet/atlas_features/failure_memory.js +52 -0
  71. probity_ratchet-0.1.0/src/ratchet/atlas_features/fusion.py +330 -0
  72. probity_ratchet-0.1.0/src/ratchet/atlas_features/mcp_probe.py +238 -0
  73. probity_ratchet-0.1.0/src/ratchet/atlas_features/triggers.py +301 -0
  74. probity_ratchet-0.1.0/src/ratchet/bench/__init__.py +1 -0
  75. probity_ratchet-0.1.0/src/ratchet/bench/agentdojo/__init__.py +8 -0
  76. probity_ratchet-0.1.0/src/ratchet/bench/agentdojo/__main__.py +220 -0
  77. probity_ratchet-0.1.0/src/ratchet/bench/agentdojo/cases.py +166 -0
  78. probity_ratchet-0.1.0/src/ratchet/bench/agentdojo/experiment.py +326 -0
  79. probity_ratchet-0.1.0/src/ratchet/bench/agentdojo/metrics.py +100 -0
  80. probity_ratchet-0.1.0/src/ratchet/bench/agentdojo/report.py +181 -0
  81. probity_ratchet-0.1.0/src/ratchet/bench/agentdojo/run.py +193 -0
  82. probity_ratchet-0.1.0/src/ratchet/bench/agentdojo/world.py +181 -0
  83. probity_ratchet-0.1.0/src/ratchet/bench/tau/__init__.py +0 -0
  84. probity_ratchet-0.1.0/src/ratchet/bench/tau/__main__.py +288 -0
  85. probity_ratchet-0.1.0/src/ratchet/bench/tau/conversation.py +192 -0
  86. probity_ratchet-0.1.0/src/ratchet/bench/tau/metrics.py +54 -0
  87. probity_ratchet-0.1.0/src/ratchet/bench/tau/report.py +255 -0
  88. probity_ratchet-0.1.0/src/ratchet/bench/tau/runner.py +231 -0
  89. probity_ratchet-0.1.0/src/ratchet/bench/tau/store.py +108 -0
  90. probity_ratchet-0.1.0/src/ratchet/bench/tau/tasks.py +140 -0
  91. probity_ratchet-0.1.0/src/ratchet/bench/tau/world.py +229 -0
  92. probity_ratchet-0.1.0/src/ratchet/bench/tau2/__init__.py +13 -0
  93. probity_ratchet-0.1.0/src/ratchet/bench/tau2/__main__.py +529 -0
  94. probity_ratchet-0.1.0/src/ratchet/bench/tau2/conversation.py +152 -0
  95. probity_ratchet-0.1.0/src/ratchet/bench/tau2/data.py +108 -0
  96. probity_ratchet-0.1.0/src/ratchet/bench/tau2/evolve.py +146 -0
  97. probity_ratchet-0.1.0/src/ratchet/bench/tau2/report.py +302 -0
  98. probity_ratchet-0.1.0/src/ratchet/bench/tau2/results.py +165 -0
  99. probity_ratchet-0.1.0/src/ratchet/bench/tau2/runner.py +216 -0
  100. probity_ratchet-0.1.0/src/ratchet/bench/tau2/tasks.py +95 -0
  101. probity_ratchet-0.1.0/src/ratchet/bench/tau2/world.py +446 -0
  102. probity_ratchet-0.1.0/src/ratchet/bench/terminal/__init__.py +2 -0
  103. probity_ratchet-0.1.0/src/ratchet/bench/terminal/__main__.py +450 -0
  104. probity_ratchet-0.1.0/src/ratchet/bench/terminal/container.py +142 -0
  105. probity_ratchet-0.1.0/src/ratchet/bench/terminal/grade.py +185 -0
  106. probity_ratchet-0.1.0/src/ratchet/bench/terminal/report.py +104 -0
  107. probity_ratchet-0.1.0/src/ratchet/bench/terminal/runner.py +163 -0
  108. probity_ratchet-0.1.0/src/ratchet/bench/terminal/split-heldout-6-5.json +44 -0
  109. probity_ratchet-0.1.0/src/ratchet/bench/terminal/split.json +40 -0
  110. probity_ratchet-0.1.0/src/ratchet/bench/terminal/tasks.py +251 -0
  111. probity_ratchet-0.1.0/src/ratchet/bench/terminal/world.py +389 -0
  112. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/__init__.py +10 -0
  113. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/__main__.py +405 -0
  114. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/_compat.py +36 -0
  115. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/cases.py +205 -0
  116. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/gate.py +55 -0
  117. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/grading.py +173 -0
  118. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/metrics.py +136 -0
  119. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/replay.py +123 -0
  120. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/report.py +311 -0
  121. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/runner.py +172 -0
  122. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/store.py +47 -0
  123. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/user.py +130 -0
  124. probity_ratchet-0.1.0/src/ratchet/bench/toolsandbox/world.py +294 -0
  125. probity_ratchet-0.1.0/src/ratchet/bench/transfer/__init__.py +18 -0
  126. probity_ratchet-0.1.0/src/ratchet/bench/transfer/__main__.py +360 -0
  127. probity_ratchet-0.1.0/src/ratchet/bench/transfer/analysis.py +208 -0
  128. probity_ratchet-0.1.0/src/ratchet/bench/transfer/render.py +176 -0
  129. probity_ratchet-0.1.0/src/ratchet/bench/transfer/run.py +365 -0
  130. probity_ratchet-0.1.0/src/ratchet/cases/FROZEN.sha256 +1 -0
  131. probity_ratchet-0.1.0/src/ratchet/cases/__init__.py +22 -0
  132. probity_ratchet-0.1.0/src/ratchet/cases/build.py +293 -0
  133. probity_ratchet-0.1.0/src/ratchet/cases/families/__init__.py +1 -0
  134. probity_ratchet-0.1.0/src/ratchet/cases/families/approval_revoked.py +240 -0
  135. probity_ratchet-0.1.0/src/ratchet/cases/families/concurrent_worker.py +251 -0
  136. probity_ratchet-0.1.0/src/ratchet/cases/families/injection.py +347 -0
  137. probity_ratchet-0.1.0/src/ratchet/cases/families/order_modification.py +431 -0
  138. probity_ratchet-0.1.0/src/ratchet/cases/families/ordinary.py +172 -0
  139. probity_ratchet-0.1.0/src/ratchet/cases/families/policy_changed.py +269 -0
  140. probity_ratchet-0.1.0/src/ratchet/cases/families/reconciliation.py +276 -0
  141. probity_ratchet-0.1.0/src/ratchet/cases/families/refund_lost_reply.py +235 -0
  142. probity_ratchet-0.1.0/src/ratchet/cases/grade.py +23 -0
  143. probity_ratchet-0.1.0/src/ratchet/cases/grading.py +299 -0
  144. probity_ratchet-0.1.0/src/ratchet/cases/model.py +85 -0
  145. probity_ratchet-0.1.0/src/ratchet/cases/registry.py +84 -0
  146. probity_ratchet-0.1.0/src/ratchet/cases/solvers.py +397 -0
  147. probity_ratchet-0.1.0/src/ratchet/cli.py +659 -0
  148. probity_ratchet-0.1.0/src/ratchet/demo/__init__.py +1 -0
  149. probity_ratchet-0.1.0/src/ratchet/demo/scenario.py +256 -0
  150. probity_ratchet-0.1.0/src/ratchet/demo/worker.py +108 -0
  151. probity_ratchet-0.1.0/src/ratchet/export/__init__.py +1 -0
  152. probity_ratchet-0.1.0/src/ratchet/export/claude_code.py +351 -0
  153. probity_ratchet-0.1.0/src/ratchet/export/hookrt.py +827 -0
  154. probity_ratchet-0.1.0/src/ratchet/export/mcp_gateway.py +411 -0
  155. probity_ratchet-0.1.0/src/ratchet/export/replay_transcripts.py +273 -0
  156. probity_ratchet-0.1.0/src/ratchet/improve/__init__.py +0 -0
  157. probity_ratchet-0.1.0/src/ratchet/improve/activate.py +212 -0
  158. probity_ratchet-0.1.0/src/ratchet/improve/admit.py +476 -0
  159. probity_ratchet-0.1.0/src/ratchet/improve/archive.py +742 -0
  160. probity_ratchet-0.1.0/src/ratchet/improve/diagnose.py +216 -0
  161. probity_ratchet-0.1.0/src/ratchet/improve/evaluate.py +251 -0
  162. probity_ratchet-0.1.0/src/ratchet/improve/evaluator.py +61 -0
  163. probity_ratchet-0.1.0/src/ratchet/improve/instruction_search.py +1161 -0
  164. probity_ratchet-0.1.0/src/ratchet/improve/llm.py +90 -0
  165. probity_ratchet-0.1.0/src/ratchet/improve/loop.py +905 -0
  166. probity_ratchet-0.1.0/src/ratchet/improve/overfit.py +96 -0
  167. probity_ratchet-0.1.0/src/ratchet/improve/propose.py +343 -0
  168. probity_ratchet-0.1.0/src/ratchet/improve/recall.py +675 -0
  169. probity_ratchet-0.1.0/src/ratchet/improve/receipt.py +143 -0
  170. probity_ratchet-0.1.0/src/ratchet/improve/replay.py +279 -0
  171. probity_ratchet-0.1.0/src/ratchet/improve/run.py +199 -0
  172. probity_ratchet-0.1.0/src/ratchet/improve/run_det.py +243 -0
  173. probity_ratchet-0.1.0/src/ratchet/improve/run_v3.py +353 -0
  174. probity_ratchet-0.1.0/src/ratchet/improve/sandbox.py +30 -0
  175. probity_ratchet-0.1.0/src/ratchet/improve/sim.py +91 -0
  176. probity_ratchet-0.1.0/src/ratchet/improve/stochastic.py +209 -0
  177. probity_ratchet-0.1.0/src/ratchet/improve/worldsim.py +48 -0
  178. probity_ratchet-0.1.0/src/ratchet/py.typed +0 -0
  179. probity_ratchet-0.1.0/src/ratchet/store/__init__.py +24 -0
  180. probity_ratchet-0.1.0/src/ratchet/store/__main__.py +5 -0
  181. probity_ratchet-0.1.0/src/ratchet/store/atlas.py +776 -0
  182. probity_ratchet-0.1.0/src/ratchet/store/atlas_admin.py +79 -0
  183. probity_ratchet-0.1.0/src/ratchet/store/atlas_setup.py +195 -0
  184. probity_ratchet-0.1.0/src/ratchet/store/embed.py +192 -0
  185. probity_ratchet-0.1.0/src/ratchet/telemetry/__init__.py +10 -0
  186. probity_ratchet-0.1.0/src/ratchet/telemetry/raindrop.py +684 -0
  187. probity_ratchet-0.1.0/src/ratchet/telemetry/smoke.py +242 -0
  188. probity_ratchet-0.1.0/src/ratchet/types.py +168 -0
  189. probity_ratchet-0.1.0/src/ratchet/verify/__init__.py +17 -0
  190. probity_ratchet-0.1.0/src/ratchet/verify/__main__.py +3 -0
  191. probity_ratchet-0.1.0/src/ratchet/verify/adapter.py +408 -0
  192. probity_ratchet-0.1.0/src/ratchet/verify/cli.py +91 -0
  193. probity_ratchet-0.1.0/src/ratchet/verify/dsse.py +112 -0
  194. probity_ratchet-0.1.0/src/ratchet/verify/evidence.py +195 -0
  195. probity_ratchet-0.1.0/src/ratchet/verify/keys.py +34 -0
  196. probity_ratchet-0.1.0/src/ratchet/verify/receipt.py +274 -0
  197. probity_ratchet-0.1.0/src/ratchet/verify/recompute.py +165 -0
  198. probity_ratchet-0.1.0/src/ratchet/view/__init__.py +1 -0
  199. probity_ratchet-0.1.0/src/ratchet/view/admission.py +231 -0
  200. probity_ratchet-0.1.0/src/ratchet/view/data.py +373 -0
  201. probity_ratchet-0.1.0/src/ratchet/view/evidence.py +203 -0
  202. probity_ratchet-0.1.0/src/ratchet/view/lineage.py +92 -0
  203. probity_ratchet-0.1.0/src/ratchet/view/live.py +250 -0
  204. probity_ratchet-0.1.0/src/ratchet/view/matrix.py +460 -0
  205. probity_ratchet-0.1.0/src/ratchet/view/report.py +340 -0
  206. probity_ratchet-0.1.0/src/ratchet/view/resume.py +277 -0
  207. probity_ratchet-0.1.0/src/ratchet/view/show.py +312 -0
  208. probity_ratchet-0.1.0/src/ratchet/view/telemetry.py +190 -0
  209. probity_ratchet-0.1.0/src/ratchet/view/verify.py +204 -0
  210. probity_ratchet-0.1.0/src/ratchet/world/__init__.py +18 -0
  211. probity_ratchet-0.1.0/src/ratchet/world/approvals.py +68 -0
  212. probity_ratchet-0.1.0/src/ratchet/world/billing.py +142 -0
  213. probity_ratchet-0.1.0/src/ratchet/world/catalog.py +35 -0
  214. probity_ratchet-0.1.0/src/ratchet/world/core.py +229 -0
  215. probity_ratchet-0.1.0/src/ratchet/world/customers.py +50 -0
  216. probity_ratchet-0.1.0/src/ratchet/world/faults.py +36 -0
  217. probity_ratchet-0.1.0/src/ratchet/world/mail.py +74 -0
  218. probity_ratchet-0.1.0/src/ratchet/world/orders.py +146 -0
  219. probity_ratchet-0.1.0/src/ratchet/world/payments.py +176 -0
  220. probity_ratchet-0.1.0/src/ratchet/world/policy.py +54 -0
  221. probity_ratchet-0.1.0/src/ratchet/world/subscriptions.py +70 -0
  222. probity_ratchet-0.1.0/src/ratchet/world/system.py +141 -0
  223. probity_ratchet-0.1.0/src/ratchet/world/tickets.py +88 -0
  224. probity_ratchet-0.1.0/src/ratchet/world/view.py +66 -0
  225. probity_ratchet-0.1.0/tests/agent/__init__.py +0 -0
  226. probity_ratchet-0.1.0/tests/agent/test_guard_child.py +162 -0
  227. probity_ratchet-0.1.0/tests/agent/test_guards.py +406 -0
  228. probity_ratchet-0.1.0/tests/agent/test_model.py +232 -0
  229. probity_ratchet-0.1.0/tests/agent/test_seed.py +18 -0
  230. probity_ratchet-0.1.0/tests/agent/test_worker.py +412 -0
  231. probity_ratchet-0.1.0/tests/agent/test_worker_integration.py +86 -0
  232. probity_ratchet-0.1.0/tests/atlas_features/atlas_fakes.py +112 -0
  233. probity_ratchet-0.1.0/tests/atlas_features/conftest.py +41 -0
  234. probity_ratchet-0.1.0/tests/atlas_features/test_agent_engine.py +149 -0
  235. probity_ratchet-0.1.0/tests/atlas_features/test_agent_engine_unit.py +226 -0
  236. probity_ratchet-0.1.0/tests/atlas_features/test_autoembed.py +33 -0
  237. probity_ratchet-0.1.0/tests/atlas_features/test_autoembed_unit.py +88 -0
  238. probity_ratchet-0.1.0/tests/atlas_features/test_common.py +131 -0
  239. probity_ratchet-0.1.0/tests/atlas_features/test_fusion.py +71 -0
  240. probity_ratchet-0.1.0/tests/atlas_features/test_fusion_unit.py +125 -0
  241. probity_ratchet-0.1.0/tests/atlas_features/test_mcp_probe.py +51 -0
  242. probity_ratchet-0.1.0/tests/atlas_features/test_mcp_probe_unit.py +127 -0
  243. probity_ratchet-0.1.0/tests/atlas_features/test_triggers.py +96 -0
  244. probity_ratchet-0.1.0/tests/atlas_features/test_triggers_unit.py +212 -0
  245. probity_ratchet-0.1.0/tests/bench/agentdojo/conftest.py +20 -0
  246. probity_ratchet-0.1.0/tests/bench/agentdojo/dojo_fakes.py +42 -0
  247. probity_ratchet-0.1.0/tests/bench/agentdojo/test_dojo_cases.py +72 -0
  248. probity_ratchet-0.1.0/tests/bench/agentdojo/test_dojo_experiment.py +230 -0
  249. probity_ratchet-0.1.0/tests/bench/agentdojo/test_dojo_metrics_report.py +167 -0
  250. probity_ratchet-0.1.0/tests/bench/agentdojo/test_dojo_run.py +175 -0
  251. probity_ratchet-0.1.0/tests/bench/agentdojo/test_dojo_world.py +143 -0
  252. probity_ratchet-0.1.0/tests/bench/tau/tau_testkit.py +62 -0
  253. probity_ratchet-0.1.0/tests/bench/tau/test_tau_airline.py +56 -0
  254. probity_ratchet-0.1.0/tests/bench/tau/test_tau_cli.py +129 -0
  255. probity_ratchet-0.1.0/tests/bench/tau/test_tau_conversation.py +123 -0
  256. probity_ratchet-0.1.0/tests/bench/tau/test_tau_report.py +95 -0
  257. probity_ratchet-0.1.0/tests/bench/tau/test_tau_runner.py +151 -0
  258. probity_ratchet-0.1.0/tests/bench/tau/test_tau_store.py +34 -0
  259. probity_ratchet-0.1.0/tests/bench/tau/test_tau_tasks_metrics.py +74 -0
  260. probity_ratchet-0.1.0/tests/bench/tau/test_tau_world.py +136 -0
  261. probity_ratchet-0.1.0/tests/bench/tau2/conftest.py +8 -0
  262. probity_ratchet-0.1.0/tests/bench/tau2/tau2_testkit.py +115 -0
  263. probity_ratchet-0.1.0/tests/bench/tau2/test_tau2_cli.py +309 -0
  264. probity_ratchet-0.1.0/tests/bench/tau2/test_tau2_conversation.py +94 -0
  265. probity_ratchet-0.1.0/tests/bench/tau2/test_tau2_data.py +100 -0
  266. probity_ratchet-0.1.0/tests/bench/tau2/test_tau2_evolve.py +69 -0
  267. probity_ratchet-0.1.0/tests/bench/tau2/test_tau2_runner.py +166 -0
  268. probity_ratchet-0.1.0/tests/bench/tau2/test_tau2_tasks.py +51 -0
  269. probity_ratchet-0.1.0/tests/bench/tau2/test_tau2_world.py +201 -0
  270. probity_ratchet-0.1.0/tests/bench/terminal/terminal_testkit.py +163 -0
  271. probity_ratchet-0.1.0/tests/bench/terminal/test_terminal_cli.py +233 -0
  272. probity_ratchet-0.1.0/tests/bench/terminal/test_terminal_container.py +85 -0
  273. probity_ratchet-0.1.0/tests/bench/terminal/test_terminal_grade.py +118 -0
  274. probity_ratchet-0.1.0/tests/bench/terminal/test_terminal_report.py +53 -0
  275. probity_ratchet-0.1.0/tests/bench/terminal/test_terminal_runner.py +158 -0
  276. probity_ratchet-0.1.0/tests/bench/terminal/test_terminal_tasks.py +137 -0
  277. probity_ratchet-0.1.0/tests/bench/terminal/test_terminal_world.py +172 -0
  278. probity_ratchet-0.1.0/tests/bench/toolsandbox/conftest.py +19 -0
  279. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_cases.py +182 -0
  280. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_cli.py +313 -0
  281. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_compat.py +25 -0
  282. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_gate.py +92 -0
  283. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_grading.py +126 -0
  284. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_metrics.py +83 -0
  285. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_replay.py +162 -0
  286. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_report.py +176 -0
  287. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_runner.py +218 -0
  288. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_store.py +37 -0
  289. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_user.py +216 -0
  290. probity_ratchet-0.1.0/tests/bench/toolsandbox/test_toolsandbox_world.py +281 -0
  291. probity_ratchet-0.1.0/tests/bench/toolsandbox/toolsandbox_testkit.py +63 -0
  292. probity_ratchet-0.1.0/tests/bench/transfer/test_transfer_analysis.py +98 -0
  293. probity_ratchet-0.1.0/tests/bench/transfer/test_transfer_run.py +479 -0
  294. probity_ratchet-0.1.0/tests/cases/__init__.py +0 -0
  295. probity_ratchet-0.1.0/tests/cases/test_grading.py +254 -0
  296. probity_ratchet-0.1.0/tests/cases/test_registry.py +105 -0
  297. probity_ratchet-0.1.0/tests/cases/test_solvers.py +72 -0
  298. probity_ratchet-0.1.0/tests/demo/test_derive_ids.py +429 -0
  299. probity_ratchet-0.1.0/tests/demo/test_drive_outcomes.py +107 -0
  300. probity_ratchet-0.1.0/tests/demo/test_scenario.py +71 -0
  301. probity_ratchet-0.1.0/tests/export/__init__.py +0 -0
  302. probity_ratchet-0.1.0/tests/export/conftest.py +38 -0
  303. probity_ratchet-0.1.0/tests/export/synth.py +97 -0
  304. probity_ratchet-0.1.0/tests/export/test_claude_code.py +321 -0
  305. probity_ratchet-0.1.0/tests/export/test_example.py +117 -0
  306. probity_ratchet-0.1.0/tests/export/test_hookrt.py +542 -0
  307. probity_ratchet-0.1.0/tests/export/test_mcp_gateway.py +366 -0
  308. probity_ratchet-0.1.0/tests/export/test_replay_transcripts.py +166 -0
  309. probity_ratchet-0.1.0/tests/improve/__init__.py +0 -0
  310. probity_ratchet-0.1.0/tests/improve/fakes.py +287 -0
  311. probity_ratchet-0.1.0/tests/improve/test_activate.py +103 -0
  312. probity_ratchet-0.1.0/tests/improve/test_admit.py +294 -0
  313. probity_ratchet-0.1.0/tests/improve/test_archive.py +592 -0
  314. probity_ratchet-0.1.0/tests/improve/test_diagnose.py +109 -0
  315. probity_ratchet-0.1.0/tests/improve/test_drivers_v3.py +42 -0
  316. probity_ratchet-0.1.0/tests/improve/test_evaluate.py +88 -0
  317. probity_ratchet-0.1.0/tests/improve/test_evaluator.py +26 -0
  318. probity_ratchet-0.1.0/tests/improve/test_instruction_search.py +613 -0
  319. probity_ratchet-0.1.0/tests/improve/test_loop.py +340 -0
  320. probity_ratchet-0.1.0/tests/improve/test_overfit.py +58 -0
  321. probity_ratchet-0.1.0/tests/improve/test_propose.py +143 -0
  322. probity_ratchet-0.1.0/tests/improve/test_recall.py +687 -0
  323. probity_ratchet-0.1.0/tests/improve/test_receipt.py +130 -0
  324. probity_ratchet-0.1.0/tests/improve/test_replay.py +152 -0
  325. probity_ratchet-0.1.0/tests/improve/test_run.py +131 -0
  326. probity_ratchet-0.1.0/tests/improve/test_sandbox.py +54 -0
  327. probity_ratchet-0.1.0/tests/improve/test_stochastic.py +154 -0
  328. probity_ratchet-0.1.0/tests/improve/test_worldsim.py +66 -0
  329. probity_ratchet-0.1.0/tests/store/conftest.py +106 -0
  330. probity_ratchet-0.1.0/tests/store/test_search_retry.py +41 -0
  331. probity_ratchet-0.1.0/tests/store/test_store_integration.py +401 -0
  332. probity_ratchet-0.1.0/tests/store/test_store_roles.py +262 -0
  333. probity_ratchet-0.1.0/tests/store/test_store_unit.py +246 -0
  334. probity_ratchet-0.1.0/tests/telemetry/test_raindrop_sink.py +470 -0
  335. probity_ratchet-0.1.0/tests/telemetry/test_raindrop_smoke.py +144 -0
  336. probity_ratchet-0.1.0/tests/test_cli.py +593 -0
  337. probity_ratchet-0.1.0/tests/test_types.py +28 -0
  338. probity_ratchet-0.1.0/tests/verify/__init__.py +0 -0
  339. probity_ratchet-0.1.0/tests/verify/conftest.py +15 -0
  340. probity_ratchet-0.1.0/tests/verify/helpers.py +142 -0
  341. probity_ratchet-0.1.0/tests/verify/test_adapter.py +218 -0
  342. probity_ratchet-0.1.0/tests/verify/test_admission_vectors.py +127 -0
  343. probity_ratchet-0.1.0/tests/verify/test_cli.py +137 -0
  344. probity_ratchet-0.1.0/tests/verify/test_dsse_keys.py +89 -0
  345. probity_ratchet-0.1.0/tests/verify/test_evidence.py +544 -0
  346. probity_ratchet-0.1.0/tests/verify/test_pinned_dependencies.py +27 -0
  347. probity_ratchet-0.1.0/tests/verify/test_receipt.py +311 -0
  348. probity_ratchet-0.1.0/tests/view/__init__.py +0 -0
  349. probity_ratchet-0.1.0/tests/view/conftest.py +55 -0
  350. probity_ratchet-0.1.0/tests/view/fakes.py +467 -0
  351. probity_ratchet-0.1.0/tests/view/test_admission.py +79 -0
  352. probity_ratchet-0.1.0/tests/view/test_atlas_integration.py +191 -0
  353. probity_ratchet-0.1.0/tests/view/test_data.py +228 -0
  354. probity_ratchet-0.1.0/tests/view/test_evidence.py +94 -0
  355. probity_ratchet-0.1.0/tests/view/test_lineage.py +85 -0
  356. probity_ratchet-0.1.0/tests/view/test_live.py +210 -0
  357. probity_ratchet-0.1.0/tests/view/test_matrix.py +319 -0
  358. probity_ratchet-0.1.0/tests/view/test_report.py +97 -0
  359. probity_ratchet-0.1.0/tests/view/test_resume.py +160 -0
  360. probity_ratchet-0.1.0/tests/view/test_resume_e2e.py +209 -0
  361. probity_ratchet-0.1.0/tests/view/test_show.py +224 -0
  362. probity_ratchet-0.1.0/tests/view/test_telemetry.py +198 -0
  363. probity_ratchet-0.1.0/tests/view/test_verify.py +142 -0
  364. probity_ratchet-0.1.0/tests/view/test_verify_e2e.py +156 -0
  365. probity_ratchet-0.1.0/tests/world/__init__.py +0 -0
  366. probity_ratchet-0.1.0/tests/world/helpers.py +56 -0
  367. probity_ratchet-0.1.0/tests/world/test_core.py +175 -0
  368. probity_ratchet-0.1.0/tests/world/test_systems.py +171 -0
  369. probity_ratchet-0.1.0/uv.lock +6481 -0
@@ -0,0 +1,82 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: ci-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ env:
16
+ UV_PYTHON: "3.14"
17
+ UV_LOCKED: "1"
18
+
19
+ jobs:
20
+ lint:
21
+ runs-on: ubuntu-24.04
22
+ timeout-minutes: 20
23
+ steps:
24
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25
+ - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
26
+ - run: uv sync --all-groups --all-extras
27
+ - run: uv run ruff check
28
+ - run: uv run ruff format --check
29
+ - run: uv run mypy src
30
+ - run: python3 scripts/readme-lint.py README.md
31
+ # check-docs imports ratchet.cases to count the case families, so it runs inside the synced virtualenv
32
+ - run: uv run python scripts/check-docs.py
33
+
34
+ test:
35
+ runs-on: ubuntu-24.04
36
+ timeout-minutes: 45
37
+ services:
38
+ # Same image, credentials and port mapping as docker/compose.yaml; the "image tag matches compose" step fails the
39
+ # job if the two drift apart.
40
+ atlas:
41
+ image: mongodb/mongodb-atlas-local:8.3.9-20260928T091948Z
42
+ env:
43
+ MONGODB_INITDB_ROOT_USERNAME: ratchet
44
+ MONGODB_INITDB_ROOT_PASSWORD: ratchet-local-dev
45
+ ports:
46
+ - 127.0.0.1:27018:27017
47
+ options: >-
48
+ --hostname ratchet-atlas
49
+ --ulimit nofile=1048576:1048576
50
+ --health-cmd "mongosh -u ratchet -p ratchet-local-dev --quiet --eval 1"
51
+ --health-interval 5s
52
+ --health-timeout 10s
53
+ --health-retries 30
54
+ --health-start-period 20s
55
+ steps:
56
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
57
+ - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
58
+ - name: image tag matches compose
59
+ run: |
60
+ want=$(sed -n 's/^ *image: *//p' docker/compose.yaml | head -1)
61
+ have=$(sed -n 's/^ *image: *\(mongodb\/mongodb-atlas-local:[^ ]*\).*$/\1/p' .github/workflows/ci.yml | head -1)
62
+ echo "compose: $want workflow: $have"
63
+ test -n "$want" && test "$want" = "$have"
64
+ - name: wait until mongot answers search-index calls
65
+ run: |
66
+ id=$(docker ps --filter ancestor="$(sed -n 's/^ *image: *//p' docker/compose.yaml | head -1)" --format '{{.ID}}' | head -1)
67
+ test -n "$id"
68
+ for i in $(seq 1 90); do
69
+ if docker exec "$id" mongosh -u ratchet -p ratchet-local-dev --quiet --eval "db.getSiblingDB('healthprobe').nothing.aggregate([{\$listSearchIndexes:{}}]).toArray().length" >/dev/null 2>&1; then
70
+ echo "search ready after $((i * 5)) s"; exit 0
71
+ fi
72
+ sleep 5
73
+ done
74
+ docker logs --tail 50 "$id"
75
+ exit 1
76
+ - run: uv sync --all-groups --all-extras
77
+ # Default selection: sandbox tests (hackathon cluster secrets) and live tests (VOYAGE_API_KEY) are deselected.
78
+ - name: pytest
79
+ run: >-
80
+ uv run --with pytest-timeout python -m pytest -q -W error --timeout=120 -rfEs --tb=short
81
+ -m "not sandbox and not live"
82
+ --cov=src/ratchet --cov-report=term-missing:skip-covered
@@ -0,0 +1,14 @@
1
+ # Private strategy, captures and research never enter this public repository.
2
+ captures/
3
+ research/
4
+ private/
5
+ .venv/
6
+ __pycache__/
7
+ *.pyc
8
+ .env
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .pytest_cache/
12
+ htmlcov/
13
+ .coverage
14
+ .claude_correlation/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.5
2
+ Name: probity-ratchet
3
+ Version: 0.1.0
4
+ Summary: An agent harness that turns each failure into a proven guard or procedure, with every version and proof kept in MongoDB Atlas.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: agent-evidence-vectors==0.17.7
9
+ Requires-Dist: cryptography>=44
10
+ Requires-Dist: httpx>=0.27
11
+ Requires-Dist: probity-verify==0.1.0
12
+ Requires-Dist: pymongo>=4.10
13
+ Requires-Dist: raindrop-ai==0.0.75
14
+ Requires-Dist: rich>=15.0.0
15
+ Provides-Extra: bench
16
+ Requires-Dist: agentdojo==0.1.35; extra == 'bench'
17
+ Requires-Dist: audioop-lts==0.2.2; (python_full_version >= '3.13') and extra == 'bench'
18
+ Requires-Dist: litellm==1.102.1; extra == 'bench'
19
+ Requires-Dist: tau-bench; extra == 'bench'
20
+ Requires-Dist: tau2; extra == 'bench'
21
+ Requires-Dist: terminal-bench==0.2.18; extra == 'bench'
22
+ Requires-Dist: tool-sandbox; extra == 'bench'
23
+ Provides-Extra: gepa
24
+ Requires-Dist: gepa==0.1.4; extra == 'gepa'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Ratchet
28
+
29
+ Ratchet turns an AI agent's mistakes into tested, signed safety rules, and refuses any change it cannot prove.
30
+
31
+ When an agent fails, Ratchet writes a guard: a small rule that checks each tool call before it runs. It adopts the guard only after a replay (rerunning recorded past conversations through it) and fresh tests on held-out cases (test cases the improver never sees). Each decision is a receipt, a signed record anyone can verify offline.
32
+
33
+ It is for teams running tool-using agents that touch money, accounts or tickets, and need a fix to a failing agent to be proven before it ships.
34
+
35
+ ## Install
36
+
37
+ ```sh
38
+ git clone --branch v0.1.0 https://github.com/probityai/ratchet && cd ratchet
39
+ uv sync
40
+ ```
41
+
42
+ Python 3.12 or later. The guard sandbox needs Linux.
43
+
44
+ ## Try it in 30 seconds
45
+
46
+ No database, no model key. This guard stops force pushes to `main`. It is a single standard-library file, exported from an admitted guard, and it is a Claude Code hook (a script run before each tool call). It denies the call:
47
+
48
+ ```sh
49
+ echo '{"hook_event_name": "PreToolUse", "tool_name": "Bash", "cwd": ".", "tool_input": {"command": "git push --force origin main"}}' \
50
+ | python3 examples/claude-code/hooks/ratchet_no_force_push_main.py; echo "exit $?"
51
+ ```
52
+
53
+ ```text
54
+ blocked by guard no-force-push-main: force push to main rewrites shared history; push a branch and open a pull request instead
55
+ {"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "deny", "permissionDecisionReason": "blocked by guard no-force-push-main: force push to main rewrites shared history; push a branch and open a pull request instead"}}exit 2
56
+ ```
57
+
58
+ Before it was exported, the guard was replayed over six recorded Claude Code sessions: it fired on the three calls it was written for and on none of the other twelve (`examples/claude-code/replay.json`). The hook's header names the receipt (the signed decision) that admitted it; `uv run python -m ratchet.export.claude_code --verify examples/claude-code/hooks/ratchet_no_force_push_main.py` checks that receipt.
59
+
60
+ ## What it does
61
+
62
+ A support agent works in a simulated company: a billing provider, tickets, approvals and mail. Its eight case families are seven kinds of trap, each with benign twins (matching cases where the action is allowed, so a rule that blocks them fails), plus ordinary requests that must succeed. Every case is graded on the final state of every system, never on the agent's words.
63
+
64
+ When the agent fails, the improver proposes a guard or a procedure (written steps for the agent). A change is adopted only if four checks pass: replay; fresh paired tests on held-out cases against the parent harness (the code around the model: prompt, tools and rules); no growth of the agent's authority; and a signed receipt, which verifies offline against a pinned public key. The gates are in [docs/ADMISSION.md](docs/ADMISSION.md). Every version, trace, evaluation and decision, rejections included, lives in MongoDB Atlas.
65
+
66
+ ## Status
67
+
68
+ Version 0.1.0, built on 2026-10-11 at the MongoDB harness hackathon. The suite, graders and rule are frozen before each run. Measured results, with denominators, are in [docs/RESULTS.md](docs/RESULTS.md).
69
+
70
+ ## Docs
71
+
72
+ | Page | What is in it |
73
+ |---|---|
74
+ | [Running](docs/RUNNING.md) | Local Atlas, environment and every command |
75
+ | [Admission rule](docs/ADMISSION.md) | The gates in plain words |
76
+ | [Architecture](docs/ARCHITECTURE.md) | Packages, guard sandbox, storage |
77
+ | [Verifying a decision](docs/VERIFY.md) | Check a receipt offline |
78
+ | [Results](docs/RESULTS.md) | Every measured result and its records |
79
+ | [Claude Code hook](examples/claude-code/README.md) | Prove a guard on your own sessions, then install it |
80
+ | [Build contract](docs/CONTRACT.md) | Types, lane interfaces and the full admission rule |
81
+
82
+ ## Built today and reused
83
+
84
+ The repository's first commit is from 2026-10-11, and everything under `src/ratchet`, `tests`, `examples` and `docs` was written at the event. The rest is a pinned dependency or a service.
85
+
86
+ | Reused | Pin |
87
+ |---|---|
88
+ | Runtime | `pymongo>=4.10`, `httpx>=0.27`, `cryptography>=44`, `rich>=15`, `raindrop-ai==0.0.75` |
89
+ | Earlier work of the same authors | `probity-verify` at commit `b920366`, `agent-evidence-vectors==0.17.7` |
90
+ | Benchmark extra | `agentdojo==0.1.35` (tool outputs carry hidden prompt-injection attacks), `litellm==1.102.1`, `terminal-bench==0.2.18`, `tau-bench` at `59a200c` (simulated customer-service tasks graded on the final database state), `tau2` at `4ce7c03`, `tool-sandbox` at `c8571d7` |
91
+ | Instruction search extra | `gepa==0.1.4` |
92
+ | Services | MongoDB Atlas (`mongodb-atlas-local:8.3.9-20260928T091948Z` for development), Voyage embeddings, Raindrop |
93
+
94
+ The integration that writes and checks Ratchet's own admission records is new. The verifier it calls is not.
95
+
96
+ License: Apache-2.0.
@@ -0,0 +1,70 @@
1
+ # Ratchet
2
+
3
+ Ratchet turns an AI agent's mistakes into tested, signed safety rules, and refuses any change it cannot prove.
4
+
5
+ When an agent fails, Ratchet writes a guard: a small rule that checks each tool call before it runs. It adopts the guard only after a replay (rerunning recorded past conversations through it) and fresh tests on held-out cases (test cases the improver never sees). Each decision is a receipt, a signed record anyone can verify offline.
6
+
7
+ It is for teams running tool-using agents that touch money, accounts or tickets, and need a fix to a failing agent to be proven before it ships.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ git clone --branch v0.1.0 https://github.com/probityai/ratchet && cd ratchet
13
+ uv sync
14
+ ```
15
+
16
+ Python 3.12 or later. The guard sandbox needs Linux.
17
+
18
+ ## Try it in 30 seconds
19
+
20
+ No database, no model key. This guard stops force pushes to `main`. It is a single standard-library file, exported from an admitted guard, and it is a Claude Code hook (a script run before each tool call). It denies the call:
21
+
22
+ ```sh
23
+ echo '{"hook_event_name": "PreToolUse", "tool_name": "Bash", "cwd": ".", "tool_input": {"command": "git push --force origin main"}}' \
24
+ | python3 examples/claude-code/hooks/ratchet_no_force_push_main.py; echo "exit $?"
25
+ ```
26
+
27
+ ```text
28
+ blocked by guard no-force-push-main: force push to main rewrites shared history; push a branch and open a pull request instead
29
+ {"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "deny", "permissionDecisionReason": "blocked by guard no-force-push-main: force push to main rewrites shared history; push a branch and open a pull request instead"}}exit 2
30
+ ```
31
+
32
+ Before it was exported, the guard was replayed over six recorded Claude Code sessions: it fired on the three calls it was written for and on none of the other twelve (`examples/claude-code/replay.json`). The hook's header names the receipt (the signed decision) that admitted it; `uv run python -m ratchet.export.claude_code --verify examples/claude-code/hooks/ratchet_no_force_push_main.py` checks that receipt.
33
+
34
+ ## What it does
35
+
36
+ A support agent works in a simulated company: a billing provider, tickets, approvals and mail. Its eight case families are seven kinds of trap, each with benign twins (matching cases where the action is allowed, so a rule that blocks them fails), plus ordinary requests that must succeed. Every case is graded on the final state of every system, never on the agent's words.
37
+
38
+ When the agent fails, the improver proposes a guard or a procedure (written steps for the agent). A change is adopted only if four checks pass: replay; fresh paired tests on held-out cases against the parent harness (the code around the model: prompt, tools and rules); no growth of the agent's authority; and a signed receipt, which verifies offline against a pinned public key. The gates are in [docs/ADMISSION.md](docs/ADMISSION.md). Every version, trace, evaluation and decision, rejections included, lives in MongoDB Atlas.
39
+
40
+ ## Status
41
+
42
+ Version 0.1.0, built on 2026-10-11 at the MongoDB harness hackathon. The suite, graders and rule are frozen before each run. Measured results, with denominators, are in [docs/RESULTS.md](docs/RESULTS.md).
43
+
44
+ ## Docs
45
+
46
+ | Page | What is in it |
47
+ |---|---|
48
+ | [Running](docs/RUNNING.md) | Local Atlas, environment and every command |
49
+ | [Admission rule](docs/ADMISSION.md) | The gates in plain words |
50
+ | [Architecture](docs/ARCHITECTURE.md) | Packages, guard sandbox, storage |
51
+ | [Verifying a decision](docs/VERIFY.md) | Check a receipt offline |
52
+ | [Results](docs/RESULTS.md) | Every measured result and its records |
53
+ | [Claude Code hook](examples/claude-code/README.md) | Prove a guard on your own sessions, then install it |
54
+ | [Build contract](docs/CONTRACT.md) | Types, lane interfaces and the full admission rule |
55
+
56
+ ## Built today and reused
57
+
58
+ The repository's first commit is from 2026-10-11, and everything under `src/ratchet`, `tests`, `examples` and `docs` was written at the event. The rest is a pinned dependency or a service.
59
+
60
+ | Reused | Pin |
61
+ |---|---|
62
+ | Runtime | `pymongo>=4.10`, `httpx>=0.27`, `cryptography>=44`, `rich>=15`, `raindrop-ai==0.0.75` |
63
+ | Earlier work of the same authors | `probity-verify` at commit `b920366`, `agent-evidence-vectors==0.17.7` |
64
+ | Benchmark extra | `agentdojo==0.1.35` (tool outputs carry hidden prompt-injection attacks), `litellm==1.102.1`, `terminal-bench==0.2.18`, `tau-bench` at `59a200c` (simulated customer-service tasks graded on the final database state), `tau2` at `4ce7c03`, `tool-sandbox` at `c8571d7` |
65
+ | Instruction search extra | `gepa==0.1.4` |
66
+ | Services | MongoDB Atlas (`mongodb-atlas-local:8.3.9-20260928T091948Z` for development), Voyage embeddings, Raindrop |
67
+
68
+ The integration that writes and checks Ratchet's own admission records is new. The verifier it calls is not.
69
+
70
+ License: Apache-2.0.
@@ -0,0 +1,31 @@
1
+ # Local Atlas (mongod + mongot) for development and tests: Atlas Search and Vector Search work offline.
2
+ # Single-node replica set, so change streams and transactions work. Start: docker compose -f docker/compose.yaml up -d --wait
3
+ services:
4
+ atlas:
5
+ image: mongodb/mongodb-atlas-local:8.3.9-20260928T091948Z
6
+ container_name: ratchet-atlas
7
+ hostname: ratchet-atlas
8
+ ports:
9
+ - "127.0.0.1:27018:27017"
10
+ environment:
11
+ MONGODB_INITDB_ROOT_USERNAME: ratchet
12
+ MONGODB_INITDB_ROOT_PASSWORD: ratchet-local-dev
13
+ # WiredTiger keeps a file per collection and index; the default limit panics mongod under test load
14
+ ulimits:
15
+ nofile:
16
+ soft: 1048576
17
+ hard: 1048576
18
+ volumes:
19
+ - ratchet-atlas-data:/data/db
20
+ - ratchet-atlas-config:/data/configdb
21
+ # healthy means mongod AND the search service (mongot) answer, so search-index calls work at once
22
+ healthcheck:
23
+ test: ["CMD", "mongosh", "-u", "ratchet", "-p", "ratchet-local-dev", "--quiet", "--eval", "db.getSiblingDB('healthprobe').nothing.aggregate([{$$listSearchIndexes:{}}]).toArray().length"]
24
+ interval: 5s
25
+ timeout: 10s
26
+ retries: 30
27
+ start_period: 20s
28
+
29
+ volumes:
30
+ ratchet-atlas-data:
31
+ ratchet-atlas-config:
@@ -0,0 +1,59 @@
1
+ # The admission rule, in plain words
2
+
3
+ Ratchet changes an agent's harness only when the change has passed every check below. This page is the
4
+ short version; the exact rule is in [CONTRACT.md](CONTRACT.md).
5
+
6
+ A change is a **guard** (code that blocks a tool call), a **procedure** (written steps), or a **prompt
7
+ section**. The agent being improved is the **parent**. The changed version is the **candidate**.
8
+
9
+ ## Before anything runs
10
+
11
+ The cases, graders, fault schedules, model configuration, evaluator version, replay snapshot and proposal
12
+ budgets are frozen and digested. A candidate is frozen before it is evaluated. If any of these changes, that is a new
13
+ version, and old results are history, not evidence for the new one.
14
+
15
+ ## The checks
16
+
17
+ | # | Check | In plain words |
18
+ |---|---|---|
19
+ | 1 | **Structure and authority** | A change may add guards, procedures and prompt sections, and may shrink the tool list. Existing guards and procedures stay, in order. Existing prompt bytes stay a prefix. Tools can only be removed. A human-signed exception is a separate record, not an ordinary admission |
20
+ | 2 | **Replay** | Each new guard has declared target failures. Using each call's recorded inputs (the call, the state before it, the history before it), the guard must fire on every target at or before the step that caused it, and on no passing trace and no benign twin. Each guard is replayed alone and all guards composed. The whole snapshot is replayed even after a first counterexample; an error or incomplete coverage cannot clear a guard |
21
+ | 3 | **Fresh evaluation** | The parent runs twice and the candidate runs twice on the same held-out cases. A *stable recovery* fails both parent runs and passes both candidate runs: at least two are needed. Every case the parent passed in either run must pass in both candidate runs. No must-succeed regression, and no intervention on a benign twin. All four outcome vectors, the parent's run-to-run disagreement and costs are recorded |
22
+ | 4 | **Overfitting screen** | No case, customer, charge or order identifier, and no copied name or amount, from the fixtures may appear in the change |
23
+ | 5 | **A signed receipt** | The decision binds the candidate, the parent, the policy and evaluator versions, the manifests and every report, and is signed before the change is activated |
24
+
25
+ Cost is recorded in every decision. It is not a gate.
26
+
27
+ ## What the evidence does and does not show
28
+
29
+ - **Replay** shows how a guard behaves on recorded inputs. It does not show that the run would have
30
+ succeeded after the block, so every kind of change also needs fresh evaluation.
31
+ - **Fresh evaluation** shows what the evaluated cases did. It is finite, and neither check proves a change safe in general.
32
+ - **Tool-list monotonicity** is an enforced policy over named capabilities, not a proof of safety.
33
+ - **A signature** shows who signed which decision with which evidence digests. It does not show the evaluator was honest.
34
+ - Every decision lists exactly what was checked, with counts and case ids, and rejected decisions are kept.
35
+
36
+ ## Labels you will see
37
+
38
+ | Label | Meaning |
39
+ |---|---|
40
+ | FRESH | every model call was answered fresh; the only mode that counts as evidence |
41
+ | RECORDED | a stored fresh result shown again, with its timestamp |
42
+ | CACHED | a byte-identical response replay, for debugging only; never evidence |
43
+
44
+ ## Who can see what
45
+
46
+ Held-out cases and their traces live in a database the improver's identity cannot read. The improver receives
47
+ a sanitized report schema, never protected case ids, raw inputs or per-case outcomes. A final audit cohort is
48
+ unused until the harness is frozen.
49
+
50
+ ## Activation
51
+
52
+ Admission and activation are separate. Activation is one idempotent database transaction that checks the
53
+ receipt and the expected active version, so a stale or missing receipt cannot activate a change.
54
+
55
+ ## The improver's own instructions
56
+
57
+ The improver's instructions are versioned too. Two frozen versions are scored on separately held-out
58
+ proposal tasks with the same budget, and counted for invalid, duplicate, rejected and empty proposals. Each
59
+ counted candidate must independently pass the checks above.
@@ -0,0 +1,85 @@
1
+ # Architecture
2
+
3
+ ## The loop
4
+
5
+ ```
6
+ failures --> diagnose --> propose --> replay --> fresh evaluation --> admit --> sign --> activate
7
+ ^ |
8
+ +------------------------------------- the new harness runs the next cases <------------------+
9
+ ```
10
+
11
+ 1. The worker runs cases under the active harness and records every event as a trace.
12
+ 2. The improver clusters the failures and proposes guards, procedures and prompt sections. It sees
13
+ training material only, plus lessons retrieved from earlier attempts on similar failures.
14
+ 3. Each guard is replayed over the recorded traces. No model is called.
15
+ 4. Candidates that survive run on held-out cases, with the parent run twice and the candidate run twice.
16
+ 5. The admission rule decides. The decision, with its evidence digests, is signed.
17
+ 6. Activation moves the active-version pointer in one database transaction that checks the receipt.
18
+
19
+ ## Packages (`src/ratchet`)
20
+
21
+ | Package | Job |
22
+ |---|---|
23
+ | `world` | The simulated company: billing provider, payments, orders, subscriptions, tickets, approvals, mail, policy, and a fault layer that can lose a reply after the action committed |
24
+ | `cases` | Eight case families, trap cases, benign twins and must-succeed cases, split into train, held-out and audit, with graders that read the final state of every system. `FROZEN.sha256` pins the suite |
25
+ | `agent` | The harness bundle, the worker loop, the guard runtime, the chat-completions model client |
26
+ | `store` | Atlas persistence: versions, runs, traces, evaluations, decisions, failure memory, checkpoints, change streams, and the database roles that keep the improver away from held-out cases |
27
+ | `improve` | Diagnosis, proposal, replay, the admission rule, receipts, activation, the version archive, retrieval of similar failures, and the search over the improver's own instructions |
28
+ | `verify` | Independent checking of a receipt through the pinned verifier and a pinned key |
29
+ | `export` | Admitted guards as Claude Code hooks, and replay of a guard over Claude Code session transcripts |
30
+ | `view` | The terminal views and the static report: replay matrix, lineage, trace, decision, live change stream |
31
+ | `bench` | Adapters that run the same loop on public agent benchmarks, plus cross-model transfer runs; the measured results are in [RESULTS.md](RESULTS.md) |
32
+ | `telemetry` | An optional sink that sends runs, evaluations and decisions to Raindrop |
33
+ | `atlas_features` | Probes that run an Atlas capability on the cluster before the product claims it; the results are in [the probe page](results/atlas-probes.md) |
34
+
35
+ ## The guard sandbox
36
+
37
+ A guard is untrusted model output. Its source defines `check(call, view, history)` and returns a reason
38
+ string to block or `None` to allow. Each guard runs in its own child process (`python -I -S`, empty
39
+ environment) that applies, before it reads the source:
40
+
41
+ - resource limits for CPU, memory and time,
42
+ - a new network namespace with no network,
43
+ - a seccomp filter,
44
+ - a Landlock file-system ruleset.
45
+
46
+ The child reports which layers took effect, and the runtime refuses to start one that lacks a required layer.
47
+ Every evaluation re-executes the module source, so a guard carries no state from one call to the next and a
48
+ replay gives the same answer as the live run. A guard that fails to compile, raises, returns something other
49
+ than a string, runs too long or kills its process blocks the call, and the error is recorded.
50
+
51
+ ## What the store keeps
52
+
53
+ | Collection | Holds |
54
+ |---|---|
55
+ | `harness_versions` | Every version, its parent and its digest. A read recomputes the digest and rejects a mismatch |
56
+ | `runs`, `traces`, `trace_chunks` | One trace per document, with events embedded. A trace over 4 MB splits into ordered chunks, and its header is written last, so a crash leaves no half-visible trace |
57
+ | `evals` | Evaluation reports, each labelled FRESH, RECORDED or CACHED |
58
+ | `decisions` | Every admission decision, rejections included, with checks, evidence and the signed envelope |
59
+ | `failures` | Failure summaries with embeddings, searched by vector similarity |
60
+ | `checkpoints` | The state after each committed world call, so a killed run resumes without repeating a side effect |
61
+ | `embedding_cache` | Embeddings keyed by content |
62
+ | `cases` (held-out database) | Held-out cases, in a separate database that the improver's role has no privilege on |
63
+
64
+ Every write is idempotent. A second write of the same document is a no-op, and a second write of different
65
+ content under the same id raises an error instead of replacing history.
66
+
67
+ ## What the improver is allowed to see
68
+
69
+ | Material | Improver | Evaluator |
70
+ |---|---|---|
71
+ | Training cases and traces | yes | yes |
72
+ | Replay results on training traces | yes | yes |
73
+ | Held-out cases and per-case outcomes | no | yes |
74
+ | Final audit cohort | no, until the harness is frozen | yes |
75
+ | Admin and evaluator credentials | no | yes |
76
+
77
+ The improver's database user holds the working database and nothing on held-out cases. The boundary is a
78
+ server-side role, so a bug in Ratchet's code cannot widen it.
79
+
80
+ ## Receipts
81
+
82
+ A decision is canonical JSON, wrapped in a DSSE envelope and signed with Ed25519. The receipt names the
83
+ candidate, the parent, the policy and evaluator versions, the corpus snapshot and every report digest.
84
+ `ratchet verify` and `python -m ratchet.verify` check it against a public key that was pinned before the
85
+ receipt existed. [VERIFY.md](VERIFY.md) lists the pins.