@bonesofspring/ai-rules 0.2.65 → 0.2.67

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 (396) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +21 -11
  3. package/bin/cli.js +9 -1
  4. package/bin/lib/engine-scripts.js +34 -7
  5. package/bin/lib/engine-upgrade.js +5 -2
  6. package/bin/lib/seed-ai-local-team.js +32 -3
  7. package/docs/OPENCODE-COMPATIBILITY.md +1 -0
  8. package/docs/OPENCODE.md +31 -10
  9. package/docs/TEAM-DB.md +54 -14
  10. package/docs/TOKEN-ECONOMY.md +110 -0
  11. package/docs/openapi/team-db.v1.json +5 -5
  12. package/package.json +16 -3
  13. package/presets/_shared/ai-local/scripts/dump-output.mjs +422 -0
  14. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +3 -3
  15. package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +2 -0
  16. package/presets/_shared/ai-local/scripts/team-db.mjs +82 -2
  17. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +3 -1
  18. package/presets/_shared/core/architecture/feature-delivery-workflow.md +4 -0
  19. package/presets/_shared/core/quality/context-and-iteration.md +1 -0
  20. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +9 -2
  21. package/presets/_shared/hooks/list-ai-local.mjs +17 -0
  22. package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
  23. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +9 -2
  24. package/presets/claude/android-kotlin/hooks/list-ai-local.mjs +17 -0
  25. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  26. package/presets/claude/go/agents/task-analyst.md +1 -1
  27. package/presets/claude/go/hooks/chain-team-phases.sh +9 -2
  28. package/presets/claude/go/hooks/list-ai-local.mjs +17 -0
  29. package/presets/claude/go/rules/architecture/feature-delivery.md +4 -0
  30. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  31. package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
  32. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +9 -2
  33. package/presets/claude/ios-swift/hooks/list-ai-local.mjs +17 -0
  34. package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +4 -0
  35. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  36. package/presets/claude/java/agents/task-analyst.md +1 -1
  37. package/presets/claude/java/hooks/chain-team-phases.sh +9 -2
  38. package/presets/claude/java/hooks/list-ai-local.mjs +17 -0
  39. package/presets/claude/java/rules/architecture/feature-delivery.md +4 -0
  40. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  41. package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
  42. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +9 -2
  43. package/presets/claude/mcp-ts/hooks/list-ai-local.mjs +17 -0
  44. package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +4 -0
  45. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  46. package/presets/claude/mol/agents/task-analyst.md +1 -1
  47. package/presets/claude/mol/hooks/chain-team-phases.sh +9 -2
  48. package/presets/claude/mol/hooks/list-ai-local.mjs +17 -0
  49. package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +4 -0
  50. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  51. package/presets/claude/next/agents/ci-investigator.md +5 -2
  52. package/presets/claude/next/agents/debugger.md +5 -2
  53. package/presets/claude/next/agents/feature-developer.md +5 -2
  54. package/presets/claude/next/agents/task-analyst.md +1 -1
  55. package/presets/claude/next/commands/README.md +1 -1
  56. package/presets/claude/next/commands/task.md +1 -1
  57. package/presets/claude/next/hooks/chain-team-phases.sh +9 -2
  58. package/presets/claude/next/hooks/list-ai-local.mjs +17 -0
  59. package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +8 -0
  60. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  61. package/presets/claude/next/team/README.md +7 -3
  62. package/presets/claude/nuxt/agents/task-analyst.md +1 -1
  63. package/presets/claude/nuxt/hooks/chain-team-phases.sh +9 -2
  64. package/presets/claude/nuxt/hooks/list-ai-local.mjs +17 -0
  65. package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +4 -0
  66. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  67. package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
  68. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  69. package/presets/claude/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  70. package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +4 -0
  71. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  72. package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
  73. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +9 -2
  74. package/presets/claude/php-laravel/hooks/list-ai-local.mjs +17 -0
  75. package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +4 -0
  76. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  77. package/presets/claude/svelte/agents/task-analyst.md +1 -1
  78. package/presets/claude/svelte/hooks/chain-team-phases.sh +9 -2
  79. package/presets/claude/svelte/hooks/list-ai-local.mjs +17 -0
  80. package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +4 -0
  81. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
  82. package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
  83. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +9 -2
  84. package/presets/cursor/android-kotlin/hooks/list-ai-local.mjs +17 -0
  85. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
  86. package/presets/cursor/go/agents/task-analyst.md +1 -1
  87. package/presets/cursor/go/hooks/chain-team-phases.sh +9 -2
  88. package/presets/cursor/go/hooks/list-ai-local.mjs +17 -0
  89. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
  90. package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
  91. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +9 -2
  92. package/presets/cursor/ios-swift/hooks/list-ai-local.mjs +17 -0
  93. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
  94. package/presets/cursor/java/agents/task-analyst.md +1 -1
  95. package/presets/cursor/java/hooks/chain-team-phases.sh +9 -2
  96. package/presets/cursor/java/hooks/list-ai-local.mjs +17 -0
  97. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
  98. package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
  99. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +9 -2
  100. package/presets/cursor/mcp-ts/hooks/list-ai-local.mjs +17 -0
  101. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
  102. package/presets/cursor/mol/agents/task-analyst.md +1 -1
  103. package/presets/cursor/mol/hooks/chain-team-phases.sh +9 -2
  104. package/presets/cursor/mol/hooks/list-ai-local.mjs +17 -0
  105. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
  106. package/presets/cursor/next/agents/task-analyst.md +1 -1
  107. package/presets/cursor/next/commands/README.md +1 -1
  108. package/presets/cursor/next/commands/task.md +1 -1
  109. package/presets/cursor/next/hooks/chain-team-phases.sh +9 -2
  110. package/presets/cursor/next/hooks/list-ai-local.mjs +17 -0
  111. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +3 -1
  112. package/presets/cursor/next/rules/feature-delivery-workflow.mdc +4 -0
  113. package/presets/cursor/next/team/README.md +7 -3
  114. package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
  115. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +9 -2
  116. package/presets/cursor/nuxt/hooks/list-ai-local.mjs +17 -0
  117. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  118. package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
  119. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  120. package/presets/cursor/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  121. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
  122. package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
  123. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +9 -2
  124. package/presets/cursor/php-laravel/hooks/list-ai-local.mjs +17 -0
  125. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
  126. package/presets/cursor/svelte/agents/task-analyst.md +1 -1
  127. package/presets/cursor/svelte/hooks/chain-team-phases.sh +9 -2
  128. package/presets/cursor/svelte/hooks/list-ai-local.mjs +17 -0
  129. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  130. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  131. package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
  132. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +9 -2
  133. package/presets/mavis/android-kotlin/hooks/list-ai-local.mjs +17 -0
  134. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +3 -1
  135. package/presets/mavis/go/adapter-map.json +1 -1
  136. package/presets/mavis/go/agents/task-analyst.md +1 -1
  137. package/presets/mavis/go/hooks/chain-team-phases.sh +9 -2
  138. package/presets/mavis/go/hooks/list-ai-local.mjs +17 -0
  139. package/presets/mavis/go/rules/agent-team-orchestrator.md +3 -1
  140. package/presets/mavis/go/rules/feature-delivery-workflow.md +4 -0
  141. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  142. package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
  143. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +9 -2
  144. package/presets/mavis/ios-swift/hooks/list-ai-local.mjs +17 -0
  145. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +3 -1
  146. package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +4 -0
  147. package/presets/mavis/java/adapter-map.json +1 -1
  148. package/presets/mavis/java/agents/task-analyst.md +1 -1
  149. package/presets/mavis/java/hooks/chain-team-phases.sh +9 -2
  150. package/presets/mavis/java/hooks/list-ai-local.mjs +17 -0
  151. package/presets/mavis/java/rules/agent-team-orchestrator.md +3 -1
  152. package/presets/mavis/java/rules/feature-delivery-workflow.md +4 -0
  153. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  154. package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
  155. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +9 -2
  156. package/presets/mavis/mcp-ts/hooks/list-ai-local.mjs +17 -0
  157. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +3 -1
  158. package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +4 -0
  159. package/presets/mavis/mol/adapter-map.json +1 -1
  160. package/presets/mavis/mol/agents/task-analyst.md +1 -1
  161. package/presets/mavis/mol/hooks/chain-team-phases.sh +9 -2
  162. package/presets/mavis/mol/hooks/list-ai-local.mjs +17 -0
  163. package/presets/mavis/mol/rules/agent-team-orchestrator.md +3 -1
  164. package/presets/mavis/mol/rules/feature-delivery-workflow.md +4 -0
  165. package/presets/mavis/next/adapter-map.json +9 -1
  166. package/presets/mavis/next/agents/ci-investigator.md +5 -2
  167. package/presets/mavis/next/agents/debugger.md +5 -2
  168. package/presets/mavis/next/agents/feature-developer.md +5 -2
  169. package/presets/mavis/next/agents/task-analyst.md +1 -1
  170. package/presets/mavis/next/commands/README.md +1 -1
  171. package/presets/mavis/next/commands/task.md +1 -1
  172. package/presets/mavis/next/hooks/chain-team-phases.sh +9 -2
  173. package/presets/mavis/next/hooks/list-ai-local.mjs +17 -0
  174. package/presets/mavis/next/rules/agent-team-orchestrator.md +3 -1
  175. package/presets/mavis/next/rules/feature-delivery-workflow.md +8 -0
  176. package/presets/mavis/next/team/README.md +7 -3
  177. package/presets/mavis/nuxt/adapter-map.json +1 -1
  178. package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
  179. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +9 -2
  180. package/presets/mavis/nuxt/hooks/list-ai-local.mjs +17 -0
  181. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +3 -1
  182. package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +4 -0
  183. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  184. package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
  185. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  186. package/presets/mavis/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  187. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +3 -1
  188. package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
  189. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  190. package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
  191. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +9 -2
  192. package/presets/mavis/php-laravel/hooks/list-ai-local.mjs +17 -0
  193. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +3 -1
  194. package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +4 -0
  195. package/presets/mavis/svelte/adapter-map.json +1 -1
  196. package/presets/mavis/svelte/agents/task-analyst.md +1 -1
  197. package/presets/mavis/svelte/hooks/chain-team-phases.sh +9 -2
  198. package/presets/mavis/svelte/hooks/list-ai-local.mjs +17 -0
  199. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +3 -1
  200. package/presets/mavis/svelte/rules/feature-delivery-workflow.md +4 -0
  201. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  202. package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
  203. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +9 -2
  204. package/presets/opencode/android-kotlin/hooks/list-ai-local.mjs +17 -0
  205. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +3 -1
  206. package/presets/opencode/go/adapter-map.json +1 -1
  207. package/presets/opencode/go/agents/task-analyst.md +1 -1
  208. package/presets/opencode/go/hooks/chain-team-phases.sh +9 -2
  209. package/presets/opencode/go/hooks/list-ai-local.mjs +17 -0
  210. package/presets/opencode/go/rules/agent-team-orchestrator.md +3 -1
  211. package/presets/opencode/go/rules/feature-delivery-workflow.md +4 -0
  212. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  213. package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
  214. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +9 -2
  215. package/presets/opencode/ios-swift/hooks/list-ai-local.mjs +17 -0
  216. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +3 -1
  217. package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +4 -0
  218. package/presets/opencode/java/adapter-map.json +1 -1
  219. package/presets/opencode/java/agents/task-analyst.md +1 -1
  220. package/presets/opencode/java/hooks/chain-team-phases.sh +9 -2
  221. package/presets/opencode/java/hooks/list-ai-local.mjs +17 -0
  222. package/presets/opencode/java/rules/agent-team-orchestrator.md +3 -1
  223. package/presets/opencode/java/rules/feature-delivery-workflow.md +4 -0
  224. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  225. package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
  226. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +9 -2
  227. package/presets/opencode/mcp-ts/hooks/list-ai-local.mjs +17 -0
  228. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +3 -1
  229. package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
  230. package/presets/opencode/mol/adapter-map.json +1 -1
  231. package/presets/opencode/mol/agents/task-analyst.md +1 -1
  232. package/presets/opencode/mol/hooks/chain-team-phases.sh +9 -2
  233. package/presets/opencode/mol/hooks/list-ai-local.mjs +17 -0
  234. package/presets/opencode/mol/rules/agent-team-orchestrator.md +3 -1
  235. package/presets/opencode/mol/rules/feature-delivery-workflow.md +4 -0
  236. package/presets/opencode/next/adapter-map.json +9 -1
  237. package/presets/opencode/next/agents/ci-investigator.md +5 -2
  238. package/presets/opencode/next/agents/debugger.md +5 -2
  239. package/presets/opencode/next/agents/feature-developer.md +5 -2
  240. package/presets/opencode/next/agents/task-analyst.md +1 -1
  241. package/presets/opencode/next/commands/README.md +1 -1
  242. package/presets/opencode/next/commands/task.md +1 -1
  243. package/presets/opencode/next/hooks/chain-team-phases.sh +9 -2
  244. package/presets/opencode/next/hooks/list-ai-local.mjs +17 -0
  245. package/presets/opencode/next/rules/agent-team-orchestrator.md +3 -1
  246. package/presets/opencode/next/rules/feature-delivery-workflow.md +8 -0
  247. package/presets/opencode/next/team/README.md +7 -3
  248. package/presets/opencode/nuxt/adapter-map.json +1 -1
  249. package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
  250. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +9 -2
  251. package/presets/opencode/nuxt/hooks/list-ai-local.mjs +17 -0
  252. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +3 -1
  253. package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +4 -0
  254. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  255. package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
  256. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  257. package/presets/opencode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  258. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +3 -1
  259. package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
  260. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  261. package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
  262. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +9 -2
  263. package/presets/opencode/php-laravel/hooks/list-ai-local.mjs +17 -0
  264. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +3 -1
  265. package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +4 -0
  266. package/presets/opencode/plugins/output-guard/README.md +43 -0
  267. package/presets/opencode/plugins/output-guard/index.ts +300 -0
  268. package/presets/opencode/plugins/output-guard/package.json +9 -0
  269. package/presets/opencode/plugins/output-guard/rewrite.ts +149 -0
  270. package/presets/opencode/plugins/task-status/README.md +23 -11
  271. package/presets/opencode/plugins/task-status/details-data.ts +64 -46
  272. package/presets/opencode/plugins/task-status/details.tsx +12 -2
  273. package/presets/opencode/plugins/task-status/format.ts +16 -0
  274. package/presets/opencode/plugins/task-status/prompt-text.ts +37 -0
  275. package/presets/opencode/plugins/task-status/task-view.ts +281 -179
  276. package/presets/opencode/plugins/task-status/tui.tsx +60 -16
  277. package/presets/opencode/plugins/task-status/types.ts +74 -0
  278. package/presets/opencode/svelte/adapter-map.json +1 -1
  279. package/presets/opencode/svelte/agents/task-analyst.md +1 -1
  280. package/presets/opencode/svelte/hooks/chain-team-phases.sh +9 -2
  281. package/presets/opencode/svelte/hooks/list-ai-local.mjs +17 -0
  282. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +3 -1
  283. package/presets/opencode/svelte/rules/feature-delivery-workflow.md +4 -0
  284. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  285. package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
  286. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +9 -2
  287. package/presets/zcode/android-kotlin/hooks/list-ai-local.mjs +17 -0
  288. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +3 -1
  289. package/presets/zcode/go/adapter-map.json +1 -1
  290. package/presets/zcode/go/agents/task-analyst.md +1 -1
  291. package/presets/zcode/go/hooks/chain-team-phases.sh +9 -2
  292. package/presets/zcode/go/hooks/list-ai-local.mjs +17 -0
  293. package/presets/zcode/go/rules/agent-team-orchestrator.md +3 -1
  294. package/presets/zcode/go/rules/feature-delivery-workflow.md +4 -0
  295. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  296. package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
  297. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +9 -2
  298. package/presets/zcode/ios-swift/hooks/list-ai-local.mjs +17 -0
  299. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +3 -1
  300. package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +4 -0
  301. package/presets/zcode/java/adapter-map.json +1 -1
  302. package/presets/zcode/java/agents/task-analyst.md +1 -1
  303. package/presets/zcode/java/hooks/chain-team-phases.sh +9 -2
  304. package/presets/zcode/java/hooks/list-ai-local.mjs +17 -0
  305. package/presets/zcode/java/rules/agent-team-orchestrator.md +3 -1
  306. package/presets/zcode/java/rules/feature-delivery-workflow.md +4 -0
  307. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  308. package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
  309. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +9 -2
  310. package/presets/zcode/mcp-ts/hooks/list-ai-local.mjs +17 -0
  311. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +3 -1
  312. package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
  313. package/presets/zcode/mol/adapter-map.json +1 -1
  314. package/presets/zcode/mol/agents/task-analyst.md +1 -1
  315. package/presets/zcode/mol/hooks/chain-team-phases.sh +9 -2
  316. package/presets/zcode/mol/hooks/list-ai-local.mjs +17 -0
  317. package/presets/zcode/mol/rules/agent-team-orchestrator.md +3 -1
  318. package/presets/zcode/mol/rules/feature-delivery-workflow.md +4 -0
  319. package/presets/zcode/next/adapter-map.json +9 -1
  320. package/presets/zcode/next/agents/ci-investigator.md +5 -2
  321. package/presets/zcode/next/agents/debugger.md +5 -2
  322. package/presets/zcode/next/agents/feature-developer.md +5 -2
  323. package/presets/zcode/next/agents/task-analyst.md +1 -1
  324. package/presets/zcode/next/commands/README.md +1 -1
  325. package/presets/zcode/next/commands/task.md +1 -1
  326. package/presets/zcode/next/hooks/chain-team-phases.sh +9 -2
  327. package/presets/zcode/next/hooks/list-ai-local.mjs +17 -0
  328. package/presets/zcode/next/rules/agent-team-orchestrator.md +3 -1
  329. package/presets/zcode/next/rules/feature-delivery-workflow.md +8 -0
  330. package/presets/zcode/next/team/README.md +7 -3
  331. package/presets/zcode/nuxt/adapter-map.json +1 -1
  332. package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
  333. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +9 -2
  334. package/presets/zcode/nuxt/hooks/list-ai-local.mjs +17 -0
  335. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +3 -1
  336. package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +4 -0
  337. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  338. package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
  339. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  340. package/presets/zcode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  341. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +3 -1
  342. package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
  343. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  344. package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
  345. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +9 -2
  346. package/presets/zcode/php-laravel/hooks/list-ai-local.mjs +17 -0
  347. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +3 -1
  348. package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +4 -0
  349. package/presets/zcode/svelte/adapter-map.json +1 -1
  350. package/presets/zcode/svelte/agents/task-analyst.md +1 -1
  351. package/presets/zcode/svelte/hooks/chain-team-phases.sh +9 -2
  352. package/presets/zcode/svelte/hooks/list-ai-local.mjs +17 -0
  353. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +3 -1
  354. package/presets/zcode/svelte/rules/feature-delivery-workflow.md +4 -0
  355. package/scripts/report-context-cost.mjs +432 -0
  356. package/presets/_shared/ai-local/scripts/upstream-research.mjs +0 -2964
  357. package/presets/claude/next/commands/upstream-research.md +0 -23
  358. package/presets/claude/next/team/upstream/config.json +0 -31
  359. package/presets/claude/next/team/upstream/digest-template.md +0 -55
  360. package/presets/claude/next/team/upstream/jobs.json +0 -34
  361. package/presets/claude/next/team/upstream/opencode.json +0 -34
  362. package/presets/claude/next/team/upstream/projects.json +0 -4
  363. package/presets/claude/next/team/upstream/prompt.md +0 -77
  364. package/presets/claude/next/team/upstream/signatures.json +0 -9
  365. package/presets/cursor/next/commands/upstream-research.md +0 -23
  366. package/presets/cursor/next/team/upstream/config.json +0 -31
  367. package/presets/cursor/next/team/upstream/digest-template.md +0 -55
  368. package/presets/cursor/next/team/upstream/jobs.json +0 -34
  369. package/presets/cursor/next/team/upstream/opencode.json +0 -34
  370. package/presets/cursor/next/team/upstream/projects.json +0 -4
  371. package/presets/cursor/next/team/upstream/prompt.md +0 -77
  372. package/presets/cursor/next/team/upstream/signatures.json +0 -9
  373. package/presets/mavis/next/commands/upstream-research.md +0 -18
  374. package/presets/mavis/next/team/upstream/config.json +0 -31
  375. package/presets/mavis/next/team/upstream/digest-template.md +0 -55
  376. package/presets/mavis/next/team/upstream/jobs.json +0 -34
  377. package/presets/mavis/next/team/upstream/opencode.json +0 -34
  378. package/presets/mavis/next/team/upstream/projects.json +0 -4
  379. package/presets/mavis/next/team/upstream/prompt.md +0 -77
  380. package/presets/mavis/next/team/upstream/signatures.json +0 -9
  381. package/presets/opencode/next/commands/upstream-research.md +0 -26
  382. package/presets/opencode/next/team/upstream/config.json +0 -31
  383. package/presets/opencode/next/team/upstream/digest-template.md +0 -55
  384. package/presets/opencode/next/team/upstream/jobs.json +0 -34
  385. package/presets/opencode/next/team/upstream/opencode.json +0 -34
  386. package/presets/opencode/next/team/upstream/projects.json +0 -4
  387. package/presets/opencode/next/team/upstream/prompt.md +0 -77
  388. package/presets/opencode/next/team/upstream/signatures.json +0 -9
  389. package/presets/zcode/next/commands/upstream-research.md +0 -26
  390. package/presets/zcode/next/team/upstream/config.json +0 -31
  391. package/presets/zcode/next/team/upstream/digest-template.md +0 -55
  392. package/presets/zcode/next/team/upstream/jobs.json +0 -34
  393. package/presets/zcode/next/team/upstream/opencode.json +0 -34
  394. package/presets/zcode/next/team/upstream/projects.json +0 -4
  395. package/presets/zcode/next/team/upstream/prompt.md +0 -77
  396. package/presets/zcode/next/team/upstream/signatures.json +0 -9
