loopmath 0.0.1__tar.gz → 0.2.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 (363) hide show
  1. loopmath-0.2.0/LICENSE +21 -0
  2. loopmath-0.2.0/PKG-INFO +266 -0
  3. loopmath-0.2.0/README.md +228 -0
  4. loopmath-0.2.0/pyproject.toml +111 -0
  5. loopmath-0.2.0/setup.cfg +4 -0
  6. loopmath-0.2.0/spec/ocp-v0.2.schema.json +373 -0
  7. loopmath-0.2.0/spec/ocp-v0.schema.json +244 -0
  8. loopmath-0.2.0/spec/ocp_conformance.py +22 -0
  9. loopmath-0.2.0/src/loopmath/__init__.py +8 -0
  10. loopmath-0.2.0/src/loopmath/__main__.py +7 -0
  11. loopmath-0.2.0/src/loopmath/adapter_host.py +311 -0
  12. loopmath-0.2.0/src/loopmath/adapters/__init__.py +44 -0
  13. loopmath-0.2.0/src/loopmath/adapters/atrium.py +494 -0
  14. loopmath-0.2.0/src/loopmath/adapters/base.py +349 -0
  15. loopmath-0.2.0/src/loopmath/adapters/bb.py +450 -0
  16. loopmath-0.2.0/src/loopmath/adapters/bb_support.py +253 -0
  17. loopmath-0.2.0/src/loopmath/adapters/omp.py +458 -0
  18. loopmath-0.2.0/src/loopmath/adapters/omp_facts.py +357 -0
  19. loopmath-0.2.0/src/loopmath/adapters/omp_links.py +158 -0
  20. loopmath-0.2.0/src/loopmath/adapters/omp_parse.py +246 -0
  21. loopmath-0.2.0/src/loopmath/adapters/omp_types.py +89 -0
  22. loopmath-0.2.0/src/loopmath/adapters/opencode.py +477 -0
  23. loopmath-0.2.0/src/loopmath/adapters/opencode_store.py +385 -0
  24. loopmath-0.2.0/src/loopmath/adapters/orca.py +483 -0
  25. loopmath-0.2.0/src/loopmath/adapters/otel_genai.py +480 -0
  26. loopmath-0.2.0/src/loopmath/adapters/otel_genai_graph.py +377 -0
  27. loopmath-0.2.0/src/loopmath/adapters/otel_genai_parse.py +237 -0
  28. loopmath-0.2.0/src/loopmath/adapters/otel_genai_types.py +216 -0
  29. loopmath-0.2.0/src/loopmath/adapters/otel_genai_usage.py +282 -0
  30. loopmath-0.2.0/src/loopmath/adapters/paseo.py +441 -0
  31. loopmath-0.2.0/src/loopmath/adapters/pi.py +240 -0
  32. loopmath-0.2.0/src/loopmath/adapters/pi_support.py +466 -0
  33. loopmath-0.2.0/src/loopmath/adapters/registry.py +86 -0
  34. loopmath-0.2.0/src/loopmath/belief/__init__.py +4 -0
  35. loopmath-0.2.0/src/loopmath/belief/block.py +169 -0
  36. loopmath-0.2.0/src/loopmath/belief/check_pymc.py +111 -0
  37. loopmath-0.2.0/src/loopmath/belief/commands.py +159 -0
  38. loopmath-0.2.0/src/loopmath/belief/compose.py +209 -0
  39. loopmath-0.2.0/src/loopmath/belief/design.py +841 -0
  40. loopmath-0.2.0/src/loopmath/belief/features.py +218 -0
  41. loopmath-0.2.0/src/loopmath/belief/fit.py +691 -0
  42. loopmath-0.2.0/src/loopmath/belief/forest.py +223 -0
  43. loopmath-0.2.0/src/loopmath/belief/gaussian.py +492 -0
  44. loopmath-0.2.0/src/loopmath/belief/lookahead.py +405 -0
  45. loopmath-0.2.0/src/loopmath/belief/outcome.py +154 -0
  46. loopmath-0.2.0/src/loopmath/belief/priors.py +139 -0
  47. loopmath-0.2.0/src/loopmath/belief/state.py +945 -0
  48. loopmath-0.2.0/src/loopmath/cli.py +495 -0
  49. loopmath-0.2.0/src/loopmath/cli_graph.py +340 -0
  50. loopmath-0.2.0/src/loopmath/cli_registry.py +458 -0
  51. loopmath-0.2.0/src/loopmath/cli_support.py +403 -0
  52. loopmath-0.2.0/src/loopmath/e0/__init__.py +1 -0
  53. loopmath-0.2.0/src/loopmath/e0/arms.py +222 -0
  54. loopmath-0.2.0/src/loopmath/e0/cli_e0.py +206 -0
  55. loopmath-0.2.0/src/loopmath/e0/estimate.py +462 -0
  56. loopmath-0.2.0/src/loopmath/e0/estimate_rework.py +153 -0
  57. loopmath-0.2.0/src/loopmath/e0/figures.py +463 -0
  58. loopmath-0.2.0/src/loopmath/e0/io.py +194 -0
  59. loopmath-0.2.0/src/loopmath/e0/verb.py +30 -0
  60. loopmath-0.2.0/src/loopmath/explain.py +86 -0
  61. loopmath-0.2.0/src/loopmath/fit.py +279 -0
  62. loopmath-0.2.0/src/loopmath/fit_assembly.py +258 -0
  63. loopmath-0.2.0/src/loopmath/fit_bayes.py +184 -0
  64. loopmath-0.2.0/src/loopmath/fit_masks.py +160 -0
  65. loopmath-0.2.0/src/loopmath/fit_predict.py +118 -0
  66. loopmath-0.2.0/src/loopmath/fit_pricing.py +363 -0
  67. loopmath-0.2.0/src/loopmath/fit_transfer.py +300 -0
  68. loopmath-0.2.0/src/loopmath/gaps.py +182 -0
  69. loopmath-0.2.0/src/loopmath/gitwalk.py +49 -0
  70. loopmath-0.2.0/src/loopmath/grade.py +407 -0
  71. loopmath-0.2.0/src/loopmath/grade_support.py +338 -0
  72. loopmath-0.2.0/src/loopmath/graph/__init__.py +8 -0
  73. loopmath-0.2.0/src/loopmath/graph/artifact_git.py +223 -0
  74. loopmath-0.2.0/src/loopmath/graph/artifact_join.py +238 -0
  75. loopmath-0.2.0/src/loopmath/graph/artifact_kinds.py +155 -0
  76. loopmath-0.2.0/src/loopmath/graph/artifacts.py +70 -0
  77. loopmath-0.2.0/src/loopmath/graph/bashparse.py +250 -0
  78. loopmath-0.2.0/src/loopmath/graph/bashread_ops.py +158 -0
  79. loopmath-0.2.0/src/loopmath/graph/bashwrite_ops.py +124 -0
  80. loopmath-0.2.0/src/loopmath/graph/bashwrites.py +10 -0
  81. loopmath-0.2.0/src/loopmath/graph/cache.py +269 -0
  82. loopmath-0.2.0/src/loopmath/graph/codexio.py +12 -0
  83. loopmath-0.2.0/src/loopmath/graph/codexio_parse.py +392 -0
  84. loopmath-0.2.0/src/loopmath/graph/codexio_scan.py +473 -0
  85. loopmath-0.2.0/src/loopmath/graph/dataset.py +15 -0
  86. loopmath-0.2.0/src/loopmath/graph/dataset_build.py +422 -0
  87. loopmath-0.2.0/src/loopmath/graph/dataset_core.py +368 -0
  88. loopmath-0.2.0/src/loopmath/graph/dataset_edges.py +386 -0
  89. loopmath-0.2.0/src/loopmath/graph/dataset_nodes.py +401 -0
  90. loopmath-0.2.0/src/loopmath/graph/extract.py +248 -0
  91. loopmath-0.2.0/src/loopmath/graph/html_common.py +422 -0
  92. loopmath-0.2.0/src/loopmath/graph/html_costcurve.py +65 -0
  93. loopmath-0.2.0/src/loopmath/graph/html_css.py +132 -0
  94. loopmath-0.2.0/src/loopmath/graph/html_data.py +484 -0
  95. loopmath-0.2.0/src/loopmath/graph/html_force.py +57 -0
  96. loopmath-0.2.0/src/loopmath/graph/html_render.py +93 -0
  97. loopmath-0.2.0/src/loopmath/graph/html_swimlanes.py +86 -0
  98. loopmath-0.2.0/src/loopmath/graph/labeler.py +83 -0
  99. loopmath-0.2.0/src/loopmath/graph/labeler_cli.py +163 -0
  100. loopmath-0.2.0/src/loopmath/graph/labeler_common.py +166 -0
  101. loopmath-0.2.0/src/loopmath/graph/labeler_parse.py +186 -0
  102. loopmath-0.2.0/src/loopmath/graph/labeler_pricing.py +224 -0
  103. loopmath-0.2.0/src/loopmath/graph/labeler_prompt.py +82 -0
  104. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_build.py +479 -0
  105. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_dispatch.py +375 -0
  106. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_evidence.py +294 -0
  107. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_node.py +444 -0
  108. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_records.py +449 -0
  109. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_result.py +157 -0
  110. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_session.py +477 -0
  111. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_tools.py +370 -0
  112. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_validation.py +69 -0
  113. loopmath-0.2.0/src/loopmath/graph/labeler_prompt_workflow.py +429 -0
  114. loopmath-0.2.0/src/loopmath/graph/labeler_report.py +87 -0
  115. loopmath-0.2.0/src/loopmath/graph/labeler_score.py +485 -0
  116. loopmath-0.2.0/src/loopmath/graph/labels.py +115 -0
  117. loopmath-0.2.0/src/loopmath/graph/launch.py +495 -0
  118. loopmath-0.2.0/src/loopmath/graph/launch_origin.py +291 -0
  119. loopmath-0.2.0/src/loopmath/graph/ocp.py +9 -0
  120. loopmath-0.2.0/src/loopmath/graph/ocp_emit.py +264 -0
  121. loopmath-0.2.0/src/loopmath/graph/ocp_support.py +441 -0
  122. loopmath-0.2.0/src/loopmath/graph/render.py +68 -0
  123. loopmath-0.2.0/src/loopmath/graph/runfile.py +11 -0
  124. loopmath-0.2.0/src/loopmath/graph/runfile_export.py +300 -0
  125. loopmath-0.2.0/src/loopmath/graph/runfile_finish.py +299 -0
  126. loopmath-0.2.0/src/loopmath/graph/scan.py +259 -0
  127. loopmath-0.2.0/src/loopmath/graph/schema.py +152 -0
  128. loopmath-0.2.0/src/loopmath/graph/token_completeness.py +26 -0
  129. loopmath-0.2.0/src/loopmath/ingest/__init__.py +476 -0
  130. loopmath-0.2.0/src/loopmath/ingest/base.py +504 -0
  131. loopmath-0.2.0/src/loopmath/ingest/claude_code.py +522 -0
  132. loopmath-0.2.0/src/loopmath/ingest/claude_code_support.py +70 -0
  133. loopmath-0.2.0/src/loopmath/ingest/codex.py +536 -0
  134. loopmath-0.2.0/src/loopmath/ingest/codex_support.py +209 -0
  135. loopmath-0.2.0/src/loopmath/ingest/ocp.py +153 -0
  136. loopmath-0.2.0/src/loopmath/ingest/ocp_analysis.py +78 -0
  137. loopmath-0.2.0/src/loopmath/ingest/ocp_artifact.py +128 -0
  138. loopmath-0.2.0/src/loopmath/ingest/ocp_common.py +242 -0
  139. loopmath-0.2.0/src/loopmath/ingest/ocp_convert.py +499 -0
  140. loopmath-0.2.0/src/loopmath/ingest/ocp_projection.py +95 -0
  141. loopmath-0.2.0/src/loopmath/logmatch/__init__.py +4 -0
  142. loopmath-0.2.0/src/loopmath/logmatch/artifacts.py +89 -0
  143. loopmath-0.2.0/src/loopmath/logmatch/clip.py +191 -0
  144. loopmath-0.2.0/src/loopmath/logmatch/costs.py +185 -0
  145. loopmath-0.2.0/src/loopmath/logmatch/match.py +555 -0
  146. loopmath-0.2.0/src/loopmath/logmatch/settle.py +297 -0
  147. loopmath-0.2.0/src/loopmath/logmatch/tariff.py +82 -0
  148. loopmath-0.2.0/src/loopmath/ocp/__init__.py +15 -0
  149. loopmath-0.2.0/src/loopmath/ocp/canonical.py +137 -0
  150. loopmath-0.2.0/src/loopmath/ocp/commands.py +199 -0
  151. loopmath-0.2.0/src/loopmath/ocp/conformance.py +1140 -0
  152. loopmath-0.2.0/src/loopmath/ocp/contractv3.py +250 -0
  153. loopmath-0.2.0/src/loopmath/ocp/emit.py +429 -0
  154. loopmath-0.2.0/src/loopmath/ocp/migrate.py +132 -0
  155. loopmath-0.2.0/src/loopmath/ocp/schema/ocp-v0.2.schema.json +373 -0
  156. loopmath-0.2.0/src/loopmath/ocp/schema/ocp-v0.3.schema.json +2214 -0
  157. loopmath-0.2.0/src/loopmath/ocp/schema/ocp-v0.schema.json +244 -0
  158. loopmath-0.2.0/src/loopmath/ocp/version.py +34 -0
  159. loopmath-0.2.0/src/loopmath/onboard/__init__.py +4 -0
  160. loopmath-0.2.0/src/loopmath/onboard/commands.py +458 -0
  161. loopmath-0.2.0/src/loopmath/onboard/history.py +568 -0
  162. loopmath-0.2.0/src/loopmath/onboard/label.py +409 -0
  163. loopmath-0.2.0/src/loopmath/onboard/usual.py +87 -0
  164. loopmath-0.2.0/src/loopmath/output.py +83 -0
  165. loopmath-0.2.0/src/loopmath/pool.py +50 -0
  166. loopmath-0.2.0/src/loopmath/price.py +587 -0
  167. loopmath-0.2.0/src/loopmath/price_validation.py +337 -0
  168. loopmath-0.2.0/src/loopmath/prices.toml +277 -0
  169. loopmath-0.2.0/src/loopmath/priors/__init__.py +113 -0
  170. loopmath-0.2.0/src/loopmath/priors/benchmarks.py +107 -0
  171. loopmath-0.2.0/src/loopmath/priors/benchmarks.toml +677 -0
  172. loopmath-0.2.0/src/loopmath/priors/build.py +247 -0
  173. loopmath-0.2.0/src/loopmath/priors/bundle/README.md +1 -0
  174. loopmath-0.2.0/src/loopmath/priors/bundle/e0.jsonl.gz +0 -0
  175. loopmath-0.2.0/src/loopmath/priors/bundle/manifest.json +202 -0
  176. loopmath-0.2.0/src/loopmath/priors/bundle/rq1.jsonl.gz +0 -0
  177. loopmath-0.2.0/src/loopmath/priors/bundle/sweep.jsonl.gz +0 -0
  178. loopmath-0.2.0/src/loopmath/priors/commands.py +101 -0
  179. loopmath-0.2.0/src/loopmath/priors/e0.py +207 -0
  180. loopmath-0.2.0/src/loopmath/priors/history.py +698 -0
  181. loopmath-0.2.0/src/loopmath/priors/ocpdoc.py +205 -0
  182. loopmath-0.2.0/src/loopmath/priors/reduce.py +136 -0
  183. loopmath-0.2.0/src/loopmath/priors/registry.py +70 -0
  184. loopmath-0.2.0/src/loopmath/priors/rq1.py +111 -0
  185. loopmath-0.2.0/src/loopmath/priors/show.py +72 -0
  186. loopmath-0.2.0/src/loopmath/priors/sweep.py +393 -0
  187. loopmath-0.2.0/src/loopmath/priors/validate.py +57 -0
  188. loopmath-0.2.0/src/loopmath/receipts.py +183 -0
  189. loopmath-0.2.0/src/loopmath/recommend/__init__.py +4 -0
  190. loopmath-0.2.0/src/loopmath/recommend/backlog.py +666 -0
  191. loopmath-0.2.0/src/loopmath/recommend/commands.py +652 -0
  192. loopmath-0.2.0/src/loopmath/recommend/curve.py +131 -0
  193. loopmath-0.2.0/src/loopmath/recommend/engine.py +617 -0
  194. loopmath-0.2.0/src/loopmath/recommend/gain.py +172 -0
  195. loopmath-0.2.0/src/loopmath/recommend/message.py +246 -0
  196. loopmath-0.2.0/src/loopmath/recommend/receipts.py +311 -0
  197. loopmath-0.2.0/src/loopmath/recommend/search.py +1096 -0
  198. loopmath-0.2.0/src/loopmath/recommend/stats.py +54 -0
  199. loopmath-0.2.0/src/loopmath/recommend/storeread.py +322 -0
  200. loopmath-0.2.0/src/loopmath/report/__init__.py +1 -0
  201. loopmath-0.2.0/src/loopmath/report/html.py +344 -0
  202. loopmath-0.2.0/src/loopmath/report/terminal.py +500 -0
  203. loopmath-0.2.0/src/loopmath/report/terminal_exclusions.py +70 -0
  204. loopmath-0.2.0/src/loopmath/report/terminal_format.py +253 -0
  205. loopmath-0.2.0/src/loopmath/report/terminal_read.py +172 -0
  206. loopmath-0.2.0/src/loopmath/research_defaults.py +5 -0
  207. loopmath-0.2.0/src/loopmath/research_paths.py +68 -0
  208. loopmath-0.2.0/src/loopmath/scoring.py +302 -0
  209. loopmath-0.2.0/src/loopmath/scoring_comparisons.py +447 -0
  210. loopmath-0.2.0/src/loopmath/scoring_predictive.py +377 -0
  211. loopmath-0.2.0/src/loopmath/share/__init__.py +4 -0
  212. loopmath-0.2.0/src/loopmath/share/commands.py +88 -0
  213. loopmath-0.2.0/src/loopmath/share/export.py +599 -0
  214. loopmath-0.2.0/src/loopmath/share/import_.py +432 -0
  215. loopmath-0.2.0/src/loopmath/skill/__init__.py +4 -0
  216. loopmath-0.2.0/src/loopmath/skill/commands.py +81 -0
  217. loopmath-0.2.0/src/loopmath/skill/doctor.py +230 -0
  218. loopmath-0.2.0/src/loopmath/skill/install.py +538 -0
  219. loopmath-0.2.0/src/loopmath/skill/skills/loopmath/SKILL.md +35 -0
  220. loopmath-0.2.0/src/loopmath/skill/skills/loopmath-import-runs/SKILL.md +63 -0
  221. loopmath-0.2.0/src/loopmath/skill/skills/loopmath-onboard/SKILL.md +81 -0
  222. loopmath-0.2.0/src/loopmath/skill/skills/loopmath-plan-task/SKILL.md +95 -0
  223. loopmath-0.2.0/src/loopmath/skill/skills/loopmath-record-run/SKILL.md +84 -0
  224. loopmath-0.2.0/src/loopmath/skill/skills/loopmath-update-fit/SKILL.md +45 -0
  225. loopmath-0.2.0/src/loopmath/skill/skills/reference.md +107 -0
  226. loopmath-0.2.0/src/loopmath/store/__init__.py +15 -0
  227. loopmath-0.2.0/src/loopmath/store/budget.py +86 -0
  228. loopmath-0.2.0/src/loopmath/store/commands.py +1038 -0
  229. loopmath-0.2.0/src/loopmath/store/config.py +506 -0
  230. loopmath-0.2.0/src/loopmath/store/finish.py +406 -0
  231. loopmath-0.2.0/src/loopmath/store/fitjob.py +227 -0
  232. loopmath-0.2.0/src/loopmath/store/home.py +514 -0
  233. loopmath-0.2.0/src/loopmath/store/ids.py +157 -0
  234. loopmath-0.2.0/src/loopmath/store/lock.py +200 -0
  235. loopmath-0.2.0/src/loopmath/store/record.py +464 -0
  236. loopmath-0.2.0/src/loopmath/store/report.py +297 -0
  237. loopmath-0.2.0/src/loopmath/store/runs.py +453 -0
  238. loopmath-0.2.0/src/loopmath/store/status.py +245 -0
  239. loopmath-0.2.0/src/loopmath/surface.py +211 -0
  240. loopmath-0.2.0/src/loopmath/surface_bootstrap.py +164 -0
  241. loopmath-0.2.0/src/loopmath/surface_estimation.py +389 -0
  242. loopmath-0.2.0/src/loopmath/surface_frame.py +157 -0
  243. loopmath-0.2.0/src/loopmath/surface_presentation.py +205 -0
  244. loopmath-0.2.0/src/loopmath/surface_support.py +132 -0
  245. loopmath-0.2.0/src/loopmath/taskmodel.py +648 -0
  246. loopmath-0.2.0/src/loopmath/types.py +384 -0
  247. loopmath-0.2.0/src/loopmath/views/__init__.py +4 -0
  248. loopmath-0.2.0/src/loopmath/views/assets/README.md +1 -0
  249. loopmath-0.2.0/src/loopmath/views/assets/base.css +94 -0
  250. loopmath-0.2.0/src/loopmath/views/assets/common.js +89 -0
  251. loopmath-0.2.0/src/loopmath/views/assets/estimates.css +50 -0
  252. loopmath-0.2.0/src/loopmath/views/assets/estimates.js +808 -0
  253. loopmath-0.2.0/src/loopmath/views/assets/graph.css +28 -0
  254. loopmath-0.2.0/src/loopmath/views/assets/graph.js +383 -0
  255. loopmath-0.2.0/src/loopmath/views/assets/plans.css +9 -0
  256. loopmath-0.2.0/src/loopmath/views/assets/plans.js +355 -0
  257. loopmath-0.2.0/src/loopmath/views/assets/results.css +18 -0
  258. loopmath-0.2.0/src/loopmath/views/assets/results.js +276 -0
  259. loopmath-0.2.0/src/loopmath/views/assets/runs.js +239 -0
  260. loopmath-0.2.0/src/loopmath/views/assets/viz.css +219 -0
  261. loopmath-0.2.0/src/loopmath/views/assets/viz.js +347 -0
  262. loopmath-0.2.0/src/loopmath/views/common.py +491 -0
  263. loopmath-0.2.0/src/loopmath/views/plans.py +148 -0
  264. loopmath-0.2.0/src/loopmath/views/posterior.py +1337 -0
  265. loopmath-0.2.0/src/loopmath/views/runs.py +479 -0
  266. loopmath-0.2.0/src/loopmath/workflows/__init__.py +46 -0
  267. loopmath-0.2.0/src/loopmath/workflows/candidates.py +356 -0
  268. loopmath-0.2.0/src/loopmath/workflows/catalog/best_of_n.toml +46 -0
  269. loopmath-0.2.0/src/loopmath/workflows/catalog/implement_review.toml +47 -0
  270. loopmath-0.2.0/src/loopmath/workflows/catalog/plan_implement.toml +42 -0
  271. loopmath-0.2.0/src/loopmath/workflows/catalog/plan_implement_review.toml +61 -0
  272. loopmath-0.2.0/src/loopmath/workflows/catalog/solo.toml +29 -0
  273. loopmath-0.2.0/src/loopmath/workflows/catalog/swarm.toml +61 -0
  274. loopmath-0.2.0/src/loopmath/workflows/commands.py +399 -0
  275. loopmath-0.2.0/src/loopmath/workflows/diff.py +161 -0
  276. loopmath-0.2.0/src/loopmath/workflows/format.py +526 -0
  277. loopmath-0.2.0/src/loopmath/workflows/graphview.py +34 -0
  278. loopmath-0.2.0/src/loopmath/workflows/ids.py +47 -0
  279. loopmath-0.2.0/src/loopmath/workflows/infer.py +630 -0
  280. loopmath-0.2.0/src/loopmath/workflows/models.py +158 -0
  281. loopmath-0.2.0/src/loopmath/workflows/ocp.py +268 -0
  282. loopmath-0.2.0/src/loopmath/workflows/shapes.py +203 -0
  283. loopmath-0.2.0/src/loopmath.egg-info/PKG-INFO +266 -0
  284. loopmath-0.2.0/src/loopmath.egg-info/SOURCES.txt +357 -0
  285. loopmath-0.2.0/src/loopmath.egg-info/dependency_links.txt +1 -0
  286. loopmath-0.2.0/src/loopmath.egg-info/entry_points.txt +3 -0
  287. loopmath-0.2.0/src/loopmath.egg-info/requires.txt +13 -0
  288. loopmath-0.2.0/src/loopmath.egg-info/top_level.txt +1 -0
  289. loopmath-0.2.0/tests/test_adapter_atrium.py +256 -0
  290. loopmath-0.2.0/tests/test_adapter_bb.py +701 -0
  291. loopmath-0.2.0/tests/test_adapter_omp.py +745 -0
  292. loopmath-0.2.0/tests/test_adapter_opencode.py +409 -0
  293. loopmath-0.2.0/tests/test_adapter_opencode_output_tokens.py +68 -0
  294. loopmath-0.2.0/tests/test_adapter_orca.py +248 -0
  295. loopmath-0.2.0/tests/test_adapter_otel_genai.py +772 -0
  296. loopmath-0.2.0/tests/test_adapter_paseo.py +290 -0
  297. loopmath-0.2.0/tests/test_adapter_services.py +420 -0
  298. loopmath-0.2.0/tests/test_adapters.py +166 -0
  299. loopmath-0.2.0/tests/test_adapters_pi.py +324 -0
  300. loopmath-0.2.0/tests/test_arms.py +60 -0
  301. loopmath-0.2.0/tests/test_cli_graph.py +658 -0
  302. loopmath-0.2.0/tests/test_cli_labeler.py +32 -0
  303. loopmath-0.2.0/tests/test_cli_main_module.py +32 -0
  304. loopmath-0.2.0/tests/test_cli_plan_hidden.py +73 -0
  305. loopmath-0.2.0/tests/test_cli_prices.py +88 -0
  306. loopmath-0.2.0/tests/test_cli_startup.py +35 -0
  307. loopmath-0.2.0/tests/test_color_proof.py +46 -0
  308. loopmath-0.2.0/tests/test_duplicate_guards.py +359 -0
  309. loopmath-0.2.0/tests/test_estimate.py +125 -0
  310. loopmath-0.2.0/tests/test_explain.py +37 -0
  311. loopmath-0.2.0/tests/test_fit.py +535 -0
  312. loopmath-0.2.0/tests/test_gaps.py +108 -0
  313. loopmath-0.2.0/tests/test_gitwalk.py +45 -0
  314. loopmath-0.2.0/tests/test_grade.py +809 -0
  315. loopmath-0.2.0/tests/test_graph_artifact_recording.py +338 -0
  316. loopmath-0.2.0/tests/test_graph_artifacts.py +516 -0
  317. loopmath-0.2.0/tests/test_graph_bashwrites.py +142 -0
  318. loopmath-0.2.0/tests/test_graph_cache.py +783 -0
  319. loopmath-0.2.0/tests/test_graph_codexio.py +550 -0
  320. loopmath-0.2.0/tests/test_graph_dataset.py +946 -0
  321. loopmath-0.2.0/tests/test_graph_extract.py +486 -0
  322. loopmath-0.2.0/tests/test_graph_glue.py +56 -0
  323. loopmath-0.2.0/tests/test_graph_html.py +487 -0
  324. loopmath-0.2.0/tests/test_graph_labeler.py +1461 -0
  325. loopmath-0.2.0/tests/test_graph_labeler_evidence_matrix.py +1961 -0
  326. loopmath-0.2.0/tests/test_graph_launch.py +566 -0
  327. loopmath-0.2.0/tests/test_graph_ocp.py +611 -0
  328. loopmath-0.2.0/tests/test_graph_render.py +156 -0
  329. loopmath-0.2.0/tests/test_graph_runfile.py +504 -0
  330. loopmath-0.2.0/tests/test_graph_schema.py +232 -0
  331. loopmath-0.2.0/tests/test_home_guard.py +51 -0
  332. loopmath-0.2.0/tests/test_html.py +69 -0
  333. loopmath-0.2.0/tests/test_ingest.py +469 -0
  334. loopmath-0.2.0/tests/test_ingest_claude_code.py +761 -0
  335. loopmath-0.2.0/tests/test_ingest_codex.py +687 -0
  336. loopmath-0.2.0/tests/test_ingest_ocp.py +830 -0
  337. loopmath-0.2.0/tests/test_io.py +42 -0
  338. loopmath-0.2.0/tests/test_not_run_summary.py +62 -0
  339. loopmath-0.2.0/tests/test_ocp_conformance.py +866 -0
  340. loopmath-0.2.0/tests/test_ocp_golden.py +39 -0
  341. loopmath-0.2.0/tests/test_ocp_open_enums.py +85 -0
  342. loopmath-0.2.0/tests/test_ocp_versioning.py +43 -0
  343. loopmath-0.2.0/tests/test_output_html_path.py +36 -0
  344. loopmath-0.2.0/tests/test_packaging_metadata.py +101 -0
  345. loopmath-0.2.0/tests/test_packaging_smoke.py +305 -0
  346. loopmath-0.2.0/tests/test_pool.py +38 -0
  347. loopmath-0.2.0/tests/test_preview_script.py +35 -0
  348. loopmath-0.2.0/tests/test_price.py +1015 -0
  349. loopmath-0.2.0/tests/test_receipts.py +89 -0
  350. loopmath-0.2.0/tests/test_release_paths.py +79 -0
  351. loopmath-0.2.0/tests/test_runfile_privacy_n1b.py +251 -0
  352. loopmath-0.2.0/tests/test_scoring.py +699 -0
  353. loopmath-0.2.0/tests/test_split_rebindings.py +535 -0
  354. loopmath-0.2.0/tests/test_surface.py +1369 -0
  355. loopmath-0.2.0/tests/test_taskmodel_features.py +126 -0
  356. loopmath-0.2.0/tests/test_terminal.py +1570 -0
  357. loopmath-0.2.0/tests/test_types_control.py +22 -0
  358. loopmath-0.2.0/tests/test_types_piece_prediction.py +25 -0
  359. loopmath-0.2.0/tests/test_v01_scaffold.py +122 -0
  360. loopmath-0.0.1/PKG-INFO +0 -18
  361. loopmath-0.0.1/README.md +0 -7
  362. loopmath-0.0.1/pyproject.toml +0 -19
  363. loopmath-0.0.1/src/loopmath/__init__.py +0 -3
