bantamkit 0.39.2__tar.gz → 0.40.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 (325) hide show
  1. {bantamkit-0.39.2 → bantamkit-0.40.0}/PKG-INFO +3 -3
  2. {bantamkit-0.39.2 → bantamkit-0.40.0}/README.md +2 -2
  3. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/shiftwork_clock_in.json +5 -1
  4. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/shiftwork_clock_out.json +6 -1
  5. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/__init__.py +1 -1
  6. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/shiftwork.py +197 -0
  7. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/served-tool-surface.json +16 -2
  8. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_shiftwork.py +252 -0
  9. {bantamkit-0.39.2 → bantamkit-0.40.0}/.gitignore +0 -0
  10. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/contracts/default.yaml +0 -0
  11. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/manifest.yaml +0 -0
  12. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/HISTORY.md +0 -0
  13. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/README.md +0 -0
  14. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/docs/architecture.md +0 -0
  15. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/docs/runbook.md +0 -0
  16. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/issues/142-settlement-timeout.md +0 -0
  17. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/patches/0009-retry-budget.patch +0 -0
  18. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/__init__.py +0 -0
  19. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/config.py +0 -0
  20. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/errors.py +0 -0
  21. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/posting.py +0 -0
  22. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/registry.py +0 -0
  23. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/report.py +0 -0
  24. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/retry.py +0 -0
  25. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/settle.py +0 -0
  26. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/src/ledger/validate.py +0 -0
  27. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/tests/test_posting.py +0 -0
  28. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/repo/tests/test_settle.py +0 -0
  29. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/tasks/dt-error-contract.yaml +0 -0
  30. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/tasks/dt-handler-map.yaml +0 -0
  31. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/tasks/dt-patch-before-after.yaml +0 -0
  32. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/tasks/dt-retry-attempts.yaml +0 -0
  33. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/tasks/dt-settlement-config.yaml +0 -0
  34. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/tasks/dt-symbol-home.yaml +0 -0
  35. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/tasks/dt-trace-blame.yaml +0 -0
  36. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/devteam/tasks/dt-unread-key.yaml +0 -0
  37. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-large-in-137.yaml +0 -0
  38. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-large-in-359.yaml +0 -0
  39. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-large-in-372.yaml +0 -0
  40. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-large-out-11764.yaml +0 -0
  41. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-large-out-4137.yaml +0 -0
  42. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-large-out-8022.yaml +0 -0
  43. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-small-137.yaml +0 -0
  44. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-small-261.yaml +0 -0
  45. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/document/tasks/doc-small-388.yaml +0 -0
  46. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/fixtures/.gitkeep +0 -0
  47. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/fixtures/catalog.json +0 -0
  48. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/perturbations/task-completion.yaml +0 -0
  49. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/.gitkeep +0 -0
  50. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/extract-contact.yaml +0 -0
  51. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/extract-invoice.yaml +0 -0
  52. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/extract-order.yaml +0 -0
  53. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/extract-schedule.yaml +0 -0
  54. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/extract-versions.yaml +0 -0
  55. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/nav-prod-port.yaml +0 -0
  56. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/nav-release-bundle.yaml +0 -0
  57. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-audit-retention.yaml +0 -0
  58. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-cache-ttl.yaml +0 -0
  59. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-db-port.yaml +0 -0
  60. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-deploy.yaml +0 -0
  61. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-env-endpoint.yaml +0 -0
  62. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-oncall-rotation.yaml +0 -0
  63. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-oncall.yaml +0 -0
  64. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-org-quota.yaml +0 -0
  65. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/recall-owner.yaml +0 -0
  66. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/shop-basket-total.yaml +0 -0
  67. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/shop-cheapest.yaml +0 -0
  68. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/shop-compare.yaml +0 -0
  69. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/shop-gadget-value.yaml +0 -0
  70. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/shop-stock-total.yaml +0 -0
  71. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/evals/tasks/shop-total.yaml +0 -0
  72. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/langs/core-fixed.md +0 -0
  73. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/langs/core-latest.md +0 -0
  74. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/langs/ja.md +0 -0
  75. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/langs/th.md +0 -0
  76. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/pricing/default.json +0 -0
  77. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/profiles/default.yaml +0 -0
  78. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/profiles/patient.yaml +0 -0
  79. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/rubrics/.gitkeep +0 -0
  80. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/rubrics/code-quality.yaml +0 -0
  81. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/rubrics/grounded-completion.yaml +0 -0
  82. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/rubrics/task-completion.yaml +0 -0
  83. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/schemas/shiftwork-checkpoint.json +0 -0
  84. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/skills/.gitkeep +0 -0
  85. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/skills/file-graph.md +0 -0
  86. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/skills/memory-queries.md +0 -0
  87. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/skills/memory.md +0 -0
  88. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/.gitkeep +0 -0
  89. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/bantamkit_read.json +0 -0
  90. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/bantamkit_status.json +0 -0
  91. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/build_identity.json +0 -0
  92. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/document_list.json +0 -0
  93. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/document_read.json +0 -0
  94. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/file_graph.json +0 -0
  95. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/memory_compact.json +0 -0
  96. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/memory_dream.json +0 -0
  97. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/memory_queries.json +0 -0
  98. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/memory_recall.json +0 -0
  99. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/memory_save.json +0 -0
  100. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/repo_map.json +0 -0
  101. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/shiftwork_draft.json +0 -0
  102. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/shiftwork_plan.json +0 -0
  103. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/shiftwork_status.json +0 -0
  104. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/skill_audit.json +0 -0
  105. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/token_ledger.json +0 -0
  106. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/validate_json.json +0 -0
  107. {bantamkit-0.39.2 → bantamkit-0.40.0}/_assets/tools/work_plan.json +0 -0
  108. {bantamkit-0.39.2 → bantamkit-0.40.0}/hatch_build.py +0 -0
  109. {bantamkit-0.39.2 → bantamkit-0.40.0}/pyproject.toml +0 -0
  110. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/agent.py +0 -0
  111. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/assets.py +0 -0
  112. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/budget.py +0 -0
  113. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/client.py +0 -0
  114. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/contract.py +0 -0
  115. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/criticreplay.py +0 -0
  116. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/critique.py +0 -0
  117. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/docmanifest.py +0 -0
  118. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/docread.py +0 -0
  119. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/evalrun.py +0 -0
  120. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/eventlog.py +0 -0
  121. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/experiment.py +0 -0
  122. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/filegraph.py +0 -0
  123. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/hookadapter.py +0 -0
  124. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/hostinstall.py +0 -0
  125. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/jobbudget.py +0 -0
  126. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/loopguard.py +0 -0
  127. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/mcpreport.py +0 -0
  128. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/mcpserver.py +0 -0
  129. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/mcpstdio.py +0 -0
  130. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/__init__.py +0 -0
  131. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/__main__.py +0 -0
  132. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/component.py +0 -0
  133. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/divergence.py +0 -0
  134. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/dream.py +0 -0
  135. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/layers.py +0 -0
  136. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/native.py +0 -0
  137. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/queries.py +0 -0
  138. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/retrieval.py +0 -0
  139. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/skills.py +0 -0
  140. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/store.py +0 -0
  141. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/memory/usage.py +0 -0
  142. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/pdfread.py +0 -0
  143. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/pricing.py +0 -0
  144. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/profile.py +0 -0
  145. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/replynative.py +0 -0
  146. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/repomap.py +0 -0
  147. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/selfupdate.py +0 -0
  148. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skillaudit.py +0 -0
  149. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skilldraft.py +0 -0
  150. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skillfile.py +0 -0
  151. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skillhost.py +0 -0
  152. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skillinstall.py +0 -0
  153. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skillmine.py +0 -0
  154. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skillpromote.py +0 -0
  155. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skillpropose.py +0 -0
  156. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/skillreport.py +0 -0
  157. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/statusline.py +0 -0
  158. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/storage/__init__.py +0 -0
  159. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/storage/coldindex.py +0 -0
  160. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/storage/hotindex.py +0 -0
  161. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/storage/lock.py +0 -0
  162. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/storage/logsegment.py +0 -0
  163. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/storage/retention.py +0 -0
  164. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/storage/tiers.py +0 -0
  165. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/structured.py +0 -0
  166. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/textutil.py +0 -0
  167. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/tokenledger.py +0 -0
  168. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/__init__.py +0 -0
  169. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/bashturn.py +0 -0
  170. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/context.py +0 -0
  171. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/graph.py +0 -0
  172. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/log.py +0 -0
  173. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/recallfile.py +0 -0
  174. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/refs.py +0 -0
  175. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/repo.py +0 -0
  176. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/touch/summary.py +0 -0
  177. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/updatecheck.py +0 -0
  178. {bantamkit-0.39.2 → bantamkit-0.40.0}/src/bantamkit/workplan.py +0 -0
  179. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/cli_exit_status_probe.py +0 -0
  180. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/conftest.py +0 -0
  181. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/bad-crc.docx +0 -0
  182. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/charref-4301-digits.html +0 -0
  183. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/charset-table.json +0 -0
  184. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/compression-method-9.docx +0 -0
  185. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/corrupt-deflate.docx +0 -0
  186. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/encrypted-member.docx +0 -0
  187. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/encrypted-mimetype.odt +0 -0
  188. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/eszett-cell-ref.xlsx +0 -0
  189. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/internal-dtd-entity.docx +0 -0
  190. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/rfc2231-charset.eml +0 -0
  191. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/rfc822-nested-twice.eml +0 -0
  192. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/unicode-digit-shared-string.xlsx +0 -0
  193. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/docread/x-uuencode.eml +0 -0
  194. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/f8404ab-perturbation-baseline.json +0 -0
  195. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/data/platform-assumption-baseline.json +0 -0
  196. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/docread_fixtures.py +0 -0
  197. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/perturbation_baseline_harness.py +0 -0
  198. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/rbp16_effect_probe.py +0 -0
  199. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/rbp18_payload_probe.py +0 -0
  200. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_adapter.py +0 -0
  201. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_agent.py +0 -0
  202. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_agreements.py +0 -0
  203. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_amendguard.py +0 -0
  204. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_assets.py +0 -0
  205. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_bantamkit_gitignore.py +0 -0
  206. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_bantamkit_read_tool.py +0 -0
  207. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_budget.py +0 -0
  208. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_build_identity.py +0 -0
  209. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_cli_oneshot.py +0 -0
  210. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_client.py +0 -0
  211. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_compaction_corpus_survey.py +0 -0
  212. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_conformance.py +0 -0
  213. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_conformance_harness_resilience.py +0 -0
  214. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_conformance_suite_table_gate.py +0 -0
  215. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_contract_fanout.py +0 -0
  216. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_contract_patterns.py +0 -0
  217. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_contract_refs.py +0 -0
  218. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_criticreplay.py +0 -0
  219. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_critique.py +0 -0
  220. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_doc_commands_gate.py +0 -0
  221. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_docread.py +0 -0
  222. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_docread_ceilings.py +0 -0
  223. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_document_manifest_parity.py +0 -0
  224. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_document_setup.py +0 -0
  225. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_document_tasks.py +0 -0
  226. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_document_tools.py +0 -0
  227. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_encoding_gate.py +0 -0
  228. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_evalrun.py +0 -0
  229. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_eventlog.py +0 -0
  230. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_experimentation.py +0 -0
  231. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_field_program_gates.py +0 -0
  232. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_field_programs.py +0 -0
  233. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_filegraph.py +0 -0
  234. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_follow_ups.py +0 -0
  235. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_hookadapter.py +0 -0
  236. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_hostinstall.py +0 -0
  237. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_hostinstall_hooks.py +0 -0
  238. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_install_shape.py +0 -0
  239. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_investigation.py +0 -0
  240. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_jobbudget.py +0 -0
  241. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_ladder_statistics.py +0 -0
  242. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_launcher_which.py +0 -0
  243. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_layers.py +0 -0
  244. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_loopguard.py +0 -0
  245. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_mcp_endpoint.py +0 -0
  246. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_mcp_request_guard.py +0 -0
  247. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_mcpdrift.py +0 -0
  248. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_mcpreport.py +0 -0
  249. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_mcpserver.py +0 -0
  250. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_mcpstdio_frames.py +0 -0
  251. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory.py +0 -0
  252. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_compact_tool.py +0 -0
  253. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_component.py +0 -0
  254. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_divergence.py +0 -0
  255. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_dream.py +0 -0
  256. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_layers.py +0 -0
  257. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_lifecycle.py +0 -0
  258. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_native.py +0 -0
  259. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_queries.py +0 -0
  260. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_retrieval.py +0 -0
  261. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_skills.py +0 -0
  262. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_store_tripwire.py +0 -0
  263. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_strings.py +0 -0
  264. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_memory_usage.py +0 -0
  265. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_mutmatrix.py +0 -0
  266. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_nativeexport.py +0 -0
  267. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_never_block.py +0 -0
  268. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_newline_gate.py +0 -0
  269. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_packaging.py +0 -0
  270. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_pdfread.py +0 -0
  271. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_pinharness_ledger.py +0 -0
  272. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_platform_assumption_gate.py +0 -0
  273. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_pricing.py +0 -0
  274. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_readme_separation.py +0 -0
  275. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_replynative.py +0 -0
  276. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_repo_map_tool.py +0 -0
  277. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_repomap.py +0 -0
  278. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_reviews.py +0 -0
  279. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_sdk_wire_text.py +0 -0
  280. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_selfupdate.py +0 -0
  281. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_served_tool_count_records.py +0 -0
  282. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_shiftwork_draft.py +0 -0
  283. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillaudit.py +0 -0
  284. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillaudit_roots.py +0 -0
  285. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skilldraft.py +0 -0
  286. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillfile.py +0 -0
  287. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillhost.py +0 -0
  288. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillimprove.py +0 -0
  289. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillimprove_signals.py +0 -0
  290. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillinstall.py +0 -0
  291. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillmine.py +0 -0
  292. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillmine_daily.py +0 -0
  293. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillpromote.py +0 -0
  294. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillpropose.py +0 -0
  295. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillreport.py +0 -0
  296. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_skillsurface_replay.py +0 -0
  297. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_status_surface.py +0 -0
  298. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_statusline.py +0 -0
  299. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_storage_bar.py +0 -0
  300. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_storage_coldindex.py +0 -0
  301. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_storage_hotindex.py +0 -0
  302. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_storage_log.py +0 -0
  303. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_storage_log_consumers.py +0 -0
  304. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_storage_recall_index.py +0 -0
  305. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_storage_retention.py +0 -0
  306. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_storage_tiers.py +0 -0
  307. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_structured.py +0 -0
  308. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_thread_exception_gate.py +0 -0
  309. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_tokenledger.py +0 -0
  310. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_tool_annotations.py +0 -0
  311. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_tool_manifest.py +0 -0
  312. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_touch_bashturn.py +0 -0
  313. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_touch_context.py +0 -0
  314. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_touch_graph.py +0 -0
  315. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_touch_log.py +0 -0
  316. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_touch_recall_file.py +0 -0
  317. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_touch_refs.py +0 -0
  318. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_touch_summary.py +0 -0
  319. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_touches.py +0 -0
  320. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_unit_agent_id.py +0 -0
  321. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_unit_results.py +0 -0
  322. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_unknown_arguments.py +0 -0
  323. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_updatecheck.py +0 -0
  324. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_version_agreement.py +0 -0
  325. {bantamkit-0.39.2 → bantamkit-0.40.0}/tests/test_workplan.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bantamkit