@@ -1,9 +1,11 @@
1
1
  import { Plugin, usePlugin } from "@opencode/plugin/tui"
2
- import { createTaskWatcher, engagePause } from "./task-view"
3
- import { TaskDetails } from "./details"
4
- import type { TaskStore, TaskTone } from "./task-view"
2
+ import { clearPause, createTaskWatcher, engagePause, logTaskDebug } from "./task-view.ts"
3
+ import { TaskDetails } from "./details.tsx"
4
+ import type { TaskStore, TaskTone } from "./task-view.ts"
5
5
 
6
6
  let taskStore: TaskStore = { view: undefined }
7
+ let slot: { readonly sessionID?: string } | undefined
8
+ let lastSessionKey = ""
7
9
 
8
10
  const TaskSidebar = () => {
9
11
  const context = usePlugin()
@@ -43,11 +45,30 @@ const TaskSidebar = () => {
43
45
  label: { confirm: "Stop", cancel: "Cancel" },
44
46
  })
45
47
  if (!confirmed) return
46
- if (!engagePause(view.root)) {
48
+ const written = engagePause(view.root, view.slug)
49
+ if (!written) {
47
50
  context.ui.toast.show({ title: "Task", message: "Cannot write .ai.local/STOP", variant: "error" })
48
51
  return
49
52
  }
50
- context.ui.toast.show({ title: "Task", message: `Soft stop engaged for ${view.slug}`, variant: "warning" })
53
+ const where = written === "repo" ? `repository-wide (the ${view.slug} task dir was unwritable)` : `for ${view.slug}`
54
+ context.ui.toast.show({ title: "Task", message: `Soft stop engaged ${where}`, variant: "warning" })
55
+ }
56
+
57
+ const confirmResume = async () => {
58
+ const view = taskStore.view
59
+ if (!view?.slug || !view.root || !view.resumable) return
60
+ const scope = view.pausedScope === "task" ? "task" : "repository"
61
+ const confirmed = await context.ui.dialog.confirm({
62
+ title: "Resume task",
63
+ message: `Clear the ${scope} stop sentinel for ${view.slug}?`,
64
+ label: { confirm: "Resume", cancel: "Cancel" },
65
+ })
66
+ if (!confirmed) return
67
+ if (!clearPause(view.root, view.slug, view.pausedScope === "task" ? "task" : "repo")) {
68
+ context.ui.toast.show({ title: "Task", message: "No stop sentinel to clear", variant: "error" })
69
+ return
70
+ }
71
+ context.ui.toast.show({ title: "Task", message: `Resume requested for ${view.slug}`, variant: "success" })
51
72
  }
