@tacuchi/agent-workflow-cli 25.8.0 → 25.9.0

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 (502) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +5 -1
  3. package/dist/adapters/git-cli.js +225 -17
  4. package/dist/adapters/git-cli.js.map +1 -1
  5. package/dist/adapters/node-file-system.js +48 -0
  6. package/dist/adapters/node-file-system.js.map +1 -1
  7. package/dist/application/amend-service.js +51 -14
  8. package/dist/application/amend-service.js.map +1 -1
  9. package/dist/application/branch-resolver.js +6 -3
  10. package/dist/application/branch-resolver.js.map +1 -1
  11. package/dist/application/capability/design-handler.js +124 -43
  12. package/dist/application/capability/design-handler.js.map +1 -1
  13. package/dist/application/capability/dispatcher.js +4 -1
  14. package/dist/application/capability/dispatcher.js.map +1 -1
  15. package/dist/application/capability/durable-effect.js +3 -0
  16. package/dist/application/capability/durable-effect.js.map +1 -1
  17. package/dist/application/check-branch-service.js +158 -19
  18. package/dist/application/check-branch-service.js.map +1 -1
  19. package/dist/application/checkpoint/markdown.js +2 -2
  20. package/dist/application/checkpoint/markdown.js.map +1 -1
  21. package/dist/application/checkpoint/state-reader.js +12 -0
  22. package/dist/application/checkpoint/state-reader.js.map +1 -1
  23. package/dist/application/checkpoint-service.js +12 -4
  24. package/dist/application/checkpoint-service.js.map +1 -1
  25. package/dist/application/checkpoint-write-service.js +91 -17
  26. package/dist/application/checkpoint-write-service.js.map +1 -1
  27. package/dist/application/claims-ledger.js +137 -11
  28. package/dist/application/claims-ledger.js.map +1 -1
  29. package/dist/application/claims-recovery.js +85 -44
  30. package/dist/application/claims-recovery.js.map +1 -1
  31. package/dist/application/database-tool-catalog.js +33 -0
  32. package/dist/application/database-tool-catalog.js.map +1 -1
  33. package/dist/application/design/consumer-document.js +2 -2
  34. package/dist/application/design/consumer-document.js.map +1 -1
  35. package/dist/application/design/design-content-gate-service.js +20 -2
  36. package/dist/application/design/design-content-gate-service.js.map +1 -1
  37. package/dist/application/design/design-gate-service.js +2 -0
  38. package/dist/application/design/design-gate-service.js.map +1 -1
  39. package/dist/application/design/design-index-service.js +4 -0
  40. package/dist/application/design/design-index-service.js.map +1 -1
  41. package/dist/application/design/design-publish-service.js +1 -4
  42. package/dist/application/design/design-publish-service.js.map +1 -1
  43. package/dist/application/design/design-record-service.js +13 -7
  44. package/dist/application/design/design-record-service.js.map +1 -1
  45. package/dist/application/design/design-resolver-service.js +22 -3
  46. package/dist/application/design/design-resolver-service.js.map +1 -1
  47. package/dist/application/design/design-simple-service.js +24 -5
  48. package/dist/application/design/design-simple-service.js.map +1 -1
  49. package/dist/application/design/digest.js +41 -0
  50. package/dist/application/design/digest.js.map +1 -0
  51. package/dist/application/dev-only-services.js +166 -20
  52. package/dist/application/dev-only-services.js.map +1 -1
  53. package/dist/application/doc-branch-ledger.js +145 -0
  54. package/dist/application/doc-branch-ledger.js.map +1 -0
  55. package/dist/application/docs-canon-service.js +1 -1
  56. package/dist/application/docs-canon-service.js.map +1 -1
  57. package/dist/application/doctor/dist-integrity.js +113 -0
  58. package/dist/application/doctor/dist-integrity.js.map +1 -0
  59. package/dist/application/doctor/hosts.js +5 -2
  60. package/dist/application/doctor/hosts.js.map +1 -1
  61. package/dist/application/doctor/prepare.js +4 -1
  62. package/dist/application/doctor/prepare.js.map +1 -1
  63. package/dist/application/doctor/provider-installation.js +39 -19
  64. package/dist/application/doctor/provider-installation.js.map +1 -1
  65. package/dist/application/doctor/provider-mcps.js +9 -1
  66. package/dist/application/doctor/provider-mcps.js.map +1 -1
  67. package/dist/application/doctor/provider-skills.js +25 -0
  68. package/dist/application/doctor/provider-skills.js.map +1 -1
  69. package/dist/application/doctor/provider-visibility.js +76 -3
  70. package/dist/application/doctor/provider-visibility.js.map +1 -1
  71. package/dist/application/doctor/provider-workspace-block.js +156 -0
  72. package/dist/application/doctor/provider-workspace-block.js.map +1 -0
  73. package/dist/application/doctor/repair-runner.js +47 -3
  74. package/dist/application/doctor/repair-runner.js.map +1 -1
  75. package/dist/application/doctor/report.js +24 -4
  76. package/dist/application/doctor/report.js.map +1 -1
  77. package/dist/application/doctor/skills-toml-migrate.js +76 -0
  78. package/dist/application/doctor/skills-toml-migrate.js.map +1 -0
  79. package/dist/application/export-catalog-check.js +200 -0
  80. package/dist/application/export-catalog-check.js.map +1 -0
  81. package/dist/application/export-service.js +716 -79
  82. package/dist/application/export-service.js.map +1 -1
  83. package/dist/application/fix-git-service.js +285 -64
  84. package/dist/application/fix-git-service.js.map +1 -1
  85. package/dist/application/flow/advance.js +202 -25
  86. package/dist/application/flow/advance.js.map +1 -1
  87. package/dist/application/flow/annul-service.js +3 -1
  88. package/dist/application/flow/annul-service.js.map +1 -1
  89. package/dist/application/flow/batch-commit.js +189 -0
  90. package/dist/application/flow/batch-commit.js.map +1 -0
  91. package/dist/application/flow/checkout-observation.js +63 -10
  92. package/dist/application/flow/checkout-observation.js.map +1 -1
  93. package/dist/application/flow/close-artifacts.js +105 -0
  94. package/dist/application/flow/close-artifacts.js.map +1 -0
  95. package/dist/application/flow/close-at-boundary.js +25 -14
  96. package/dist/application/flow/close-at-boundary.js.map +1 -1
  97. package/dist/application/flow/close-document-guidance.js +70 -0
  98. package/dist/application/flow/close-document-guidance.js.map +1 -0
  99. package/dist/application/flow/flow-service.js +46 -3
  100. package/dist/application/flow/flow-service.js.map +1 -1
  101. package/dist/application/flow/internal-actions.js +300 -82
  102. package/dist/application/flow/internal-actions.js.map +1 -1
  103. package/dist/application/flow/internal-drive.js +24 -1
  104. package/dist/application/flow/internal-drive.js.map +1 -1
  105. package/dist/application/flow/plan-entry.js +82 -0
  106. package/dist/application/flow/plan-entry.js.map +1 -0
  107. package/dist/application/flow/prove.js +32 -1
  108. package/dist/application/flow/prove.js.map +1 -1
  109. package/dist/application/flow/quick-checkouts.js +48 -0
  110. package/dist/application/flow/quick-checkouts.js.map +1 -0
  111. package/dist/application/flow/reinfer-batch.js +177 -0
  112. package/dist/application/flow/reinfer-batch.js.map +1 -0
  113. package/dist/application/flow/reopen-run.js +12 -5
  114. package/dist/application/flow/reopen-run.js.map +1 -1
  115. package/dist/application/flow/run-state-service.js +2 -0
  116. package/dist/application/flow/run-state-service.js.map +1 -1
  117. package/dist/application/flow/submit.js +583 -116
  118. package/dist/application/flow/submit.js.map +1 -1
  119. package/dist/application/generate-launch-service.js +16 -6
  120. package/dist/application/generate-launch-service.js.map +1 -1
  121. package/dist/application/git-flow-service.js +34 -3
  122. package/dist/application/git-flow-service.js.map +1 -1
  123. package/dist/application/history-publications.js +24 -0
  124. package/dist/application/history-publications.js.map +1 -1
  125. package/dist/application/history-reconcile-service.js +45 -0
  126. package/dist/application/history-reconcile-service.js.map +1 -0
  127. package/dist/application/history-table.js +61 -12
  128. package/dist/application/history-table.js.map +1 -1
  129. package/dist/application/history-update-service.js +25 -4
  130. package/dist/application/history-update-service.js.map +1 -1
  131. package/dist/application/hook-branch-check.js +25 -3
  132. package/dist/application/hook-branch-check.js.map +1 -1
  133. package/dist/application/hook-git-commit-advisor.js +3 -4
  134. package/dist/application/hook-git-commit-advisor.js.map +1 -1
  135. package/dist/application/hook-turn-start.js +51 -0
  136. package/dist/application/hook-turn-start.js.map +1 -0
  137. package/dist/application/host-memory/codex.js +1 -1
  138. package/dist/application/host-memory/codex.js.map +1 -1
  139. package/dist/application/hub-registry.js +135 -0
  140. package/dist/application/hub-registry.js.map +1 -0
  141. package/dist/application/local-proposal.js +72 -19
  142. package/dist/application/local-proposal.js.map +1 -1
  143. package/dist/application/mcp-host-reader.js +1 -1
  144. package/dist/application/mcp-host-reader.js.map +1 -1
  145. package/dist/application/mcp-host-writer.js +16 -10
  146. package/dist/application/mcp-host-writer.js.map +1 -1
  147. package/dist/application/merge-state-service.js +150 -34
  148. package/dist/application/merge-state-service.js.map +1 -1
  149. package/dist/application/multiroot/claude.js +17 -10
  150. package/dist/application/multiroot/claude.js.map +1 -1
  151. package/dist/application/multiroot/codex.js +17 -11
  152. package/dist/application/multiroot/codex.js.map +1 -1
  153. package/dist/application/multiroot-service.js +52 -28
  154. package/dist/application/multiroot-service.js.map +1 -1
  155. package/dist/application/parsers/execution-batches.js +64 -0
  156. package/dist/application/parsers/execution-batches.js.map +1 -0
  157. package/dist/application/parsers/phases.js +23 -2
  158. package/dist/application/parsers/phases.js.map +1 -1
  159. package/dist/application/parsers/project-block.js +146 -17
  160. package/dist/application/parsers/project-block.js.map +1 -1
  161. package/dist/application/parsers/tasks.js +16 -2
  162. package/dist/application/parsers/tasks.js.map +1 -1
  163. package/dist/application/parsers/toml.js +19 -0
  164. package/dist/application/parsers/toml.js.map +1 -0
  165. package/dist/application/paths-service.js +13 -16
  166. package/dist/application/paths-service.js.map +1 -1
  167. package/dist/application/persist-service.js +118 -5
  168. package/dist/application/persist-service.js.map +1 -1
  169. package/dist/application/plan-exec-batch-service.js +162 -22
  170. package/dist/application/plan-exec-batch-service.js.map +1 -1
  171. package/dist/application/plan-exec-decision-service.js +61 -12
  172. package/dist/application/plan-exec-decision-service.js.map +1 -1
  173. package/dist/application/plan-exec-plan-diff.js +105 -0
  174. package/dist/application/plan-exec-plan-diff.js.map +1 -0
  175. package/dist/application/plan-lint-service.js +2 -0
  176. package/dist/application/plan-lint-service.js.map +1 -1
  177. package/dist/application/plan-passes.js +41 -0
  178. package/dist/application/plan-passes.js.map +1 -0
  179. package/dist/application/preparation-receipts.js +58 -0
  180. package/dist/application/preparation-receipts.js.map +1 -0
  181. package/dist/application/project-md-upsert-service.js +191 -52
  182. package/dist/application/project-md-upsert-service.js.map +1 -1
  183. package/dist/application/project-tab-data.js +40 -10
  184. package/dist/application/project-tab-data.js.map +1 -1
  185. package/dist/application/release-data/artifacts.js +15 -7
  186. package/dist/application/release-data/artifacts.js.map +1 -1
  187. package/dist/application/release-data/bundles.js +52 -6
  188. package/dist/application/release-data/bundles.js.map +1 -1
  189. package/dist/application/release-data/common.js +2 -2
  190. package/dist/application/release-data/common.js.map +1 -1
  191. package/dist/application/release-data/rollback.js +7 -0
  192. package/dist/application/release-data/rollback.js.map +1 -0
  193. package/dist/application/release-data/sessions.js +2 -2
  194. package/dist/application/release-data/sessions.js.map +1 -1
  195. package/dist/application/release-pass-ledger.js +1 -1
  196. package/dist/application/render/history-row.js +2 -0
  197. package/dist/application/render/history-row.js.map +1 -1
  198. package/dist/application/render/project-block.js +28 -11
  199. package/dist/application/render/project-block.js.map +1 -1
  200. package/dist/application/reseal-service.js +1 -0
  201. package/dist/application/reseal-service.js.map +1 -1
  202. package/dist/application/resume-service.js +55 -8
  203. package/dist/application/resume-service.js.map +1 -1
  204. package/dist/application/retirement/apply.js +25 -7
  205. package/dist/application/retirement/apply.js.map +1 -1
  206. package/dist/application/retirement/attribution.js +121 -48
  207. package/dist/application/retirement/attribution.js.map +1 -1
  208. package/dist/application/retirement/prepare.js +17 -11
  209. package/dist/application/retirement/prepare.js.map +1 -1
  210. package/dist/application/retirement/preview.js +2 -1
  211. package/dist/application/retirement/preview.js.map +1 -1
  212. package/dist/application/self/codex-plugin.js +1 -1
  213. package/dist/application/self/codex-plugin.js.map +1 -1
  214. package/dist/application/self/host-states.js +3 -3
  215. package/dist/application/self/host-states.js.map +1 -1
  216. package/dist/application/self/install-hooks.js +1 -1
  217. package/dist/application/self/install-hooks.js.map +1 -1
  218. package/dist/application/self/mcp-config.js +19 -11
  219. package/dist/application/self/mcp-config.js.map +1 -1
  220. package/dist/application/self/opencode-plugin.js +1 -0
  221. package/dist/application/self/opencode-plugin.js.map +1 -1
  222. package/dist/application/self/uninstall.js +1 -1
  223. package/dist/application/self/uninstall.js.map +1 -1
  224. package/dist/application/semantic-operation/protocol.js +66 -5
  225. package/dist/application/semantic-operation/protocol.js.map +1 -1
  226. package/dist/application/session-archive-service.js +113 -0
  227. package/dist/application/session-archive-service.js.map +1 -0
  228. package/dist/application/session-binding-service.js +35 -0
  229. package/dist/application/session-binding-service.js.map +1 -1
  230. package/dist/application/session-close-service.js +390 -54
  231. package/dist/application/session-close-service.js.map +1 -1
  232. package/dist/application/session-create-service.js +97 -5
  233. package/dist/application/session-create-service.js.map +1 -1
  234. package/dist/application/session-custody-recorder.js +15 -12
  235. package/dist/application/session-custody-recorder.js.map +1 -1
  236. package/dist/application/session-custody-service.js +1 -0
  237. package/dist/application/session-custody-service.js.map +1 -1
  238. package/dist/application/session-narrative.js +42 -12
  239. package/dist/application/session-narrative.js.map +1 -1
  240. package/dist/application/session-pause-service.js +46 -0
  241. package/dist/application/session-pause-service.js.map +1 -0
  242. package/dist/application/session-resolver.js +36 -11
  243. package/dist/application/session-resolver.js.map +1 -1
  244. package/dist/application/session-resume-service.js +134 -13
  245. package/dist/application/session-resume-service.js.map +1 -1
  246. package/dist/application/sessions-service.js +4 -0
  247. package/dist/application/sessions-service.js.map +1 -1
  248. package/dist/application/sessions-sweep-service.js +77 -0
  249. package/dist/application/sessions-sweep-service.js.map +1 -0
  250. package/dist/application/settle-service.js +3 -1
  251. package/dist/application/settle-service.js.map +1 -1
  252. package/dist/application/skills-resolver-service.js +1 -1
  253. package/dist/application/skills-resolver-service.js.map +1 -1
  254. package/dist/application/source-add-service.js +37 -0
  255. package/dist/application/source-add-service.js.map +1 -0
  256. package/dist/application/source-boundary-policy.js +97 -8
  257. package/dist/application/source-boundary-policy.js.map +1 -1
  258. package/dist/application/source-pipeline.js +68 -0
  259. package/dist/application/source-pipeline.js.map +1 -0
  260. package/dist/application/source-remove-service.js +15 -3
  261. package/dist/application/source-remove-service.js.map +1 -1
  262. package/dist/application/sources-service.js +71 -16
  263. package/dist/application/sources-service.js.map +1 -1
  264. package/dist/application/status-service.js +55 -5
  265. package/dist/application/status-service.js.map +1 -1
  266. package/dist/application/unit-dependencies.js +100 -0
  267. package/dist/application/unit-dependencies.js.map +1 -0
  268. package/dist/application/unit-membership.js +37 -0
  269. package/dist/application/unit-membership.js.map +1 -0
  270. package/dist/application/unit-residue.js +72 -0
  271. package/dist/application/unit-residue.js.map +1 -0
  272. package/dist/application/visibility-doctor-service.js +66 -4
  273. package/dist/application/visibility-doctor-service.js.map +1 -1
  274. package/dist/application/working-branch-service.js +6 -0
  275. package/dist/application/working-branch-service.js.map +1 -1
  276. package/dist/application/workline-graph.js +1 -1
  277. package/dist/application/workline-graph.js.map +1 -1
  278. package/dist/application/workline-index-service.js +118 -17
  279. package/dist/application/workline-index-service.js.map +1 -1
  280. package/dist/application/workspace-commit-service.js +218 -0
  281. package/dist/application/workspace-commit-service.js.map +1 -0
  282. package/dist/application/workspace-init-service.js +64 -34
  283. package/dist/application/workspace-init-service.js.map +1 -1
  284. package/dist/application/workspace-local-config.js +90 -0
  285. package/dist/application/workspace-local-config.js.map +1 -0
  286. package/dist/application/workspace-materialization-service.js +52 -3
  287. package/dist/application/workspace-materialization-service.js.map +1 -1
  288. package/dist/application/workspace-migrate/apply.js +525 -4
  289. package/dist/application/workspace-migrate/apply.js.map +1 -1
  290. package/dist/application/workspace-migrate/markers.js +9 -6
  291. package/dist/application/workspace-migrate/markers.js.map +1 -1
  292. package/dist/application/workspace-migrate/plan.js +97 -5
  293. package/dist/application/workspace-migrate/plan.js.map +1 -1
  294. package/dist/application/workspace-move-service.js +270 -0
  295. package/dist/application/workspace-move-service.js.map +1 -0
  296. package/dist/application/workspace-untrack-service.js +28 -0
  297. package/dist/application/workspace-untrack-service.js.map +1 -0
  298. package/dist/application/worktree-service.js +654 -105
  299. package/dist/application/worktree-service.js.map +1 -1
  300. package/dist/cli/ascii.js +2 -0
  301. package/dist/cli/ascii.js.map +1 -1
  302. package/dist/cli/commands/add-source.js +38 -0
  303. package/dist/cli/commands/add-source.js.map +1 -0
  304. package/dist/cli/commands/amend.js +14 -3
  305. package/dist/cli/commands/amend.js.map +1 -1
  306. package/dist/cli/commands/capability.js +11 -0
  307. package/dist/cli/commands/capability.js.map +1 -1
  308. package/dist/cli/commands/designs.js +14 -5
  309. package/dist/cli/commands/designs.js.map +1 -1
  310. package/dist/cli/commands/dev-only.js +19 -6
  311. package/dist/cli/commands/dev-only.js.map +1 -1
  312. package/dist/cli/commands/doc-branch.js +184 -0
  313. package/dist/cli/commands/doc-branch.js.map +1 -0
  314. package/dist/cli/commands/doctor.js +5 -1
  315. package/dist/cli/commands/doctor.js.map +1 -1
  316. package/dist/cli/commands/export.js +78 -18
  317. package/dist/cli/commands/export.js.map +1 -1
  318. package/dist/cli/commands/fix-git.js +89 -14
  319. package/dist/cli/commands/fix-git.js.map +1 -1
  320. package/dist/cli/commands/flow.js +120 -15
  321. package/dist/cli/commands/flow.js.map +1 -1
  322. package/dist/cli/commands/generate-launch.js +14 -2
  323. package/dist/cli/commands/generate-launch.js.map +1 -1
  324. package/dist/cli/commands/history-update.js +1 -1
  325. package/dist/cli/commands/history-update.js.map +1 -1
  326. package/dist/cli/commands/history.js +14 -0
  327. package/dist/cli/commands/history.js.map +1 -0
  328. package/dist/cli/commands/hook.js +15 -2
  329. package/dist/cli/commands/hook.js.map +1 -1
  330. package/dist/cli/commands/index.js +18 -1
  331. package/dist/cli/commands/index.js.map +1 -1
  332. package/dist/cli/commands/merge-state.js +2 -2
  333. package/dist/cli/commands/merge-state.js.map +1 -1
  334. package/dist/cli/commands/persist.js +6 -5
  335. package/dist/cli/commands/persist.js.map +1 -1
  336. package/dist/cli/commands/project-md-upsert.js +5 -3
  337. package/dist/cli/commands/project-md-upsert.js.map +1 -1
  338. package/dist/cli/commands/release-pass.js +3 -3
  339. package/dist/cli/commands/release-pass.js.map +1 -1
  340. package/dist/cli/commands/resume.js +12 -3
  341. package/dist/cli/commands/resume.js.map +1 -1
  342. package/dist/cli/commands/self.js +7 -2
  343. package/dist/cli/commands/self.js.map +1 -1
  344. package/dist/cli/commands/session-close.js +64 -9
  345. package/dist/cli/commands/session-close.js.map +1 -1
  346. package/dist/cli/commands/session-create.js +4 -2
  347. package/dist/cli/commands/session-create.js.map +1 -1
  348. package/dist/cli/commands/session-pause.js +14 -0
  349. package/dist/cli/commands/session-pause.js.map +1 -0
  350. package/dist/cli/commands/sessions.js +16 -3
  351. package/dist/cli/commands/sessions.js.map +1 -1
  352. package/dist/cli/commands/set-branch.js +28 -4
  353. package/dist/cli/commands/set-branch.js.map +1 -1
  354. package/dist/cli/commands/set-edit-mode.js +20 -0
  355. package/dist/cli/commands/set-edit-mode.js.map +1 -0
  356. package/dist/cli/commands/set-pipeline.js +35 -0
  357. package/dist/cli/commands/set-pipeline.js.map +1 -0
  358. package/dist/cli/commands/sources.js +4 -0
  359. package/dist/cli/commands/sources.js.map +1 -1
  360. package/dist/cli/commands/status.js +35 -2
  361. package/dist/cli/commands/status.js.map +1 -1
  362. package/dist/cli/commands/unknown-flags.js +1 -0
  363. package/dist/cli/commands/unknown-flags.js.map +1 -1
  364. package/dist/cli/commands/visibility.js +1 -0
  365. package/dist/cli/commands/visibility.js.map +1 -1
  366. package/dist/cli/commands/workspace-commit.js +62 -0
  367. package/dist/cli/commands/workspace-commit.js.map +1 -0
  368. package/dist/cli/commands/workspace-init.js +39 -2
  369. package/dist/cli/commands/workspace-init.js.map +1 -1
  370. package/dist/cli/commands/workspace-migrate.js +31 -3
  371. package/dist/cli/commands/workspace-migrate.js.map +1 -1
  372. package/dist/cli/commands/workspace-move.js +42 -0
  373. package/dist/cli/commands/workspace-move.js.map +1 -0
  374. package/dist/cli/commands/worktree.js +4 -4
  375. package/dist/cli/commands/worktree.js.map +1 -1
  376. package/dist/cli/context-id.js +6 -0
  377. package/dist/cli/context-id.js.map +1 -1
  378. package/dist/cli/full-cli.js +555 -0
  379. package/dist/cli/full-cli.js.map +1 -0
  380. package/dist/cli/help-groups.js +75 -16
  381. package/dist/cli/help-groups.js.map +1 -1
  382. package/dist/cli/hook-stdin-cache.js +12 -0
  383. package/dist/cli/hook-stdin-cache.js.map +1 -0
  384. package/dist/cli/main.js +47 -453
  385. package/dist/cli/main.js.map +1 -1
  386. package/dist/cli/parser.js +4 -0
  387. package/dist/cli/parser.js.map +1 -1
  388. package/dist/cli/tui/app.js +1 -1
  389. package/dist/cli/tui/app.js.map +1 -1
  390. package/dist/cli/tui/components/workspace-init-form.js +4 -1
  391. package/dist/cli/tui/components/workspace-init-form.js.map +1 -1
  392. package/dist/cli/tui/data/recommended-skills.js +2 -2
  393. package/dist/cli/tui/data/recommended-skills.js.map +1 -1
  394. package/dist/cli/tui/data/workflow-content.js +6 -1
  395. package/dist/cli/tui/data/workflow-content.js.map +1 -1
  396. package/dist/cli/tui/tabs/mcp-tab.js +4 -3
  397. package/dist/cli/tui/tabs/mcp-tab.js.map +1 -1
  398. package/dist/cli/tui/tabs/project-tab.js +7 -2
  399. package/dist/cli/tui/tabs/project-tab.js.map +1 -1
  400. package/dist/dist-manifest.json +4117 -0
  401. package/dist/domain/capability/protocol.js.map +1 -1
  402. package/dist/domain/decision-note.js +13 -0
  403. package/dist/domain/decision-note.js.map +1 -1
  404. package/dist/domain/design/artifact.js +22 -3
  405. package/dist/domain/design/artifact.js.map +1 -1
  406. package/dist/domain/design/capability.js +1 -0
  407. package/dist/domain/design/capability.js.map +1 -1
  408. package/dist/domain/design/expansion.js +1 -1
  409. package/dist/domain/design/expansion.js.map +1 -1
  410. package/dist/domain/design/maturity.js +16 -0
  411. package/dist/domain/design/maturity.js.map +1 -1
  412. package/dist/domain/design/reference.js +5 -0
  413. package/dist/domain/design/reference.js.map +1 -1
  414. package/dist/domain/doctor/operations.js +28 -2
  415. package/dist/domain/doctor/operations.js.map +1 -1
  416. package/dist/domain/effective-contract.js +3 -1
  417. package/dist/domain/effective-contract.js.map +1 -1
  418. package/dist/domain/elicitation.js +1 -1
  419. package/dist/domain/flow/answer.js +265 -130
  420. package/dist/domain/flow/answer.js.map +1 -1
  421. package/dist/domain/flow/authority.js +193 -34
  422. package/dist/domain/flow/authority.js.map +1 -1
  423. package/dist/domain/flow/batch-review.js +65 -0
  424. package/dist/domain/flow/batch-review.js.map +1 -0
  425. package/dist/domain/flow/decision-schema.js +47 -0
  426. package/dist/domain/flow/decision-schema.js.map +1 -0
  427. package/dist/domain/flow/directive.js +16 -0
  428. package/dist/domain/flow/directive.js.map +1 -1
  429. package/dist/domain/flow/execution-result.js +91 -2
  430. package/dist/domain/flow/execution-result.js.map +1 -1
  431. package/dist/domain/flow/run-state.js +352 -24
  432. package/dist/domain/flow/run-state.js.map +1 -1
  433. package/dist/domain/flow/test-run-evidence.js +285 -0
  434. package/dist/domain/flow/test-run-evidence.js.map +1 -0
  435. package/dist/domain/flow/unchanged-phase.js +15 -0
  436. package/dist/domain/flow/unchanged-phase.js.map +1 -0
  437. package/dist/domain/harnesses.js +14 -5
  438. package/dist/domain/harnesses.js.map +1 -1
  439. package/dist/domain/isolation-unit.js +2 -2
  440. package/dist/domain/isolation-unit.js.map +1 -1
  441. package/dist/domain/lineage.js +7 -2
  442. package/dist/domain/lineage.js.map +1 -1
  443. package/dist/domain/obligation-correspondence.js +4 -2
  444. package/dist/domain/obligation-correspondence.js.map +1 -1
  445. package/dist/domain/plan-handoff.js +5 -0
  446. package/dist/domain/plan-handoff.js.map +1 -0
  447. package/dist/domain/proposal.js +18 -7
  448. package/dist/domain/proposal.js.map +1 -1
  449. package/dist/domain/reservation.js +5 -3
  450. package/dist/domain/reservation.js.map +1 -1
  451. package/dist/domain/retirement/proposal.js +1 -0
  452. package/dist/domain/retirement/proposal.js.map +1 -1
  453. package/dist/domain/session/custody.js +10 -6
  454. package/dist/domain/session/custody.js.map +1 -1
  455. package/dist/domain/session/narrative.js +4 -1
  456. package/dist/domain/session/narrative.js.map +1 -1
  457. package/dist/domain/skills.js +2 -0
  458. package/dist/domain/skills.js.map +1 -1
  459. package/dist/domain/sql-lexer.js +1 -1
  460. package/dist/domain/sql-lexer.js.map +1 -1
  461. package/dist/runtime/namespace-resolver.js +4 -0
  462. package/dist/runtime/namespace-resolver.js.map +1 -1
  463. package/dist/runtime/workline-marker.js +35 -8
  464. package/dist/runtime/workline-marker.js.map +1 -1
  465. package/dist/runtime/workspace-resolution.js +123 -0
  466. package/dist/runtime/workspace-resolution.js.map +1 -0
  467. package/package.json +5 -4
  468. package/skills/w/SKILL.md +3 -1
  469. package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +1 -1
  470. package/skills/w/artifacts/artifacts-core/SCRIPTS.rollback.sql +8 -0
  471. package/skills/w/artifacts/artifacts-core/SCRIPTS.sql +4 -8
  472. package/skills/w/commands/export-diagrams.md +3 -3
  473. package/skills/w/commands/export-manuals.md +6 -6
  474. package/skills/w/commands/export-reports.md +3 -3
  475. package/skills/w/commands/export-scripts.md +5 -5
  476. package/skills/w/commands/fix-git.md +12 -13
  477. package/skills/w/commands/persist.md +2 -2
  478. package/skills/w/commands/plan-exec.md +4 -2
  479. package/skills/w/commands/spec-new.md +1 -1
  480. package/skills/w/commands/workspace-init.md +2 -0
  481. package/skills/w/context/MANIFEST.json +1 -1
  482. package/skills/w/exports/export-diagrams/EXPORT.md +3 -3
  483. package/skills/w/exports/export-manuals/EXPORT.md +14 -16
  484. package/skills/w/exports/export-reports/EXPORT.md +3 -3
  485. package/skills/w/exports/export-scripts/EXPORT.md +45 -21
  486. package/skills/w/harness/HARNESS.md +2 -2
  487. package/skills/w/hooks/hooks.template.json +6 -4
  488. package/skills/w/loops/CHASSIS.md +11 -5
  489. package/skills/w/loops/CODE-POLICIES.md +7 -4
  490. package/skills/w/loops/plan-exec-loop/LOOP.md +23 -22
  491. package/skills/w/loops/plan-new-loop/LOOP.md +23 -31
  492. package/skills/w/loops/plan-refine-loop/LOOP.md +8 -2
  493. package/skills/w/loops/quick-loop/LOOP.md +6 -5
  494. package/skills/w/modules/DESIGN-REFERENCES.md +9 -11
  495. package/skills/w/modules/PLAN-EXECUTION-BATCHES.md +4 -4
  496. package/skills/w/modules/SESSION-NUMBERING.md +2 -0
  497. package/skills/w/roles/design/CONTRACT.md +6 -4
  498. package/skills/w/roles/design/ROLE.md +4 -2
  499. package/skills/w/roles/git/ROLE.md +16 -9
  500. package/skills/w/roles/research/ROLE.md +1 -1
  501. package/skills/w/roles/sql/ROLE.md +16 -14
  502. package/skills/w/schemas/design/ui-screen.v1.schema.json +9 -0