3
- Version: 0.39.2
3
+ Version: 0.40.0
4
4
  Summary: Persistent memory for coding agents: an MCP server for Claude Code, Claude Desktop, Cursor and VS Code Copilot, plus a Python library that lifts small-model agents. Install once, run offline.
5
5
  Project-URL: Homepage, https://github.com/Ink01101011/bantamkit
6
6
  Project-URL: Repository, https://github.com/Ink01101011/bantamkit
@@ -144,9 +144,9 @@ CPU architecture and Python minor version** (some wheels, such as `pydantic_core
144
144
  one platform only), copy `wheels/` across, and install from it:
145
145
 
146
146
  ```bash
147
- python -m pip download "bantamkit[mcp]==0.39.2" -d wheels
147
+ python -m pip download "bantamkit[mcp]==0.40.0" -d wheels
148
148
  python -m venv <env>
149
- <env>/bin/pip install --no-index --find-links wheels "bantamkit[mcp]==0.39.2"
149
+ <env>/bin/pip install --no-index --find-links wheels "bantamkit[mcp]==0.40.0"
150
150
  <env>/bin/bantamkit-mcp --install cursor
151
151
  ```
152
152
 
@@ -113,9 +113,9 @@ CPU architecture and Python minor version** (some wheels, such as `pydantic_core
113
113
  one platform only), copy `wheels/` across, and install from it:
114
114
 
115
115
  ```bash
116
- python -m pip download "bantamkit[mcp]==0.39.2" -d wheels
116
+ python -m pip download "bantamkit[mcp]==0.40.0" -d wheels
117
117
  python -m venv <env>
118
- <env>/bin/pip install --no-index --find-links wheels "bantamkit[mcp]==0.39.2"
118
+ <env>/bin/pip install --no-index --find-links wheels "bantamkit[mcp]==0.40.0"
119
119
  <env>/bin/bantamkit-mcp --install cursor
120
120
  ```
121
121
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shiftwork_clock_in",
3
3
  "title": "Shift work: clock in",
4
- "description": "Shift-work clock-in: validate the checkpoint against the checkpoint schema and return the brief of ONE unit — {unit, role, invariants, handoff, do_not, files} — to hand to the agent you spawn, verbatim. Call it once per unit, right before spawning; use shiftwork_plan first to see the `ready` batch when several units are to run at once, and shiftwork_clock_out, not this tool, when a unit finishes. The unit briefed is plan.cursor, or `unit_id` when given; either way it must be in shiftwork_plan's `ready` — a done or dropped cursor, a cursor whose dependencies have not run, or a `unit_id` naming no unit answers {\"result\": \"error\", \"reason\": \"unit <id> is not ready; ready is <a, b>\"}, and the batch view's own refusals (cycle, unknown dependency, unreadable checkpoint) pass through verbatim. A ready unit whose `touches` shares a path with a unit briefed and not yet clocked out is refused too, before any brief: `unit <id> touches <path>, which <other> holds until its clock-out`. A checkpoint whose `reviews` break review independence is refused with shiftwork_plan's sentence. With job.budget declared, a brief that does not fit is refused: `budget <dim> spent: <n> of <limit>; raise job.budget or stop the job`. The other outcomes, never exceptions: `escalate` when handoff.open_questions is non-empty (stop and ask the user) or when the cursor names no unit, `success` when every unit is done or dropped, `error` when the checkpoint fails validation. It never moves plan.cursor; clock_out does. What it WRITES: on result=brief, and only then, one line {event: brief, ts, unit, role} appended to <checkpoint>.log.jsonl — best-effort, so a log it cannot write costs the brief nothing. That line is what later lets clock_out accept the unit while the cursor is elsewhere and sets `briefed` on its accounting line. The checkpoint file itself is never modified. See docs/shiftwork.md.",
4
+ "description": "Shift-work clock-in: validate the checkpoint against the checkpoint schema and return the brief of ONE unit — {unit, role, invariants, handoff, do_not, files} — to hand to the agent you spawn, verbatim. Call it once per unit, right before spawning; use shiftwork_plan first to see the `ready` batch when several units are to run at once, and shiftwork_clock_out, not this tool, when a unit finishes. The unit briefed is plan.cursor, or `unit_id` when given; either way it must be in shiftwork_plan's `ready` — a done or dropped cursor, a cursor whose dependencies have not run, or a `unit_id` naming no unit answers {\"result\": \"error\", \"reason\": \"unit <id> is not ready; ready is <a, b>\"}, and the batch view's own refusals (cycle, unknown dependency, unreadable checkpoint) pass through verbatim. A ready unit whose `touches` shares a path with a unit briefed and not yet clocked out is refused too, before any brief: `unit <id> touches <path>, which <other> holds until its clock-out`. A checkpoint whose `reviews` break review independence is refused with shiftwork_plan's sentence. With job.budget declared, a brief that does not fit is refused: `budget <dim> spent: <n> of <limit>; raise job.budget or stop the job`. The other outcomes: `escalate` when handoff.open_questions is non-empty (stop and ask) or when the cursor names no unit, `success` when every unit is done or dropped, `error` when the checkpoint fails validation. It never moves plan.cursor; clock_out does. What it WRITES: on result=brief, and only then, one line {event: brief, ts, unit, role} appended to <checkpoint>.log.jsonl — best-effort, so a log it cannot write costs the brief nothing. That line lets clock_out accept the unit while the cursor is elsewhere and sets `briefed`. The checkpoint file itself is never modified. A brief always carries `hints` {repair, review}, null when none (#310). See docs/shiftwork.md.",
5
5
  "surfaces": [
6
6
  "mcp"
7
7
  ],
@@ -78,6 +78,10 @@
78
78
  "type": "array",
79
79
  "description": "This unit's own attempts, oldest first, at most 3; [] when none. A unit clocked out todo and briefed again is a rework, and this is what it found."
80
80
  },