52
73
 
53
74
  const content = () => {
@@ -67,6 +88,10 @@ const TaskSidebar = () => {
67
88
  <box paddingLeft={1} onMouseUp={() => void confirmStop()}>
68
89
  <text fg={theme.text.feedback.error.base}>■ stop</text>
69
90
  </box>
91
+ ) : view.resumable ? (
92
+ <box paddingLeft={1} onMouseUp={() => void confirmResume()}>
93
+ <text fg={theme.text.feedback.success.base}>▶ resume</text>
94
+ </box>
70
95
  ) : null}
71
96
  </box>
72
97
  {panel.open ? (
@@ -114,26 +139,45 @@ export default Plugin.define({
114
139
  },
115
140
  sessionID: () => {
116
141
  const route = context.ui.router.current()
117
- if (route.type !== "session") return undefined
142
+ const routeSession = route.type === "session" ? route.sessionID : undefined
143
+ const chosen = slot?.sessionID ?? routeSession
144
+ const key = `${slot?.sessionID ?? "-"}|${routeSession ?? "-"}`
145
+ if (key !== lastSessionKey) {
146
+ lastSessionKey = key
147
+ logTaskDebug(`slot=${slot?.sessionID ?? "-"} route=${routeSession ?? "-"}`)
148
+ }
149
+ if (!chosen) return undefined
118
150
  try {
119
- return context.data.session.root(route.sessionID) ?? route.sessionID
151
+ return context.data.session.root(chosen) ?? chosen
120
152
  } catch {
121
- return route.sessionID
153
+ return chosen
122
154
  }
123
155
  },
124
156
  sessionTitle: (sessionID) => context.data.session.get(sessionID)?.title,
125
157
  userTexts: async (sessionID) => {
126
- const page = await context.client.message.list({
127
- sessionID,
128
- type: "user",
129
- order: "asc",
130
- limit: "200",
131
- })
132
- return page.data.flatMap((message) => (message.type === "user" ? [message.text] : []))
158
+ const texts: string[] = []
159
+ let cursor: string | undefined
160
+ for (let page = 0; page < 5; page += 1) {
161
+ const response = await context.client.message.list(
162
+ cursor
163
+ ? { sessionID, type: "user", cursor }
164
+ : { sessionID, type: "user", order: "asc", limit: "200" },
165
+ )
166
+ texts.push(...response.data.flatMap((message) => (message.type === "user" ? [message.text] : [])))
167
+ cursor = response.cursor?.next ?? undefined
168
+ if (!cursor) break
169
+ }
170
+ return texts
133
171
  },
134
172
  })
135
173
  taskStore = watcher.state
136
- context.ui.slot({ append: "sidebar.content", render: () => <TaskSidebar /> })
174
+ context.ui.slot({
175
+ append: "sidebar.content",
176
+ render: (input) => {
177
+ slot = input as unknown as { readonly sessionID?: string }
178
+ return <TaskSidebar />
179
+ },
180
+ })
137
181
  return watcher.stop
138
182
  },