@@ -62,7 +62,7 @@
62
62
  "plan.escalation-adopted": "this refine consumed the escalation package an execution handed over, instead of re-deriving its diagnosis",
63
63
  "plan.escalation-absent": "no escalation package reached this refine, so it starts from the document alone",
64
64
  "chassis.context-pressure": "a fresh reader would need the CHECKPOINT to continue this run",
65
- "quick.db-touched": "the task read from or wrote to a database, so there is a statement to derive into the session script"
65
+ "quick.db-touched": "the task mutates a database; derive its DDL or DML into the session script"
66
66
  },
67
67
  "commands": {
68
68
  "doctor": {
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: export-diagrams
3
- description: "Generates the workspace's architecture and flow diagrams in `docs/diagrams/` consolidating the sources' code + the plan-doc (the AS-IS → TO-BE delta in `## Solution`, `Impacted`) of N sessions. Produces context, containers, components, integrations and data model (when read-only MCP is available). Default `mermaid` (renders on GitHub, `mermaid.ink` link for preview); `c4`/structurizr opt-in via `--engine`. Output in `docs/diagrams/NNN-export-diagrams-YYYY-MM-DD/` (or `.md`). Read-only/report: emits only the diagram source (the reader renders it); never commits nor mutates anything; MCP reads only. Composes the `diagrams` capability. Use for 'system diagram', 'workspace C4', 'architecture/flow map'. User-invoked via `/w:export-diagrams`."
3
+ description: "Generates architecture and flow diagram source in `docs/diagrams/`, consolidating code and plan context from N sessions. The CLI proposes an optional exact-path commit after publication and executes it only with approval; MCP reads only. Composes `diagrams`. User-invoked via `/w:export-diagrams`."
4
4
  ---
5
5
 
6
6
  # export-diagrams — architecture and flow diagrams from code + plan-doc
7
7
 
8
- Generates a diagram dossier (**architecture and flows**) of the workspace, aggregating the sources' structure and the sessions' delta. **Read-only / report** — it emits only the diagram **source** (Mermaid / DSL); the reader renders it. It never commits, never mutates anything; MCP reads only.
8
+ Generates a diagram dossier (**architecture and flows**) of the workspace, aggregating the sources' structure and the sessions' delta. It emits only diagram **source** (Mermaid / DSL); the reader renders it. The CLI offers an optional approved commit after publication; MCP reads only.
9
9
 
10
10
  > `export-*` family (the only artifact→`docs/` path). Design: `docs/referencias/workflow-exports/export-diagrams.md`.
11
11
 
@@ -102,7 +102,7 @@ Per `--engine`: `mermaid` → native Mermaid C4 blocks (`C4Context`/`C4Container
102
102
 
103
103
  ### Step 6 — Write or report
104
104
 
105
- With `--dry-run`: print the report; write nothing. Otherwise: `aw next-number docs/diagrams` + write the dossier. **NEVER commit**. Summary to the user: engine, present/omitted sections (e.g. Data omitted without MCP) and the path.
105
+ With `--dry-run`: print the report; write nothing. Otherwise: `aw next-number docs/diagrams` + write the dossier. The CLI proposes `aw workspace-commit prepare --export <ruta>` after publication; `apply --approval <digest>` commits only approved paths, never pushes. Summary to the user: engine, present/omitted sections (e.g. Data omitted without MCP) and the path.
106
106
 
107
107
  ## Output location
108
108
 
@@ -1,21 +1,21 @@
1
1
  ---
2
2
  name: export-manuals
3
- description: "Operations / onboarding manuals (operator/support audience). Synthesizes the workspace's technical manuals into `docs/manuals/` consolidating N sessions (`exec`/`quick`) + `docs/`. Reads each session's `DECISION` and the plan-doc (`Solution` — including its Final behavior block —, `Validations`) + the touched code in the sources (how what was built operates/works). Two modes: `complement` (default, overwrites `INDEX.md` pointing at the detected manuals) and `regenerate` (produces a `NNN-export-manuals-YYYY-MM-DD/` dossier with 1 manual per topic). Audience: operators / support / onboarding. Read-only/report: it never commits nor mutates sessions. The prose follows the ambient writing conventions (the host auto-applies an installed writing skill when present). Use for 'operations manual', 'how what we shipped works', 'technical onboarding pack', 'manuals index'. User-invoked via `/w:export-manuals`."
3
+ description: "Operations/onboarding manuals from N sessions into `docs/manuals/` or `[docs] manuals`. The CLI previews replacement, publishes on approval and offers a separate exact-path commit, executed only with approval; sessions remain untouched. User-invoked via `/w:export-manuals`."
4
4
  ---
5
5
 
6
6
  # export-manuals — technical manuals from sessions + `docs/`
7
7
 
8
- Generates or refreshes **operations / how-it-works / onboarding** manuals in `docs/manuals/`, consolidating what N sessions delivered + the `docs/` corpus. **Read-only / report** — it never commits, never mutates sessions or code.
8
+ Generates or refreshes **operations / how-it-works / onboarding** manuals in `docs/manuals/`, consolidating what N sessions delivered + the `docs/` corpus. It never mutates sessions or code; the CLI separately proposes a commit after publication.
9
9
 
10
10
  > `export-*` family (the only artifact→`docs/` path). Design: `docs/referencias/workflow-exports/export-manuals.md`.
11
11
 
12
12
  ## Category
13
13
 
14
- `docs/manuals` — the **only** `docs/` folder this export writes.
14
+ `docs/manuals` or its `[docs] manuals` override — the **only** `docs/` folder this export writes.
15
15
 
16
16
  ## Writing (ambient convention, not a role)
17
17
 
18
- The manual's prose follows the **ambient** writing conventions: the host auto-applies an installed writing skill (when present) by its `description` — short sentences, lists over prose, no filler, technical lexicon for the operator/support audience. This export does **not** compose or bind a `writing` role; it is **indifferent** to which writing skill exists. A useful family lives in the `dev-conventions` marketplace plugin, but the export does **not depend** on it. Manuals are user-facing deliverables → write them in the user's language.
18
+ The manual's prose follows **ambient** writing conventions when the host has one installed — short sentences, lists over prose, no filler, technical lexicon for operators and support. This export does not bind a writing role and works without any installed convention. Manuals are user-facing → write them in the user's language.
19
19
 
20
20
  ## When to use
21
21
 
@@ -29,9 +29,9 @@ The manual's prose follows the **ambient** writing conventions: the host auto-ap
29
29
  1. Reads the session corpus (`exec`/`quick`): per session, `DECISION` + the plan-doc (`Solution` — including its Final behavior block; legacy plans: a separate `## Final behavior` section —, `Validations`).
30
30
  2. Inspects the touched code in the sources (how what was built operates/works) — read-only.
31
31
  3. Detects topics (declared in `SESSION` — its `## Objective` —, or inferred by operational keywords).
32
- 4. Resolves the mode (`complement` or `regenerate`).
32
+ 4. Infers mode from the response (`complement`, flat or `regenerate`).
33
33
  5. Synthesizes the content applying the ambient writing conventions (host).
34
- 6. Writes: `complement` → overwrites `docs/manuals/INDEX.md`; `regenerate` → a `docs/manuals/NNN-export-manuals-YYYY-MM-DD/` dossier with 1 manual per topic.
34
+ 6. Publishes: index only → `INDEX.md`; direct `<slug>.md` → flat canon; dossier → numbered pack. Existing files require `--overwrite`.
35
35
 
36
36
  ## What it does NOT do
37
37
 
@@ -44,7 +44,7 @@ The manual's prose follows the **ambient** writing conventions: the host auto-ap
44
44
 
45
45
  ## Read-only sandbox
46
46
 
47
- In plan mode it **describes**, never writes: the resolved mode, the detected topics (with origin sessions), the manuals already present in `docs/manuals/`, and — per mode — the `INDEX.md` structure it would overwrite or the count of manuals the dossier would generate. It does **not** run `Write`; numbering queries use `aw next-number --dry-run` (pure).
47
+ In plan mode it **describes**, never writes: the inferred mode, topics and destination. It does **not** run `Write`; numbering queries use `aw next-number --dry-run` (pure).
48
48
 
49
49
  ## Inputs
50
50
 
@@ -64,7 +64,6 @@ In plan mode it **describes**, never writes: the resolved mode, the detected top
64
64
 
65
65
  ```
66
66
  /w:export-manuals [--sessions NNN[,NNN]] [--since sessionNNN] [--source <alias>]
67
- [--mode complement|regenerate] [--topics slug1,slug2] [--dry-run]
68
67
  ```
69
68
 
70
69
  | Flag | Behavior |
@@ -72,17 +71,15 @@ In plan mode it **describes**, never writes: the resolved mode, the detected top
72
71
  | `--sessions NNN[,NNN]` | Discrete filter by code (takes precedence over `--since`) |
73
72
  | `--since sessionNNN` | Only sessions after NNN (exclusive: NNN itself is out; use `--sessions` to include it) |
74
73
  | `--source <alias>` | Limits to one source (multi-source workspace) |
75
- | `--mode complement\|regenerate` | Default `complement` |
76
- | `--topics slug1,slug2` | Limits to the declared topics |
77
- | `--dry-run` | Propositional report, no files written |
78
74
 
79
- No args: `--mode complement` over the whole corpus.
75
+ No args: the response determines the mode over the whole corpus.
80
76
 
81
- ### `--mode` resolution
77
+ ### Response shape determines the mode
82
78
 
83
79
  | Mode | Output | When to use |
84
80
  |---|---|---|
85
81
  | `complement` (default) | `docs/manuals/INDEX.md` (overwrites) | Refresh the index after new sessions/manuals |
82
+ | Flat canon | Direct `docs/manuals/<slug>.md` files | One manual per topic without a dossier; replacements need `--overwrite` |
86
83
  | `regenerate` | `docs/manuals/NNN-export-manuals-YYYY-MM-DD/` (next-number) | Consolidated manual pack (e.g. onboarding) |
87
84
 
88
85
  ## Flow
@@ -97,7 +94,7 @@ List `docs/manuals/*.md` (excluding `INDEX.md` and `NNN-export-manuals-*/` subdi
97
94
 
98
95
  ### Step 3 — Detect topics
99
96
 
100
- For every filtered corpus session (`aw session-artifacts --code <NNN> --dump objetivo,decisiones`): take the dump's `DECISION` + the plan-doc (`Solution` with its Final behavior block/`Validations`) + the touched code. **Primary** topic: the topic in `SESSION` (its `## Objective`). **Secondary**: inference by operational keywords ("configure", "install", "step by step", "how to …" — in the user's language). Filter by `--topics` when present. List (slug, confidence, origin sessions).
97
+ For every filtered corpus session (`aw session-artifacts --code <NNN> --dump objetivo,decisiones`): take the dump's `DECISION` + the plan-doc (`Solution` with its Final behavior block/`Validations`) + the touched code. **Primary** topic: the topic in `SESSION` (its `## Objective`). **Secondary**: inference by operational keywords ("configure", "install", "step by step", "how to …" — in the user's language). List (slug, confidence, origin sessions).
101
98
 
102
99
  ### Step 4 — Synthesize (prose: ambient conventions)
103
100
 
@@ -107,11 +104,12 @@ For every filtered corpus session (`aw session-artifacts --code <NNN> --dump obj
107
104
 
108
105
  ### Step 5 — Write or report
109
106
 
110
- With `--dry-run`: print the report; write nothing. Otherwise: `complement` → `Write` over `docs/manuals/INDEX.md`; `regenerate` → `aw next-number docs/manuals` + create the dossier. **NEVER commit**. Summary to the user: mode + written paths + counts; if there are detectable topics without a manual, suggest covering them.
107
+ Publish via `aw export-manuals` prepare → validate → apply: index-only response → `complement`; dossier → `regenerate`. The CLI then proposes `aw workspace-commit prepare --export <ruta>`; only approval of the pathspec and message allows `apply --approval <digest>`, never push. Summarize mode and written paths.
111
108
 
112
109
  ## Output location
113
110
 
114
- - `complement`: `docs/manuals/INDEX.md` (overwrites).
111
+ - `complement`: `docs/manuals/INDEX.md` (overwrites if already present).
112
+ - Flat: `docs/manuals/<slug>.md` (each existing file requires `--overwrite`).
115
113
  - `regenerate`: `docs/manuals/NNN-export-manuals-YYYY-MM-DD/` with `README.md` + 1 `.md` per topic.
116
114
 
117
115
  ## Re-run
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: export-reports
3
- description: "Executive/functional report (management/committee audience) consolidating N workspace sessions under `docs/reports/NNN-<slug>-YYYY-MM-DD.md`. Reads the corpus: the spec (`docs/specs`), `CONCLUSIONS` (research), `DECISION`, the plan-doc state + the rest of `docs/` for context. Synthesizes: what was done, key decisions, results/conclusions, pending/roadmap — with cross-session recommendation dedup. Audience adjustable via `--audience` (gerencia ≈ short; tecnica ≈ detailed). Read-only/report: it never commits nor mutates sessions. The prose follows the ambient writing conventions (the host auto-applies an installed writing skill when present). Use for 'executive report', 'what got done this quarter for management', 'brief with consolidated recommendations'. User-invoked via `/w:export-reports`."
3
+ description: "Executive/functional report consolidating N workspace sessions under `docs/reports/`. Publishes only the report and proposes an exact-path workspace commit, executed by the CLI only with approval. The prose follows ambient writing conventions. User-invoked via `/w:export-reports`."
4
4
  ---
5
5
 
6
6
  # export-reports — executive/functional report from the session corpus + `docs/`
7
7
 
8
- Generates a single `.md` consolidating N workspace sessions into an **executive/functional** report: what was done, key decisions, results/conclusions and pending/roadmap. **Read-only / report** — it never commits, never mutates sessions or the corpus.
8
+ Generates a single `.md` consolidating N workspace sessions into an **executive/functional** report: what was done, key decisions, results/conclusions and pending/roadmap. It does not mutate sessions or the source corpus; after publication the CLI proposes an optional approved commit.
9
9
 
10
10
  > `export-*` family (the only artifact→`docs/` path). It **merges** two legacy exports into one `docs/reports` output: the executive report and the cross-session recommendation dedup. Design: `docs/referencias/workflow-exports/export-reports.md`.
11
11
 
@@ -95,7 +95,7 @@ Render applying the ambient writing conventions (host): Executive summary · Wha
95
95
 
96
96
  ### Step 5 — Write or report
97
97
 
98
- `aw next-number docs/reports` → `docs/reports/NNN-<slug>-YYYY-MM-DD.md`. With `--dry-run`: print; write nothing. **NEVER commit**. Summary to the user: path, audience/length, covered sessions (count + range), consolidated R-items, and a note if a conditional section was omitted.
98
+ `aw next-number docs/reports` → `docs/reports/NNN-<slug>-YYYY-MM-DD.md`. With `--dry-run`: print; write nothing. After publication the CLI proposes `aw workspace-commit prepare --export <ruta>`; only an explicit approval runs `apply --approval <digest>` with exact paths and no push. Summary to the user: path, audience/length, covered sessions (count + range), consolidated R-items, and a note if a conditional section was omitted.
99
99
 
100
100
  ## Output location
101
101
 
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: export-scripts
3
- description: "Consolidates pending SQL into one `docs/scripts/NNN-export-scripts-YYYY-MM-DD/` bundle with continuous numbering after `00-ROLLBACK.sql`. It publishes the net final state, not a chronological transcript. Its origin is DECLARED: a base (the session corpus, the published bundles, or a sweep of the whole workspace), minus the pieces named in `--exclude`, minus whatever the release book says already ran in `--environment`. Read-only/report: it NEVER executes SQL nor commits; external application is a handoff. Composes the `sql` capability. User-invoked via `/w:export-scripts`."
3
+ description: "Consolidates pending SQL into a numbered `docs/scripts/` bundle: five forward categories and paired rollbacks. Publishes the net final state; never executes SQL. After publication the CLI offers a commit of explicit paths, only with approval. Composes `sql`. User-invoked via `/w:export-scripts`."
4
4
  ---
5
5
 
6
6
  # export-scripts — consolidated SQL bundle, simple and direct
7
7
 
8
- Consolidates pending SQL migrations into a single bundle under `docs/scripts/NNN-export-scripts-YYYY-MM-DD/`, with continuous numbering after `00-ROLLBACK.sql`. **Read-only / report** — the AI **never executes** the SQL; external application is an optional handoff.
8
+ Consolidates pending SQL into `docs/scripts/NNN-export-scripts-YYYY-MM-DD/`, with category folders and rollback files under `rollback/`. The AI **never executes** SQL; application is a handoff.
9
9
 
10
10
  **The material is declared, not assumed:** a base brings it, `--exclude` subtracts pieces and `--environment` what the book records as applied. With no flag: the session corpus, bundles out.
11
11
 
@@ -30,23 +30,23 @@ The **`sql`** capability (built-in default `sql`), resolved via `.workflow/skill
30
30
 
31
31
  ## Read-only sandbox
32
32
 
33
- In plan mode it **describes**, never writes: the resolved `NNN`, the declared origin with its exclusions, the categories with content and the files that would appear. No `Write`, no mutations; numbering uses `aw next-number --dry-run` (pure).
33
+ In plan mode do **not** call `prepare` (it reserves a folder): describe the origin, categories and tentative `NNN` from `aw next-number --dry-run docs/scripts`. No mutations.
34
34
 
35
35
  ## Inputs
36
36
 
37
37
  **`agent-workflow` CLI (alias `aw`)** — never read hardcoded paths:
38
38
 
39
39
  - `aw release-data [--since sessionNNN] [--source <alias>]` — the session corpus (ALL sessions, closed + active, with `release_eligible`). `aw sessions` lists only ACTIVE ones: never use it as the corpus.
40
- - `aw session-artifacts --code <NNN> --dump scripts` — the session's `.sql` files with path and size (content is read by path). No scripts → empty list, silent skip.
40
+ - `aw session-artifacts --code <NNN> --dump scripts` — session SQL including root `SCRIPTS.sql` and `SCRIPTS.rollback.sql`, with relative names, path and size. No SQL → not material.
41
41
  - `aw release-data --standalone-sql [--include-graduated]` — the loose `docs/scripts/*.sql` and the previous bundles. `prepare` already reads both through its base; these are for looking by hand.
42
- - `aw release-pass list` — the book `--environment` reads: `link --artifact <ruta>` says which bundle a pass carries, `applied --environment` that its SQL RAN there. Nothing inspects a database.
42
+ - `aw release-pass list` — `--environment` reads linked/applied bundles. `--catalog <connection>` optionally inspects the target catalog through Workline's read-only PostgreSQL connection; unreachable or missing objects block publication. Without it, no database connection opens.
43
43
  - `aw next-number docs/scripts` — deterministic numbering; it also creates `docs/scripts` when missing, which is what makes destination resolution a CLI guarantee. In plan mode, `--dry-run`.
44
44
 
45
45
  **Args** (no lifecycle *structured-choice*; harness capability — see [`../../harness/HARNESS.md`](../../harness/HARNESS.md)):
46
46
 
47
47
  ```
48
48
  /w:export-scripts [--from sessions|bundles|workspace] [--exclude <nombre>]… [--environment <ambiente>]
49
- [--sessions NNN[,NNN]] [--since sessionNNN] [--source <alias>]
49
+ [--sessions NNN[,NNN]] [--since sessionNNN] [--source <alias>] [--code <sesión>] [--catalog <conexión>]
50
50
  ```
51
51
 
52
52
  | Flag | Behavior |
@@ -57,6 +57,8 @@ In plan mode it **describes**, never writes: the resolved `NNN`, the declared or
57
57
  | `--sessions NNN[,NNN]` | Discrete filter by code (takes precedence over `--since`) |
58
58
  | `--since sessionNNN` | Only sessions after NNN (exclusive: NNN itself is out; use `--sessions` to include it) |
59
59
  | `--source <alias>` | Limits to one source (multi-source workspace) |
60
+ | `--catalog <connection>` | Optional read-only target catalog check, repeated on validate and apply |
61
+ | `--code <sesión>` | Owns the folder reservation; without it, the sealed operation owns it |
60
62
 
61
63
  No args: every corpus session, bundles and loose SQL out — the behavior that always was. The three composition flags are this export's alone.
62
64
 
@@ -66,11 +68,11 @@ No args: every corpus session, bundles and loose SQL out — the behavior that a
66
68
 
67
69
  `prepare` already resolved WHICH pieces are in: its inventory lists them per origin with every exclusion and its reason. Read only that.
68
70
 
69
- **Sessions**: for every session the inventory names (`aw session-artifacts --code <NNN> --dump scripts`), read the `.sql` files the dump lists (per-script path). Take **only** type-B statements (deliverable DDL/DML migrations); ignore read-only type-A (diagnostic queries). Expected per-statement markers: `-- @category: <01-04>` + `-- @stmt: NNN-verb-target` (format defined by the `sql` capability).
71
+ **Sessions**: read every `.sql` named by `aw session-artifacts --code <NNN> --dump scripts`, including root `SCRIPTS.sql` and `SCRIPTS.rollback.sql`. Take only type-B migrations; skip type-A research. Markers: `-- @category: <01-05>` and `-- @stmt: NNN-verb-target` (from the `sql` capability).
70
72
 
71
73
  **Loose SQL**: per file, honor `@category` markers when present; otherwise infer it from content (`CREATE/ALTER TABLE`, `CREATE INDEX` → `01`; `CREATE OR REPLACE FUNCTION`/`PROCEDURE` → `02`; `UPDATE`/`DELETE` → `03`; `INSERT INTO … VALUES` → `04`). If the filename contains `rollback` → skip (it never enters a forward).
72
74
 
73
- **Published bundles**: their forwards in numeric order, same markers. `00-ROLLBACK.sql` is **never** read as a forward — it is the bundle's reverse, not its material.
75
+ **Published bundles**: read forwards in category and filename order. Both `rollback/` and legacy flat rollbacks are **never** forwards.
74
76
 
75
77
  An empty origin → **abort**: `prepare` already refused, saying whether nothing matched or everything was already applied.
76
78
 
@@ -84,47 +86,69 @@ Reconcile every candidate the origin brought against the code and the declared f
84
86
  objects born and retired within the sequence; write migrated objects directly in their final form;
85
87
  omit explicitly retired objects even when their deletion is absent from the input.
86
88
 
89
+ | History in the corpus | Publish |
90
+ |---|---|
91
+ | Created, then dropped | Nothing: neither forward nor rollback |
92
+ | Created, then changed (type/rename) | One statement in final form |
93
+ | Created, untouched | The original statement |
94
+ | Retired by session context without an explicit `DROP` | Omit it |
95
+
96
+ **Synthesize, never invent:** folding `CREATE` + `ALTER` into a final `CREATE` is required;
97
+ adding a migration no session performed is forbidden. Session context outranks script chronology:
98
+ a retired object stays out even when no file dropped it. Check actual state **read-only** before
99
+ deciding what remains; reconcile code (including entity mappings and native queries) with it.
100
+ Do not promote one-off QA data repairs into release migrations.
101
+
102
+ **Corpus ≠ live source environment.** Hand edits may never appear in a script. As an
103
+ operational handoff after application, compare source and target object by object through
104
+ read-only inspections; before application the planned delta hides omissions. Portable
105
+ guards assert existence, not a source-specific row count. Compare routine definitions
106
+ from the live catalog, not the file that once created them: omit a replacement when live
107
+ bodies already agree. User-visible labels matter too; an older label can leave an object
108
+ present but unfindable. None of these remote observations is a local closure criterion.
109
+
87
110
  **A previous bundle in the origin is MATERIAL A RECONCILIAR, not untouchable history.** Two that
88
111
  contradict — one creating an object, a later one retiring it — publish the resulting net final state,
89
- never their chronological sum: the new bundle does not create it, and its `00-ROLLBACK.sql` does not
112
+ never their chronological sum: the new bundle does not create it, and its global rollback does not
90
113
  reverse a creation it never published. The bundles on disk are never modified.
91
114
 
92
- Then group the remaining statements by canonical category: `01 DDL-TABLES` · `02 DDL-FUNCTIONS` · `03 DML` ·
93
- `04 INSERTS`. Origin is traceability, not an ordering authority over the final contract.
115
+ Group the remaining statements: `01-ddl-tablas` · `02-ddl-funciones` · `03-migracion` · `04-inserts` · `05-grants`. Origin traces changes, never determines their order.
94
116
 
95
117
  ### Step 4 — Continuous numbering (no gaps)
96
118
 
97
- Assign sequential numbers **only to categories with content**, in canonical order. The first forward is always `01-…`. E.g.: DML only → `00-ROLLBACK.sql`, `01-DML.sql`; all 4 categories → `00-ROLLBACK.sql`, `01-DDL-TABLES.sql`, `02-DDL-FUNCTIONS.sql`, `03-DML.sql`, `04-INSERTS.sql`.
119
+ Keep the five fixed category numbers. Omit empty folders; within each populated folder, number files `01-<nombre>.sql`, `02-<nombre>.sql`, … with no gaps.
98
120
 
99
121
  ### Step 5 — Write the forwards
100
122
 
101
- Per category with content, one file with a 1-2 line header (`-- 0N-<CATEGORY>.sql — bundle NNN-export-scripts-YYYY-MM-DD`) and traceable origin comments where useful. Write SQL for the reconciled final state, not necessarily the original statement verbatim; preserve explicit intent, idempotency and safe transaction boundaries. Do not replicate motivation/impact already present at the origin; no statement index, no invented verification SELECTs.
123
+ Write each forward in its category folder with a concise header and useful origin. Reconcile to the net final state; keep idempotency, intent and transaction boundaries. Never invent verification SELECTs.
102
124
 
103
125
  ### Step 6 — Derive `00-ROLLBACK.sql` (at the end)
104
126
 
105
- Via the `sql` capability, **reading the already-written forwards** (not the original `SCRIPTS.sql`): inverse statements in reverse order (last→first), a single transactional block, and an "irreversible cleanup" block at the end outside the transaction only if there are operations without an automatic reverse.
127
+ For every forward `<categoría>/NN-<nombre>.sql`, write `rollback/<categoría>/NN-<nombre>.rollback.sql`. Derive `rollback/00-global/00-ROLLBACK.sql` from the consolidated final state, **in dependency-safe order**: drop referencing rows/tables before their FK targets; never reverse the session chronology or file order literally. Verify the real state only through read-only inspection; application is the user's handoff.
106
128
 
107
129
  ### Step 7 — Write the `README.md` (3 sections)
108
130
 
109
- `## Archivos` (table: 1 row per file present) · `## Aplicar` (one `psql -f` per file in ascending order; the export executes nothing) · `## Revertir` (`psql -f 00-ROLLBACK.sql` + a note if there is an irreversible block). The README is a user-facing deliverable → write it in the user's language. **Vetoed**: everything the section above forbids.
131
+ `## Archivos` (every file present) · `## Aplicar` (`psql -f` for each forward, category then filename order; `*/*.sql` or `0*/*.sql` reaches only forwards; `**/*.sql`, `find` and PowerShell `-Recurse` also reach rollbacks and MUST NOT be used to apply) · `## Revertir` (`rollback/00-global/00-ROLLBACK.sql`). Write it in the user's language.
110
132
 
111
133
  ### Step 8 — Write or report
112
134
 
113
- Publish through the three stages (`prepare` → `validate` → `apply --approval`); in plan mode, describe instead. **NEVER commit**. Summary: one line per file + the bundle path, naming the origin and what stayed out.
135
+ Publish through the three stages (`prepare` → `validate` → `apply --approval`); in plan mode, describe instead. Once published, the CLI proposes `aw workspace-commit prepare --export <ruta>` and executes `apply --approval <digest>` only with explicit approval, with exact paths and no push. Summary: one line per file + the bundle path, naming the origin and what stayed out.
114
136
 
115
137
  ## Output location
116
138
 
117
139
  ```
118
140
  docs/scripts/NNN-export-scripts-YYYY-MM-DD/
119
- ├── 00-ROLLBACK.sql # reverse derived from the forwards
120
- ├── 01-<CATEGORY>.sql # first forward (continuous numbering)
121
- ├── 02-<CATEGORY>.sql # …per category with content
122
- └── README.md # Archivos · Aplicar · Revertir
141
+ ├── README.md
142
+ ├── 01-ddl-tablas/01-<nombre>.sql
143
+ ├── 02-ddl-funciones/ · 03-migracion/ · 04-inserts/ · 05-grants/
144
+ └── rollback/
145
+ ├── 00-global/00-ROLLBACK.sql
146
+ └── <categoría>/NN-<nombre>.rollback.sql # one per forward
123
147
  ```
124
148
 
125
149
  ## Re-run
126
150
 
127
- Functionally idempotent: each invocation takes the next `NNN` and **never overwrites** a previous bundle. To regenerate, delete the directory by hand and re-invoke.
151
+ Each invocation publishes a new `NNN`: never delete or overwrite a published bundle. Corrections supersede the earlier bundle.
128
152
 
129
153
  ## Resources
130
154
 
@@ -74,7 +74,7 @@ coordination, without turning a deterministic CLI rule into model work.
74
74
 
75
75
  ## Harness binding matrix
76
76
 
77
- Concrete mechanism per harness (matrix base verified **Jul-2026**; the `structured-choice` row re-verified **2026-08-22**, the Codex `hooks` row **2026-08-05** and the crush/gemini/opencode `hooks` contract **2026-08-18**, all against the INSTALLED runtimes plus real runs — not docs; `~` partial). Antigravity CLI reuses Gemini's surfaces (`~/.gemini/`); Oz reuses Warp's (they share the **Warp / Oz** column, with MCP via flag — see the note under the matrix).
77
+ Concrete mechanism per harness (matrix base verified **Jul-2026**; `structured-choice` re-verified **2026-08-22**, Codex `hooks` **2026-08-05**, crush/gemini/opencode `hooks` **2026-08-18**; Codex `host-memory` **2026-09-27**; installed runtimes and real runs, `~` partial). Antigravity reuses Gemini's surfaces; Oz reuses Warp's (MCP via flag — see below).
78
78
 
79
79
  | Capability | Claude Code | Codex | Kimi Code | Gemini / Antigravity | OpenCode | Crush | Warp / Oz | Generic |
80
80
  |---|---|---|---|---|---|---|---|---|
@@ -84,7 +84,7 @@ Concrete mechanism per harness (matrix base verified **Jul-2026**; the `structur
84
84
  | compaction | `/compact` | Pre/PostCompact hooks | `/compact` + Pre/PostCompact hooks | ~ | `session.compacted` | ~ | ~ | CHECKPOINT + resume |
85
85
  | subagent-dispatch | `Task` (parallel) | `agents` | `SubagentStart` | agents (`.gemini/agents`) | `.opencode/agent/*.md` | inline | inline (Oz cloud orchestration is not a direct worker binding) | inline |
86
86
  | persistent-context | `CLAUDE.md` (does **not** read AGENTS.md → symlink) | `AGENTS.md` | `AGENTS.md` (hierarchical) | `GEMINI.md` + `AGENTS.md` | `AGENTS.md` | `CRUSH.md` + `AGENTS.md` | `AGENTS.md` (auto) | `AGENTS.md` |
87
- | **host-memory** | `MEMORY.md` (cheap) + transcripts/`--resume` (deep) | `AGENTS.md` (static → fallback) | sessions with resume/fork (`kimi -S`) + `AGENTS.md` | `GEMINI.md`+`AGENTS.md` (static → fallback) | `AGENTS.md` (static → fallback) | `CRUSH.md`+`AGENTS.md` (static → fallback) | rules / history (~) | git/`docs/` + ask |
87
+ | **host-memory** | `MEMORY.md` (cheap) + transcripts/`--resume` (deep) | `~/.codex/memories/` (config-enabled); `AGENTS.md` static fallback | sessions with resume/fork (`kimi -S`) + `AGENTS.md` | `GEMINI.md`+`AGENTS.md` (static → fallback) | `AGENTS.md` (static → fallback) | `CRUSH.md`+`AGENTS.md` (static → fallback) | rules / history (~) | git/`docs/` + ask |
88
88
  | **web-research** | `WebSearch` / `WebFetch` | `web_search` (opt-in config) | moonshot search + fetch services | `google_web_search` + `web_fetch` | `webfetch` (~) | ~ | ~ (agent web access) | — (offline + declare) |
89
89
  | external-data (MCP) | `.mcp.json` | `.codex/config.toml` `[mcp_servers]` | `~/.kimi-code/mcp.json` `mcpServers` (also reads project `.mcp.json`) | `settings.json` `mcpServers` | `opencode.json` `mcp` | `crush.json` `mcp` | `.warp/.mcp.json` (+auto-discovers `.mcp.json`) · Oz: `--mcp` flag | — |
90
90
  | **enforcement (deny tool)** | `PreToolUse` → `permissionDecision:deny` / exit 2 | `PreToolUse` (**≈same protocol**) | `PreToolUse` → block / exit 2 | `PreToolUse` in its `hooks.json` (Claude-shaped; `BeforeTool` **does not exist**) | plugin `tool.execute.before` (`throw`) | `PreToolUse` in `crush.json` → `hooks` (+ `allowed_tools` allowlist) | allow/deny lists (**coarse**) | doctrine (git-safe #5) |
@@ -1,5 +1,11 @@
1
1
  {
2
2
  "hooks": {
3
+ "UserPromptSubmit": [
4
+ {
5
+ "matcher": "",
6
+ "hooks": [{ "type": "command", "command": "agent-workflow hook turn-start", "timeout": 10 }]
7
+ }
8
+ ],
3
9
  "SessionStart": [
4
10
  {
5
11
  "matcher": "startup|resume|clear",
@@ -78,10 +84,6 @@
78
84
  "command": "agent-workflow resume-summary",
79
85
  "statusMessage": "Recuperando estado tras compact...",
80
86
  "timeout": 10
81
- },
82
- {
83
- "type": "prompt",
84
- "prompt": "Contexto compactado. El JSON anterior es output de `agent-workflow resume-summary`. Si `continuity` es `ok`, reanudá el loop de `primary_session` desde su CHECKPOINT.md y presentá un resumen. Si `continuity` es `degraded`, NO reanudes ninguna sesión: `active_sessions` es un listado, no una identidad — mostrá `candidates` con su `action` y pedí al usuario que elija (después reintentá con `--code <NNN>`). Si el JSON trae `refuge`, la compactación dejó un CHECKPOINT de refugio fuera de toda sesión: mostrá su `path` y avisá que se adopta al resolver la sesión (`aw checkpoint-write --code <NNN>`). Si no hay sesiones, terminá."
85
87
  }
86
88
  ]
87
89
  }
@@ -1,8 +1,14 @@
1
1
  # CHASSIS — the loop engine
2
2
 
3
- The **common engine** of the Workline loops: every loop reads it from its `## Inherits`, **always, before its deltas**. Edit the engine **here**; heirs only reference it.
3
+ The **common engine** of Workline loops: heirs read it before their deltas and only reference it.
4
4
 
5
- > **When each step below happens is no longer this document's call:** the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document. They consume no model worker, subagent or external process: the CLI advances them locally to the first real frontier. What stays is what each rule is FOR — the half no engine carries. Answering the frontier it stops at is `aw flow submit`, and its envelope — which fields each kind of frontier demands, and where each digest comes from — is **read** with `aw flow --help`, never guessed.
5
+ > **When:** the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document. `aw flow submit` answers the frontier. Read its envelope and digest from `aw flow --help`, never guess. Use `--adopt` for an existing run; `aw flow recover` restores a no-effect exhausted frontier, `aw flow restart` handles stuck runs, `aw flow annul` reopens miscredited batches, and `aw flow prove` binds evidence to the checkout.
6
+
7
+ ## Host execution rules
8
+
9
+ - Write JSON envelopes with the file tool, never heredoc or shell-built JSON; redirect the file to stdin.
10
+ - Use a CLI verb before editing the runtime; make one call per approvable effect.
11
+ - The user executes force-push; on Windows set `PYTHONUTF8=1` for Python consumers.
6
12
 
7
13
  ## Heirs (canonical list)
8
14
 
@@ -18,9 +24,9 @@ The two that edit code also apply [`CODE-POLICIES.md`](CODE-POLICIES.md).
18
24
 
19
25
  ## Persistent objective
20
26
 
21
- A loop **is a persistent objective**: it exists to fulfill the `SESSION.Objective` declared at start, and **it is not finished until the convergence gate confirms the objective was met**. Gap-driven iteration is the *method*; the artifacts are the *record*; the objective is the *frame*.
27
+ A loop fulfills `SESSION.Objective` until its convergence gate confirms it. Gaps are the method; artifacts the record.
22
28
 
23
- "Don't stop until convergence" is sustained by the loop itself — its `repeat:` plus the convergence gate — never by a host hook, which is what makes it harness-agnostic.
29
+ The loop's `repeat:` and gate sustain convergence, not a host hook.
24
30
 
25
31
  > **Inter-turn continuity.** The same `CHECKPOINT`+resume governs the **next prompt**: the objective persists **across turns**, not only within a run. Its canonical rules have their **single source** in [`../SKILL.md`](../SKILL.md) § *Operating context*; this engine executes them via *Compact / resume* (case 3).
26
32
 
@@ -125,7 +131,7 @@ Resume **keys off the `CHECKPOINT`** of the run's session, not the existence of
125
131
  ## Convergence / exit
126
132
 
127
133
  - **No material gaps** → **convergence gate** (read-only) = **`Success criteria` green** (*verification-first*). Whatever fails **comes back as a gap**; if it passes → the loop **flips the green criteria** in `SESSION.md` (`- [ ]` → `- [x]`) and offers its closing action. The checklist must reflect the real final state: a criterion left unchecked at `finalize` needs an explicit reason. Each heir names its own instance of this gate, and those instances are what realize it.
128
- - `Cerrar` (the `flow` control, at any time) → `finalize`, the last step of every journey. **`finalize` always persists `CHECKPOINT.md`** (resumable) and, **only if** something was deferred, writes `BACKLOG.md` (close reason + the deferred items); closes the session and reports. Progress survives even without a prior `Compactar`.
134
+ - Finish sources → approve exact workspace paths/message or skip → `finalize` persists CHECKPOINT, deferred BACKLOG if needed, archive and HISTORY; an approved commit runs last, never push. `Cerrar` at any time uses `finalize` and preserves progress.
129
135
 
130
136
  ## docs/ boundary — no auto-export (hard rule)
131
137
 
@@ -6,19 +6,22 @@ closing-review invariants.
6
6
 
7
7
  ## Safe git — verified branch + proposed commits
8
8
 
9
- Sources are edited on a **verified** branch (`aw check-branch`), and the unit's commits are
10
- **proposed**: exactly one commit per affected source — at effective-batch close in plan-exec, at task
11
- close in quick — never `push`/`--amend`/`--no-verify`, and never a destructive clean or a branch
9
+ Sources are edited on a **verified** branch (`aw check-branch`), and commits are
10
+ **proposed**: in plan-exec the CLI commits only the batch's approved paths once per source; in quick
11
+ the task closes with one proposed commit. Never `push`/`--amend`/`--no-verify`, a destructive clean or a branch
12
12
  switch without confirmation. A **rejected** commit leaves the changes in the tree and the unit
13
13
  recorded as uncommitted in `CHECKPOINT` and `BACKLOG`. Between units each working tree is clean or
14
14
  explicitly acknowledged; a `continuous` batch is the narrow exception that intentionally co-mingles
15
15
  its internal phases in one reviewed commit, and no batch may co-mingle with another.
16
16
 
17
- Concurrent flows never share a working tree: a run declares its sources and takes an **isolation
17
+ Concurrent flows declare sources. By default a run takes an **isolation
18
18
  unit** in each before writing — a worktree on its own branch
19
19
  (`aw worktree ensure | list | release`). An edit outside is
20
20
  blocked naming the command that gets one, and at close `aw worktree integrate` merges each into
21
21
  the source's work branch; a conflict is reported, routed to `aw fix-git --path`, never alone.
22
+ An in-place workspace declares `Modo de edición: in-place`; a plan may override it with `> Aislamiento: unidad`. In-place declares and approves only its own paths against the acquisition snapshot, without integration.
23
+
24
+ For frontend sources, install dependencies (`npm ci` if the lockfile changes) inside each acquired unit: `node_modules` belongs to that worktree, never to a sibling checkout.
22
25
 
23
26
  > **When the branch is verified, when a commit becomes available and what an approval covers is not this document's call:** the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document. Approving is the person's act and committing is a separate effect that comes back as the units' own git state — which is what makes "the checks passed" impossible to assert without having run them.
24
27
 
@@ -111,8 +111,11 @@ reconciliation** in `CHECKPOINT`, never reported as published.
111
111
 
112
112
  ## Delta 1 — One session per run; execution-unit cycle in the plan-doc
113
113
 
114
+ `aw flow advance --adopt` adopts an existing plan; `aw flow recover` restores exhausted no-effect frontiers, `aw flow restart` unsticks runs, `aw flow annul` reopens miscredited batches. `aw flow prove --source <alias>` supplies checkout-bound evidence to `aw flow submit` after validation.
115
+
114
116
  - Walk the plan's `### Fn` blocks under `## Tasks` in dependency order inside one session. Infer
115
117
  effective `continuous`/`isolated` batches first; legacy `## Phases` tables degrade the same way.
118
+ - In-place `branch-precondition`: clean on another branch → offer switch, change document branch or cancel; dirty on another branch → pause; expected branch with user changes → proceed. Switch only with consent; the hook guards edits and the commit fences HEAD/branch against acquisition.
116
119
  - **Execution-unit cycle:** seed one batch intent; implement all its phases in order; validate and
117
120
  review at unit close; then update states/`CHECKPOINT` and enter Git. An isolated unit contains
118
121
  one phase. A continuous unit follows `PLAN-EXECUTION-BATCHES`: no proof, runner, build, lint,
@@ -123,7 +126,7 @@ reconciliation** in `CHECKPOINT`, never reported as published.
123
126
  **Never** because all its checkboxes are ticked.
124
127
  - **Intermediate states:** `bloqueada` = the phase is stopped on a live checkout blocker — recorded in `CHECKPOINT` + the plan's `## Open questions`, back to `en ejecución` when it clears; it counts as **not validated**. A proof that cannot run **stays `bloqueada`**. A deferred check never counts as a passed one. A script awaiting real-world application is a **handoff**, not a blocker: local fixture/ephemeral validation can still establish the promised behavior and the phase may become `validada`.
125
128
  - **A blocker without a reason is not a blocker (hard rule).** Writing `> Estado: bloqueada` **always** writes its `> Bloqueo:` line in the same edit: a state that says "stopped" without saying on what is a dead end for whoever reads `aw status` next. The runtime tolerates a legacy block that states none (`blocker: null`) — this loop never produces one. `CHECKPOINT.Next` names **the action that unblocks it** in the checkout, never an operator's deployed run.
126
- - **Plan-doc residue (hard rule):** execution writes into the plan-doc **only** five things — checkbox flips (`- [ ]` → `- [x]`), the phase's own `> Estado:` line, its `> Bloqueo:` line while blocked, deferrals appended to its `## Open questions`, and the plan's own status mark (its `> Estado:` line and, on close, its `> Cierre:` line — Delta 6). The declared-gap hatch is Deltas 4, 5 and 7. Per-phase results, review-gate findings and metrics go to the session's `DECISION`/`CHECKPOINT` — **never** into the plan-doc. Phase blocks are updated **in place — NEVER append a duplicate `### Fn` block** (same contract as CHECKPOINT sections). The entry gate's consented normalization is the single exception, and it lands before execution starts.
129
+ - **Plan-doc residue (hard rule):** execution writes **only** checkbox flips (`- [ ]` → `- [x]`), phase `> Estado:` and `> Bloqueo:` while blocked, deferrals in `## Open questions`, and the plan's title-level `> Estado:`, `> Cierre:` and `> Assurance:` (CLI-sealed at close). Deltas 4, 5 and 7 permit declared gaps; consented normalization occurs before execution. Results, findings and metrics belong in session `DECISION`/`CHECKPOINT`, **never** the plan. Update phases **in place — NEVER append a duplicate `### Fn` block**.
127
130
  - **CHECKPOINT per execution unit:** record its effective grouping, functional states, simulation
128
131
  boundary when applicable, checks/results, decisions, deferrals and next intent. The task boxes
129
132
  and `en ejecución` marks preserve an intra-batch resume.
@@ -222,20 +225,22 @@ adds nothing of its own beyond running on a verified branch and never
222
225
  1. **phase proof** — component interaction, endpoint smoke test, vertical run down to the stub, persistence integration, or the main path end to end;
223
226
  2. **focused tests** — added when the layer carries its own rules, a relevant transformation, error handling, persistence, transactions, temporal logic or external integration;
224
227
  3. **risk tests** — security, concurrency, idempotency, retries, known regressions.
225
- - **One vertical proof per operation while wiring** (request → controller → use case → repository → fake or stub → expected response): it demonstrates the path once instead of re-asserting the same happy path at every layer. Trivial mappers, plain DTOs and framework behavior get no dedicated test.
228
+ - **One vertical proof per operation**; don't repeat happy paths or test trivial mappers/DTOs.
226
229
  - `isolated` remains compatible with literal TDD. A continuous batch may author evidence before
227
230
  code, but first runs it at batch close. No phase becomes `validada` before its exit is demonstrated.
228
231
  - **Continuous means all checks at batch close.** Do not run its phase proofs, focused/risk tests,
229
232
  build, typecheck, lint or review while implementing internal phases. At close run proofs in phase
230
233
  order, then the justified checks and cross-cutting validations. `isolated` runs the same stack for
231
234
  its single phase.
232
- - Each added test is re-weighed at the closing review gate ([`../CODE-POLICIES.md`](../CODE-POLICIES.md) § *Closing review gate* → *Test-value lens*, tag `overtest`): over-testing is a **finding to fix or justify**, never an automatic rejection.
233
- - Also run the plan's `## Validations` (cross-cutting rules and constraints) + the Final behavior block of `## Solution` (legacy plans: the `## Final behavior` section). **What execution runs is the PLAN's evidence, never the spec's prose:** `plan-new` already derived those validations from the spec's acceptance criteria and its `## Scenarios`, so the spec is confirmed functionally **through** them. A criterion no validation covers is a gap of the plan, not a test to improvise here.
235
+ - Review each test's value at close (`CODE-POLICIES.md`, `overtest`); over-testing is a finding to fix or justify, never an automatic rejection.
236
+ - Run the plan's `## Validations` and `## Solution` Final behavior (legacy: `## Final behavior`). The PLAN's evidence, derived from spec criteria and scenarios, decides closure; a criterion without evidence is a plan gap.
234
237
  - A validation that **runs and fails** → back into the phase (gap): no advancing, no `validada`.
235
238
 
236
239
  - **SQL delivery**: validate the migration's behavior against a fixture or ephemeral database in the acquired checkout. The forward/rollback script is delivered through `SCRIPTS.sql` and `export-scripts`; a real application is an optional handoff and never keeps a phase or the plan open.
237
240
 
238
- > The **final validation** is PLAN-exec's **convergence gate** = **`Success criteria` green** (*verification-first*; analogous to SPEC's *analyze gate* and plan-new's *coherence gate*): the plan is not marked *done* until local proof passes. For code and persistence these are checkout commands/tests; a script's real-world application is never a closing criterion.
241
+ > **Final validation** is the convergence gate: `Success criteria` green on local checkout proof before `done`. A script's real-world application is never a closing criterion.
242
+
243
+ For each code source, the final-validation directive names its required build and tests and whether each came from the plan's `## Validations` override or the source's versioned pipeline. A missing command leaves the gate open with the action to declare it in either place. Run both commands in the acquired checkout and return each command's real output as its own evidence; a test suite that did not run never counts. The final gate cannot be omitted by the adaptive route.
239
244
 
240
245
  ## Delta 5 — Closing review gate (conventions, pre-commit)
241
246
 
@@ -250,24 +255,23 @@ without subagents runs a clean re-read instead, and the closing report declares
250
255
 
251
256
  ## Delta 6 — Completion / close
252
257
 
253
- - A phase closes when its `> Estado:` reads `validada`: work done, exit condition true and proof
254
- passed. In a continuous batch every phase waits for the batch review; an operative handoff leaves
255
- the affected phase `bloqueada` and the unit uncommitted.
256
- - **The plan's own state is the third axis, and it stays `open` during the whole run.** Every phase `validada` is **not** the plan closed: the final validation still has to run. Keep `> Estado: open` under the title while executing — stamping it on the first write if the plan carries none — and never write `done` from the counters — a legacy plan with every box ticked is not closed by that fact (§ *Legacy plans degrade safely*).
258
+ - A phase closes as `validada` only after its exit, proof and batch review pass. An operative handoff leaves it `bloqueada` and uncommitted.
259
+ - Check each known outdated spec/plan line with `aw amend apply … --check` before closing; propose its path, edit only with approval.
260
+ - **The plan stays `open` until final validation.** Every phase `validada` is **not** the plan closed; keep `> Estado: open` under the title (stamp it if absent); never write `done` from the counters (§ *Legacy plans degrade safely*).
257
261
  - **Every phase `validada` + final validation passed** unlocks completion, and the mark is written
258
262
  **after Git**: commit each unit, integrate it, and only then seal `done`. A run that isolates its
259
263
  writing holds commits that live on `aw/<session>` and nowhere else, so a `done` stamped before the
260
264
  merge would be true of no branch anybody reads.
261
265
  - **Integrating is part of closing, not a chore after it.** `aw worktree integrate --code <NNN>`
262
- merges every unit of the session into its source's working branch, in alias order, one at a time
263
- over the live branch — never a rebase, a force, a push or a silent branch switch. A **conflict is a
266
+ merges each unit into its sealed base, in alias order, over the live branch — never a rebase,
267
+ force, push or silent branch switch. A **conflict is a
264
268
  live state, not a failure**: the unit, its commits and the merge are kept, the receipt names the
265
- plan, the source and the files, and `aw fix-git --path <source>` (`prepare` → `apply` →
269
+ plan, the source and the files, and `aw fix-git --path <reported merge path>` (`prepare` → `apply` →
266
270
  `commit --confirm`) resolves it; then integrate again to confirm and give the unit back. The plan
267
271
  is not `done` and the session does not close while a unit is still alive.
268
- - **Marking done = ONE status line in the plan-doc**, under the title's blockquote: `> Estado: done`, updated in place on a re-run. The machine value **stands alone** — the date and session go on their own `> Cierre: YYYY-MM-DD · sesión NNN` line right under it, for the same reason a blocker never rides on a phase's state line. It never replaces the per-phase lines inside the `### Fn` blocks — position tells the two apart. No per-phase result tables, no ✅ suffixes — that record lives in the session (`DECISION`/`CHECKPOINT`).
272
+ - **Marking done = ONE status line in the plan-doc** under the title: `> Estado: done`. The CLI seals `> Cierre:` with evidence of the run and `> Assurance: verified|partially_verified|unverified_accepted` on separate lines. Position distinguishes title from phase states; no per-phase result tables or suffixes (use session `DECISION`/`CHECKPOINT`).
269
273
  - **Legacy status line, migrated on write.** A plan carrying the old single-line form (`> Estado: done — YYYY-MM-DD · sesión NNN`) is still **read** as closed; the first time this loop legitimately writes that document, it is rewritten to the two-line form. Compatibility is for reading old plans — every new write uses the normalized contract.
270
- - **No automatic export**: the artifacts (`SCRIPTS.sql`, `DECISION`, …) stay in the session. Promoting them to `docs/` (scripts, manuals, …) is a separate step via `export-*`.
274
+ - **No automatic export**: session artifacts stay there; only a later explicit `export-*` promotes them to `docs/`.
271
275
 
272
276
  ## Sequence
273
277
 
@@ -281,8 +285,6 @@ plan-exec-loop(PPP-plan-<slug>.md):
281
285
  batches = infer_effective_batches(pending phases, plan + live checkout)
282
286
  may merge/split declared rows without asking; legacy absence is allowed
283
287
  record batches + declaration drift in CHECKPOINT
284
- commit_authorization = explicit conditional pre-authorization from the user, if any
285
- record it before editing; otherwise approval is deferred to each green batch close
286
288
  for each Batch in batches:
287
289
  verify every affected source's branch; mismatch → stop + human
288
290
  seed CHECKPOINT.Next = Batch Bn (mode + phases + tasks)
@@ -306,16 +308,15 @@ plan-exec-loop(PPP-plan-<slug>.md):
306
308
  if any proof/check/review/exit condition is not green:
307
309
  preserve actual states + combined uncommitted diff; record unblocking action; stop
308
310
  set every Batch phase > Estado: validada; update CHECKPOINT
309
- prepare exactly one commit per affected source, in its own isolation unit
310
- pre-authorized → commit without another question
311
- else → one consolidated approval for all source commits
312
- rejected → changes stay; record "batch uncommitted"
311
+ propose one message and exact paths per changed source; show them for batch approval
312
+ approved → CLI commits those paths, verifies git and stores receipts before the next batch
313
+ Cerrar → persist the pending batch and its uncommitted changes
313
314
  if last Batch + final validation green:
314
315
  integrate: aw worktree integrate --code NNN # every unit, alias order, live branch
315
- conflict → keep unit + merge; report plan/source/files; aw fix-git --path <source>
316
+ conflict → keep unit + merge; report plan/source/files; aw fix-git --path <reported merge path>
316
317
  (prepare → apply → commit --confirm) → integrate again → release
317
318
  refused (dirty checkout / off branch / uncommitted unit) → fix what it names; retry
318
- then mark plan done: > Estado: done + > Cierre: YYYY-MM-DD · sesión NNN under the title (Delta 6)
319
+ then CLI seals plan: > Estado: done + > Cierre: run evidence + > Assurance: verdict (Delta 6)
319
320
  next-batch precondition: working trees clean or acknowledged
320
321
  if no Batch ran and phases are already validada:
321
322
  run final validation now; if green → same integrate-then-mark-done branch