loopmath-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 QKV Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.4
2
+ Name: loopmath
3
+ Version: 0.2.0
4
+ Summary: Plan agent workflows, record how they went, and learn from your own Claude Code and Codex logs
5
+ Author: QKV Labs
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/loopmath/loopmath
8
+ Project-URL: Issues, https://github.com/loopmath/loopmath/issues
9
+ Project-URL: Repository, https://github.com/loopmath/loopmath.git
10
+ Keywords: agents,claude code,codex,cost analysis,developer tools,workflow analysis
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Software Development
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: jsonschema>=4
27
+ Requires-Dist: numpy
28
+ Requires-Dist: pandas
29
+ Requires-Dist: scipy
30
+ Provides-Extra: bayes
31
+ Requires-Dist: pymc>=5; extra == "bayes"
32
+ Requires-Dist: pytensor; extra == "bayes"
33
+ Requires-Dist: arviz; extra == "bayes"
34
+ Requires-Dist: h5netcdf; extra == "bayes"
35
+ Provides-Extra: e0
36
+ Requires-Dist: matplotlib; extra == "e0"
37
+ Dynamic: license-file
38
+
39
+ # loopmath
40
+
41
+ loopmath helps an orchestrator agent choose how to run a coding task, and learns from how it went.
42
+
43
+ Before a task, it predicts how the user's usual agent workflow will do: the chance of an accepted result, and the cost in tokens and dollars. It shows the other workflows on a success-cost curve and offers two exploration picks. Each pick comes with its gain on every future similar run, its one-time price, and the number of runs it takes to pay back. After the task, the orchestrator records what ran and what came of it. loopmath fills in the token costs from the Claude Code and Codex logs, writes a receipt of predicted against actual, and refits.
44
+
45
+ loopmath never starts or coordinates agents. Claude Code, Codex, herdr or your own tool does that; loopmath is a CLI they call. Everything runs locally. No command opens a network connection, the logs are opened read only, and loopmath writes only to its store (`~/.loopmath`) and to paths you name.
46
+
47
+ The package installs two commands: `loopmath` and its short alias `loop`. If another `loop` is already on your PATH, use `loopmath`.
48
+
49
+ ## Install
50
+
51
+ Python 3.11 or newer.
52
+
53
+ ```sh
54
+ pipx install loopmath # or: uv tool install loopmath, or pip install loopmath in a venv
55
+ loopmath --version
56
+ ```
57
+
58
+ From a clone of this repository:
59
+
60
+ ```sh
61
+ python3 -m venv .venv
62
+ .venv/bin/python -m pip install -e .
63
+ ```
64
+
65
+ ## First run
66
+
67
+ ```sh
68
+ loopmath skill install # teach your coding agents how to use loopmath
69
+ ```
70
+
71
+ Then ask your agent to onboard, for example "onboard loopmath". The agent runs a dry run, asks you one question (which model labels your sessions, with the cost of each option), onboards, fits, and opens the results page.
72
+
73
+ `skill install` writes six skills, one per job, and a shared `reference.md` with every command and JSON field they use. An agent loads only the skill for the job at hand, and each phrase belongs to one skill:
74
+
75
+ | Skill | Ask your agent |
76
+ |---|---|
77
+ | `loopmath` | loopmath named without a job: "use loopmath", "what can loopmath do", "what next with loopmath" |
78
+ | `loopmath-onboard` | "onboard", "set up", "start" or "try" loopmath; or loopmath has no runs yet |
79
+ | `loopmath-import-runs` | OCP files (`*.ocp.json`), a folder of finished runs, or the output of an orchestrator or experiment harness that writes OCP |
80
+ | `loopmath-update-fit` | "update", "refresh" or "rerun" the fit; what loopmath learned; runs imported or recorded without a refit |
81
+ | `loopmath-plan-task` | "plan a task with loopmath"; which workflow, model or effort to use; a coding task of more than a few minutes in a repo that uses loopmath |
82
+ | `loopmath-record-run` | a task planned with loopmath is done; "record", "log" or "save" a run; both runs of a pair need a blind judge |
83
+
84
+ By default the skills go to every agent whose home exists: Claude Code (`~/.claude/skills/<name>/`, or under `$CLAUDE_CONFIG_DIR`) and Codex (`~/.codex/skills/<name>/`, or under `$CODEX_HOME`). `--target claude-code`, `codex` or `both` picks them yourself. If your Codex has no skills folder, the files go to `~/.codex/loopmath/<name>/` instead, with a short marked block in `~/.codex/AGENTS.md` that lists them. Add `--scope project` to install into the current repository (or `--dir PATH` for another one).
85
+
86
+ It is safe to run again. It records the files it wrote, with their hashes, in `.loopmath-skills.json` beside the skill folders, and it replaces or removes only those. A skill file you changed is kept, with a note. Any other file where a skill goes stops the install before it writes anything, and names the path to move aside. The single skill that 0.1 installed is replaced when it is as 0.1 wrote it. `loopmath skill show NAME` prints one skill, and `loopmath skill uninstall` removes the files it wrote. `loopmath doctor` shows what loopmath can see: logs, agents, store, fit, prices and skills.
87
+
88
+ To onboard by hand instead:
89
+
90
+ ```sh
91
+ loopmath onboard --dry-run # what it found, and what each labeller costs
92
+ loopmath onboard --labeler claude:claude-haiku-4-5 --yes # record it and run a first fit
93
+ ```
94
+
95
+ `onboard` reads your recent Claude Code and Codex sessions (the last 90 days unless you pass `--since`). It groups them into runs, labels each group's task type with a model you choose, names your usual workflow per task type and repository, and fits. loopmath never picks the labelling model for you. `--labeler` takes one of:
96
+
97
+ - `claude:<model>`, through your `claude` CLI;
98
+ - `codex:<model>`, through your `codex` CLI;
99
+ - `command:<cmd>`, any local command such as `command:ollama run <model>`, so nothing leaves the machine;
100
+ - `none`, to skip labelling.
101
+
102
+ Reading the history uses up to 8 worker processes (one per CPU, at most 8). Set `LOOPMATH_WORKERS=1` to keep everything in one process, or another number to change the count.
103
+
104
+ loopmath ships with a prior built from our own sweeps and experiments, so `recommend` gives an answer before you have any history. Your own runs then move it.
105
+
106
+ ## The loop
107
+
108
+ The plan and record skills take an agent through the loop in three commands:
109
+
110
+ ```sh
111
+ loopmath recommend --type bug_fix --repo acme/api --title "Fix the parser crash" --json --brief --html
112
+ loopmath run start --rec REC --choice goal --base-commit SHA --json # the harness, model and effort per piece
113
+ loopmath run record --run RUN --session UUID --verified tests=pass --json # costs from the logs, the outcome, the receipt
114
+ ```
115
+
116
+ The same loop step by step, for a tool of your own:
117
+
118
+ ```sh
119
+ # 1. Plan: classify the task, then ask.
120
+ loopmath task-types
121
+ loopmath recommend --type bug_fix --repo acme/api --feature size=s --feature lang=python --json
122
+ # the usual workflow (without one, your best recorded workflow is the reference), the success-cost curve,
123
+ # alternatives, two exploration picks, a suggested pair
124
+
125
+ # 2. Record: one run per workflow you run, one attempt per agent you launch.
126
+ loopmath run start --type bug_fix --repo acme/api --base-commit SHA --config CFG --source usual --rec REC
127
+ loopmath run attempt --run RUN --piece implement --harness claude-code --model claude-opus-5-5 \
128
+ --effort high --cwd . --session UUID # launch the agent with: claude --session-id UUID
129
+ loopmath run attempt --run RUN --end ATT --status done
130
+ loopmath run artifact --run RUN --kind commit --path SHA --by ATT
131
+
132
+ # 3. Outcome: verdicts, scores, and later events.
133
+ loopmath outcome --run RUN --signal tests=pass --kind verdict --tier verified
134
+ loopmath outcome --run RUN --signal runtime_s=182 --kind score --unit s --better lower
135
+
136
+ # 4. Finish: costs from the logs, a receipt, a refit.
137
+ loopmath run finish --run RUN
138
+
139
+ # Later: an incident or revert traced back to the run that made the commit.
140
+ loopmath outcome --commit SHA --signal incident=INC-42 --kind event --source tracker
141
+ ```
142
+
143
+ A pair runs the goal workflow and an exploration pick from the same base commit, in separate worktrees. Save the recommendation (`recommend ... --json > rec.json`) and start both runs from it with `run start --task-file rec.json`, so they share one task: the first with `--new-slate`, the second with `--slate SLT`. A blinded referee then picks the better change, which you record with `loopmath outcome --slate SLT --prefer RUN --judge referee --blinded`.
144
+
145
+ A run counts as a success when it is accepted under your rule. By default that means the task's tests pass. A rule can also be a score target: `loopmath recommend ... --target 'heldout_perf>=2400'` or `--target 'runtime_s<=200'` gives the expected score and the chance of reaching the target. Set standing rules and other options with `loopmath config set KEY VALUE`, and the spending cap with `loopmath budget --usd X --period month`.
146
+
147
+ Runs recorded by another tool that writes OCP v0.3, such as an experiment runner, come in with `loopmath run import DIR --finish`: several files or a directory, with one refit at the end (`--no-fit` skips it). Runs in your store always count as yours, whatever source their documents name. `loopmath fit --without SOURCE` leaves out one shipped prior source, and `loopmath status` names the options of the current fit.
148
+
149
+ ## The three views
150
+
151
+ Each view is a self-contained HTML file written by a command; there is no server. The same numbers are available with `--json`.
152
+
153
+ - **Previous runs:** `loopmath runs --html`. Every recorded run with its workflow graph, costs, signals and receipt.
154
+ - **Plans for a task:** `loopmath recommend ... --html`. The candidates on a success-cost chart. Click one to see its workflow graph with per-piece predictions.
155
+ - **Current estimates:** `loopmath posterior --html`. What loopmath believes at each level (model, effort, role, topology, task type, repository, feature), each with a range. Add `--workflow CFG` (a configuration id from `loopmath recommend` or your runs) to see the estimate for each piece of one workflow.
156
+
157
+ Without a path, `--html` writes the page under `~/.loopmath/views/` and prints where it went.
158
+
159
+ ## Commands
160
+
161
+ | Group | Commands |
162
+ |---|---|
163
+ | Plan | `task-types`, `workflows` (list, show, validate, diff), `recommend` |
164
+ | Record | `run` (start, attempt, artifact, finish, import), `outcome`, `budget`, `config` (get, set) |
165
+ | Learn | `fit`, `onboard`, `share`, `prior` |
166
+ | View | `runs`, `posterior`, `status`, `report`, `doctor` |
167
+ | Skill | `skill` (install, uninstall, show) |
168
+ | OCP | `ocp` (validate, migrate) |
169
+ | Log analysis | `analyze`, `graph`, `adapt`, `prices`, `validate-prices`, `scan`, `verify-receipts` |
170
+
171
+ Each command prints a short summary by default. With `--json`, it prints exactly one JSON object instead. Exit codes: 0 ok, 1 user error, 2 not found, 3 not implemented, 4 store locked, 5 no fit yet. For flags, `loopmath <command> --help` is the source of truth.
172
+
173
+ A workflow is a TOML file. `loopmath workflows list` shows the catalog and yours, which live in `~/.loopmath/workflows/`. This one implements, then sends a rejected change back once or twice:
174
+
175
+ ```toml
176
+ id = "implement_review_mine"
177
+ version = 1
178
+ title = "Implement, then review"
179
+ edges = ["issue -> implement", "repo -> implement", "implement -> diff", "diff -> review", "review -> verdict"]
180
+
181
+ [[pieces]]
182
+ id = "implement"
183
+ role = "implementer"
184
+
185
+ [[pieces]]
186
+ id = "review"
187
+ role = "reviewer"
188
+
189
+ [[artifacts]]
190
+ id = "issue"
191
+ kind = "issue"
192
+
193
+ [[artifacts]]
194
+ id = "repo"
195
+ kind = "repo"
196
+
197
+ [[artifacts]]
198
+ id = "diff"
199
+ kind = "diff"
200
+
201
+ [[artifacts]]
202
+ id = "verdict"
203
+ kind = "verdict"
204
+
205
+ [control]
206
+ budget_rounds = 3 # rounds, counting the first; 1 means no repair
207
+
208
+ [[control.gates]]
209
+ after = "review" # the review's verdict decides
210
+ on_fail = "implement" # a rejected change goes back to implement
211
+
212
+ [settings.implement] # optional; with a setting for every piece, the file is a configuration
213
+ harness = "claude-code"
214
+ model = "claude-opus-5-5"
215
+ effort = "high"
216
+
217
+ [settings.review]
218
+ harness = "codex"
219
+ model = "gpt-5.6-sol"
220
+ effort = "high"
221
+ ```
222
+
223
+ Check it with `loopmath workflows validate FILE`, compare it with `loopmath workflows diff implement_review FILE`, and pass it to `recommend --workflow FILE` to have it considered, or to `run start --workflow FILE` to record a run with its settings (`--set PIECE=HARNESS:MODEL:EFFORT` overrides a piece).
224
+
225
+ ## The store and privacy
226
+
227
+ The store is `~/.loopmath`. Set `LOOPMATH_HOME` or pass `--home` to put it elsewhere; the log parse cache moves with it, to `cache/` inside the store, unless you set `LOOPMATH_CACHE_DIR`. It holds:
228
+
229
+ - one OCP v0.3 document per recorded run;
230
+ - signals, receipts and fits;
231
+ - your config and your workflows;
232
+ - the views you write;
233
+ - the log parse cache.
234
+
235
+ Do not edit the store by hand; use the commands.
236
+
237
+ Run files use the `metadata_only` privacy profile. They keep structure, models, tokens, dollars, paths and verdicts, but not transcript text.
238
+
239
+ `loopmath share --out FILE` writes a reduced copy you can send to us. It keeps task types, workflows, models, tokens, dollars and outcomes. Repository names are hashed. Titles, paths, commands, session ids and commit shas are removed. `loopmath share --preview` prints exactly what would leave.
240
+
241
+ ## Analyzing logs without recording
242
+
243
+ The log commands work on their own, with no store or fit:
244
+
245
+ ```sh
246
+ loopmath analyze # cost per accepted run from the last 14 days of local logs
247
+ loopmath graph --workspace NAME --format html --out graph.html
248
+ ```
249
+
250
+ `analyze` reads `~/.claude/projects` and `~/.codex/sessions`. It grades the outcome evidence it finds, prices known models, and prints cost per accepted run with an 80% band. It also lists what it could not use and why.
251
+
252
+ `graph` rebuilds which agent launched which, and which session read what another wrote. Its formats are `ocp`, `json`, `dot`, `run` and `html`. See the [workflow graph guide](docs/graph.md) and [adapters](docs/adapters.md).
253
+
254
+ ## Research data
255
+
256
+ `loopmath research fit|transfer-test` and `loopmath analyze-e0` read data folders that are not part of the package. Name them with a flag (`--sweep-dir`, `--corpus`), an environment variable (`LOOPMATH_SWEEP_DIR`, `LOOPMATH_E0_CORPUS`), or config (`loopmath config set research.sweep_dir PATH`, `research.e0_corpus`). The research verbs need the `bayes` extra (`pip install 'loopmath[bayes]'`).
257
+
258
+ ## More
259
+
260
+ - [OCP, the run format](spec/OCP.md): the normative note that goes with the [schemas](spec/), and the [versioning promise](spec/VERSIONING.md)
261
+ - [Release policy](docs/release.md)
262
+ - [Packaged model prices](src/loopmath/prices.toml)
263
+
264
+ ## License
265
+
266
+ MIT.
@@ -0,0 +1,228 @@
1
+ # loopmath
2
+
3
+ loopmath helps an orchestrator agent choose how to run a coding task, and learns from how it went.
4
+
5
+ Before a task, it predicts how the user's usual agent workflow will do: the chance of an accepted result, and the cost in tokens and dollars. It shows the other workflows on a success-cost curve and offers two exploration picks. Each pick comes with its gain on every future similar run, its one-time price, and the number of runs it takes to pay back. After the task, the orchestrator records what ran and what came of it. loopmath fills in the token costs from the Claude Code and Codex logs, writes a receipt of predicted against actual, and refits.
6
+
7
+ loopmath never starts or coordinates agents. Claude Code, Codex, herdr or your own tool does that; loopmath is a CLI they call. Everything runs locally. No command opens a network connection, the logs are opened read only, and loopmath writes only to its store (`~/.loopmath`) and to paths you name.
8
+
9
+ The package installs two commands: `loopmath` and its short alias `loop`. If another `loop` is already on your PATH, use `loopmath`.
10
+
11
+ ## Install
12
+
13
+ Python 3.11 or newer.
14
+
15
+ ```sh
16
+ pipx install loopmath # or: uv tool install loopmath, or pip install loopmath in a venv
17
+ loopmath --version
18
+ ```
19
+
20
+ From a clone of this repository:
21
+
22
+ ```sh
23
+ python3 -m venv .venv
24
+ .venv/bin/python -m pip install -e .
25
+ ```
26
+
27
+ ## First run
28
+
29
+ ```sh
30
+ loopmath skill install # teach your coding agents how to use loopmath
31
+ ```
32
+
33
+ Then ask your agent to onboard, for example "onboard loopmath". The agent runs a dry run, asks you one question (which model labels your sessions, with the cost of each option), onboards, fits, and opens the results page.
34
+
35
+ `skill install` writes six skills, one per job, and a shared `reference.md` with every command and JSON field they use. An agent loads only the skill for the job at hand, and each phrase belongs to one skill:
36
+
37
+ | Skill | Ask your agent |
38
+ |---|---|
39
+ | `loopmath` | loopmath named without a job: "use loopmath", "what can loopmath do", "what next with loopmath" |
40
+ | `loopmath-onboard` | "onboard", "set up", "start" or "try" loopmath; or loopmath has no runs yet |
41
+ | `loopmath-import-runs` | OCP files (`*.ocp.json`), a folder of finished runs, or the output of an orchestrator or experiment harness that writes OCP |
42
+ | `loopmath-update-fit` | "update", "refresh" or "rerun" the fit; what loopmath learned; runs imported or recorded without a refit |
43
+ | `loopmath-plan-task` | "plan a task with loopmath"; which workflow, model or effort to use; a coding task of more than a few minutes in a repo that uses loopmath |
44
+ | `loopmath-record-run` | a task planned with loopmath is done; "record", "log" or "save" a run; both runs of a pair need a blind judge |
45
+
46
+ By default the skills go to every agent whose home exists: Claude Code (`~/.claude/skills/<name>/`, or under `$CLAUDE_CONFIG_DIR`) and Codex (`~/.codex/skills/<name>/`, or under `$CODEX_HOME`). `--target claude-code`, `codex` or `both` picks them yourself. If your Codex has no skills folder, the files go to `~/.codex/loopmath/<name>/` instead, with a short marked block in `~/.codex/AGENTS.md` that lists them. Add `--scope project` to install into the current repository (or `--dir PATH` for another one).
47
+
48
+ It is safe to run again. It records the files it wrote, with their hashes, in `.loopmath-skills.json` beside the skill folders, and it replaces or removes only those. A skill file you changed is kept, with a note. Any other file where a skill goes stops the install before it writes anything, and names the path to move aside. The single skill that 0.1 installed is replaced when it is as 0.1 wrote it. `loopmath skill show NAME` prints one skill, and `loopmath skill uninstall` removes the files it wrote. `loopmath doctor` shows what loopmath can see: logs, agents, store, fit, prices and skills.
49
+
50
+ To onboard by hand instead:
51
+
52
+ ```sh
53
+ loopmath onboard --dry-run # what it found, and what each labeller costs
54
+ loopmath onboard --labeler claude:claude-haiku-4-5 --yes # record it and run a first fit
55
+ ```
56
+
57
+ `onboard` reads your recent Claude Code and Codex sessions (the last 90 days unless you pass `--since`). It groups them into runs, labels each group's task type with a model you choose, names your usual workflow per task type and repository, and fits. loopmath never picks the labelling model for you. `--labeler` takes one of:
58
+
59
+ - `claude:<model>`, through your `claude` CLI;
60
+ - `codex:<model>`, through your `codex` CLI;
61
+ - `command:<cmd>`, any local command such as `command:ollama run <model>`, so nothing leaves the machine;
62
+ - `none`, to skip labelling.
63
+
64
+ Reading the history uses up to 8 worker processes (one per CPU, at most 8). Set `LOOPMATH_WORKERS=1` to keep everything in one process, or another number to change the count.
65
+
66
+ loopmath ships with a prior built from our own sweeps and experiments, so `recommend` gives an answer before you have any history. Your own runs then move it.
67
+
68
+ ## The loop
69
+
70
+ The plan and record skills take an agent through the loop in three commands:
71
+
72
+ ```sh
73
+ loopmath recommend --type bug_fix --repo acme/api --title "Fix the parser crash" --json --brief --html
74
+ loopmath run start --rec REC --choice goal --base-commit SHA --json # the harness, model and effort per piece
75
+ loopmath run record --run RUN --session UUID --verified tests=pass --json # costs from the logs, the outcome, the receipt
76
+ ```
77
+
78
+ The same loop step by step, for a tool of your own:
79
+
80
+ ```sh
81
+ # 1. Plan: classify the task, then ask.
82
+ loopmath task-types
83
+ loopmath recommend --type bug_fix --repo acme/api --feature size=s --feature lang=python --json
84
+ # the usual workflow (without one, your best recorded workflow is the reference), the success-cost curve,
85
+ # alternatives, two exploration picks, a suggested pair
86
+
87
+ # 2. Record: one run per workflow you run, one attempt per agent you launch.
88
+ loopmath run start --type bug_fix --repo acme/api --base-commit SHA --config CFG --source usual --rec REC
89
+ loopmath run attempt --run RUN --piece implement --harness claude-code --model claude-opus-5-5 \
90
+ --effort high --cwd . --session UUID # launch the agent with: claude --session-id UUID
91
+ loopmath run attempt --run RUN --end ATT --status done
92
+ loopmath run artifact --run RUN --kind commit --path SHA --by ATT
93
+
94
+ # 3. Outcome: verdicts, scores, and later events.
95
+ loopmath outcome --run RUN --signal tests=pass --kind verdict --tier verified
96
+ loopmath outcome --run RUN --signal runtime_s=182 --kind score --unit s --better lower
97
+
98
+ # 4. Finish: costs from the logs, a receipt, a refit.
99
+ loopmath run finish --run RUN
100
+
101
+ # Later: an incident or revert traced back to the run that made the commit.
102
+ loopmath outcome --commit SHA --signal incident=INC-42 --kind event --source tracker
103
+ ```
104
+
105
+ A pair runs the goal workflow and an exploration pick from the same base commit, in separate worktrees. Save the recommendation (`recommend ... --json > rec.json`) and start both runs from it with `run start --task-file rec.json`, so they share one task: the first with `--new-slate`, the second with `--slate SLT`. A blinded referee then picks the better change, which you record with `loopmath outcome --slate SLT --prefer RUN --judge referee --blinded`.
106
+
107
+ A run counts as a success when it is accepted under your rule. By default that means the task's tests pass. A rule can also be a score target: `loopmath recommend ... --target 'heldout_perf>=2400'` or `--target 'runtime_s<=200'` gives the expected score and the chance of reaching the target. Set standing rules and other options with `loopmath config set KEY VALUE`, and the spending cap with `loopmath budget --usd X --period month`.
108
+
109
+ Runs recorded by another tool that writes OCP v0.3, such as an experiment runner, come in with `loopmath run import DIR --finish`: several files or a directory, with one refit at the end (`--no-fit` skips it). Runs in your store always count as yours, whatever source their documents name. `loopmath fit --without SOURCE` leaves out one shipped prior source, and `loopmath status` names the options of the current fit.
110
+
111
+ ## The three views
112
+
113
+ Each view is a self-contained HTML file written by a command; there is no server. The same numbers are available with `--json`.
114
+
115
+ - **Previous runs:** `loopmath runs --html`. Every recorded run with its workflow graph, costs, signals and receipt.
116
+ - **Plans for a task:** `loopmath recommend ... --html`. The candidates on a success-cost chart. Click one to see its workflow graph with per-piece predictions.
117
+ - **Current estimates:** `loopmath posterior --html`. What loopmath believes at each level (model, effort, role, topology, task type, repository, feature), each with a range. Add `--workflow CFG` (a configuration id from `loopmath recommend` or your runs) to see the estimate for each piece of one workflow.
118
+
119
+ Without a path, `--html` writes the page under `~/.loopmath/views/` and prints where it went.
120
+
121
+ ## Commands
122
+
123
+ | Group | Commands |
124
+ |---|---|
125
+ | Plan | `task-types`, `workflows` (list, show, validate, diff), `recommend` |
126
+ | Record | `run` (start, attempt, artifact, finish, import), `outcome`, `budget`, `config` (get, set) |
127
+ | Learn | `fit`, `onboard`, `share`, `prior` |
128
+ | View | `runs`, `posterior`, `status`, `report`, `doctor` |
129
+ | Skill | `skill` (install, uninstall, show) |
130
+ | OCP | `ocp` (validate, migrate) |
131
+ | Log analysis | `analyze`, `graph`, `adapt`, `prices`, `validate-prices`, `scan`, `verify-receipts` |
132
+
133
+ Each command prints a short summary by default. With `--json`, it prints exactly one JSON object instead. Exit codes: 0 ok, 1 user error, 2 not found, 3 not implemented, 4 store locked, 5 no fit yet. For flags, `loopmath <command> --help` is the source of truth.
134
+
135
+ A workflow is a TOML file. `loopmath workflows list` shows the catalog and yours, which live in `~/.loopmath/workflows/`. This one implements, then sends a rejected change back once or twice:
136
+
137
+ ```toml
138
+ id = "implement_review_mine"
139
+ version = 1
140
+ title = "Implement, then review"
141
+ edges = ["issue -> implement", "repo -> implement", "implement -> diff", "diff -> review", "review -> verdict"]
142
+
143
+ [[pieces]]
144
+ id = "implement"
145
+ role = "implementer"
146
+
147
+ [[pieces]]
148
+ id = "review"
149
+ role = "reviewer"
150
+
151
+ [[artifacts]]
152
+ id = "issue"
153
+ kind = "issue"
154
+
155
+ [[artifacts]]
156
+ id = "repo"
157
+ kind = "repo"
158
+
159
+ [[artifacts]]
160
+ id = "diff"
161
+ kind = "diff"
162
+
163
+ [[artifacts]]
164
+ id = "verdict"
165
+ kind = "verdict"
166
+
167
+ [control]
168
+ budget_rounds = 3 # rounds, counting the first; 1 means no repair
169
+
170
+ [[control.gates]]
171
+ after = "review" # the review's verdict decides
172
+ on_fail = "implement" # a rejected change goes back to implement
173
+
174
+ [settings.implement] # optional; with a setting for every piece, the file is a configuration
175
+ harness = "claude-code"
176
+ model = "claude-opus-5-5"
177
+ effort = "high"
178
+
179
+ [settings.review]
180
+ harness = "codex"
181
+ model = "gpt-5.6-sol"
182
+ effort = "high"
183
+ ```
184
+
185
+ Check it with `loopmath workflows validate FILE`, compare it with `loopmath workflows diff implement_review FILE`, and pass it to `recommend --workflow FILE` to have it considered, or to `run start --workflow FILE` to record a run with its settings (`--set PIECE=HARNESS:MODEL:EFFORT` overrides a piece).
186
+
187
+ ## The store and privacy
188
+
189
+ The store is `~/.loopmath`. Set `LOOPMATH_HOME` or pass `--home` to put it elsewhere; the log parse cache moves with it, to `cache/` inside the store, unless you set `LOOPMATH_CACHE_DIR`. It holds:
190
+
191
+ - one OCP v0.3 document per recorded run;
192
+ - signals, receipts and fits;
193
+ - your config and your workflows;
194
+ - the views you write;
195
+ - the log parse cache.
196
+
197
+ Do not edit the store by hand; use the commands.
198
+
199
+ Run files use the `metadata_only` privacy profile. They keep structure, models, tokens, dollars, paths and verdicts, but not transcript text.
200
+
201
+ `loopmath share --out FILE` writes a reduced copy you can send to us. It keeps task types, workflows, models, tokens, dollars and outcomes. Repository names are hashed. Titles, paths, commands, session ids and commit shas are removed. `loopmath share --preview` prints exactly what would leave.
202
+
203
+ ## Analyzing logs without recording
204
+
205
+ The log commands work on their own, with no store or fit:
206
+
207
+ ```sh
208
+ loopmath analyze # cost per accepted run from the last 14 days of local logs
209
+ loopmath graph --workspace NAME --format html --out graph.html
210
+ ```
211
+
212
+ `analyze` reads `~/.claude/projects` and `~/.codex/sessions`. It grades the outcome evidence it finds, prices known models, and prints cost per accepted run with an 80% band. It also lists what it could not use and why.
213
+
214
+ `graph` rebuilds which agent launched which, and which session read what another wrote. Its formats are `ocp`, `json`, `dot`, `run` and `html`. See the [workflow graph guide](docs/graph.md) and [adapters](docs/adapters.md).
215
+
216
+ ## Research data
217
+
218
+ `loopmath research fit|transfer-test` and `loopmath analyze-e0` read data folders that are not part of the package. Name them with a flag (`--sweep-dir`, `--corpus`), an environment variable (`LOOPMATH_SWEEP_DIR`, `LOOPMATH_E0_CORPUS`), or config (`loopmath config set research.sweep_dir PATH`, `research.e0_corpus`). The research verbs need the `bayes` extra (`pip install 'loopmath[bayes]'`).
219
+
220
+ ## More
221
+
222
+ - [OCP, the run format](spec/OCP.md): the normative note that goes with the [schemas](spec/), and the [versioning promise](spec/VERSIONING.md)
223
+ - [Release policy](docs/release.md)
224
+ - [Packaged model prices](src/loopmath/prices.toml)
225
+
226
+ ## License
227
+
228
+ MIT.
@@ -0,0 +1,111 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "loopmath"
7
+ version = "0.2.0"
8
+ description = "Plan agent workflows, record how they went, and learn from your own Claude Code and Codex logs"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.11"
13
+ authors = [
14
+ { name = "QKV Labs" },
15
+ ]
16
+ keywords = [
17
+ "agents",
18
+ "claude code",
19
+ "codex",
20
+ "cost analysis",
21
+ "developer tools",
22
+ "workflow analysis",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 3 - Alpha",
26
+ "Environment :: Console",
27
+ "Intended Audience :: Developers",
28
+ "Operating System :: OS Independent",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3 :: Only",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Programming Language :: Python :: 3.14",
35
+ "Topic :: Software Development",
36
+ "Topic :: Software Development :: Quality Assurance",
37
+ ]
38
+ # Core: everything the loop needs (onboard, recommend, run, outcome, finish, the
39
+ # views). The default belief engine behind `fit`, `recommend` and receipts is
40
+ # Gaussian and uses scipy (spec 00 section 4, `loopmath/belief/`); jsonschema
41
+ # checks OCP documents; `analyze` runs on numpy and pandas. A plotting stack
42
+ # stays out: matplotlib is only for the E0 figure writer (the `e0` extra).
43
+ dependencies = [
44
+ "jsonschema>=4",
45
+ "numpy",
46
+ "pandas",
47
+ "scipy",
48
+ ]
49
+
50
+ # The research verbs (`loopmath research fit|transfer-test`) use the older PyMC
51
+ # engine and need the [bayes] extra; they say so when it is missing. The default
52
+ # engine does not.
53
+ [project.optional-dependencies]
54
+ bayes = [
55
+ "pymc>=5",
56
+ # `fit_bayes.py` imports pytensor directly. Do not rely on pymc's
57
+ # transitive dependency to supply a module loopmath itself imports.
58
+ "pytensor",
59
+ "arviz",
60
+ # arviz writes a fit with `to_netcdf`, which needs a NetCDF backend it does
61
+ # not itself depend on. Without one, `loopmath research fit --out PATH` samples fine and
62
+ # then dies on the write. Declared here so a fresh install of the extra can
63
+ # actually use `--out`; the CLI still catches the missing backend and says
64
+ # which package to install rather than surfacing a raw ValueError.
65
+ "h5netcdf",
66
+ ]
67
+
68
+ # The E0 walkdown verb writes figures, which is the only thing in the package
69
+ # that needs a plotting stack. Without this extra, `loopmath analyze-e0` is simply
70
+ # not registered and every other verb works unchanged.
71
+ e0 = [
72
+ "matplotlib",
73
+ ]
74
+
75
+ [project.scripts]
76
+ loopmath = "loopmath.cli:main"
77
+ loop = "loopmath.cli:main"
78
+
79
+ [project.urls]
80
+ Homepage = "https://github.com/loopmath/loopmath"
81
+ Issues = "https://github.com/loopmath/loopmath/issues"
82
+ Repository = "https://github.com/loopmath/loopmath.git"
83
+
84
+ [tool.setuptools.packages.find]
85
+ where = ["src"]
86
+
87
+ [tool.setuptools.package-data]
88
+ loopmath = [
89
+ "prices.toml",
90
+ "workflows/catalog/*.toml",
91
+ "skill/skills/*.md",
92
+ "skill/skills/*/SKILL.md",
93
+ "priors/*.toml",
94
+ "priors/bundle/*",
95
+ "views/assets/*",
96
+ "ocp/schema/*.json",
97
+ ]
98
+
99
+ [tool.setuptools.data-files]
100
+ spec = [
101
+ "spec/ocp_conformance.py",
102
+ "spec/ocp-v0.schema.json",
103
+ "spec/ocp-v0.2.schema.json",
104
+ ]
105
+
106
+ [tool.pytest.ini_options]
107
+ testpaths = ["tests"]
108
+ addopts = '-m "not packaging"'
109
+ markers = [
110
+ "packaging: builds and installs a distribution artifact in an isolated environment",
111
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+