139
183
  })
@@ -0,0 +1,74 @@
1
+ export type TaskTone = "success" | "warning" | "error" | "muted"
2
+
3
+ export type TaskField = { label: string; value: string; tone?: TaskTone }
4
+
5
+ export type PauseScope = "task" | "repo"
6
+
7
+ export type TaskView = {
8
+ fields: TaskField[]
9
+ summary: string
10
+ tone: TaskTone
11
+ slug?: string
12
+ root?: string
13
+ stoppable?: boolean
14
+ resumable?: boolean
15
+ pausedScope?: PauseScope
16
+ offline?: boolean
17
+ }
18
+
19
+ export type TaskStore = { view: TaskView | null | undefined }
20
+
21
+ export type Attempt = {
22
+ agent?: string
23
+ stepIndex?: number
24
+ attempt?: number
25
+ startedAt?: string
26
+ }
27
+
28
+ export type JoinedSlot = {
29
+ agent?: string
30
+ stepIndex?: number
31
+ attemptId?: string
32
+ outcome?: string
33
+ }
34
+
35
+ export type Status = {
36
+ state?: string
37
+ phase?: string
38
+ pipelineIndex?: number
39
+ currentAgent?: string | null
40
+ awaitingHumanGate?: boolean
41
+ activeHumanGateEventId?: string | null
42
+ activeAttempts?: Record<string, Attempt>
43
+ lastCompletedAttempt?: { attemptId?: string; completedAt?: string }
44
+ joinedSlots?: Record<string, JoinedSlot>
45
+ updatedAt?: string
46
+ metricsRunId?: string
47
+ }
48
+
49
+ export type Pipeline = {
50
+ steps?: { agent?: string | string[]; label?: string; parallel?: boolean }[]
51
+ }
52
+
53
+ export type MetricEvent = {
54
+ type?: string
55
+ at?: string
56
+ eventId?: string
57
+ attemptId?: string
58
+ agent?: string
59
+ role?: string
60
+ durationMs?: number
61
+ stepIndex?: number
62
+ }
63
+
64
+ export type Metrics = { events?: MetricEvent[] }
65
+
66
+ export type Manifest = {
67
+ artifacts?: {
68
+ producer?: string
69
+ path?: string
70
+ authoritativePaths?: string[]
71
+ status?: string
72
+ receipt?: { outcome?: string; at?: string }
73
+ }[]
74
+ }
@@ -3,7 +3,7 @@
3
3
  "platform": "opencode",
