manabot 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 (480) hide show
  1. manabot-0.2.0/PKG-INFO +280 -0
  2. manabot-0.2.0/README.md +235 -0
  3. manabot-0.2.0/academy/README.md +213 -0
  4. manabot-0.2.0/academy/__init__.py +14 -0
  5. manabot-0.2.0/academy/advice.py +1713 -0
  6. manabot-0.2.0/academy/advice_identity.py +123 -0
  7. manabot-0.2.0/academy/attempts.py +571 -0
  8. manabot-0.2.0/academy/authored_match_parity.py +831 -0
  9. manabot-0.2.0/academy/authored_match_receipt.py +439 -0
  10. manabot-0.2.0/academy/bot_decision.py +30 -0
  11. manabot-0.2.0/academy/curated_pack.py +413 -0
  12. manabot-0.2.0/academy/fixtures/choice-navigation-explicit-w10.json +1964 -0
  13. manabot-0.2.0/academy/fixtures/choice-navigation-explicit-w11.json +1964 -0
  14. manabot-0.2.0/academy/fixtures/choice-navigation-explicit-w9.json +1964 -0
  15. manabot-0.2.0/academy/fixtures/choice-navigation-w10.json +4483 -0
  16. manabot-0.2.0/academy/fixtures/choice-navigation-w11.json +4483 -0
  17. manabot-0.2.0/academy/fixtures/choice-navigation-w9.json +4483 -0
  18. manabot-0.2.0/academy/fixtures/choice-navigation.json +5058 -0
  19. manabot-0.2.0/academy/fixtures/learn-demo-explicit-w10.json +434 -0
  20. manabot-0.2.0/academy/fixtures/learn-demo-explicit-w11.json +434 -0
  21. manabot-0.2.0/academy/fixtures/learn-demo-explicit-w9.json +433 -0
  22. manabot-0.2.0/academy/fixtures/learn-demo-w10.json +213 -0
  23. manabot-0.2.0/academy/fixtures/learn-demo-w11.json +213 -0
  24. manabot-0.2.0/academy/fixtures/learn-demo-w7.json +213 -0
  25. manabot-0.2.0/academy/fixtures/learn-demo-w8.json +213 -0
  26. manabot-0.2.0/academy/fixtures/learn-demo-w9.json +213 -0
  27. manabot-0.2.0/academy/fixtures/learn-demo.json +213 -0
  28. manabot-0.2.0/academy/fixtures/precision-demo-w10.json +979 -0
  29. manabot-0.2.0/academy/fixtures/precision-demo-w11.json +979 -0
  30. manabot-0.2.0/academy/fixtures/precision-demo-w9.json +979 -0
  31. manabot-0.2.0/academy/fixtures/precision-mana-demo-w10.json +1064 -0
  32. manabot-0.2.0/academy/fixtures/precision-mana-demo-w11.json +1064 -0
  33. manabot-0.2.0/academy/fixtures/precision-mana-demo-w9.json +1064 -0
  34. manabot-0.2.0/academy/learn_lesson_evidence.py +232 -0
  35. manabot-0.2.0/academy/live_advice.py +197 -0
  36. manabot-0.2.0/academy/local_advice.py +74 -0
  37. manabot-0.2.0/academy/opponent.py +283 -0
  38. manabot-0.2.0/academy/play_demo.py +77 -0
  39. manabot-0.2.0/academy/presentation.py +350 -0
  40. manabot-0.2.0/academy/public_commitment_parity.py +679 -0
  41. manabot-0.2.0/academy/replay_index.py +783 -0
  42. manabot-0.2.0/academy/semantic_boundary.py +40 -0
  43. manabot-0.2.0/academy/server.py +3637 -0
  44. manabot-0.2.0/academy/shared_table_protocol.py +378 -0
  45. manabot-0.2.0/academy/study_branch.py +333 -0
  46. manabot-0.2.0/academy/study_evidence.py +247 -0
  47. manabot-0.2.0/academy/study_index.py +674 -0
  48. manabot-0.2.0/academy/study_protocol.py +481 -0
  49. manabot-0.2.0/academy/study_runtime.py +190 -0
  50. manabot-0.2.0/academy/trace.py +283 -0
  51. manabot-0.2.0/academy/ui/src/lib/packs/elemental-world/v1/manifest.json +2467 -0
  52. manabot-0.2.0/academy/ui/src/lib/packs/elemental-world/v2/manifest.json +2467 -0
  53. manabot-0.2.0/academy/ui/src/lib/packs/tla-gw-allies-jeong-vs-ur-lessons/v1/manifest.json +761 -0
  54. manabot-0.2.0/academy/ui/src/lib/packs/tla-gw-allies-jeong-vs-ur-lessons/v2/manifest.json +765 -0
  55. manabot-0.2.0/academy/ui/src/lib/packs/tla-ur-lessons-vs-gw-allies/v1/NOTICE.md +16 -0
  56. manabot-0.2.0/academy/ui/src/lib/packs/tla-ur-lessons-vs-gw-allies/v1/manifest.json +244 -0
  57. manabot-0.2.0/academy/ui/src/lib/packs/tla-ur-lessons-vs-gw-allies/v2/NOTICE.md +16 -0
  58. manabot-0.2.0/academy/ui/src/lib/packs/tla-ur-lessons-vs-gw-allies/v2/manifest.json +248 -0
  59. manabot-0.2.0/academy/villain.py +209 -0
  60. manabot-0.2.0/academy/watch.py +306 -0
  61. manabot-0.2.0/content/semantic/v1/complexity.learning_schema.json +304 -0
  62. manabot-0.2.0/content/semantic/v1/complexity.source.json +1764 -0
  63. manabot-0.2.0/content/semantic/v1/coverage.evidence.json +488 -0
  64. manabot-0.2.0/content/semantic/v1/elemental.fixtures.json +65 -0
  65. manabot-0.2.0/content/semantic/v1/elemental.source.json +2668 -0
  66. manabot-0.2.0/content/semantic/v1/elemental_world.fixtures.json +958 -0
  67. manabot-0.2.0/content/semantic/v1/elemental_world.source.json +6136 -0
  68. manabot-0.2.0/content/semantic/v1/generated/complexity.coverage.json +461 -0
  69. manabot-0.2.0/content/semantic/v1/generated/complexity.ir.json +2144 -0
  70. manabot-0.2.0/content/semantic/v1/generated/coverage-gaps.json +1841 -0
  71. manabot-0.2.0/content/semantic/v1/generated/elemental.coverage.json +664 -0
  72. manabot-0.2.0/content/semantic/v1/generated/elemental.ir.json +3240 -0
  73. manabot-0.2.0/content/semantic/v1/generated/elemental_world.coverage.json +1307 -0
  74. manabot-0.2.0/content/semantic/v1/generated/elemental_world.ir.json +7333 -0
  75. manabot-0.2.0/content/semantic/v1/generated/jeong_increment.coverage.json +425 -0
  76. manabot-0.2.0/content/semantic/v1/generated/jeong_increment.ir.json +1951 -0
  77. manabot-0.2.0/content/semantic/v1/generated/sacrifice.coverage.json +346 -0
  78. manabot-0.2.0/content/semantic/v1/generated/sacrifice.ir.json +1730 -0
  79. manabot-0.2.0/content/semantic/v1/generated/temur.coverage.json +149 -0
  80. manabot-0.2.0/content/semantic/v1/generated/temur.ir.json +810 -0
  81. manabot-0.2.0/content/semantic/v1/generated/two_deck.coverage.json +414 -0
  82. manabot-0.2.0/content/semantic/v1/generated/two_deck.ir.json +1914 -0
  83. manabot-0.2.0/content/semantic/v1/jeong_increment.fixtures.json +12 -0
  84. manabot-0.2.0/content/semantic/v1/jeong_increment.source.json +1581 -0
  85. manabot-0.2.0/content/semantic/v1/learning_schema.json +303 -0
  86. manabot-0.2.0/content/semantic/v1/sacrifice.fixtures.json +53 -0
  87. manabot-0.2.0/content/semantic/v1/sacrifice.source.json +1416 -0
  88. manabot-0.2.0/content/semantic/v1/temur.fixtures.json +130 -0
  89. manabot-0.2.0/content/semantic/v1/temur.source.json +658 -0
  90. manabot-0.2.0/content/semantic/v1/two_deck.fixtures.json +30 -0
  91. manabot-0.2.0/content/semantic/v1/two_deck.source.json +557 -0
  92. manabot-0.2.0/content/semantic/w10/learning_schema.json +437 -0
  93. manabot-0.2.0/content/semantic/w11/elemental_world.fixtures.json +959 -0
  94. manabot-0.2.0/content/semantic/w11/elemental_world.source.json +6144 -0
  95. manabot-0.2.0/content/semantic/w11/generated/elemental_world.coverage.json +1308 -0
  96. manabot-0.2.0/content/semantic/w11/generated/elemental_world.ir.json +7342 -0
  97. manabot-0.2.0/content/semantic/w11/learning_schema.json +441 -0
  98. manabot-0.2.0/content/semantic/w7/learning_schema.json +402 -0
  99. manabot-0.2.0/content/semantic/w8/learning_schema.json +426 -0
  100. manabot-0.2.0/content/semantic/w9/learning_schema.json +433 -0
  101. manabot-0.2.0/docs/experiment-metrics.md +361 -0
  102. manabot-0.2.0/manabot/README.md +339 -0
  103. manabot-0.2.0/manabot/RESEARCH.md +348 -0
  104. manabot-0.2.0/manabot/__init__.py +0 -0
  105. manabot-0.2.0/manabot/arena/__init__.py +6 -0
  106. manabot-0.2.0/manabot/arena/competency.py +129 -0
  107. manabot-0.2.0/manabot/arena/evaluate.py +447 -0
  108. manabot-0.2.0/manabot/arena/guidance.py +137 -0
  109. manabot-0.2.0/manabot/arena/heuristic.py +648 -0
  110. manabot-0.2.0/manabot/arena/match.py +536 -0
  111. manabot-0.2.0/manabot/arena/matchup.py +39 -0
  112. manabot-0.2.0/manabot/arena/models.py +685 -0
  113. manabot-0.2.0/manabot/arena/players.py +131 -0
  114. manabot-0.2.0/manabot/arena/profile.py +463 -0
  115. manabot-0.2.0/manabot/arena/rating.py +277 -0
  116. manabot-0.2.0/manabot/arena/replay.py +230 -0
  117. manabot-0.2.0/manabot/belief/__init__.py +63 -0
  118. manabot-0.2.0/manabot/belief/agent.py +216 -0
  119. manabot-0.2.0/manabot/belief/audit.py +434 -0
  120. manabot-0.2.0/manabot/belief/demo.py +215 -0
  121. manabot-0.2.0/manabot/belief/encoding.py +379 -0
  122. manabot-0.2.0/manabot/belief/learning.py +885 -0
  123. manabot-0.2.0/manabot/belief/learning_demo.py +374 -0
  124. manabot-0.2.0/manabot/belief/likelihood.py +245 -0
  125. manabot-0.2.0/manabot/belief/player.py +294 -0
  126. manabot-0.2.0/manabot/belief/range.py +405 -0
  127. manabot-0.2.0/manabot/belief/runtime.py +189 -0
  128. manabot-0.2.0/manabot/belief/sampling.py +283 -0
  129. manabot-0.2.0/manabot/belief/sampling_cohort.py +501 -0
  130. manabot-0.2.0/manabot/belief/sampling_data.py +396 -0
  131. manabot-0.2.0/manabot/belief/sampling_fit.py +547 -0
  132. manabot-0.2.0/manabot/belief/sampling_report.py +330 -0
  133. manabot-0.2.0/manabot/belief/state.py +336 -0
  134. manabot-0.2.0/manabot/belief/tracker.py +372 -0
  135. manabot-0.2.0/manabot/cli.py +313 -0
  136. manabot-0.2.0/manabot/conf/model/attention.yaml +29 -0
  137. manabot-0.2.0/manabot/conf/model/local.yaml +29 -0
  138. manabot-0.2.0/manabot/conf/model/simple.yaml +29 -0
  139. manabot-0.2.0/manabot/conf/sim/sim.yaml +19 -0
  140. manabot-0.2.0/manabot/config/__init__.py +1 -0
  141. manabot-0.2.0/manabot/config/load.py +127 -0
  142. manabot-0.2.0/manabot/config/presets.py +80 -0
  143. manabot-0.2.0/manabot/data.py +330 -0
  144. manabot-0.2.0/manabot/env/__init__.py +23 -0
  145. manabot-0.2.0/manabot/env/env.py +233 -0
  146. manabot-0.2.0/manabot/env/match.py +227 -0
  147. manabot-0.2.0/manabot/env/observation.py +579 -0
  148. manabot-0.2.0/manabot/env/single_agent_env.py +174 -0
  149. manabot-0.2.0/manabot/env/target_practice.py +128 -0
  150. manabot-0.2.0/manabot/env/vector_env.py +350 -0
  151. manabot-0.2.0/manabot/infra/__init__.py +26 -0
  152. manabot-0.2.0/manabot/infra/artifacts.py +159 -0
  153. manabot-0.2.0/manabot/infra/experiment.py +158 -0
  154. manabot-0.2.0/manabot/infra/hypers.py +282 -0
  155. manabot-0.2.0/manabot/infra/log.py +29 -0
  156. manabot-0.2.0/manabot/infra/profiler.py +276 -0
  157. manabot-0.2.0/manabot/managym/__init__.py +7 -0
  158. manabot-0.2.0/manabot/managym/__init__.pyi +446 -0
  159. manabot-0.2.0/manabot/managym/decision.py +274 -0
  160. manabot-0.2.0/manabot/managym/enums.py +103 -0
  161. manabot-0.2.0/manabot/managym/experience.py +605 -0
  162. manabot-0.2.0/manabot/managym/experience_projection.py +445 -0
  163. manabot-0.2.0/manabot/managym/possible_worlds.py +580 -0
  164. manabot-0.2.0/manabot/model/__init__.py +8 -0
  165. manabot-0.2.0/manabot/model/agent.md +193 -0
  166. manabot-0.2.0/manabot/model/agent.py +754 -0
  167. manabot-0.2.0/manabot/model/architecture.py +100 -0
  168. manabot-0.2.0/manabot/model/catalog.py +380 -0
  169. manabot-0.2.0/manabot/model/compound.py +171 -0
  170. manabot-0.2.0/manabot/model/inference.py +146 -0
  171. manabot-0.2.0/manabot/model/policy_distribution.py +184 -0
  172. manabot-0.2.0/manabot/model/recent_events.py +99 -0
  173. manabot-0.2.0/manabot/model/semantic_cards.py +171 -0
  174. manabot-0.2.0/manabot/model/train.py +924 -0
  175. manabot-0.2.0/manabot/model/training.md +282 -0
  176. manabot-0.2.0/manabot/model/training_monitoring.md +5 -0
  177. manabot-0.2.0/manabot/model/world.py +164 -0
  178. manabot-0.2.0/manabot/remote/__init__.py +1 -0
  179. manabot-0.2.0/manabot/remote/_legacy.py +122 -0
  180. manabot-0.2.0/manabot/remote/bundle.py +179 -0
  181. manabot-0.2.0/manabot/remote/cli.py +336 -0
  182. manabot-0.2.0/manabot/remote/cohort.py +529 -0
  183. manabot-0.2.0/manabot/remote/cohort_cli.py +170 -0
  184. manabot-0.2.0/manabot/remote/cohort_projection.py +382 -0
  185. manabot-0.2.0/manabot/remote/cohort_service.py +352 -0
  186. manabot-0.2.0/manabot/remote/continuation.py +101 -0
  187. manabot-0.2.0/manabot/remote/deploy.py +511 -0
  188. manabot-0.2.0/manabot/remote/guardian.sh +13 -0
  189. manabot-0.2.0/manabot/remote/job_client.py +598 -0
  190. manabot-0.2.0/manabot/remote/job_store.py +317 -0
  191. manabot-0.2.0/manabot/remote/jobs.py +220 -0
  192. manabot-0.2.0/manabot/remote/live_evaluation.py +394 -0
  193. manabot-0.2.0/manabot/remote/plan.py +286 -0
  194. manabot-0.2.0/manabot/remote/progress.py +99 -0
  195. manabot-0.2.0/manabot/remote/provider.py +134 -0
  196. manabot-0.2.0/manabot/remote/snapshots.py +186 -0
  197. manabot-0.2.0/manabot/remote/supervisor.py +448 -0
  198. manabot-0.2.0/manabot/remote/transport.py +217 -0
  199. manabot-0.2.0/manabot/remote/validation.py +203 -0
  200. manabot-0.2.0/manabot/semantic/__init__.py +51 -0
  201. manabot-0.2.0/manabot/semantic/compiler.py +1157 -0
  202. manabot-0.2.0/manabot/semantic/coverage.py +850 -0
  203. manabot-0.2.0/manabot/semantic/decision_contract.py +86 -0
  204. manabot-0.2.0/manabot/semantic/learning.py +1300 -0
  205. manabot-0.2.0/manabot/semantic/policy.py +565 -0
  206. manabot-0.2.0/manabot/semantic/policy_catalog.py +103 -0
  207. manabot-0.2.0/manabot/semantic/structural.py +520 -0
  208. manabot-0.2.0/manabot/semantic/structural_katas.py +1336 -0
  209. manabot-0.2.0/manabot/semantic/transfer.py +1109 -0
  210. manabot-0.2.0/manabot/sim/__init__.py +0 -0
  211. manabot-0.2.0/manabot/sim/compound.py +124 -0
  212. manabot-0.2.0/manabot/sim/conditional_search.py +1378 -0
  213. manabot-0.2.0/manabot/sim/distill.py +749 -0
  214. manabot-0.2.0/manabot/sim/flat_mc.py +749 -0
  215. manabot-0.2.0/manabot/sim/flat_search.py +71 -0
  216. manabot-0.2.0/manabot/sim/local_compound.py +435 -0
  217. manabot-0.2.0/manabot/sim/local_sampling.py +197 -0
  218. manabot-0.2.0/manabot/sim/local_update.py +1048 -0
  219. manabot-0.2.0/manabot/sim/mcts.py +750 -0
  220. manabot-0.2.0/manabot/sim/net_opponent.py +991 -0
  221. manabot-0.2.0/manabot/sim/player.py +253 -0
  222. manabot-0.2.0/manabot/sim/pooled_datagen.py +328 -0
  223. manabot-0.2.0/manabot/sim/producers.py +206 -0
  224. manabot-0.2.0/manabot/sim/rollout.py +365 -0
  225. manabot-0.2.0/manabot/sim/search_branch.py +249 -0
  226. manabot-0.2.0/manabot/sim/search_runtime.py +414 -0
  227. manabot-0.2.0/manabot/sim/search_supervised.py +597 -0
  228. manabot-0.2.0/manabot/sim/selected_branchdriver_teacher.py +655 -0
  229. manabot-0.2.0/manabot/sim/sim.py +764 -0
  230. manabot-0.2.0/manabot/sim/structured_benchmark.py +757 -0
  231. manabot-0.2.0/manabot/sim/structured_policy.py +282 -0
  232. manabot-0.2.0/manabot/sim/teacher1_evidence.py +705 -0
  233. manabot-0.2.0/manabot/sim/value.py +704 -0
  234. manabot-0.2.0/manabot/study/README.md +108 -0
  235. manabot-0.2.0/manabot/study/__init__.py +57 -0
  236. manabot-0.2.0/manabot/study/allies_lessons/__init__.py +13 -0
  237. manabot-0.2.0/manabot/study/allies_lessons/__main__.py +100 -0
  238. manabot-0.2.0/manabot/study/allies_lessons/balance.py +321 -0
  239. manabot-0.2.0/manabot/study/allies_lessons/config.py +84 -0
  240. manabot-0.2.0/manabot/study/allies_lessons/matchup.py +117 -0
  241. manabot-0.2.0/manabot/study/allies_lessons/play-study.ipynb +144 -0
  242. manabot-0.2.0/manabot/study/allies_lessons/report.py +301 -0
  243. manabot-0.2.0/manabot/study/allies_lessons/targeting_audit.py +90 -0
  244. manabot-0.2.0/manabot/study/frames.py +122 -0
  245. manabot-0.2.0/manabot/study/measures.py +258 -0
  246. manabot-0.2.0/manabot/study/record.py +364 -0
  247. manabot-0.2.0/manabot/study/report.py +196 -0
  248. manabot-0.2.0/manabot/study/targeting.py +92 -0
  249. manabot-0.2.0/manabot/training/__init__.py +5 -0
  250. manabot-0.2.0/manabot/training/admission.py +189 -0
  251. manabot-0.2.0/manabot/training/analysis.py +486 -0
  252. manabot-0.2.0/manabot/training/artifacts.py +157 -0
  253. manabot-0.2.0/manabot/training/ataraxos.py +399 -0
  254. manabot-0.2.0/manabot/training/attack_execution.py +316 -0
  255. manabot-0.2.0/manabot/training/attacks.py +103 -0
  256. manabot-0.2.0/manabot/training/baseline.py +169 -0
  257. manabot-0.2.0/manabot/training/builders.py +266 -0
  258. manabot-0.2.0/manabot/training/checkpoint_queue.py +537 -0
  259. manabot-0.2.0/manabot/training/clock.py +88 -0
  260. manabot-0.2.0/manabot/training/comparison_notebook.py +117 -0
  261. manabot-0.2.0/manabot/training/compound.py +372 -0
  262. manabot-0.2.0/manabot/training/etude_evaluation.py +220 -0
  263. manabot-0.2.0/manabot/training/etude_job.py +158 -0
  264. manabot-0.2.0/manabot/training/execution.py +1771 -0
  265. manabot-0.2.0/manabot/training/experiment_execution.py +255 -0
  266. manabot-0.2.0/manabot/training/experiment_report.py +968 -0
  267. manabot-0.2.0/manabot/training/experiment_runner.py +488 -0
  268. manabot-0.2.0/manabot/training/experiments.py +568 -0
  269. manabot-0.2.0/manabot/training/head_to_head.py +426 -0
  270. manabot-0.2.0/manabot/training/health.py +163 -0
  271. manabot-0.2.0/manabot/training/incidents.py +191 -0
  272. manabot-0.2.0/manabot/training/learning_dashboard.py +562 -0
  273. manabot-0.2.0/manabot/training/learning_state.py +265 -0
  274. manabot-0.2.0/manabot/training/local_service.py +243 -0
  275. manabot-0.2.0/manabot/training/matchups.py +52 -0
  276. manabot-0.2.0/manabot/training/models.py +1052 -0
  277. manabot-0.2.0/manabot/training/monitor_checkpoint.py +222 -0
  278. manabot-0.2.0/manabot/training/monitor_evaluation.py +578 -0
  279. manabot-0.2.0/manabot/training/monitoring.py +551 -0
  280. manabot-0.2.0/manabot/training/objectives.py +240 -0
  281. manabot-0.2.0/manabot/training/paired.py +115 -0
  282. manabot-0.2.0/manabot/training/presets/ataraxos-mtg-v1.json +159 -0
  283. manabot-0.2.0/manabot/training/presets.py +20 -0
  284. manabot-0.2.0/manabot/training/recovery.py +266 -0
  285. manabot-0.2.0/manabot/training/references.py +22 -0
  286. manabot-0.2.0/manabot/training/regime_study.ipynb +100 -0
  287. manabot-0.2.0/manabot/training/regime_study.py +1126 -0
  288. manabot-0.2.0/manabot/training/report_snapshot.py +88 -0
  289. manabot-0.2.0/manabot/training/report_study.py +232 -0
  290. manabot-0.2.0/manabot/training/selection.py +177 -0
  291. manabot-0.2.0/manabot/training/selection_analysis.py +290 -0
  292. manabot-0.2.0/manabot/training/selection_data.py +183 -0
  293. manabot-0.2.0/manabot/training/self_play.py +72 -0
  294. manabot-0.2.0/manabot/training/self_play_report.py +152 -0
  295. manabot-0.2.0/manabot/training/source_bundle.py +92 -0
  296. manabot-0.2.0/manabot/training/time_cohort.html +39 -0
  297. manabot-0.2.0/manabot/training/time_cohort.js +224 -0
  298. manabot-0.2.0/manabot/training/time_cohort.py +392 -0
  299. manabot-0.2.0/manabot/training/time_profile.py +384 -0
  300. manabot-0.2.0/manabot/training/time_sources.py +412 -0
  301. manabot-0.2.0/manabot/verify/__init__.py +1 -0
  302. manabot-0.2.0/manabot/verify/action_cases.py +366 -0
  303. manabot-0.2.0/manabot/verify/checkpoint_scenarios.py +353 -0
  304. manabot-0.2.0/manabot/verify/choice_corpus.py +356 -0
  305. manabot-0.2.0/manabot/verify/competency.py +1305 -0
  306. manabot-0.2.0/manabot/verify/decision_profile.py +541 -0
  307. manabot-0.2.0/manabot/verify/first_light.py +639 -0
  308. manabot-0.2.0/manabot/verify/learnability/__init__.py +1 -0
  309. manabot-0.2.0/manabot/verify/learnability/__main__.py +127 -0
  310. manabot-0.2.0/manabot/verify/learnability/capacity.py +196 -0
  311. manabot-0.2.0/manabot/verify/learnability/historical.py +109 -0
  312. manabot-0.2.0/manabot/verify/learnability/input_audit.py +140 -0
  313. manabot-0.2.0/manabot/verify/learnability/publish.py +136 -0
  314. manabot-0.2.0/manabot/verify/learnability/report.py +55 -0
  315. manabot-0.2.0/manabot/verify/learnability/schema.py +86 -0
  316. manabot-0.2.0/manabot/verify/learnability/search.py +276 -0
  317. manabot-0.2.0/manabot/verify/learning_control.py +154 -0
  318. manabot-0.2.0/manabot/verify/learning_regression.py +537 -0
  319. manabot-0.2.0/manabot/verify/report_first_light.py +40 -0
  320. manabot-0.2.0/manabot/verify/run_exp11_judge.py +148 -0
  321. manabot-0.2.0/manabot/verify/run_exp11_train.py +130 -0
  322. manabot-0.2.0/manabot/verify/run_first_light.py +115 -0
  323. manabot-0.2.0/manabot/verify/scenario_validation.py +350 -0
  324. manabot-0.2.0/manabot/verify/step0_env_sanity.py +163 -0
  325. manabot-0.2.0/manabot/verify/step1_trivial_reward.py +73 -0
  326. manabot-0.2.0/manabot/verify/step2_memorization.py +63 -0
  327. manabot-0.2.0/manabot/verify/step3_beat_passive.py +137 -0
  328. manabot-0.2.0/manabot/verify/step4_beat_random.py +58 -0
  329. manabot-0.2.0/manabot/verify/store.py +661 -0
  330. manabot-0.2.0/manabot/verify/util.py +781 -0
  331. manabot-0.2.0/managym/Cargo.lock +527 -0
  332. manabot-0.2.0/managym/Cargo.toml +30 -0
  333. manabot-0.2.0/managym/README.md +134 -0
  334. manabot-0.2.0/managym/__init__.py +16 -0
  335. manabot-0.2.0/managym/__init__.pyi +2 -0
  336. manabot-0.2.0/managym/examples/export_canonical_replay.rs +16 -0
  337. manabot-0.2.0/managym/examples/export_experience_protocol.rs +16 -0
  338. manabot-0.2.0/managym/examples/export_study_index.rs +10 -0
  339. manabot-0.2.0/managym/examples/export_study_protocol.rs +16 -0
  340. manabot-0.2.0/managym/examples/export_study_recorded_decisions.rs +10 -0
  341. manabot-0.2.0/managym/examples/measure_content_pack.rs +318 -0
  342. manabot-0.2.0/managym/src/agent/action.rs +188 -0
  343. manabot-0.2.0/managym/src/agent/behavior_tracker.rs +44 -0
  344. manabot-0.2.0/managym/src/agent/env.rs +1374 -0
  345. manabot-0.2.0/managym/src/agent/mod.rs +10 -0
  346. manabot-0.2.0/managym/src/agent/observation.rs +1212 -0
  347. manabot-0.2.0/managym/src/agent/observation_encoder.rs +1195 -0
  348. manabot-0.2.0/managym/src/agent/opponent.rs +18 -0
  349. manabot-0.2.0/managym/src/agent/policy_history.rs +481 -0
  350. manabot-0.2.0/managym/src/agent/rollout_pool.rs +378 -0
  351. manabot-0.2.0/managym/src/agent/structured_offer.rs +1972 -0
  352. manabot-0.2.0/managym/src/agent/vector_env.rs +725 -0
  353. manabot-0.2.0/managym/src/benchmark.rs +1275 -0
  354. manabot-0.2.0/managym/src/bin/branching_bench.rs +94 -0
  355. manabot-0.2.0/managym/src/bin/semantic_conformance.rs +100 -0
  356. manabot-0.2.0/managym/src/bin/validate_study_artifact.rs +33 -0
  357. manabot-0.2.0/managym/src/canonical_replay.rs +426 -0
  358. manabot-0.2.0/managym/src/cardsets/alpha.rs +490 -0
  359. manabot-0.2.0/managym/src/cardsets/elemental.rs +968 -0
  360. manabot-0.2.0/managym/src/cardsets/ice_age.rs +20 -0
  361. manabot-0.2.0/managym/src/cardsets/mkm.rs +45 -0
  362. manabot-0.2.0/managym/src/cardsets/mod.rs +9 -0
  363. manabot-0.2.0/managym/src/cardsets/sacrifice.rs +503 -0
  364. manabot-0.2.0/managym/src/cardsets/strixhaven.rs +83 -0
  365. manabot-0.2.0/managym/src/cardsets/temur.rs +185 -0
  366. manabot-0.2.0/managym/src/cardsets/tla.rs +842 -0
  367. manabot-0.2.0/managym/src/cardsets/visions.rs +31 -0
  368. manabot-0.2.0/managym/src/conformance.rs +1242 -0
  369. manabot-0.2.0/managym/src/decision.rs +809 -0
  370. manabot-0.2.0/managym/src/decision_context.rs +400 -0
  371. manabot-0.2.0/managym/src/experience.rs +665 -0
  372. manabot-0.2.0/managym/src/flow/action.rs +606 -0
  373. manabot-0.2.0/managym/src/flow/combat.rs +11 -0
  374. manabot-0.2.0/managym/src/flow/combat_actions.rs +324 -0
  375. manabot-0.2.0/managym/src/flow/damage.rs +253 -0
  376. manabot-0.2.0/managym/src/flow/decision.rs +2080 -0
  377. manabot-0.2.0/managym/src/flow/event.rs +131 -0
  378. manabot-0.2.0/managym/src/flow/event_log.rs +461 -0
  379. manabot-0.2.0/managym/src/flow/game.rs +263 -0
  380. manabot-0.2.0/managym/src/flow/identity.rs +183 -0
  381. manabot-0.2.0/managym/src/flow/mana.rs +579 -0
  382. manabot-0.2.0/managym/src/flow/mod.rs +26 -0
  383. manabot-0.2.0/managym/src/flow/play.rs +1161 -0
  384. manabot-0.2.0/managym/src/flow/priority.rs +50 -0
  385. manabot-0.2.0/managym/src/flow/proposed_event.rs +474 -0
  386. manabot-0.2.0/managym/src/flow/resolution.rs +1148 -0
  387. manabot-0.2.0/managym/src/flow/sba.rs +185 -0
  388. manabot-0.2.0/managym/src/flow/scenario.rs +154 -0
  389. manabot-0.2.0/managym/src/flow/search.rs +183 -0
  390. manabot-0.2.0/managym/src/flow/setup.rs +155 -0
  391. manabot-0.2.0/managym/src/flow/stabilization.rs +67 -0
  392. manabot-0.2.0/managym/src/flow/statics.rs +228 -0
  393. manabot-0.2.0/managym/src/flow/tick.rs +440 -0
  394. manabot-0.2.0/managym/src/flow/trigger.rs +53 -0
  395. manabot-0.2.0/managym/src/flow/triggers.rs +735 -0
  396. manabot-0.2.0/managym/src/flow/turn.rs +145 -0
  397. manabot-0.2.0/managym/src/flow/undo.rs +754 -0
  398. manabot-0.2.0/managym/src/flow/zones.rs +561 -0
  399. manabot-0.2.0/managym/src/infra/log.rs +19 -0
  400. manabot-0.2.0/managym/src/infra/mod.rs +2 -0
  401. manabot-0.2.0/managym/src/infra/profiler.rs +284 -0
  402. manabot-0.2.0/managym/src/lib.rs +25 -0
  403. manabot-0.2.0/managym/src/possible_worlds.rs +1351 -0
  404. manabot-0.2.0/managym/src/python/bindings.rs +3507 -0
  405. manabot-0.2.0/managym/src/python/convert.rs +86 -0
  406. manabot-0.2.0/managym/src/python/mod.rs +6 -0
  407. manabot-0.2.0/managym/src/python/vector_env_bindings.rs +969 -0
  408. manabot-0.2.0/managym/src/search_state.rs +771 -0
  409. manabot-0.2.0/managym/src/semantic/content.rs +1374 -0
  410. manabot-0.2.0/managym/src/semantic/mod.rs +1586 -0
  411. manabot-0.2.0/managym/src/state/ability.rs +647 -0
  412. manabot-0.2.0/managym/src/state/card.rs +469 -0
  413. manabot-0.2.0/managym/src/state/game_object.rs +189 -0
  414. manabot-0.2.0/managym/src/state/hash.rs +261 -0
  415. manabot-0.2.0/managym/src/state/mana.rs +469 -0
  416. manabot-0.2.0/managym/src/state/mod.rs +11 -0
  417. manabot-0.2.0/managym/src/state/permanent.rs +141 -0
  418. manabot-0.2.0/managym/src/state/player.rs +77 -0
  419. manabot-0.2.0/managym/src/state/predicate.rs +123 -0
  420. manabot-0.2.0/managym/src/state/stack_object.rs +111 -0
  421. manabot-0.2.0/managym/src/state/target.rs +2 -0
  422. manabot-0.2.0/managym/src/state/zone.rs +264 -0
  423. manabot-0.2.0/managym/src/study.rs +690 -0
  424. manabot-0.2.0/managym/tests/authored_match_tests.rs +250 -0
  425. manabot-0.2.0/managym/tests/canonical_replay_tests.rs +187 -0
  426. manabot-0.2.0/managym/tests/conformance_tests.rs +355 -0
  427. manabot-0.2.0/managym/tests/content_pack_clone_allocations.rs +299 -0
  428. manabot-0.2.0/managym/tests/content_pack_tests.rs +228 -0
  429. manabot-0.2.0/managym/tests/elemental_world_tests.rs +99 -0
  430. manabot-0.2.0/managym/tests/engine_tests.rs +443 -0
  431. manabot-0.2.0/managym/tests/experience_protocol_tests.rs +151 -0
  432. manabot-0.2.0/managym/tests/fixtures/scryfall_cards.json +1633 -0
  433. manabot-0.2.0/managym/tests/fixtures/structured_declare_attackers_offer.json +110 -0
  434. manabot-0.2.0/managym/tests/fixtures/structured_priority_bolt_offer.json +90 -0
  435. manabot-0.2.0/managym/tests/learn_setup_tests.rs +108 -0
  436. manabot-0.2.0/managym/tests/match_state_hash_tests.rs +209 -0
  437. manabot-0.2.0/managym/tests/possible_worlds_tests.rs +434 -0
  438. manabot-0.2.0/managym/tests/prepared_possible_worlds_tests.rs +238 -0
  439. manabot-0.2.0/managym/tests/rules/cr_103_game_start.rs +31 -0
  440. manabot-0.2.0/managym/tests/rules/cr_106_mana.rs +77 -0
  441. manabot-0.2.0/managym/tests/rules/cr_117_priority.rs +44 -0
  442. manabot-0.2.0/managym/tests/rules/cr_305_lands.rs +60 -0
  443. manabot-0.2.0/managym/tests/rules/cr_400_identity.rs +202 -0
  444. manabot-0.2.0/managym/tests/rules/cr_405_stack.rs +98 -0
  445. manabot-0.2.0/managym/tests/rules/cr_508_attackers.rs +60 -0
  446. manabot-0.2.0/managym/tests/rules/cr_509_blockers.rs +56 -0
  447. manabot-0.2.0/managym/tests/rules/cr_510_combat_damage.rs +48 -0
  448. manabot-0.2.0/managym/tests/rules/cr_514_cleanup.rs +77 -0
  449. manabot-0.2.0/managym/tests/rules/cr_601_casting.rs +83 -0
  450. manabot-0.2.0/managym/tests/rules/cr_602_activated_abilities.rs +244 -0
  451. manabot-0.2.0/managym/tests/rules/cr_603_triggers.rs +279 -0
  452. manabot-0.2.0/managym/tests/rules/cr_614_replacement.rs +205 -0
  453. manabot-0.2.0/managym/tests/rules/cr_702_keywords.rs +530 -0
  454. manabot-0.2.0/managym/tests/rules/cr_704_sba.rs +354 -0
  455. manabot-0.2.0/managym/tests/rules/elemental_cards.rs +1507 -0
  456. manabot-0.2.0/managym/tests/rules/event_log.rs +126 -0
  457. manabot-0.2.0/managym/tests/rules/event_observations.rs +171 -0
  458. manabot-0.2.0/managym/tests/rules/helpers.rs +591 -0
  459. manabot-0.2.0/managym/tests/rules/interaction_spells.rs +148 -0
  460. manabot-0.2.0/managym/tests/rules/mod.rs +32 -0
  461. manabot-0.2.0/managym/tests/rules/presentation_events.rs +101 -0
  462. manabot-0.2.0/managym/tests/rules/sacrifice_cards.rs +606 -0
  463. manabot-0.2.0/managym/tests/rules/stage2_cards.rs +1101 -0
  464. manabot-0.2.0/managym/tests/rules/stage3_cards.rs +1214 -0
  465. manabot-0.2.0/managym/tests/rules/structured_attacker_offers.rs +640 -0
  466. manabot-0.2.0/managym/tests/rules/structured_offers.rs +696 -0
  467. manabot-0.2.0/managym/tests/rules/temur_cards.rs +578 -0
  468. manabot-0.2.0/managym/tests/rules/tla_cards.rs +1031 -0
  469. manabot-0.2.0/managym/tests/rules/ur_lessons_increment.rs +631 -0
  470. manabot-0.2.0/managym/tests/rules_tests.rs +1 -0
  471. manabot-0.2.0/managym/tests/scenario_tests.rs +315 -0
  472. manabot-0.2.0/managym/tests/search_state_contract.rs +535 -0
  473. manabot-0.2.0/managym/tests/search_tests.rs +490 -0
  474. manabot-0.2.0/managym/tests/semantic_conformance_tests.rs +75 -0
  475. manabot-0.2.0/managym/tests/semantic_interpreter_tests.rs +436 -0
  476. manabot-0.2.0/managym/tests/semantic_ir_tests.rs +275 -0
  477. manabot-0.2.0/managym/tests/study_index_protocol_tests.rs +163 -0
  478. manabot-0.2.0/managym/tests/study_protocol_tests.rs +122 -0
  479. manabot-0.2.0/managym/uv.lock +206 -0
  480. manabot-0.2.0/pyproject.toml +166 -0