81
+ "hints": {
82
+ "type": "object",
83
+ "description": "Always present with a brief: {repair, review}. `repair` is null or {lever, owned, fast_check, use_when, call, write, fallback, skip_when, log}, set for an implementer unit with touches that a blocked reviewer rejected. `review` is null or {lever, thread, resumes_so_far, resume_allowed, members, turn, fresh_when, log}, set for a reviewer unit that has clocked out before; each member is {unit, changed, revision, fast_check, paths}. Advice only: nothing refuses ignoring it."
84
+ },
81
85
  "agreements": {
82
86
  "type": "array",
83
87
  "items": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shiftwork_clock_out",
3
3
  "title": "Shift work: clock out",
4
- "description": "Shift-work clock-out: record that a unit finished — set its status, advance plan.cursor, merge `handoff_patch` into handoff, push `history_entry` onto the 5-entry history ring, and append one accounting line to <checkpoint>.log.jsonl. Call it once per unit after its agent returns: shiftwork_clock_in briefs, this tool closes, and shiftwork_status reads what both wrote. The whole mutated document is validated against the checkpoint schema BEFORE one atomic write, so a failure writes nothing and answers {\"result\": \"error\", \"reason\": ...}; nothing is ever deleted from the checkpoint. `unit_id` must be plan.cursor — which needs no brief and clocks out with briefed=false — or a unit clock_in briefed since its own last clock-out; any other id is refused with `unit X is not the cursor unit Y`. `handoff_patch` and `history_entry` are both required arguments: pass `{}` to leave handoff unchanged, and give history_entry at least `unit` and `outcome`. plan.cursor then moves to the head of the ready batch recomputed on the new document — plan.units order over the remaining non-terminal units when the graph cannot batch, `unit_id` when none remain. The accounting line carries unit, role, status, ts and `briefed` (written by the runtime, never taken from you: true only when a brief was issued since this unit's LAST clock-out) plus your `accounting` fields when given. `follow_ups` appends the work it discovered as todo units. `agreements` adopts or retires a working agreement every later brief carries. Each clock-out also appends {status, outcome, notes?, produced?} to the unit's attempts (newest 3 kept). With job.budget declared, a line reporting 0 tokens is refused unless it carries `estimate: true`. When job.roles names this unit's role, `accounting.model` must be on that role's list, spelled exactly, or nothing is written — see the `model` property.",
4
+ "description": "Shift-work clock-out: record that a unit finished — set its status, advance plan.cursor, merge `handoff_patch` into handoff, push `history_entry` onto the 5-entry history ring, and append one accounting line to <checkpoint>.log.jsonl. Call it once per unit after its agent returns; shiftwork_clock_in briefs, shiftwork_status reads. The whole mutated document is validated against the checkpoint schema BEFORE one atomic write, so a failure writes nothing and answers {\"result\": \"error\", \"reason\": ...}; nothing is ever deleted from the checkpoint. `unit_id` must be plan.cursor — which needs no brief and clocks out with briefed=false — or a unit clock_in briefed since its own last clock-out; any other id is refused with `unit X is not the cursor unit Y`. `handoff_patch` and `history_entry` are both required arguments: pass `{}` to leave handoff unchanged, and give history_entry at least `unit` and `outcome`. plan.cursor then moves to the head of the ready batch recomputed on the new document — plan.units order over the remaining non-terminal units when the graph cannot batch, `unit_id` when none remain. The accounting line carries unit, role, status, ts and `briefed` (written by the runtime, never taken from you: true only when a brief was issued since this unit's LAST clock-out) plus your `accounting` fields when given. `follow_ups` appends the work it discovered as todo units. `agreements` adopts or retires a working agreement every later brief carries. Each clock-out also appends {status, outcome, notes?, produced?} to the unit's attempts (newest 3 kept). With job.budget declared, a line reporting 0 tokens is refused unless it carries `estimate: true`. When job.roles names this unit's role, `accounting.model` must be on that role's list, spelled exactly, or nothing is written — see the `model` property. accounting.path: patch, fallback, resume or fresh.",
5
5
  "surfaces": [
6
6
  "mcp"
7
7
  ],
@@ -159,6 +159,11 @@
159
159
  "note": {
160
160
  "type": "string",
161
161
  "description": "Free text for what the fields above cannot say: that `tokens` is an estimate, that this is a retry or a second scope under the same unit id, what a harness counter excludes. Anything that is not a model identifier goes here, not in `model`."
162
+ },
163
+ "path": {
164
+ "type": "string",
165
+ "enum": ["patch", "fallback", "resume", "fresh"],
166
+ "description": "Which #310 path this unit ran, when it followed a clock_in hint: patch (a no-tools patch repair was written and its fast check passed), fallback (the patch failed and one ordinary repair ran), resume (a resumed re-review answer was used), fresh (a full fresh review ran). Optional; absent means the host did not say."
162
167
  }
163
168
  },
164
169
  "required": [
@@ -29,4 +29,4 @@ from bantamkit.structured import StructuredOutputError, extract_json, structured
29
29
  # file as its dynamic version source, so the wheel's metadata and the string the MCP
30
30
  # server advertises are the same committed bytes, and neither is a function of when
31
31
  # someone last ran `pip`.
32
- __version__ = "0.39.2"
32
+ __version__ = "0.40.0"
@@ -266,6 +266,47 @@ def _record_event(log_path: Path, event: str, unit_id: str, role: str) -> None:
266
266
  except OSError:
267
267
  return
268
268
 
269
+ # #324: the fixed prose of the two clock_in hints. Byte-identical in runtime-ts (camelCase).
270
+ RESUME_CAP = 2
271
+ REPAIR_USE_WHEN = "Every finding against this unit names one file, and that file is in owned."
272
+ REPAIR_CALL = (
273
+ "One call with no tools. Send the unit's brief, the reviewer's findings verbatim, and the "
274
+ "full current text of every owned path. It answers "
275
+ '{"files": [{"path", "content"}]}.'
276
+ )
277
+ REPAIR_WRITE = (
278
+ "Write only owned paths. A path that is a symlink, or that resolves outside the "
279
+ "workspace, makes the answer invalid. Then run fast_check."
280
+ )
281
+ REPAIR_FALLBACK = (
282
+ "If the answer is invalid or fast_check fails, run exactly one ordinary repair with "
283
+ "tools, then clock out with accounting.path = fallback."
284
+ )
285
+ REPAIR_SKIP_WHEN = (
286
+ "The repair would continue a session that already holds this work in its cache (the "
287
+ "parent session authored it). There the fresh patch call cost more uncached input + "
288
+ "output in #310."
289
+ )
290
+ REPAIR_LOG = (
291
+ "Clock out with accounting.path = patch when the patch answer was written and "
292
+ "fast_check passed."
293
+ )
294
+ REVIEW_TURN = (
295
+ "Resume thread with a delta turn only: a new reviewer context id, every member's "
296
+ "revision, fast check and changed flag, and the full current text of every path of a "
297
+ "changed member. changed is a superset: a member flagged changed may be identical, and "
298
+ "the host may compare content to send less. Acceptance still binds every member and "
299
+ "criterion to the current revision."
300
+ )
301
+ REVIEW_FRESH_WHEN = (
302
+ "resume_allowed is false, the thread cannot be resumed, or the resumed answer is "
303
+ "invalid: run one fresh full review and clock out with accounting.path = fresh."
304
+ )
305
+ REVIEW_LOG = (
306
+ "Clock out with accounting.path = resume when the resumed answer was used, and pass the "
307
+ "thread as clock_out's agent_id argument again."
308
+ )
309
+
269
310
 
270
311
  def _briefed(log_path: Path, unit_id: str) -> bool:
271
312
  """F6: was a brief issued for `unit_id` since its last clock-out? Read off the ledger.
@@ -748,6 +789,30 @@ def _ready(
748
789
  return (batches[0] if batches else []), None, answer["declared"]
749
790
 
750
791
 
792
+ def _dropped_review(document: dict, unit: dict) -> str | None:
793
+ """#309: the sentence when a non-terminal reviewer reviews a unit that was `dropped`.
794
+
795
+ The batch view treats a dropped dependency as satisfied, so without this a reviewer of a
796
+ group whose member was dropped is briefed and approved over less than it was planned for,
797
+ and nobody decided that. The first id in `reviews` order whose unit is dropped is named:
798
+
799
+ unit <id> reviews <r>, which was dropped; remove it from reviews or restore it
800
+
801
+ A terminal reviewer is history and is never judged. Only this unit is held: the plan, and
802
+ every other unit in it, is untouched.
803
+ """
804
+ if unit["status"] in TERMINAL_UNIT_STATUS:
805
+ return None
806
+ for reviewed in unit.get("reviews") or []:
807
+ target = _find_unit(document, reviewed)
808
+ if target is not None and target["status"] == "dropped":
809
+ return (
810
+ f"unit {unit['id']} reviews {reviewed}, which was dropped; "
811
+ "remove it from reviews or restore it"
812
+ )
813
+ return None
814
+
815
+
751
816
  def _contention(path: Path, document: dict, unit: dict) -> str | None:
752
817
  """#257/D4: the sentence when `unit` writes a file a unit still in flight writes.
753
818
 
@@ -839,6 +904,126 @@ def _upstream(document: dict, dep: str) -> dict[str, Any]:
839
904
  }