4
4
  "stack": "svelte",
5
5
  "semanticSource": "cursor/svelte",
6
- "sourceRevision": "5ba1fd160dc99c9432e271fd004ddbc3a54f34ad4f6b2e5027d42d1f9b986082",
6
+ "sourceRevision": "e38ba765bb0c5bb6d7d8054db0f7089e6512d6cb8d2eb2d7525a164bfd673828",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -63,7 +63,7 @@ Decompose as a **dependency graph**: each task carries `dependsOn[]`, the edges
63
63
 
64
64
  <!-- shared-core: quality/context-and-iteration.md -->
65
65
 
66
- Work in bounded waves; delegate mechanical waves to repo scripts. **Checkpoint** progress to `.memlog.md` and record produced paths on the `implementation` manifest entry `authoritativePaths`, so a run can resume from `artifact-manifest.json` + `.memlog.md` without re-deriving state. Refine with the named loop **draft → evaluate against named criteria → refine**.
66
+ Work in bounded waves; delegate mechanical waves to repo scripts. A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. **Checkpoint** progress to `.memlog.md` and record produced paths on the `implementation` manifest entry `authoritativePaths`, so a run can resume from `artifact-manifest.json` + `.memlog.md` without re-deriving state. Refine with the named loop **draft → evaluate against named criteria → refine**.
67
67
 