manabot-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,280 @@
1
+ Metadata-Version: 2.4
2
+ Name: manabot
3
+ Version: 0.2.0
4
+ Requires-Dist: torch==2.10.0
5
+ Requires-Dist: numpy>=1.24.0
6
+ Requires-Dist: pandas>=2.0.0
7
+ Requires-Dist: nbformat>=5.10.0
8
+ Requires-Dist: gymnasium>=1.0.0
9
+ Requires-Dist: pydantic>=2.12.0
10
+ Requires-Dist: typer>=0.12.5
11
+ Requires-Dist: wandb>=0.18.7
12
+ Requires-Dist: psutil>=5.9.0
13
+ Requires-Dist: etude-sdk==0.2.0
14
+ Requires-Dist: fastapi>=0.116.0 ; extra == 'academy'
15
+ Requires-Dist: uvicorn[standard]>=0.34.0 ; extra == 'academy'
16
+ Requires-Dist: boto3>=1.35.0 ; extra == 'artifacts'
17
+ Requires-Dist: fastapi>=0.116.0 ; extra == 'dev'
18
+ Requires-Dist: uvicorn[standard]>=0.34.0 ; extra == 'dev'
19
+ Requires-Dist: pytest>=7.0.0 ; extra == 'dev'
20
+ Requires-Dist: httpx>=0.28.0 ; extra == 'dev'
21
+ Requires-Dist: jsonschema>=4.23.0 ; extra == 'dev'
22
+ Requires-Dist: ruff>=0.9.0 ; extra == 'dev'
23
+ Requires-Dist: etude-sdk[eval]==0.2.0 ; extra == 'evaluation'
24
+ Requires-Dist: matplotlib>=3.9 ; extra == 'evaluation'
25
+ Requires-Dist: jupyterlab>=4.0 ; extra == 'notebook'
26
+ Requires-Dist: nbclient>=0.10 ; extra == 'notebook'
27
+ Requires-Dist: matplotlib>=3.9 ; extra == 'notebook'
28
+ Requires-Dist: wandb-workspaces>=0.4.13 ; extra == 'notebook'
29
+ Requires-Dist: maturin>=1.5,<2.0 ; extra == 'play'
30
+ Requires-Dist: etude-sdk[s3]==0.2.0 ; python_full_version >= '3.12' and extra == 'reports'
31
+ Requires-Dist: matplotlib>=3.9 ; extra == 'reports'
32
+ Provides-Extra: academy
33
+ Provides-Extra: artifacts
34
+ Provides-Extra: dev
35
+ Provides-Extra: evaluation
36
+ Provides-Extra: notebook
37
+ Provides-Extra: play
38
+ Provides-Extra: reports
39
+ Summary: The trainable Magic: The Gathering agent for Manabot
40
+ Requires-Python: >=3.12, <3.13
41
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
42
+ Project-URL: Homepage, https://manabot.gg
43
+ Project-URL: Repository, https://github.com/loopflowstudio/manabot
44
+
45
+ # Manabot
46
+
47
+ Manabot is a project to train superhuman
48
+ [Magic: The Gathering](https://magic.wizards.com/) bots.
49
+
50
+ It has two halves:
51
+
52
+ - **managym** (Rust): a deterministic rules engine built for learning. It
53
+ handles fast batched stepping, exact clone/fork for search, replay, and
54
+ per-player observations that keep hidden information hidden. Python bindings
55
+ come through PyO3.
56
+ - **manabot** (Python): the agents. It includes self-play training, search,
57
+ belief models over hidden cards, and an arena for evaluating checkpoints
58
+ against fixed opponents.
59
+
60
+ We are currently focusing on a very small but fairly complicated set of decks:
61
+ [UR Lessons versus GW Allies](content/DECKS.md), from the *Avatar: The Last
62
+ Airbender* set.
63
+
64
+ > **Built with two companion projects from Loopflow Studio:**
65
+ >
66
+ > - **[Loopflow](https://github.com/loopflowstudio/loopflow)** is how
67
+ > coding agents are coordinated to write the code.
68
+ > - **[Etude](https://github.com/loopflowstudio/etude)** launches training and evaluation
69
+ > runs and tracks what they record.
70
+
71
+ ## Technical approach
72
+
73
+ **A rules engine built for learning.** managym runs a full game of Magic:
74
+ priority, the stack, combat, triggers, and state-based actions. It is
75
+ deterministic given a seed, steps many games in lockstep, and can clone a game
76
+ state exactly. That makes batched self-play, search over possible futures,
77
+ and replay verification cheap. At every decision it gives each player an
78
+ observation of only what that player can see: players, cards, and permanents
79
+ as typed objects, plus the list of legal actions with the objects each one
80
+ targets.
81
+
82
+ **Cards as typed programs.** Cards are not parsed from Oracle text and not
83
+ hand-coded per card name. Each card is authored as a typed program
84
+ ([content/semantic/](content/semantic/README.md)), compiled to an IR, and run
85
+ by a generic interpreter that rejects anything it cannot execute. The model can
86
+ embed what a card *does* as well as its name, and most new cards are content
87
+ changes rather than engine changes. Rules behavior is pinned by conformance
88
+ fixtures ([conformance/](conformance/)).
89
+
90
+ **Versioned worlds.** The observation and action encoding is versioned as a
91
+ *world* ([WORLDS.md](WORLDS.md)). Checkpoints only load in the world they were
92
+ trained in, and a nightly learnability check catches encodings that make two
93
+ different choices look identical.
94
+
95
+ **One network, one action head.** One network encodes every visible object,
96
+ mixes them with attention, and scores each legal action together with its
97
+ focus objects. A value head predicts the game outcome. Every decision, from
98
+ casting and targeting to attacking, blocking, and paying costs, goes through
99
+ that single action head.
100
+
101
+ **Self-play from terminal reward.** The agent plays both decks against current
102
+ copies of itself, and many games step in lockstep so that inference is
103
+ batched. The update is a clipped policy gradient, regularized toward both the
104
+ collection policy and a fixed reference policy, with advantage filtering,
105
+ annealed step sizes, and an EMA of the weights for evaluation. Those choices
106
+ follow [Ataraxos](https://doi.org/10.1038/s41586-026-11036-y) (Sokota et al.,
107
+ 2026), and each one is a separate switch that we test on Magic rather than
108
+ adopt on the paper's authority ([research program](manabot/RESEARCH.md)).
109
+ Reward is win or loss only: our shaped rewards lost to it
110
+ ([exp-04](experiments/exp-04-potential-shaping.md)).
111
+
112
+ **Hidden information and search.** Belief samplers learn a distribution over
113
+ the opponent's hidden cards from a frozen policy's own games
114
+ ([belief sampler](docs/belief-sampler.md)). Search samples hands from that
115
+ belief, uses the frozen policy for continuations, and distills its choices
116
+ back into the policy ([local policy search](docs/local-policy-search.md)).
117
+ This runs end to end but has not yet shown a strength gain over the policy
118
+ alone.
119
+
120
+ **Evaluation by head-to-head play.** Trained agents play each other. A
121
+ *Tournament* file names a roster of checkpoints and fixed opponents, and the
122
+ runner plays every pairing on the same held-out deals, with both decks and
123
+ both seats ([head-to-head](experiments/head-to-head.md)). The arena fits
124
+ ratings across the whole population (`manabot/arena/`), and a rule-based
125
+ `heuristic` bot gives a stable reference point across runs. Every game is
126
+ replay-verified.
127
+
128
+ **Preregistered experiments.** The question, numeric prediction, kill
129
+ criteria, and cost cap are committed to git before a run; without that commit
130
+ a result is exploratory, not evidence. Frozen contracts record the hashes of
131
+ their inputs, claims about a training method need independent training seeds,
132
+ and refutations stay on the record ([experiments/](experiments/README.md)).
133
+
134
+ Right now the main open question is the training curriculum: which matchups,
135
+ opponents, and mix of self-play the agent should learn from (for example,
136
+ mirror matches versus balanced cross-deck play). Evaluation is kept narrow,
137
+ just enough to compare curricula, rather than testing current agents across a
138
+ wide range of environments.
139
+
140
+ ## Versioned installs
141
+
142
+ Versioned PyPI release preparation, platform support, CPU/CUDA installation and
143
+ maintainer publishing are described in [the release guide](docs/releases.md).
144
+ The first planned release is 0.2.0; the source workflow below remains available.
145
+
146
+ ## Quickstart
147
+
148
+ You need [uv](https://docs.astral.sh/uv/) and a Rust toolchain.
149
+
150
+ ```bash
151
+ git clone git@github.com:loopflowstudio/manabot.git
152
+ cd manabot
153
+ uv sync --python 3.12 --extra dev
154
+ uv run --extra play maturin develop --release \
155
+ --manifest-path managym/Cargo.toml --features python
156
+
157
+ uv run manabot train # small CPU training run, under a minute, no W&B
158
+ ```
159
+
160
+ `uv run manabot train` trains a small agent and saves checkpoints to
161
+ `.runs/local/`. Training recipes are typed *regimes* composed in Python, one module per
162
+ current experiment in [experiments/](experiments/), from reusable parts in
163
+ [manabot/training/builders.py](manabot/training/builders.py). The current GPU
164
+ baseline is
165
+ `uv run manabot train --regime-name batched_baseline --out .runs/batched/run`.
166
+ [manabot/README.md](manabot/README.md) covers presets, remote GPU runs,
167
+ simulation, and evaluation.
168
+
169
+ There is also a local browser table (`./scripts/play`, needs Node) for playing
170
+ one game against a checkpoint or stepping through a replay. It is for
171
+ inspecting what a bot does, not a way to play Magic.
172
+
173
+ ## Scale
174
+
175
+ Training scale per agent, measured in **learner decisions**: the decisions
176
+ the learning policy made and trained on. Decisions with a single legal action
177
+ are played automatically and not counted, and neither are the opponent seat's
178
+ decisions in self-play. This unit does not depend on model size or batching,
179
+ unlike iterations or Adam steps, and does not depend on hardware, unlike
180
+ dollars or hours. We add a row when a run sets a new high.
181
+
182
+ | Agent | Date | Model | Learner decisions | Decisions per iteration × iterations | Hardware |
183
+ |---|---|---|---:|---:|---|
184
+ | first-light PPO ([report](experiments/first-light-run-1.md)) | 2026-03 | width 64 | 262k | 512 × 512 | CPU |
185
+ | matched-cost PPO ([exp-03](experiments/exp-03-distillation.md)) | 2026-07 | 100k params | 5.8M | 2,048 × 2,850 | M4 Max |
186
+ | `small-26k` ([capacity](experiments/model-capacity.md)) | 2026-10 | 64×2, 188k params | 13.3M | 512 × 26,000 | 1× L4 |
187
+ | `small-63k`, continued | 2026-10 | 64×2 | 32.3M | 512 × 63,000 | 1× L4 |
188
+ | `small-100k`, continued | 2026-10 | 64×2 | 51.2M | 512 × 100,000 | 1× L4 |
189
+ | scale ladder v1, one seat ([ladder](experiments/scale-ladder.md)) | 2026-10 | 64×2 | 196.6M | 16,384 × 12,000 | 1× L4, $13.34 |
190
+
191
+ The first two rows predate the current world and encoding, so they record
192
+ scale only. The ladder run's $10 checkpoint (151.6M decisions) scored 0.69
193
+ against the `heuristic` anchor across the four deck matchups, and 0.70 as
194
+ Lessons against Allies. The run was closed before its $50 tier, once
195
+ self-play moved to learning from both seats.
196
+
197
+ Learning-rate schedules currently count iterations, not decisions. The same
198
+ recipe run at a different batch size therefore decays at a different number
199
+ of decisions: about 18M for `small-100k` versus about 575M for the ladder recipe.
200
+
201
+ ## Earlier results
202
+
203
+ Before self-play became the main loop, the project leaned on search. These
204
+ results come from that period and from earlier encodings, so their numbers are
205
+ not comparable with today's checkpoints:
206
+
207
+ - **Search was strong and cheap.** Flat determinized Monte Carlo with 256
208
+ rollouts beat random 99% of the time. Every early trained policy was weaker
209
+ than 16-rollout search ([exp-02](experiments/exp-02-flat-mc.md)).
210
+ - **Distillation beat PPO at equal cost**, 90.5% versus 52.7% against random
211
+ ([exp-03](experiments/exp-03-distillation.md)). Naive expert iteration did
212
+ not compound: round 1 lost 74–26 to round 0
213
+ ([exp-07](experiments/exp-07-expert-iteration.md)).
214
+ - **Reward shaping hurt.** Terminal-only reward beat our shaped rewards by
215
+ about 15 points ([exp-04](experiments/exp-04-potential-shaping.md)).
216
+ - **Win rate hid incompetence.** The search pilot could not play a control
217
+ deck: it found the right line at most 39% of the time in competency
218
+ scenarios, and random beat it in 3 of 5
219
+ ([exp-09](experiments/exp-09-control-competency.md)). Matchup tables mostly
220
+ measured the pilot and card quality
221
+ ([exp-08b](experiments/exp-08b-ancestral-dose.md)).
222
+
223
+ ## Not built yet
224
+
225
+ - **More cards.** Because cards are typed programs, most new cards can be
226
+ added as content without engine changes, but the pool is still two decks.
227
+ - **Limited.** The long-term target is sealed and draft play: building decks
228
+ from a pool, then piloting them. Nothing in the repository drafts or builds
229
+ decks yet.
230
+
231
+ ## Map of the repository
232
+
233
+ | Path | What it is |
234
+ |---|---|
235
+ | `managym/` | Rust rules engine, vectorized env, and PyO3 bindings ([README](managym/README.md)) |
236
+ | `manabot/` | Agents: models, training, search, beliefs, arena, verification ([README](manabot/README.md)) |
237
+ | `experiments/` | Preregistered experiment reports, protocols, and data |
238
+ | `content/` | Card and deck definitions compiled to a typed IR |
239
+ | `conformance/` | Rules conformance fixtures |
240
+ | `docs/` | Architecture, training operations, rules, and research notes ([index](docs/README.md)) |
241
+ | `paper/` | A working paper draft |
242
+ | `ops/`, `deploy/` | Remote training hardware and deployment |
243
+ | `academy/`, `academy/ui/`, `protocol/` | Local browser UI for testing a bot by hand and reviewing replays |
244
+ | `wave/`, `.lf/` | Loopflow Waves, Flows, and skills that organize agent work |
245
+
246
+ [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) has the full system design. In
247
+ short, managym owns the rules and legality, manabot owns inference and
248
+ decisions, and the play UI only displays what managym allows the viewer to
249
+ see.
250
+
251
+ ## Development
252
+
253
+ ```bash
254
+ # Rust (CI runs cargo test in debug, so validate in debug before landing)
255
+ cd managym && cargo fmt --check && cargo clippy --all-targets --all-features -- -D warnings && cargo test && cd ..
256
+
257
+ # Python
258
+ uv run --extra dev pytest tests/
259
+ ```
260
+
261
+ Contributor and agent conventions are in [AGENTS.md](AGENTS.md). Package style
262
+ guides are in each package README.
263
+
264
+ ## Names
265
+
266
+ - **manabot**: the bot and the Python library. You train *a* manabot.
267
+ - **managym**: the rules environment the bot lives in.
268
+ - **Academy**: the local bot-testing UI (`academy/`, `academy/ui/`).
269
+ - **Etude**: the separate system that launches and records experiments
270
+ ([`loopflowstudio/etude`](https://github.com/loopflowstudio/etude)). Older
271
+ documents also use *Etude* and *Fantasia* for this project.
272
+ - **Loopflow**: the agent development tool
273
+ ([`loopflowstudio/loopflow`](https://github.com/loopflowstudio/loopflow)).
274
+
275
+ Manabot is an independent research project and unofficial Fan Content
276
+ permitted under the Wizards of the Coast
277
+ [Fan Content Policy](https://company.wizards.com/en/legal/fancontentpolicy).
278
+ Not approved or endorsed by Wizards. Magic: The Gathering and its card names
279
+ are property of Wizards of the Coast LLC.
280
+
@@ -0,0 +1,235 @@
1
+ # Manabot
2
+
3
+ Manabot is a project to train superhuman
4
+ [Magic: The Gathering](https://magic.wizards.com/) bots.
5
+
6
+ It has two halves:
7
+
8
+ - **managym** (Rust): a deterministic rules engine built for learning. It
9
+ handles fast batched stepping, exact clone/fork for search, replay, and
10
+ per-player observations that keep hidden information hidden. Python bindings
11
+ come through PyO3.
12
+ - **manabot** (Python): the agents. It includes self-play training, search,
13
+ belief models over hidden cards, and an arena for evaluating checkpoints
14
+ against fixed opponents.
15
+
16
+ We are currently focusing on a very small but fairly complicated set of decks:
17
+ [UR Lessons versus GW Allies](content/DECKS.md), from the *Avatar: The Last
18
+ Airbender* set.
19
+
20
+ > **Built with two companion projects from Loopflow Studio:**
21
+ >
22
+ > - **[Loopflow](https://github.com/loopflowstudio/loopflow)** is how
23
+ > coding agents are coordinated to write the code.
24
+ > - **[Etude](https://github.com/loopflowstudio/etude)** launches training and evaluation
25
+ > runs and tracks what they record.
26
+
27
+ ## Technical approach
28
+
29
+ **A rules engine built for learning.** managym runs a full game of Magic:
30
+ priority, the stack, combat, triggers, and state-based actions. It is
31
+ deterministic given a seed, steps many games in lockstep, and can clone a game
32
+ state exactly. That makes batched self-play, search over possible futures,
33
+ and replay verification cheap. At every decision it gives each player an
34
+ observation of only what that player can see: players, cards, and permanents
35
+ as typed objects, plus the list of legal actions with the objects each one
36
+ targets.
37
+
38
+ **Cards as typed programs.** Cards are not parsed from Oracle text and not
39
+ hand-coded per card name. Each card is authored as a typed program
40
+ ([content/semantic/](content/semantic/README.md)), compiled to an IR, and run
41
+ by a generic interpreter that rejects anything it cannot execute. The model can
42
+ embed what a card *does* as well as its name, and most new cards are content
43
+ changes rather than engine changes. Rules behavior is pinned by conformance
44
+ fixtures ([conformance/](conformance/)).
45
+
46
+ **Versioned worlds.** The observation and action encoding is versioned as a
47
+ *world* ([WORLDS.md](WORLDS.md)). Checkpoints only load in the world they were
48
+ trained in, and a nightly learnability check catches encodings that make two
49
+ different choices look identical.
50
+
51
+ **One network, one action head.** One network encodes every visible object,
52
+ mixes them with attention, and scores each legal action together with its
53
+ focus objects. A value head predicts the game outcome. Every decision, from
54
+ casting and targeting to attacking, blocking, and paying costs, goes through
55
+ that single action head.
56
+
57
+ **Self-play from terminal reward.** The agent plays both decks against current
58
+ copies of itself, and many games step in lockstep so that inference is
59
+ batched. The update is a clipped policy gradient, regularized toward both the
60
+ collection policy and a fixed reference policy, with advantage filtering,
61
+ annealed step sizes, and an EMA of the weights for evaluation. Those choices
62
+ follow [Ataraxos](https://doi.org/10.1038/s41586-026-11036-y) (Sokota et al.,
63
+ 2026), and each one is a separate switch that we test on Magic rather than
64
+ adopt on the paper's authority ([research program](manabot/RESEARCH.md)).
65
+ Reward is win or loss only: our shaped rewards lost to it
66
+ ([exp-04](experiments/exp-04-potential-shaping.md)).
67
+
68
+ **Hidden information and search.** Belief samplers learn a distribution over
69
+ the opponent's hidden cards from a frozen policy's own games
70
+ ([belief sampler](docs/belief-sampler.md)). Search samples hands from that
71
+ belief, uses the frozen policy for continuations, and distills its choices
72
+ back into the policy ([local policy search](docs/local-policy-search.md)).
73
+ This runs end to end but has not yet shown a strength gain over the policy
74
+ alone.
75
+
76
+ **Evaluation by head-to-head play.** Trained agents play each other. A
77
+ *Tournament* file names a roster of checkpoints and fixed opponents, and the
78
+ runner plays every pairing on the same held-out deals, with both decks and
79
+ both seats ([head-to-head](experiments/head-to-head.md)). The arena fits
80
+ ratings across the whole population (`manabot/arena/`), and a rule-based
81
+ `heuristic` bot gives a stable reference point across runs. Every game is
82
+ replay-verified.
83
+
84
+ **Preregistered experiments.** The question, numeric prediction, kill
85
+ criteria, and cost cap are committed to git before a run; without that commit
86
+ a result is exploratory, not evidence. Frozen contracts record the hashes of
87
+ their inputs, claims about a training method need independent training seeds,
88
+ and refutations stay on the record ([experiments/](experiments/README.md)).
89
+
90
+ Right now the main open question is the training curriculum: which matchups,
91
+ opponents, and mix of self-play the agent should learn from (for example,
92
+ mirror matches versus balanced cross-deck play). Evaluation is kept narrow,
93
+ just enough to compare curricula, rather than testing current agents across a
94
+ wide range of environments.
95
+
96
+ ## Versioned installs
97
+
98
+ Versioned PyPI release preparation, platform support, CPU/CUDA installation and
99
+ maintainer publishing are described in [the release guide](docs/releases.md).
100
+ The first planned release is 0.2.0; the source workflow below remains available.
101
+
102
+ ## Quickstart
103
+
104
+ You need [uv](https://docs.astral.sh/uv/) and a Rust toolchain.
105
+
106
+ ```bash
107
+ git clone git@github.com:loopflowstudio/manabot.git
108
+ cd manabot
109
+ uv sync --python 3.12 --extra dev
110
+ uv run --extra play maturin develop --release \
111
+ --manifest-path managym/Cargo.toml --features python
112
+
113
+ uv run manabot train # small CPU training run, under a minute, no W&B
114
+ ```
115
+
116
+ `uv run manabot train` trains a small agent and saves checkpoints to
117
+ `.runs/local/`. Training recipes are typed *regimes* composed in Python, one module per
118
+ current experiment in [experiments/](experiments/), from reusable parts in
119
+ [manabot/training/builders.py](manabot/training/builders.py). The current GPU
120
+ baseline is
121
+ `uv run manabot train --regime-name batched_baseline --out .runs/batched/run`.
122
+ [manabot/README.md](manabot/README.md) covers presets, remote GPU runs,
123
+ simulation, and evaluation.
124
+
125
+ There is also a local browser table (`./scripts/play`, needs Node) for playing
126
+ one game against a checkpoint or stepping through a replay. It is for
127
+ inspecting what a bot does, not a way to play Magic.
128
+
129
+ ## Scale
130
+
131
+ Training scale per agent, measured in **learner decisions**: the decisions
132
+ the learning policy made and trained on. Decisions with a single legal action
133
+ are played automatically and not counted, and neither are the opponent seat's
134
+ decisions in self-play. This unit does not depend on model size or batching,
135
+ unlike iterations or Adam steps, and does not depend on hardware, unlike
136
+ dollars or hours. We add a row when a run sets a new high.
137
+
138
+ | Agent | Date | Model | Learner decisions | Decisions per iteration × iterations | Hardware |
139
+ |---|---|---|---:|---:|---|
140
+ | first-light PPO ([report](experiments/first-light-run-1.md)) | 2026-03 | width 64 | 262k | 512 × 512 | CPU |
141
+ | matched-cost PPO ([exp-03](experiments/exp-03-distillation.md)) | 2026-07 | 100k params | 5.8M | 2,048 × 2,850 | M4 Max |
142
+ | `small-26k` ([capacity](experiments/model-capacity.md)) | 2026-10 | 64×2, 188k params | 13.3M | 512 × 26,000 | 1× L4 |
143
+ | `small-63k`, continued | 2026-10 | 64×2 | 32.3M | 512 × 63,000 | 1× L4 |
144
+ | `small-100k`, continued | 2026-10 | 64×2 | 51.2M | 512 × 100,000 | 1× L4 |
145
+ | scale ladder v1, one seat ([ladder](experiments/scale-ladder.md)) | 2026-10 | 64×2 | 196.6M | 16,384 × 12,000 | 1× L4, $13.34 |
146
+
147
+ The first two rows predate the current world and encoding, so they record
148
+ scale only. The ladder run's $10 checkpoint (151.6M decisions) scored 0.69
149
+ against the `heuristic` anchor across the four deck matchups, and 0.70 as
150
+ Lessons against Allies. The run was closed before its $50 tier, once
151
+ self-play moved to learning from both seats.
152
+
153
+ Learning-rate schedules currently count iterations, not decisions. The same
154
+ recipe run at a different batch size therefore decays at a different number
155
+ of decisions: about 18M for `small-100k` versus about 575M for the ladder recipe.
156
+
157
+ ## Earlier results
158
+
159
+ Before self-play became the main loop, the project leaned on search. These
160
+ results come from that period and from earlier encodings, so their numbers are
161
+ not comparable with today's checkpoints:
162
+
163
+ - **Search was strong and cheap.** Flat determinized Monte Carlo with 256
164
+ rollouts beat random 99% of the time. Every early trained policy was weaker
165
+ than 16-rollout search ([exp-02](experiments/exp-02-flat-mc.md)).
166
+ - **Distillation beat PPO at equal cost**, 90.5% versus 52.7% against random
167
+ ([exp-03](experiments/exp-03-distillation.md)). Naive expert iteration did
168
+ not compound: round 1 lost 74–26 to round 0
169
+ ([exp-07](experiments/exp-07-expert-iteration.md)).
170
+ - **Reward shaping hurt.** Terminal-only reward beat our shaped rewards by
171
+ about 15 points ([exp-04](experiments/exp-04-potential-shaping.md)).
172
+ - **Win rate hid incompetence.** The search pilot could not play a control
173
+ deck: it found the right line at most 39% of the time in competency
174
+ scenarios, and random beat it in 3 of 5
175
+ ([exp-09](experiments/exp-09-control-competency.md)). Matchup tables mostly
176
+ measured the pilot and card quality
177
+ ([exp-08b](experiments/exp-08b-ancestral-dose.md)).
178
+
179
+ ## Not built yet
180
+
181
+ - **More cards.** Because cards are typed programs, most new cards can be
182
+ added as content without engine changes, but the pool is still two decks.
183
+ - **Limited.** The long-term target is sealed and draft play: building decks
184
+ from a pool, then piloting them. Nothing in the repository drafts or builds
185
+ decks yet.
186
+
187
+ ## Map of the repository
188
+
189
+ | Path | What it is |
190
+ |---|---|
191
+ | `managym/` | Rust rules engine, vectorized env, and PyO3 bindings ([README](managym/README.md)) |
192
+ | `manabot/` | Agents: models, training, search, beliefs, arena, verification ([README](manabot/README.md)) |
193
+ | `experiments/` | Preregistered experiment reports, protocols, and data |
194
+ | `content/` | Card and deck definitions compiled to a typed IR |
195
+ | `conformance/` | Rules conformance fixtures |
196
+ | `docs/` | Architecture, training operations, rules, and research notes ([index](docs/README.md)) |
197
+ | `paper/` | A working paper draft |
198
+ | `ops/`, `deploy/` | Remote training hardware and deployment |
199
+ | `academy/`, `academy/ui/`, `protocol/` | Local browser UI for testing a bot by hand and reviewing replays |
200
+ | `wave/`, `.lf/` | Loopflow Waves, Flows, and skills that organize agent work |
201
+
202
+ [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) has the full system design. In
203
+ short, managym owns the rules and legality, manabot owns inference and
204
+ decisions, and the play UI only displays what managym allows the viewer to
205
+ see.
206
+
207
+ ## Development
208
+
209
+ ```bash
210
+ # Rust (CI runs cargo test in debug, so validate in debug before landing)
211
+ cd managym && cargo fmt --check && cargo clippy --all-targets --all-features -- -D warnings && cargo test && cd ..
212
+
213
+ # Python
214
+ uv run --extra dev pytest tests/
215
+ ```
216
+
217
+ Contributor and agent conventions are in [AGENTS.md](AGENTS.md). Package style
218
+ guides are in each package README.
219
+
220
+ ## Names
221
+
222
+ - **manabot**: the bot and the Python library. You train *a* manabot.
223
+ - **managym**: the rules environment the bot lives in.
224
+ - **Academy**: the local bot-testing UI (`academy/`, `academy/ui/`).
225
+ - **Etude**: the separate system that launches and records experiments
226
+ ([`loopflowstudio/etude`](https://github.com/loopflowstudio/etude)). Older
227
+ documents also use *Etude* and *Fantasia* for this project.
228
+ - **Loopflow**: the agent development tool
229
+ ([`loopflowstudio/loopflow`](https://github.com/loopflowstudio/loopflow)).
230
+
231
+ Manabot is an independent research project and unofficial Fan Content
232
+ permitted under the Wizards of the Coast
233
+ [Fan Content Policy](https://company.wizards.com/en/legal/fancontentpolicy).
234
+ Not approved or endorsed by Wizards. Magic: The Gathering and its card names
235
+ are property of Wizards of the Coast LLC.