840
905
 
841
906
 
907
+ def _clock_out_lines(log_path: Path) -> list[dict]:
908
+ """#324: every clock-out line in file order — a line with no `event` key — minus any line
909
+ an `uncommitted` event cancels (`_briefed`'s rule, for every unit at once).
910
+
911
+ An `uncommitted` line cancels the newest surviving clock-out line of its own unit. A
912
+ missing or unreadable ledger is `[]`, a line that is not an object is skipped.
913
+ """
914
+ lines: list[dict] = []
915
+ for record in _ledger(log_path):
916
+ if not isinstance(record, dict):
917
+ continue
918
+ event = record.get("event")
919
+ if event is None:
920
+ lines.append(record)
921
+ elif event == UNCOMMITTED_EVENT:
922
+ for i in range(len(lines) - 1, -1, -1):
923
+ if lines[i].get("unit") == record.get("unit"):
924
+ del lines[i]
925
+ break
926
+ return lines
927
+
928
+
929
+ def _repair_hint(document: dict, unit: dict) -> dict | None:
930
+ touches = unit.get("touches") or []
931
+ if unit["role"] != "implementer" or not touches:
932
+ return None
933
+ rejected = False
934
+ for other in document["plan"]["units"]:
935
+ if unit["id"] not in (other.get("reviews") or []):
936
+ continue
937
+ attempts = other.get("attempts") or []
938
+ if attempts and attempts[-1]["status"] not in ("done", "dropped"):
939
+ rejected = True
940
+ break
941
+ if not rejected:
942
+ return None
943
+ return {
944
+ "lever": "patch",
945
+ "owned": list(touches),
946
+ "fast_check": unit["verify"],
947
+ "use_when": REPAIR_USE_WHEN,
948
+ "call": REPAIR_CALL,
949
+ "write": REPAIR_WRITE,
950
+ "fallback": REPAIR_FALLBACK,
951
+ "skip_when": REPAIR_SKIP_WHEN,
952
+ "log": REPAIR_LOG,
953
+ }
954
+
955
+
956
+ def _revision(member: dict) -> str | None:
957
+ attempts = member.get("attempts") or []
958
+ if not attempts:
959
+ return None
960
+ for item in reversed(attempts[-1].get("produced") or []):
961
+ if item.get("kind") == "commit":
962
+ return item["ref"]
963
+ return None
964
+
965
+
966
+ def _review_hint(document: dict, unit: dict, lines: list[dict]) -> dict | None:
967
+ reviews = unit.get("reviews") or []
968
+ if not reviews:
969
+ return None
970
+ mine = [i for i, line in enumerate(lines) if line.get("unit") == unit["id"]]
971
+ if not mine:
972
+ return None
973
+ last = mine[-1]
974
+ thread = lines[last].get("agent_id")
975
+ resumes = 0
976
+ for i in reversed(mine):
977
+ if lines[i].get("path") != "resume":
978
+ break
979
+ resumes += 1
980
+ members = []
981
+ for member_id in reviews:
982
+ member = _find_unit(document, member_id)
983
+ idx = [i for i, line in enumerate(lines) if line.get("unit") == member_id]
984
+ changed = not any(i < last for i in idx) or any(i > last for i in idx)
985
+ if not changed:
986
+ # A writer that is not the member: any clock-out after R's newest line whose unit
987
+ # still exists and touches one of the member's paths (exact path equality).
988
+ paths = set(member.get("touches") or [])
989
+ for i in range(last + 1, len(lines)):
990
+ writer = _find_unit(document, lines[i].get("unit"))
991
+ if writer is not None and paths & set(writer.get("touches") or []):
992
+ changed = True
993
+ break
994
+ members.append(
995
+ {
996
+ "unit": member_id,
997
+ "changed": changed,
998
+ "revision": _revision(member),
999
+ "fast_check": member["verify"],
1000
+ "paths": list(member.get("touches") or []),
1001
+ }
1002
+ )
1003
+ return {
1004
+ "lever": "resume",
1005
+ "thread": thread,
1006
+ "resumes_so_far": resumes,
1007
+ "resume_allowed": thread is not None and resumes < RESUME_CAP,
1008
+ "members": members,
1009
+ "turn": REVIEW_TURN,
1010
+ "fresh_when": REVIEW_FRESH_WHEN,
1011
+ "log": REVIEW_LOG,
1012
+ }
1013
+
1014
+
1015
+ def _hints(document: dict, unit: dict, lines: list[dict]) -> dict[str, Any]:
1016
+ """#324: advisory levers for a brief, from the graph and the ledger alone.
1017
+
1018
+ Never raises on a missing ledger or one the OS cannot read; a ledger that is not valid
1019
+ UTF-8 raises, as clock_out already does.
1020
+ """
1021
+ return {
1022
+ "repair": _repair_hint(document, unit),
1023
+ "review": _review_hint(document, unit, lines),
1024
+ }
1025
+
1026
+
842
1027
  def clock_in(checkpoint: str, unit_id: str | None = None) -> dict[str, Any]:
843
1028
  """Validate the checkpoint and return a unit's brief, or a refusal.
844
1029
 
@@ -908,6 +1093,10 @@ def clock_in(checkpoint: str, unit_id: str | None = None) -> dict[str, Any]:
908
1093
  return _error(batch_refusal["reason"]) # the sentence verbatim, `_read_valid`'s idiom
909
1094
  if unit is None or selected not in ready:
910
1095
  return _error(f"unit {selected} is not ready; ready is {', '.join(ready)}")
1096
+ # #309: after readiness, so a reviewer that is not ready keeps the readiness sentence.
1097
+ dropped = _dropped_review(document, unit)
1098
+ if dropped is not None:
1099
+ return _error(dropped)
911
1100
  gate = _irreversible_gate(document, unit)
912
1101
  if gate is not None:
913
1102
  return gate
@@ -927,6 +1116,7 @@ def clock_in(checkpoint: str, unit_id: str | None = None) -> dict[str, Any]:
927
1116
  return _error(over)
928
1117
  # F6: the brief is issued, so say so in the ledger — best effort, and only on this
929
1118
  # branch: a refusal above issued nothing and therefore records nothing.
1119
+ hints = _hints(document, unit, _clock_out_lines(_log_path(Path(checkpoint))))
930
1120
  _freeze(Path(checkpoint), document) # #265: before the brief line, so it is read first
931
1121
  _record_brief(_log_path(Path(checkpoint)), selected, unit["role"])
932
1122
  return {
@@ -942,6 +1132,8 @@ def clock_in(checkpoint: str, unit_id: str | None = None) -> dict[str, Any]:
942
1132
  "prior_attempts": list(unit.get("attempts") or []),
943
1133
  # #261: always present, `[]` when the job has adopted none.
944
1134
  "agreements": list(document["job"].get("agreements") or []),
1135
+ # #324: advisory hints, computed before the brief's own line is written.
1136
+ "hints": hints,
945
1137
  }
946
1138
 
947
1139
 
@@ -1581,6 +1773,11 @@ def _clock_out_locked(
1581
1773
  unsubmitted = _submit_refusal(document, unit, status, history_entry)
1582
1774
  if unsubmitted is not None:
1583
1775
  return _error(unsubmitted)
1776
+ # #309: only `done` is an approval; dropping or blocking the reviewer is not refused.
1777
+ if status == "done":
1778
+ dropped = _dropped_review(document, unit)
1779
+ if dropped is not None:
1780
+ return _error(dropped)
1584
1781
 
1585
1782
  if follow_ups:
1586
1783
  refused = _follow_ups_refusal(path, document, unit, follow_ups)
@@ -256,7 +256,7 @@
256
256
  "openWorldHint": false,
257
257
  "readOnlyHint": false
258
258
  },
259
- "description": "Shift-work clock-in: validate the checkpoint against the checkpoint schema and return the brief of ONE unit — {unit, role, invariants, handoff, do_not, files} — to hand to the agent you spawn, verbatim. Call it once per unit, right before spawning; use shiftwork_plan first to see the `ready` batch when several units are to run at once, and shiftwork_clock_out, not this tool, when a unit finishes. The unit briefed is plan.cursor, or `unit_id` when given; either way it must be in shiftwork_plan's `ready` — a done or dropped cursor, a cursor whose dependencies have not run, or a `unit_id` naming no unit answers {\"result\": \"error\", \"reason\": \"unit <id> is not ready; ready is <a, b>\"}, and the batch view's own refusals (cycle, unknown dependency, unreadable checkpoint) pass through verbatim. A ready unit whose `touches` shares a path with a unit briefed and not yet clocked out is refused too, before any brief: `unit <id> touches <path>, which <other> holds until its clock-out`. A checkpoint whose `reviews` break review independence is refused with shiftwork_plan's sentence. With job.budget declared, a brief that does not fit is refused: `budget <dim> spent: <n> of <limit>; raise job.budget or stop the job`. The other outcomes, never exceptions: `escalate` when handoff.open_questions is non-empty (stop and ask the user) or when the cursor names no unit, `success` when every unit is done or dropped, `error` when the checkpoint fails validation. It never moves plan.cursor; clock_out does. What it WRITES: on result=brief, and only then, one line {event: brief, ts, unit, role} appended to <checkpoint>.log.jsonl — best-effort, so a log it cannot write costs the brief nothing. That line is what later lets clock_out accept the unit while the cursor is elsewhere and sets `briefed` on its accounting line. The checkpoint file itself is never modified. See docs/shiftwork.md.",
259
+ "description": "Shift-work clock-in: validate the checkpoint against the checkpoint schema and return the brief of ONE unit — {unit, role, invariants, handoff, do_not, files} — to hand to the agent you spawn, verbatim. Call it once per unit, right before spawning; use shiftwork_plan first to see the `ready` batch when several units are to run at once, and shiftwork_clock_out, not this tool, when a unit finishes. The unit briefed is plan.cursor, or `unit_id` when given; either way it must be in shiftwork_plan's `ready` — a done or dropped cursor, a cursor whose dependencies have not run, or a `unit_id` naming no unit answers {\"result\": \"error\", \"reason\": \"unit <id> is not ready; ready is <a, b>\"}, and the batch view's own refusals (cycle, unknown dependency, unreadable checkpoint) pass through verbatim. A ready unit whose `touches` shares a path with a unit briefed and not yet clocked out is refused too, before any brief: `unit <id> touches <path>, which <other> holds until its clock-out`. A checkpoint whose `reviews` break review independence is refused with shiftwork_plan's sentence. With job.budget declared, a brief that does not fit is refused: `budget <dim> spent: <n> of <limit>; raise job.budget or stop the job`. The other outcomes: `escalate` when handoff.open_questions is non-empty (stop and ask) or when the cursor names no unit, `success` when every unit is done or dropped, `error` when the checkpoint fails validation. It never moves plan.cursor; clock_out does. What it WRITES: on result=brief, and only then, one line {event: brief, ts, unit, role} appended to <checkpoint>.log.jsonl — best-effort, so a log it cannot write costs the brief nothing. That line lets clock_out accept the unit while the cursor is elsewhere and sets `briefed`. The checkpoint file itself is never modified. A brief always carries `hints` {repair, review}, null when none (#310). See docs/shiftwork.md.",
260
260
  "inputSchema": {
261
261
  "properties": {
262
262
  "checkpoint": {
@@ -349,6 +349,10 @@
349
349
  "type": "array",
350
350
  "description": "This unit's own attempts, oldest first, at most 3; [] when none. A unit clocked out todo and briefed again is a rework, and this is what it found."
351
351
  },
352
+ "hints": {
353
+ "type": "object",
354
+ "description": "Always present with a brief: {repair, review}. `repair` is null or {lever, owned, fast_check, use_when, call, write, fallback, skip_when, log}, set for an implementer unit with touches that a blocked reviewer rejected. `review` is null or {lever, thread, resumes_so_far, resume_allowed, members, turn, fresh_when, log}, set for a reviewer unit that has clocked out before; each member is {unit, changed, revision, fast_check, paths}. Advice only: nothing refuses ignoring it."
355
+ },
352
356
  "agreements": {
353
357
  "type": "array",
354
358
  "items": {
@@ -373,7 +377,7 @@
373
377
  "openWorldHint": false,
374
378
  "readOnlyHint": false
375
379
  },
376
- "description": "Shift-work clock-out: record that a unit finished — set its status, advance plan.cursor, merge `handoff_patch` into handoff, push `history_entry` onto the 5-entry history ring, and append one accounting line to <checkpoint>.log.jsonl. Call it once per unit after its agent returns: shiftwork_clock_in briefs, this tool closes, and shiftwork_status reads what both wrote. The whole mutated document is validated against the checkpoint schema BEFORE one atomic write, so a failure writes nothing and answers {\"result\": \"error\", \"reason\": ...}; nothing is ever deleted from the checkpoint. `unit_id` must be plan.cursor — which needs no brief and clocks out with briefed=false — or a unit clock_in briefed since its own last clock-out; any other id is refused with `unit X is not the cursor unit Y`. `handoff_patch` and `history_entry` are both required arguments: pass `{}` to leave handoff unchanged, and give history_entry at least `unit` and `outcome`. plan.cursor then moves to the head of the ready batch recomputed on the new document — plan.units order over the remaining non-terminal units when the graph cannot batch, `unit_id` when none remain. The accounting line carries unit, role, status, ts and `briefed` (written by the runtime, never taken from you: true only when a brief was issued since this unit's LAST clock-out) plus your `accounting` fields when given. `follow_ups` appends the work it discovered as todo units. `agreements` adopts or retires a working agreement every later brief carries. Each clock-out also appends {status, outcome, notes?, produced?} to the unit's attempts (newest 3 kept). With job.budget declared, a line reporting 0 tokens is refused unless it carries `estimate: true`. When job.roles names this unit's role, `accounting.model` must be on that role's list, spelled exactly, or nothing is written — see the `model` property.",
380
+ "description": "Shift-work clock-out: record that a unit finished — set its status, advance plan.cursor, merge `handoff_patch` into handoff, push `history_entry` onto the 5-entry history ring, and append one accounting line to <checkpoint>.log.jsonl. Call it once per unit after its agent returns; shiftwork_clock_in briefs, shiftwork_status reads. The whole mutated document is validated against the checkpoint schema BEFORE one atomic write, so a failure writes nothing and answers {\"result\": \"error\", \"reason\": ...}; nothing is ever deleted from the checkpoint. `unit_id` must be plan.cursor — which needs no brief and clocks out with briefed=false — or a unit clock_in briefed since its own last clock-out; any other id is refused with `unit X is not the cursor unit Y`. `handoff_patch` and `history_entry` are both required arguments: pass `{}` to leave handoff unchanged, and give history_entry at least `unit` and `outcome`. plan.cursor then moves to the head of the ready batch recomputed on the new document — plan.units order over the remaining non-terminal units when the graph cannot batch, `unit_id` when none remain. The accounting line carries unit, role, status, ts and `briefed` (written by the runtime, never taken from you: true only when a brief was issued since this unit's LAST clock-out) plus your `accounting` fields when given. `follow_ups` appends the work it discovered as todo units. `agreements` adopts or retires a working agreement every later brief carries. Each clock-out also appends {status, outcome, notes?, produced?} to the unit's attempts (newest 3 kept). With job.budget declared, a line reporting 0 tokens is refused unless it carries `estimate: true`. When job.roles names this unit's role, `accounting.model` must be on that role's list, spelled exactly, or nothing is written — see the `model` property. accounting.path: patch, fallback, resume or fresh.",
377
381
  "inputSchema": {
378
382
  "properties": {
379
383
  "checkpoint": {
@@ -550,6 +554,16 @@
550
554
  "note": {
551
555
  "type": "string",
552
556
  "description": "Free text for what the fields above cannot say: that `tokens` is an estimate, that this is a retry or a second scope under the same unit id, what a harness counter excludes. Anything that is not a model identifier goes here, not in `model`."
557
+ },
558
+ "path": {
559
+ "type": "string",
560
+ "enum": [
561
+ "patch",
562
+ "fallback",
563
+ "resume",
564
+ "fresh"
565
+ ],
566
+ "description": "Which #310 path this unit ran, when it followed a clock_in hint: patch (a no-tools patch repair was written and its fast check passed), fallback (the patch failed and one ordinary repair ran), resume (a resumed re-review answer was used), fresh (a full fresh review ran). Optional; absent means the host did not say."
553
567
  }
554
568
  },
555
569
  "required": [
@@ -2935,3 +2935,255 @@ def test_j65_5_default_clock_in_passes_a_graph_refusal_through_like_the_named_pa
2935
2935
  assert _j65_out(path, "A")["result"] == "ok" # clock_out still RECORDS on a broken graph
2936
2936
  path.write_text(json.dumps(_j65_graph(units, "GHOST")), encoding="utf-8")
2937
2937
  assert ops.clock_in(str(path)) == {"result": "escalate", "reason": "cursor GHOST names no unit"}
2938
+
2939
+
2940
+ # --- #324: clock_in hints -------------------------------------------------
2941
+
2942
+
2943
+ def _h_unit(unit_id, role="implementer", **extra):
2944
+ unit = _j65_unit(unit_id)
2945
+ unit["role"] = role
2946
+ unit["verify"] = f"check {unit_id}"
2947
+ unit.update(extra)
2948
+ return unit
2949
+
2950
+
2951
+ def _h_ledger(path, *lines):
2952
+ log = Path(str(path) + ".log.jsonl")
2953
+ log.write_text("".join(json.dumps(x) + "\n" for x in lines), encoding="utf-8")
2954
+
2955
+
2956
+ def _h_line(unit, **extra):
2957
+ return {"unit": unit, "role": "x", "status": "done", "ts": "t", **extra}
2958
+
2959
+
2960
+ def _h_review_doc(path, members=("A",), reviewer_extra=None, **member_extra):
2961
+ units = [_h_unit(m, touches=[f"{m}.py"], **member_extra) for m in members]
2962
+ rev = _h_unit(
2963
+ "R",
2964
+ role="reviewer",
2965
+ depends_on=list(members),
2966
+ reviews=list(members),
2967
+ **(reviewer_extra or {}),
2968
+ )
2969
+ units.append(rev)
2970
+ _j65_write(path, units, cursor="R")
2971
+ return path
2972
+
2973
+
2974
+ def _h_brief(path, unit="R"):
2975
+ brief = ops.clock_in(str(path), unit)
2976
+ assert brief["result"] == "brief", brief
2977
+ return brief
2978
+
2979
+
2980
+ def _h_done(path, members=("A",)):
2981
+ doc = json.loads(path.read_text(encoding="utf-8"))
2982
+ for u in doc["plan"]["units"]:
2983
+ if u["id"] in members:
2984
+ u["status"] = "done"
2985
+ path.write_text(json.dumps(doc), encoding="utf-8")
2986
+
2987
+
2988
+ def test_324_hints_absent_without_reviewers(tmp_path):
2989
+ path = tmp_path / "cp.json"
2990
+ _j65_write(path, [_h_unit("A")])
2991
+ assert ops.clock_in(str(path))["hints"] == {"repair": None, "review": None}
2992
+
2993
+
2994
+ def _h_repair_doc(path, touches=("src/a.py", "src/b.py"), status="blocked", role="implementer"):
2995
+ a = _h_unit("A2", role=role)
2996
+ if touches is not None:
2997
+ a["touches"] = list(touches)
2998
+ r = _h_unit("R", role="reviewer", depends_on=["A2"], reviews=["A2"], status="todo")
2999
+ r["attempts"] = [{"status": status, "outcome": "rejected"}]
3000
+ _j65_write(path, [a, r], cursor="A2")
3001
+
3002
+
3003
+ def test_324_repair_hint_under_blocked_reviewer(tmp_path):
3004
+ path = tmp_path / "cp.json"
3005
+ _h_repair_doc(path)
3006
+ repair = ops.clock_in(str(path))["hints"]["repair"]
3007
+ assert repair["owned"] == ["src/a.py", "src/b.py"]
3008
+ assert repair["fast_check"] == "check A2"
3009
+ assert repair["use_when"] == ops.REPAIR_USE_WHEN
3010
+ assert list(repair) == [
3011
+ "lever", "owned", "fast_check", "use_when", "call", "write", "fallback", "skip_when", "log",
3012
+ ]
3013
+
3014
+
3015
+ def test_324_no_repair_hint_without_touches_or_after_approval(tmp_path):
3016
+ path = tmp_path / "cp.json"
3017
+ _h_repair_doc(path, touches=None)
3018
+ assert ops.clock_in(str(path))["hints"]["repair"] is None
3019
+ _h_repair_doc(path, status="done")
3020
+ assert ops.clock_in(str(path))["hints"]["repair"] is None
3021
+ _h_repair_doc(path, role="planner")
3022
+ assert ops.clock_in(str(path))["hints"]["repair"] is None
3023
+
3024
+
3025
+ def test_324_review_hint_null_on_first_review(tmp_path):
3026
+ path = _h_review_doc(tmp_path / "cp.json")
3027
+ _h_done(path)
3028
+ assert _h_brief(path)["hints"]["review"] is None
3029
+
3030
+
3031
+ def test_324_review_hint_thread_and_changed(tmp_path):
3032
+ path = _h_review_doc(tmp_path / "cp.json", members=("A", "C"))
3033
+ _h_done(path, ("A", "C"))
3034
+ _h_ledger(
3035
+ path,
3036
+ _h_line("C"),
3037
+ _h_line("A"),
3038
+ _h_line("R", agent_id="t1"),
3039
+ _h_line("A"),
3040
+ )
3041
+ review = _h_brief(path)["hints"]["review"]
3042
+ assert review["thread"] == "t1"
3043
+ assert review["resumes_so_far"] == 0
3044
+ assert review["resume_allowed"] is True
3045
+ assert [(m["unit"], m["changed"]) for m in review["members"]] == [("A", True), ("C", False)]
3046
+ assert list(review) == [
3047
+ "lever",
3048
+ "thread",
3049
+ "resumes_so_far",
3050
+ "resume_allowed",
3051
+ "members",
3052
+ "turn",
3053
+ "fresh_when",
3054
+ "log",
3055
+ ]
3056
+ assert review["members"][1] == {
3057
+ "unit": "C", "changed": False, "revision": None, "fast_check": "check C", "paths": ["C.py"],
3058
+ }
3059
+
3060
+
3061
+ def test_324_resume_cap_and_reset(tmp_path):
3062
+ path = _h_review_doc(tmp_path / "cp.json")
3063
+ _h_done(path)
3064
+ _h_ledger(
3065
+ path,
3066
+ _h_line("A"),
3067
+ _h_line("R", agent_id="t1", path="resume"),
3068
+ _h_line("R", agent_id="t1", path="resume"),
3069
+ )
3070
+ review = _h_brief(path)["hints"]["review"]
3071
+ assert (review["resumes_so_far"], review["resume_allowed"]) == (2, False)
3072
+ _h_ledger(
3073
+ path,
3074
+ _h_line("A"),
3075
+ _h_line("R", agent_id="t1", path="resume"),
3076
+ _h_line("R", agent_id="t1", path="fresh"),
3077
+ _h_line("R", agent_id="t1", path="resume"),
3078
+ )
3079
+ review = _h_brief(path)["hints"]["review"]
3080
+ assert (review["resumes_so_far"], review["resume_allowed"]) == (1, True)
3081
+
3082
+
3083
+ def _h_other_writer_doc(path, writer_touches):
3084
+ a = _h_unit("A", touches=["src/a.py"], status="done")
3085
+ w = _h_unit("Ar1", touches=writer_touches, status="done", depends_on=["A"])
3086
+ r = _h_unit("R", role="reviewer", depends_on=["A", "Ar1"], reviews=["A"])
3087
+ _j65_write(path, [a, w, r], cursor="R")
3088
+ return path
3089
+
3090
+
3091
+ def test_324_member_rewritten_by_a_non_member_writer_is_changed(tmp_path):
3092
+ path = _h_other_writer_doc(tmp_path / "cp.json", ["src/a.py"])
3093
+ _h_ledger(path, _h_line("A"), _h_line("R", agent_id="th1", path="fresh"), _h_line("Ar1"))
3094
+ review = _h_brief(path)["hints"]["review"]
3095
+ assert review["resume_allowed"] is True
3096
+ assert review["members"][0] == {
3097
+ "unit": "A", "changed": True, "revision": None, "fast_check": "check A",
3098
+ "paths": ["src/a.py"],
3099
+ }
3100
+
3101
+
3102
+ def test_324_non_intersecting_or_earlier_or_gone_writer_leaves_changed_false(tmp_path):
3103
+ path = _h_other_writer_doc(tmp_path / "cp.json", ["src/other.py"])
3104
+ _h_ledger(path, _h_line("A"), _h_line("R", agent_id="th1", path="fresh"), _h_line("Ar1"))
3105
+ assert _h_brief(path)["hints"]["review"]["members"][0]["changed"] is False
3106
+ path = _h_other_writer_doc(tmp_path / "cp2.json", ["src/a.py"])
3107
+ _h_ledger(path, _h_line("A"), _h_line("Ar1"), _h_line("R", agent_id="th1", path="fresh"))
3108
+ assert _h_brief(path)["hints"]["review"]["members"][0]["changed"] is False
3109
+ _h_ledger(path, _h_line("A"), _h_line("R", agent_id="th1"), _h_line("Gone"))
3110
+ assert _h_brief(path)["hints"]["review"]["members"][0]["changed"] is False
3111
+
3112
+
3113
+ def test_324_review_hint_no_agent_id(tmp_path):
3114
+ path = _h_review_doc(tmp_path / "cp.json")
3115
+ _h_done(path)
3116
+ _h_ledger(path, _h_line("A"), _h_line("R", accounting=None))
3117
+ review = _h_brief(path)["hints"]["review"]
3118
+ assert review is not None
3119
+ assert (review["thread"], review["resume_allowed"]) == (None, False)
3120
+
3121
+
3122
+ def test_324_uncommitted_cancels_reviewer_line(tmp_path):
3123
+ path = _h_review_doc(tmp_path / "cp.json")
3124
+ _h_done(path)
3125
+ _h_ledger(
3126
+ path,
3127
+ _h_line("A"),
3128
+ _h_line("R", agent_id="t1"),
3129
+ _h_line("R", agent_id="t2"),
3130
+ {"event": "uncommitted", "unit": "R", "role": "reviewer", "ts": "t"},
3131
+ )
3132
+ review = _h_brief(path)["hints"]["review"]
3133
+ assert review["thread"] == "t1"
3134
+ assert review["members"][0]["changed"] is False
3135
+
3136
+
3137
+ def test_324_member_without_ledger_line_is_changed(tmp_path):
3138
+ path = _h_review_doc(tmp_path / "cp.json", members=("A", "C"))
3139
+ _h_done(path, ("A", "C"))
3140
+ _h_ledger(path, _h_line("A"), _h_line("R", agent_id="t1"))
3141
+ members = _h_brief(path)["hints"]["review"]["members"]
3142
+ assert [m["changed"] for m in members] == [False, True]
3143
+
3144
+
3145
+ def test_324_unreadable_ledger_degrades(tmp_path):
3146
+ path = _h_review_doc(tmp_path / "cp.json")
3147
+ _h_done(path)
3148
+ Path(str(path) + ".log.jsonl").mkdir()
3149
+ assert _h_brief(path)["hints"]["review"] is None
3150
+
3151
+
3152
+ def test_324_revision_from_commit_produced(tmp_path):
3153
+ path = _h_review_doc(
3154
+ tmp_path / "cp.json",
3155
+ attempts=[
3156
+ {
3157
+ "status": "done",
3158
+ "outcome": "ok",
3159
+ "produced": [{"kind": "file", "ref": "x"}, {"kind": "commit", "ref": "abc"}],
3160
+ }
3161
+ ],
3162
+ )
3163
+ _h_done(path)
3164
+ _h_ledger(path, _h_line("A"), _h_line("R", agent_id="t1"))
3165
+ assert _h_brief(path)["hints"]["review"]["members"][0]["revision"] == "abc"
3166
+ path = _h_review_doc(tmp_path / "cp2.json")
3167
+ _h_done(path)
3168
+ _h_ledger(path, _h_line("A"), _h_line("R", agent_id="t1"))
3169
+ assert _h_brief(path)["hints"]["review"]["members"][0]["revision"] is None
3170
+
3171
+
3172
+ # --- #324: accounting.path ------------------------------------------------
3173
+
3174
+
3175
+ def test_324_accounting_path_enum_refused(tmp_path, example):
3176
+ path = write_checkpoint(tmp_path, example)
3177
+ before = path.read_bytes()
3178
+ r = _attempt(path, {"tokens": 1, "duration_ms": 1, "path": "patched"})
3179
+ assert r["result"] == "error"
3180
+ assert r["reason"].startswith(REFUSED)
3181
+ assert path.read_bytes() == before
3182
+ assert read_log(path) == []
3183
+
3184
+
3185
+ def test_324_accounting_path_written_verbatim(tmp_path, example):
3186
+ path = write_checkpoint(tmp_path, example)
3187
+ r = _attempt(path, {"tokens": 1, "duration_ms": 1, "path": "patch"})
3188
+ assert r["result"] == "ok", r
3189
+ assert read_log(path)[-1]["path"] == "patch"
File without changes