68
68
  ## Self-review & context hygiene
69
69
 
@@ -1283,11 +1283,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1283
1283
  }
1284
1284
  } catch {}
1285
1285
  }
1286
+ // Five entries is enough to resume; a longer list is a status dump, not a
1287
+ // pointer. The line budget below still bounds a single entry with many paths.
1288
+ const MAX_FOCUS_ENTRIES = 5;
1289
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1286
1290
  const pathLines = [];
1287
1291
  if (incomplete.length === 0) pathLines.push(' - (none)');
1288
1292
  else {
1289
- for (let index = 0; index < incomplete.length; index += 1) {
1290
- const item = incomplete[index];
1293
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1294
+ const item = shownIncomplete[index];
1291
1295
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1292
1296
  else {
1293
1297
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1295,6 +1299,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1295
1299
  }
1296
1300
  }
1297
1301
  }
1302
+ if (incomplete.length > shownIncomplete.length) {
1303
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1304
+ }
1298
1305
  }
1299
1306
  let readyLine = '- decomposition ready set: (none)';
1300
1307
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -151,7 +151,7 @@ Replanning is a **named, auditable operation** — never a silent reorder. Trigg
151
151
 
152
152
  ## Context budget & checkpoint/resume
153
153
 
154
- Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
154
+ Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
155
155
 
156
156
  ## Self-review & context hygiene
157
157
 
@@ -218,6 +218,8 @@ Additional states: `blocked` — a step (or a parallel producer) cannot proceed;
218
218
 
219
219
  On each `subagentStop`, the hook reconciles `status.state` from the completing producer's terminal `artifact-manifest.json` receipt (`completed` \| `changes_requested` \| `validation_failed`) when agents left lifecycle fields untouched. Parent orchestrators must wait for that handoff before invoking the next step.
220
220
 
221
+ **A dispatch is not a completion.** When the host hands back a session handle, a job id, or control before the specialist's turn ends, the step is still open: do not dispatch the next step, do not report the step done, and do not run the chain hook until the specialist reports back and the hook records the receipt. A background handle is a start signal only.
222
+
221
223
  ## Pipeline step options
222
224
 
223
225
  | Field | Use |
@@ -14,6 +14,10 @@ Typical feature with data and UI. Concrete directories and rule stems — in the
14
14
  6. **Tests** — unit for mappers / non-trivial logic; e2e/UI per stack convention.
15
15
  7. **Completion** — stack post-change gate (lint/build) + package/toolchain rules. When the current WP spans **more than one** layer or module, `implementation.md` includes a **Code Map** (3–8 annotated repo-relative paths) and **Suggested Review Order** (`concern | path:line | ≤15 word note`). Omit both for a single-file or single-layer WP.
16
16
 
17
+ ## Context hygiene
18
+
19
+ A command whose output can exceed ~4 KB — a test run, a build/lint log, `git log`, a diff — is piped through `.ai.local/scripts/dump-output.mjs --task <slug>` instead of being read whole. Work from its ≤40-line head and the stored file (grep it or use `team-db.mjs search`), and when that output informed a decision, record the repo-relative `outputs/…` path in `implementation.md` or `validation-report.md`; a `code-reviewer` may ask for that path. Do not read the whole output into context.
20
+
17
21
  ## Iterative refinement loop
18
22
 
19
23
  Every stage runs the named loop **draft → evaluate against named criteria → refine**:
@@ -3,7 +3,7 @@
3
3
  "platform": "zcode",
4
4
  "stack": "android-kotlin",
5
5
  "semanticSource": "cursor/android-kotlin",
6
- "sourceRevision": "9b879e06ea1f63b90c99099ca74ded87625177f85ca0b1b30fa682f19e497d3a",
6
+ "sourceRevision": "994ba1bdd785a6551055abbe78f146711e0d4c61748a4b5f744ac8545f65cf78",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -54,7 +54,7 @@ Decompose as a **dependency graph**: each task carries `dependsOn[]`, the edges
54
54
 
55
55
  <!-- shared-core: quality/context-and-iteration.md -->
56
56
 
57
- Work in bounded waves; delegate mechanical waves to repo scripts. **Checkpoint** progress to `.memlog.md` and record produced paths on the `implementation` manifest entry `authoritativePaths`, so a run can resume from `artifact-manifest.json` + `.memlog.md` without re-deriving state. Refine with the named loop **draft → evaluate against named criteria → refine**.
57
+ Work in bounded waves; delegate mechanical waves to repo scripts. A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. **Checkpoint** progress to `.memlog.md` and record produced paths on the `implementation` manifest entry `authoritativePaths`, so a run can resume from `artifact-manifest.json` + `.memlog.md` without re-deriving state. Refine with the named loop **draft → evaluate against named criteria → refine**.
58
58
 
59
59
  ## Self-review & context hygiene
60
60
 
@@ -1283,11 +1283,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1283
1283
  }
1284
1284
  } catch {}
1285
1285
  }
1286
+ // Five entries is enough to resume; a longer list is a status dump, not a
1287
+ // pointer. The line budget below still bounds a single entry with many paths.
1288
+ const MAX_FOCUS_ENTRIES = 5;
1289
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1286
1290
  const pathLines = [];
1287
1291
  if (incomplete.length === 0) pathLines.push(' - (none)');
1288
1292
  else {
1289
- for (let index = 0; index < incomplete.length; index += 1) {
1290
- const item = incomplete[index];
1293
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1294
+ const item = shownIncomplete[index];
1291
1295
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1292
1296
  else {
1293
1297
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1295,6 +1299,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1295
1299
  }
1296
1300
  }
1297
1301
  }
1302
+ if (incomplete.length > shownIncomplete.length) {
1303
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1304
+ }
1298
1305
  }
1299
1306
  let readyLine = '- decomposition ready set: (none)';
1300
1307
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -151,7 +151,7 @@ Replanning is a **named, auditable operation** — never a silent reorder. Trigg
151
151
 
152
152
  ## Context budget & checkpoint/resume
153
153
 
154
- Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
154
+ Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
155
155
 
156
156
  ## Self-review & context hygiene
157
157
 
@@ -218,6 +218,8 @@ Additional states: `blocked` — a step (or a parallel producer) cannot proceed;
218
218
 
219
219
  On each `subagentStop`, the hook reconciles `status.state` from the completing producer's terminal `artifact-manifest.json` receipt (`completed` \| `changes_requested` \| `validation_failed`) when agents left lifecycle fields untouched. Parent orchestrators must wait for that handoff before invoking the next step.
220
220
 
221
+ **A dispatch is not a completion.** When the host hands back a session handle, a job id, or control before the specialist's turn ends, the step is still open: do not dispatch the next step, do not report the step done, and do not run the chain hook until the specialist reports back and the hook records the receipt. A background handle is a start signal only.
222
+
221
223
  ## Pipeline step options
222
224
 
223
225
  | Field | Use |
@@ -3,7 +3,7 @@
3
3
  "platform": "zcode",
4
4
  "stack": "go",
5
5
  "semanticSource": "cursor/go",
6
- "sourceRevision": "c2be82d1dfc7787eed1c8100d63ad94f91ceaab7f8aafb00e1b63f33b37abd0b",
6
+ "sourceRevision": "d47408424812fff73722b380f6ee6530f6c89088260ad094474a32c4ac9e51d2",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -54,7 +54,7 @@ Decompose as a **dependency graph**: each task carries `dependsOn[]`, the edges
54
54
 
55
55
  <!-- shared-core: quality/context-and-iteration.md -->
56
56
 
57
- Work in bounded waves; delegate mechanical waves to repo scripts. **Checkpoint** progress to `.memlog.md` and record produced paths on the `implementation` manifest entry `authoritativePaths`, so a run can resume from `artifact-manifest.json` + `.memlog.md` without re-deriving state. Refine with the named loop **draft → evaluate against named criteria → refine**.
57
+ Work in bounded waves; delegate mechanical waves to repo scripts. A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. **Checkpoint** progress to `.memlog.md` and record produced paths on the `implementation` manifest entry `authoritativePaths`, so a run can resume from `artifact-manifest.json` + `.memlog.md` without re-deriving state. Refine with the named loop **draft → evaluate against named criteria → refine**.
58
58
 
59
59
  ## Self-review & context hygiene
60
60
 
@@ -1282,11 +1282,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1282
1282
  }
1283
1283
  } catch {}
1284
1284
  }
1285
+ // Five entries is enough to resume; a longer list is a status dump, not a
1286
+ // pointer. The line budget below still bounds a single entry with many paths.
1287
+ const MAX_FOCUS_ENTRIES = 5;
1288
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1285
1289
  const pathLines = [];
1286
1290
  if (incomplete.length === 0) pathLines.push(' - (none)');
1287
1291
  else {
1288
- for (let index = 0; index < incomplete.length; index += 1) {
1289
- const item = incomplete[index];
1292
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1293
+ const item = shownIncomplete[index];
1290
1294
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1291
1295
  else {
1292
1296
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1294,6 +1298,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1294
1298
  }
1295
1299
  }
1296
1300
  }
1301
+ if (incomplete.length > shownIncomplete.length) {
1302
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1303
+ }
1297
1304
  }
1298
1305
  let readyLine = '- decomposition ready set: (none)';
1299
1306
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -151,7 +151,7 @@ Replanning is a **named, auditable operation** — never a silent reorder. Trigg
151
151
 
152
152
  ## Context budget & checkpoint/resume
153
153
 
154
- Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
154
+ Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
155
155
 
156
156
  ## Self-review & context hygiene
157
157
 
@@ -218,6 +218,8 @@ Additional states: `blocked` — a step (or a parallel producer) cannot proceed;
218
218
 
219
219
  On each `subagentStop`, the hook reconciles `status.state` from the completing producer's terminal `artifact-manifest.json` receipt (`completed` \| `changes_requested` \| `validation_failed`) when agents left lifecycle fields untouched. Parent orchestrators must wait for that handoff before invoking the next step.
220
220
 
221
+ **A dispatch is not a completion.** When the host hands back a session handle, a job id, or control before the specialist's turn ends, the step is still open: do not dispatch the next step, do not report the step done, and do not run the chain hook until the specialist reports back and the hook records the receipt. A background handle is a start signal only.
222
+
221
223
  ## Pipeline step options
222
224
 
223
225
  | Field | Use |
@@ -14,6 +14,10 @@ Typical feature with data and UI. Concrete directories and rule stems — in the
14
14
  6. **Tests** — unit for mappers / non-trivial logic; e2e/UI per stack convention.
15
15
  7. **Completion** — stack post-change gate (lint/build) + package/toolchain rules. When the current WP spans **more than one** layer or module, `implementation.md` includes a **Code Map** (3–8 annotated repo-relative paths) and **Suggested Review Order** (`concern | path:line | ≤15 word note`). Omit both for a single-file or single-layer WP.
16
16
 
17
+ ## Context hygiene
18
+
19
+ A command whose output can exceed ~4 KB — a test run, a build/lint log, `git log`, a diff — is piped through `.ai.local/scripts/dump-output.mjs --task <slug>` instead of being read whole. Work from its ≤40-line head and the stored file (grep it or use `team-db.mjs search`), and when that output informed a decision, record the repo-relative `outputs/…` path in `implementation.md` or `validation-report.md`; a `code-reviewer` may ask for that path. Do not read the whole output into context.
20
+
17
21
  ## Iterative refinement loop
18
22
 
19
23
  Every stage runs the named loop **draft → evaluate against named criteria → refine**:
@@ -3,7 +3,7 @@
3
3
  "platform": "zcode",
4
4
  "stack": "ios-swift",
5
5
  "semanticSource": "cursor/ios-swift",
6
- "sourceRevision": "8eceb6eadc05b34689d387b3c198c2f571a409c194aca72b106ce95e2ea69b3e",
6
+ "sourceRevision": "2ccc97fbc9cfcda17c06b3b49304e1f0a4b2efa7633eb05ab41874ac3f5acd76",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -54,7 +54,7 @@ Decompose as a **dependency graph**: each task carries `dependsOn[]`, the edges
54
54
 
55
55
  <!-- shared-core: quality/context-and-iteration.md -->
56
56
 
57
- Work in bounded waves; delegate mechanical waves to repo scripts. **Checkpoint** progress to `.memlog.md` and record produced paths on the `implementation` manifest entry `authoritativePaths`, so a run can resume from `artifact-manifest.json` + `.memlog.md` without re-deriving state. Refine with the named loop **draft → evaluate against named criteria → refine**.
57
+ Work in bounded waves; delegate mechanical waves to repo scripts. A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. **Checkpoint** progress to `.memlog.md` and record produced paths on the `implementation` manifest entry `authoritativePaths`, so a run can resume from `artifact-manifest.json` + `.memlog.md` without re-deriving state. Refine with the named loop **draft → evaluate against named criteria → refine**.
58
58
 
59
59
  ## Self-review & context hygiene
60
60
 
@@ -1283,11 +1283,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1283
1283
  }
1284
1284
  } catch {}
1285
1285
  }
1286
+ // Five entries is enough to resume; a longer list is a status dump, not a
1287
+ // pointer. The line budget below still bounds a single entry with many paths.
1288
+ const MAX_FOCUS_ENTRIES = 5;
1289
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1286
1290
  const pathLines = [];
1287
1291
  if (incomplete.length === 0) pathLines.push(' - (none)');
1288
1292
  else {
1289
- for (let index = 0; index < incomplete.length; index += 1) {
1290
- const item = incomplete[index];
1293
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1294
+ const item = shownIncomplete[index];
1291
1295
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1292
1296
  else {
1293
1297
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1295,6 +1299,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1295
1299
  }
1296
1300
  }
1297
1301
  }
1302
+ if (incomplete.length > shownIncomplete.length) {
1303
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1304
+ }
1298
1305
  }
1299
1306
  let readyLine = '- decomposition ready set: (none)';
1300
1307
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),