maestro-flow 0.5.45 → 0.5.47

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 (310) hide show
  1. package/.agents/agents/ralph-executor.md +51 -6
  2. package/.agents/skills/domain-add/SKILL.md +9 -0
  3. package/.agents/skills/learn-decompose/SKILL.md +12 -0
  4. package/.agents/skills/learn-follow/SKILL.md +41 -0
  5. package/.agents/skills/learn-investigate/SKILL.md +14 -0
  6. package/.agents/skills/learn-second-opinion/SKILL.md +14 -0
  7. package/.agents/skills/maestro-amend/SKILL.md +11 -0
  8. package/.agents/skills/maestro-companion/SKILL.md +11 -0
  9. package/.agents/skills/maestro-composer/SKILL.md +11 -0
  10. package/.agents/skills/maestro-guard/SKILL.md +25 -0
  11. package/.agents/skills/maestro-init/SKILL.md +28 -0
  12. package/.agents/skills/maestro-overlay/SKILL.md +11 -0
  13. package/.agents/skills/maestro-player/SKILL.md +11 -0
  14. package/.agents/skills/maestro-quick/SKILL.md +29 -0
  15. package/.agents/skills/maestro-ralph-v2/SKILL.md +124 -61
  16. package/.agents/skills/maestro-swarm-workflow/SKILL.md +25 -0
  17. package/.agents/skills/maestro-tools-execute/SKILL.md +29 -0
  18. package/.agents/skills/maestro-tools-register/SKILL.md +29 -0
  19. package/.agents/skills/maestro-ui-codify/SKILL.md +11 -0
  20. package/.agents/skills/maestro-universal-workflow/SKILL.md +59 -0
  21. package/.agents/skills/maestro-update/SKILL.md +38 -0
  22. package/.agents/skills/manage-codebase-rebuild/SKILL.md +29 -0
  23. package/.agents/skills/manage-drift-realign/SKILL.md +12 -0
  24. package/.agents/skills/manage-harvest/SKILL.md +30 -6
  25. package/.agents/skills/manage-issue/SKILL.md +23 -0
  26. package/.agents/skills/manage-issue-discover/SKILL.md +28 -0
  27. package/.agents/skills/manage-kg-extractors/SKILL.md +27 -1
  28. package/.agents/skills/manage-knowhow/SKILL.md +26 -0
  29. package/.agents/skills/manage-knowhow-capture/SKILL.md +24 -0
  30. package/.agents/skills/manage-knowledge-audit/SKILL.md +13 -0
  31. package/.agents/skills/manage-status/SKILL.md +22 -0
  32. package/.agents/skills/manage-wiki/SKILL.md +28 -0
  33. package/.agents/skills/odyssey-debug/SKILL.md +338 -253
  34. package/.agents/skills/odyssey-improve/SKILL.md +417 -281
  35. package/.agents/skills/odyssey-planex/SKILL.md +536 -420
  36. package/.agents/skills/odyssey-review-test-fix/SKILL.md +386 -251
  37. package/.agents/skills/odyssey-ui/SKILL.md +382 -247
  38. package/.agents/skills/quality-auto-test/SKILL.md +12 -0
  39. package/.agents/skills/quality-debug/SKILL.md +11 -0
  40. package/.agents/skills/quality-refactor/SKILL.md +11 -0
  41. package/.agents/skills/quality-retrospective/SKILL.md +11 -0
  42. package/.agents/skills/quality-review/SKILL.md +11 -0
  43. package/.agents/skills/quality-sync/SKILL.md +10 -0
  44. package/.agents/skills/quality-test/SKILL.md +12 -0
  45. package/.agents/skills/security-audit/SKILL.md +11 -0
  46. package/.agents/skills/spec-add/SKILL.md +27 -0
  47. package/.agents/skills/spec-load/SKILL.md +25 -0
  48. package/.agents/skills/spec-remove/SKILL.md +26 -0
  49. package/.agents/skills/spec-setup/SKILL.md +30 -0
  50. package/.agy/agents/ralph-executor.md +53 -6
  51. package/.agy/skills/domain-add/SKILL.md +9 -0
  52. package/.agy/skills/learn-decompose/SKILL.md +12 -0
  53. package/.agy/skills/learn-follow/SKILL.md +41 -0
  54. package/.agy/skills/learn-investigate/SKILL.md +14 -0
  55. package/.agy/skills/learn-second-opinion/SKILL.md +14 -0
  56. package/.agy/skills/maestro-amend/SKILL.md +11 -0
  57. package/.agy/skills/maestro-companion/SKILL.md +11 -0
  58. package/.agy/skills/maestro-composer/SKILL.md +11 -0
  59. package/.agy/skills/maestro-guard/SKILL.md +25 -0
  60. package/.agy/skills/maestro-init/SKILL.md +28 -0
  61. package/.agy/skills/maestro-overlay/SKILL.md +11 -0
  62. package/.agy/skills/maestro-player/SKILL.md +11 -0
  63. package/.agy/skills/maestro-quick/SKILL.md +29 -0
  64. package/.agy/skills/maestro-ralph-v2/SKILL.md +123 -61
  65. package/.agy/skills/maestro-swarm-workflow/SKILL.md +25 -0
  66. package/.agy/skills/maestro-tools-execute/SKILL.md +29 -0
  67. package/.agy/skills/maestro-tools-register/SKILL.md +29 -0
  68. package/.agy/skills/maestro-ui-codify/SKILL.md +11 -0
  69. package/.agy/skills/maestro-universal-workflow/SKILL.md +59 -0
  70. package/.agy/skills/maestro-update/SKILL.md +38 -0
  71. package/.agy/skills/manage-codebase-rebuild/SKILL.md +29 -0
  72. package/.agy/skills/manage-drift-realign/SKILL.md +12 -0
  73. package/.agy/skills/manage-harvest/SKILL.md +30 -6
  74. package/.agy/skills/manage-issue/SKILL.md +23 -0
  75. package/.agy/skills/manage-issue-discover/SKILL.md +28 -0
  76. package/.agy/skills/manage-kg-extractors/SKILL.md +27 -1
  77. package/.agy/skills/manage-knowhow/SKILL.md +26 -0
  78. package/.agy/skills/manage-knowhow-capture/SKILL.md +24 -0
  79. package/.agy/skills/manage-knowledge-audit/SKILL.md +13 -0
  80. package/.agy/skills/manage-status/SKILL.md +22 -0
  81. package/.agy/skills/manage-wiki/SKILL.md +28 -0
  82. package/.agy/skills/odyssey-debug/SKILL.md +338 -253
  83. package/.agy/skills/odyssey-improve/SKILL.md +417 -281
  84. package/.agy/skills/odyssey-planex/SKILL.md +536 -420
  85. package/.agy/skills/odyssey-review-test-fix/SKILL.md +386 -251
  86. package/.agy/skills/odyssey-ui/SKILL.md +382 -247
  87. package/.agy/skills/quality-auto-test/SKILL.md +12 -0
  88. package/.agy/skills/quality-debug/SKILL.md +11 -0
  89. package/.agy/skills/quality-refactor/SKILL.md +11 -0
  90. package/.agy/skills/quality-retrospective/SKILL.md +11 -0
  91. package/.agy/skills/quality-review/SKILL.md +11 -0
  92. package/.agy/skills/quality-sync/SKILL.md +10 -0
  93. package/.agy/skills/quality-test/SKILL.md +12 -0
  94. package/.agy/skills/security-audit/SKILL.md +11 -0
  95. package/.agy/skills/spec-add/SKILL.md +27 -0
  96. package/.agy/skills/spec-load/SKILL.md +25 -0
  97. package/.agy/skills/spec-remove/SKILL.md +26 -0
  98. package/.agy/skills/spec-setup/SKILL.md +30 -0
  99. package/.claude/agents/ralph-executor.md +51 -6
  100. package/.claude/commands/domain-add.md +9 -0
  101. package/.claude/commands/learn-decompose.md +12 -0
  102. package/.claude/commands/learn-follow.md +41 -0
  103. package/.claude/commands/learn-investigate.md +14 -0
  104. package/.claude/commands/learn-second-opinion.md +14 -0
  105. package/.claude/commands/maestro-amend.md +11 -0
  106. package/.claude/commands/maestro-companion.md +11 -0
  107. package/.claude/commands/maestro-composer.md +11 -0
  108. package/.claude/commands/maestro-guard.md +25 -0
  109. package/.claude/commands/maestro-init.md +28 -0
  110. package/.claude/commands/maestro-overlay.md +11 -0
  111. package/.claude/commands/maestro-player.md +11 -0
  112. package/.claude/commands/maestro-quick.md +29 -0
  113. package/.claude/commands/maestro-ralph-v2.md +124 -61
  114. package/.claude/commands/maestro-swarm-workflow.md +25 -0
  115. package/.claude/commands/maestro-tools-execute.md +29 -0
  116. package/.claude/commands/maestro-tools-register.md +29 -0
  117. package/.claude/commands/maestro-ui-codify.md +11 -0
  118. package/.claude/commands/maestro-universal-workflow.md +59 -0
  119. package/.claude/commands/maestro-update.md +38 -0
  120. package/.claude/commands/manage-codebase-rebuild.md +29 -0
  121. package/.claude/commands/manage-drift-realign.md +12 -0
  122. package/.claude/commands/manage-harvest.md +30 -6
  123. package/.claude/commands/manage-issue-discover.md +28 -0
  124. package/.claude/commands/manage-issue.md +23 -0
  125. package/.claude/commands/manage-kg-extractors.md +27 -1
  126. package/.claude/commands/manage-knowhow-capture.md +24 -0
  127. package/.claude/commands/manage-knowhow.md +26 -0
  128. package/.claude/commands/manage-knowledge-audit.md +13 -0
  129. package/.claude/commands/manage-status.md +22 -0
  130. package/.claude/commands/manage-wiki.md +28 -0
  131. package/.claude/commands/odyssey-debug.md +352 -267
  132. package/.claude/commands/odyssey-improve.md +431 -295
  133. package/.claude/commands/odyssey-planex.md +550 -434
  134. package/.claude/commands/odyssey-review-test-fix.md +400 -265
  135. package/.claude/commands/odyssey-ui.md +396 -261
  136. package/.claude/commands/quality-auto-test.md +12 -0
  137. package/.claude/commands/quality-debug.md +11 -0
  138. package/.claude/commands/quality-refactor.md +11 -0
  139. package/.claude/commands/quality-retrospective.md +11 -0
  140. package/.claude/commands/quality-review.md +11 -0
  141. package/.claude/commands/quality-sync.md +10 -0
  142. package/.claude/commands/quality-test.md +12 -0
  143. package/.claude/commands/security-audit.md +11 -0
  144. package/.claude/commands/spec-add.md +27 -0
  145. package/.claude/commands/spec-load.md +25 -0
  146. package/.claude/commands/spec-remove.md +26 -0
  147. package/.claude/commands/spec-setup.md +30 -0
  148. package/.codex/skills/codify-to-knowhow/SKILL.md +2 -0
  149. package/.codex/skills/domain-add/SKILL.md +26 -0
  150. package/.codex/skills/domain-discover/SKILL.md +46 -0
  151. package/.codex/skills/domain-list/SKILL.md +29 -0
  152. package/.codex/skills/learn-decompose/SKILL.md +2 -0
  153. package/.codex/skills/learn-follow/SKILL.md +34 -0
  154. package/.codex/skills/learn-investigate/SKILL.md +33 -0
  155. package/.codex/skills/learn-retro/SKILL.md +33 -0
  156. package/.codex/skills/learn-second-opinion/SKILL.md +30 -0
  157. package/.codex/skills/maestro-amend/SKILL.md +11 -0
  158. package/.codex/skills/maestro-companion/SKILL.md +11 -0
  159. package/.codex/skills/maestro-composer/SKILL.md +11 -0
  160. package/.codex/skills/maestro-guard/SKILL.md +25 -0
  161. package/.codex/skills/maestro-help/SKILL.md +2 -0
  162. package/.codex/skills/maestro-init/SKILL.md +16 -0
  163. package/.codex/skills/maestro-learn/SKILL.md +2 -0
  164. package/.codex/skills/maestro-overlay/SKILL.md +1 -0
  165. package/.codex/skills/maestro-player/SKILL.md +2 -0
  166. package/.codex/skills/maestro-quick/SKILL.md +17 -0
  167. package/.codex/skills/maestro-tools-execute/SKILL.md +31 -0
  168. package/.codex/skills/maestro-tools-register/SKILL.md +29 -0
  169. package/.codex/skills/maestro-ui-codify/SKILL.md +2 -0
  170. package/.codex/skills/maestro-update/SKILL.md +38 -0
  171. package/.codex/skills/manage-codebase-rebuild/SKILL.md +2 -0
  172. package/.codex/skills/manage-codebase-refresh/SKILL.md +11 -0
  173. package/.codex/skills/manage-drift-realign/SKILL.md +2 -0
  174. package/.codex/skills/manage-harvest/SKILL.md +30 -8
  175. package/.codex/skills/manage-issue/SKILL.md +24 -0
  176. package/.codex/skills/manage-issue-discover/SKILL.md +2 -0
  177. package/.codex/skills/manage-knowhow/SKILL.md +26 -0
  178. package/.codex/skills/manage-knowhow-capture/SKILL.md +23 -0
  179. package/.codex/skills/manage-learn/SKILL.md +2 -0
  180. package/.codex/skills/manage-status/SKILL.md +22 -0
  181. package/.codex/skills/manage-wiki/SKILL.md +28 -0
  182. package/.codex/skills/odyssey-debug/SKILL.md +44 -0
  183. package/.codex/skills/odyssey-improve/SKILL.md +49 -0
  184. package/.codex/skills/odyssey-planex/SKILL.md +44 -0
  185. package/.codex/skills/odyssey-review-test-fix/SKILL.md +48 -0
  186. package/.codex/skills/odyssey-ui/SKILL.md +49 -0
  187. package/.codex/skills/quality-auto-test/SKILL.md +2 -0
  188. package/.codex/skills/quality-debug/SKILL.md +2 -0
  189. package/.codex/skills/quality-refactor/SKILL.md +2 -0
  190. package/.codex/skills/quality-retrospective/SKILL.md +2 -0
  191. package/.codex/skills/quality-review/SKILL.md +2 -0
  192. package/.codex/skills/quality-sync/SKILL.md +24 -0
  193. package/.codex/skills/quality-test/SKILL.md +2 -0
  194. package/.codex/skills/security-audit/SKILL.md +30 -0
  195. package/.codex/skills/spec-add/SKILL.md +28 -0
  196. package/.codex/skills/spec-load/SKILL.md +26 -0
  197. package/.codex/skills/spec-map/SKILL.md +1 -0
  198. package/.codex/skills/spec-remove/SKILL.md +28 -0
  199. package/.codex/skills/spec-setup/SKILL.md +28 -0
  200. package/.codex/skills/wiki-connect/SKILL.md +11 -0
  201. package/.codex/skills/wiki-digest/SKILL.md +11 -0
  202. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js +3 -1
  203. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js.map +1 -1
  204. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +5 -0
  205. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +28 -4
  206. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -1
  207. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +4 -4
  208. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  209. package/dashboard/dist-server/src/graph/kg/db/queries.d.ts +10 -0
  210. package/dashboard/dist-server/src/graph/kg/db/queries.js +176 -38
  211. package/dashboard/dist-server/src/graph/kg/db/queries.js.map +1 -1
  212. package/dashboard/dist-server/src/graph/kg/extraction/code/svelte-extractor.js +1 -1
  213. package/dashboard/dist-server/src/graph/kg/extraction/code/svelte-extractor.js.map +1 -1
  214. package/dashboard/dist-server/src/graph/kg/extraction/code/tree-sitter.js +2 -2
  215. package/dashboard/dist-server/src/graph/kg/extraction/code/tree-sitter.js.map +1 -1
  216. package/dashboard/dist-server/src/graph/kg/extraction/code/vue-extractor.js +1 -1
  217. package/dashboard/dist-server/src/graph/kg/extraction/code/vue-extractor.js.map +1 -1
  218. package/dashboard/dist-server/src/graph/kg/extraction/code/wasm-stability.js +1 -1
  219. package/dashboard/dist-server/src/graph/kg/extraction/code/wasm-stability.js.map +1 -1
  220. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js +20 -12
  221. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js.map +1 -1
  222. package/dashboard/dist-server/src/graph/kg/surface/hook-injector.js +1 -1
  223. package/dashboard/dist-server/src/graph/kg/surface/hook-injector.js.map +1 -1
  224. package/dashboard/dist-server/src/hooks/keyword-spec-injector.js +35 -0
  225. package/dashboard/dist-server/src/hooks/keyword-spec-injector.js.map +1 -1
  226. package/dashboard/dist-server/src/hooks/spec-analytics.d.ts +1 -0
  227. package/dashboard/dist-server/src/hooks/spec-analytics.js.map +1 -1
  228. package/dashboard/dist-server/src/hooks/wiki-search-bridge.d.ts +32 -0
  229. package/dashboard/dist-server/src/hooks/wiki-search-bridge.js +71 -0
  230. package/dashboard/dist-server/src/hooks/wiki-search-bridge.js.map +1 -0
  231. package/dist/src/agents/api-explore/agent-loop.d.ts +15 -2
  232. package/dist/src/agents/api-explore/agent-loop.d.ts.map +1 -1
  233. package/dist/src/agents/api-explore/agent-loop.js +6 -5
  234. package/dist/src/agents/api-explore/agent-loop.js.map +1 -1
  235. package/dist/src/agents/api-explore/config.d.ts +67 -1
  236. package/dist/src/agents/api-explore/config.d.ts.map +1 -1
  237. package/dist/src/agents/api-explore/config.js +50 -15
  238. package/dist/src/agents/api-explore/config.js.map +1 -1
  239. package/dist/src/agents/api-explore/index.js +4 -4
  240. package/dist/src/agents/api-explore/index.js.map +1 -1
  241. package/dist/src/agents/api-explore/llm.d.ts +7 -1
  242. package/dist/src/agents/api-explore/llm.d.ts.map +1 -1
  243. package/dist/src/agents/api-explore/llm.js +26 -12
  244. package/dist/src/agents/api-explore/llm.js.map +1 -1
  245. package/dist/src/agents/api-explore/moa-cache.d.ts +12 -0
  246. package/dist/src/agents/api-explore/moa-cache.d.ts.map +1 -0
  247. package/dist/src/agents/api-explore/moa-cache.js +50 -0
  248. package/dist/src/agents/api-explore/moa-cache.js.map +1 -0
  249. package/dist/src/agents/api-explore/moa-loop.d.ts +49 -0
  250. package/dist/src/agents/api-explore/moa-loop.d.ts.map +1 -0
  251. package/dist/src/agents/api-explore/moa-loop.js +43 -0
  252. package/dist/src/agents/api-explore/moa-loop.js.map +1 -0
  253. package/dist/src/agents/api-explore/moa-pipeline.d.ts +43 -0
  254. package/dist/src/agents/api-explore/moa-pipeline.d.ts.map +1 -0
  255. package/dist/src/agents/api-explore/moa-pipeline.js +276 -0
  256. package/dist/src/agents/api-explore/moa-pipeline.js.map +1 -0
  257. package/dist/src/agents/api-explore/runner.d.ts +3 -0
  258. package/dist/src/agents/api-explore/runner.d.ts.map +1 -1
  259. package/dist/src/agents/api-explore/runner.js +39 -18
  260. package/dist/src/agents/api-explore/runner.js.map +1 -1
  261. package/dist/src/agents/api-explore/session.d.ts +15 -0
  262. package/dist/src/agents/api-explore/session.d.ts.map +1 -1
  263. package/dist/src/agents/api-explore/session.js.map +1 -1
  264. package/dist/src/cli.js +1 -0
  265. package/dist/src/cli.js.map +1 -1
  266. package/dist/src/commands/explore.d.ts.map +1 -1
  267. package/dist/src/commands/explore.js +34 -2
  268. package/dist/src/commands/explore.js.map +1 -1
  269. package/dist/src/commands/install.js +7 -28
  270. package/dist/src/commands/install.js.map +1 -1
  271. package/dist/src/commands/moa.d.ts +3 -0
  272. package/dist/src/commands/moa.d.ts.map +1 -0
  273. package/dist/src/commands/moa.js +217 -0
  274. package/dist/src/commands/moa.js.map +1 -0
  275. package/dist/src/commands/search.d.ts.map +1 -1
  276. package/dist/src/commands/search.js +2 -0
  277. package/dist/src/commands/search.js.map +1 -1
  278. package/dist/src/graph/kg/db/queries.d.ts +10 -0
  279. package/dist/src/graph/kg/db/queries.d.ts.map +1 -1
  280. package/dist/src/graph/kg/db/queries.js +176 -38
  281. package/dist/src/graph/kg/db/queries.js.map +1 -1
  282. package/dist/src/graph/kg/extraction/code/svelte-extractor.js +1 -1
  283. package/dist/src/graph/kg/extraction/code/svelte-extractor.js.map +1 -1
  284. package/dist/src/graph/kg/extraction/code/tree-sitter.js +2 -2
  285. package/dist/src/graph/kg/extraction/code/tree-sitter.js.map +1 -1
  286. package/dist/src/graph/kg/extraction/code/vue-extractor.js +1 -1
  287. package/dist/src/graph/kg/extraction/code/vue-extractor.js.map +1 -1
  288. package/dist/src/graph/kg/extraction/code/wasm-stability.js +1 -1
  289. package/dist/src/graph/kg/extraction/code/wasm-stability.js.map +1 -1
  290. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  291. package/dist/src/graph/kg/extraction/orchestrator.js +20 -12
  292. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  293. package/dist/src/graph/kg/surface/hook-injector.js +1 -1
  294. package/dist/src/graph/kg/surface/hook-injector.js.map +1 -1
  295. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -1
  296. package/dist/src/hooks/keyword-spec-injector.js +35 -0
  297. package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
  298. package/dist/src/hooks/plugins/explore-plugin.d.ts.map +1 -1
  299. package/dist/src/hooks/plugins/explore-plugin.js +3 -2
  300. package/dist/src/hooks/plugins/explore-plugin.js.map +1 -1
  301. package/dist/src/hooks/spec-analytics.d.ts +1 -0
  302. package/dist/src/hooks/spec-analytics.d.ts.map +1 -1
  303. package/dist/src/hooks/spec-analytics.js.map +1 -1
  304. package/dist/src/hooks/wiki-search-bridge.d.ts +33 -0
  305. package/dist/src/hooks/wiki-search-bridge.d.ts.map +1 -0
  306. package/dist/src/hooks/wiki-search-bridge.js +71 -0
  307. package/dist/src/hooks/wiki-search-bridge.js.map +1 -0
  308. package/dist/src/utils/update-notices.js +12 -0
  309. package/dist/src/utils/update-notices.js.map +1 -1
  310. package/package.json +1 -1
@@ -14,423 +14,539 @@ allowed-tools:
14
14
  ---
15
15
  <!-- Open-standard mirror generated by scripts/build-agents-standard.mjs — do not edit; re-run after editing .claude/ source. -->
16
16
 
17
- <base>@~/.maestro/workflows/odyssey-base.md</base>
18
-
19
- <purpose>
20
- Requirement-to-delivery closed loop: parse requirement → define acceptance criteria →
21
- plan → execute → verify → fix gaps → iterate until ALL criteria pass.
22
- </purpose>
23
-
24
- <boundary>
25
- **In scope:** Single requirement delivery loop — from requirement parsing to all acceptance criteria passing + generalization.
26
- **Out of scope:** Multi-requirement orchestration → `/maestro-roadmap` | Deep debugging → `/odyssey-debug` | Code review → `/odyssey-review-test-fix` | UI optimization → `/odyssey-ui`
27
-
28
- **`--template <name>`:**
29
-
30
- | Template | Criteria pattern | Use case |
31
- |----------|-----------------|----------|
32
- | `feature` | User story acceptance + boundary tests + UI verification | New feature |
33
- | `bugfix` | Regression tests + root cause confirmation + boundary coverage | Bug fix |
34
- | `refactor` | Behavior preservation + performance baseline + API compatibility | Refactoring |
35
- | `migration` | Data consistency + rollback verification + performance comparison | Data/API migration |
36
- | `api-endpoint` | Request/response contract + error handling + permission checks | API development |
37
- </boundary>
38
-
39
- <context>
40
- $ARGUMENTS
41
-
42
- **Flags:**
43
-
44
- | Flag | Description | Default |
45
- |------|-------------|---------|
46
- | `--template <name>` | Predefined requirement template | — |
47
- | `--max-iterations N` | Max verify-fix cycles before escalation | 3 |
48
- | `--skip-generalize` | Skip S_GENERALIZE + S_DISCOVER | false |
49
- | `--auto` | CLI delegate calls without confirmation | false |
50
- | `--method agent\|cli\|auto` | Execution method | `auto` |
51
- | `--executor <tool>` | Explicit executor tool for CLI delegate | First enabled |
52
- | `--skip-verify` | Skip post-execution validation gate | false |
53
- | `--heartbeat` | Enable periodic progress heartbeat | false |
54
- | `-y` | Auto-confirm — decisions recorded as `deferred` | false |
55
- | `-c` | Resume most recent session | — |
56
-
57
- **Session**: `.workflow/scratch/{YYYYMMDD}-planex-odyssey-{slug}/`
58
- **Output**: `session.json` | `evidence.ndjson` | `understanding.md`
59
-
60
- **session.json planex-specific fields:**
61
- ```json
62
- { "requirement": "",
63
- "acceptance_criteria": [{"id":"AC1","criterion":"","verify_method":"test|grep|cli-review|manual","status":"pending","evidence":"","passed_at":null}],
64
- "plan": {"tasks":[{"id":"T1","title":"","description":"","criteria_refs":["AC1"],"status":"pending","files_modified":[],"domain":"general","executor":"agent"}],"created_at":""},
65
- "execution_config": {"method":"auto","default_executor":"","domain_routing":{"frontend":"","backend":"","default":"agent"},"code_review_tool":"Skip","verification_tool":"Auto","confirmed":false},
66
- "iterations": [{"iteration":1,"started_at":"","completed_at":"","criteria_before":{"passed":0,"total":0},"criteria_after":{"passed":0,"total":0},"gaps_fixed":[],"files_modified":[]}],
67
- "current_iteration": 0,
68
- "patterns": [{"id":"P1","source":"AC1 fix","layer":"syntax|semantic|structural","signature":"","description":"","risk":"","fix_template":""}],
69
- "generalization_stats": "-> base shared_schemas" }
70
- ```
71
-
72
- **evidence.ndjson phases:** `planning|execution|verification|fix|decision|generalization|discovery|self-iteration`
73
-
74
- **understanding.md 8 sections:**
75
- 1. Requirement & Criteria <- S_INTAKE | 2. Plan <- S_PLAN | 3. Execution <- S_EXECUTE
76
- 4. Verification <- S_VERIFY | 5. Fix Log <- S_FIX | 6. Generalization <- S_GENERALIZE
77
- 7. Discoveries <- S_DISCOVER | 8. Learnings <- S_RECORD
78
-
79
- **phase_goals[]:**
80
-
81
- | ID | Goal | done_when | phase | skip_when |
82
- |----|------|-----------|-------|-----------|
83
- | G1 | Acceptance criteria defined | >=1 criterion in acceptance_criteria[] | S_INTAKE | |
84
- | G2 | Plan created | session.json.plan populated | S_PLAN | — |
85
- | G3 | Implementation complete | all plan tasks executed | S_EXECUTE | — |
86
- | G4 | All criteria pass | all acceptance_criteria[].status == passed | S_VERIFY | — |
87
- | G5 | Pattern generalized | patterns[] >=1 entry | S_GENERALIZE | skip_generalize |
88
- | G6 | Discoveries triaged | all scan hits classified | S_DISCOVER | skip_generalize |
89
- | G7 | Learnings persisted | spec entries created OR no actionable | S_RECORD | |
90
-
91
- **Knowledge Persistence (written to understanding.md section 8):**
92
-
93
- | Category | Content | Follow-up |
94
- |----------|---------|-----------|
95
- | Multi-round fix cycle pattern | Problem scenario + fix iteration + final approach | `/spec-add debug` |
96
- | Reusable implementation pattern | Pattern + applicable scope + code template | `/spec-add coding` |
97
- | Acceptance criteria template | Standard template + verify_method suggestion | `/spec-add review` |
98
- | Generalization pattern | Signature + risk + fix template | `/spec-add coding` |
99
- </context>
100
-
101
- <invariants>
102
- Base execution_discipline #1-5.
103
- 6. **Acceptance criteria are sacred** — no "close enough", no manual override without explicit escalation
104
- </invariants>
105
-
106
- <self_iteration>
107
- Applies to: **S_PLAN, S_VERIFY, S_GENERALIZE**. Logic in base.
108
- </self_iteration>
109
-
110
- <state_machine>
111
-
112
- <states>
113
- S_INTAKE → S_PLAN → S_EXECUTE → S_VERIFY → S_FIX → S_GENERALIZE → S_DISCOVER → S_RECORD → END
114
- </states>
115
-
116
- <transitions>
117
- S_INTAKE → S_INTAKE : -c + session found (resume)
118
- S_INTAKE → S_PLAN : requirement + criteria defined
119
- S_INTAKE → S_INTAKE : no requirement ask_user
120
-
121
- S_PLAN → S_EXECUTE
122
- S_EXECUTE → S_VERIFY
123
-
124
- S_VERIFY → S_GENERALIZE : all passed AND NOT skip_generalize
125
- S_VERIFY → S_RECORD : all passed AND skip_generalize
126
- S_VERIFY S_FIX : some failed AND iteration < max
127
- S_VERIFY → S_PLAN : fundamental plan flaw → cross_phase_loops++ (replan). **Criteria preservation:** acceptance_criteria[] statuses are preserved; only plan.tasks[] are regenerated. Previously passed criteria retain `passed` status; failed criteria reset to `pending` for re-verification after new plan execution.
128
- S_VERIFY → S_RECORD : some failed AND iteration >= max (escalate)
129
-
130
- S_FIX S_VERIFY (loop)
131
-
132
- S_GENERALIZE → S_DISCOVER : hits found
133
- S_GENERALIZES_RECORD : no hits
134
-
135
- S_DISCOVER → S_EXECUTE : discovery finds area needing same implementation cross_phase_loops++
136
- S_DISCOVER S_RECORD : triage complete AND remaining_actionable == 0
137
- S_DISCOVERS_RECORD : loops >= max_loops log per-item reasons
138
-
139
- S_RECORDEND
140
- </transitions>
141
-
142
- <actions>
143
-
144
- ### A_INTAKE
145
-
146
- 1. Parse requirement and flags, generate slug, create SESSION_DIR
147
- 2. **Define acceptance criteria** analyze requirement derive testable criteria. Each gets `verify_method`: test | grep | cli-review | manual
148
- - Normal: ask_user to confirm/edit
149
- - `-y`: auto-derive, record `{"phase":"decision","type":"criteria-confirmation","status":"deferred"}`
150
- 3. Search prior knowledge: `maestro search`, related sessions
151
- 4. Write session.json + understanding.md section 1. Mark G1 done. Emit Goal Prompt.
152
-
153
- Commit: `"odyssey-planex({slug}): INTAKE parse requirement and define criteria"`
154
-
155
- ### A_PLAN
156
-
157
- 1. Decompose requirement into ordered tasks mapped to acceptance criteria
158
- 2. CLI-assisted planning (optional):
159
- ```bash
160
- maestro delegate "PURPOSE: Create implementation plan for: {requirement}
161
- TASK: Decompose into subtasks | Map to acceptance criteria | Identify dependencies
162
- MODE: analysis
163
- CONTEXT: @**/* | Criteria: {criteria_summary}
164
- EXPECTED: JSON [{task_id, title, description, criteria_refs, deps}]
165
- " --role analyze --mode analysis
166
- ```
167
- Run with `run_in_background: true`, wait for callback.
168
- 3. Write session.json.plan, append evidence (planning), update understanding.md section 2. Mark G2 done.
169
-
170
- Commit: `"odyssey-planex({slug}): PLAN — create execution plan"`
171
-
172
- ### A_EXECUTE
173
-
174
- #### Step 1: Execution Options Confirmation
175
-
176
- **Skip if** `-y` flag OR `--method` explicitly set OR `execution_config.confirmed == true` (resume).
177
-
178
- Load available tools: `maestro delegate-config show --json`.
179
-
180
- Present ask_user with 3 questions:
181
- 1. **Executor** — Auto (domain routing) | delegate_subagent(all tasks) | specific CLI tool | Other (custom domain routing)
182
- 2. **Review** Skip | {tool} review (git diff quality check)
183
- 3. **Verify** Auto (delegate convergence + structure + anti-pattern check) | specific tool | Skip
184
-
185
- Parse response → write `execution_config` to session.json, set `confirmed: true`. `--skip-verify` overrides verification to `"Skip"`.
186
-
187
- #### Step 2: Executor Resolution
188
-
189
- Per-task domain routing (when method == "auto"):
190
-
191
- | Domain | Keywords / Patterns | Extensions |
192
- |--------|-------------------|------------|
193
- | frontend | UI, component, page, style, layout, CSS, view | .tsx/.jsx/.vue/.css/.html/.svelte |
194
- | backend | API, server, database, service, algorithm, worker | .go/.rs/.java/.py/.sql/.proto |
195
- | general | mixed, config, tests, unclear | .ts/.js/other |
196
-
197
- Resolution: `execution_config.domain_routing[domain]` fallback `domain_routing.default` ("agent").
198
-
199
- #### Step 3: Task Execution
200
-
201
- Execute tasks per plan order. Independent tasks may run in parallel.
202
-
203
- **Agent path:**
204
- ```
205
- Spawn Agent with: task definition, acceptance criteria refs, prior task summaries, specs_content
206
- Agent implements → verifies convergence → auto-fix (max 3) → returns result
207
- ```
208
-
209
- **CLI path:**
210
- ```bash
211
- maestro delegate "PURPOSE: Implement task ${task_id}: ${title}; success = criteria ${criteria_refs} satisfied
212
- TASK: ${description} | Read existing code first | Verify convergence criteria after changes
213
- MODE: write
214
- CONTEXT: @${scope}/**/* | Criteria: ${criteria_summary}
215
- EXPECTED: Working code changes, convergence evidence, summary of what was done
216
- CONSTRAINTS: Scope limited to task files | Follow project specs
217
-
218
- ## Acceptance Criteria (must satisfy)
219
- ${criteria_refs.map(ref => criteria[ref].criterion).join('\n')}
220
-
221
- ## Implementation Steps
222
- ${task.description}
223
-
224
- ## Project Specs
225
- ${specs_content}
226
-
227
- ## Prior Task Summaries
228
- ${prior_summaries}
229
- " --to ${resolved_executor} --mode write --id planex-${slug}-${task_id}
230
- ```
231
-
232
- Run with `run_in_background: true`, wait for callback.
233
-
234
- **Deviation Rule** max 3 auto-fix attempts per task:
235
- 1. First attempt: normal dispatch
236
- 2. Retry: `--resume planex-${slug}-${task_id}` with simplified prompt
237
- 3. Final: fallback to Agent path
238
- 4. All 3 fail mark task `blocked`, record checkpoint, continue remaining tasks
239
-
240
- #### Step 4: Per-Task Evidence
241
-
242
- Per completed task:
243
- - Record evidence: `{"phase":"execution","type":"task-completed","task_id":"T1","executor":"agent|agy|...","files_modified":[],"summary":"","attempt":1}`
244
- - Update task status in session.json plan
245
-
246
- #### Step 5: Post-Execution Validation
247
-
248
- **Skip if** `execution_config.verification_tool == "Skip"` OR `--skip-verify` OR no completed tasks.
249
-
250
- **Check 1: Summary Consistency** — cross-check task status vs actual file changes (git diff).
251
-
252
- **Check 2: CLI Verification Gate** delegate to external model:
253
- ```bash
254
- maestro delegate "PURPOSE: Verify execution output meets acceptance criteria; success = all criteria verified with file:line evidence
255
- TASK:
256
- 1. CONVERGENCE: For each criterion, read actual code, verify behavior exists, report status with evidence
257
- 2. EXISTENCE: Verify all expected files exist on disk
258
- 3. SUBSTANCE: Verify real implementation flag stubs, placeholders, TODO-only
259
- 4. ANTI-PATTERNS: Scan for TODO/FIXME/HACK, console.log debug, disabled tests
260
- MODE: analysis
261
- CONTEXT: @${modified_files}
262
- EXPECTED: JSON { convergence: [{criterion, status, evidence}], issues: [{type, file, line, severity}], overall: passed|gaps_found }
263
- CONSTRAINTS: Read-only | Check ALL criteria exhaustively | Evidence must be file:line
264
-
265
- ## Acceptance Criteria (verify each)
266
- ${acceptance_criteria.map(c => c.criterion).join('\n')}
267
-
268
- ## Modified Files
269
- ${modified_files.join('\n')}
270
- " --to ${execution_config.verification_tool} --mode analysis
271
- ```
272
-
273
- Run with `run_in_background: true`, wait for callback.
274
-
275
- On result:
276
- - `overall == "passed"` proceed to S_VERIFY with boosted confidence
277
- - `overall == "gaps_found"` → log findings, proceed to S_VERIFY
278
-
279
- **Check 3: Code Review** (if `execution_config.code_review_tool != "Skip"`):
280
- ```bash
281
- maestro delegate "Review git diff for correctness, style, bugs" --to ${code_review_tool} --mode analysis --rule analysis-review-code-quality
282
- ```
283
-
284
- #### Step 6: Completion
285
-
286
- Update understanding.md section 3. Mark G3 done.
287
-
288
- Commit: `"odyssey-planex({slug}): EXECUTE — implementation complete"`
289
-
290
- ### A_VERIFY
291
-
292
- Iron gate — every acceptance criterion checked objectively.
293
-
294
- **Verify each criterion by method:**
295
-
296
- | Method | Action |
297
- |--------|--------|
298
- | `test` | Run relevant tests, check pass/fail |
299
- | `grep` | Grep for expected pattern |
300
- | `cli-review` | `maestro delegate "PURPOSE: Verify criterion {criterion_id}: {criterion}\nTASK: Read implementation code \| Check behavior matches criterion \| Report pass/fail with file:line evidence\nMODE: analysis\nCONTEXT: @{relevant_files}\nEXPECTED: JSON {criterion_id, status: passed\|failed, evidence: [{file, line, detail}]}" --role review --mode analysis` |
301
- | `manual` | Normal: ask_user / `-y`: record `deferred` |
302
-
303
- Record per criterion: `{"phase":"verification","type":"criterion-check","criterion_id":"AC1","method":"","result":"passed|failed","evidence":"","iteration":N}`. Update acceptance_criteria[].status. Append to iterations[].
304
-
305
- Update understanding.md section 4 with pass/fail table.
306
-
307
- **Route:** all passed → mark G4 done → next state. Some failed + iteration < max → S_FIX. Some failed + iteration >= max → Normal: ask_user (continue/lower bar/accept) / `-y`: `deferred`, proceed S_RECORD.
308
-
309
- Commit: `"odyssey-planex({slug}): VERIFY acceptance check"`
310
-
311
- ### A_FIX
312
-
313
- 1. Increment current_iteration
314
- 2. For each failed criterion: diagnose gap → targeted code fix
315
- 3. CLI fix review (optional):
316
- ```bash
317
- maestro delegate "PURPOSE: Review fixes for failing criteria; success = no regressions and fixes correct
318
- TASK: Check fix correctness | Verify no regressions on passing criteria | Report verdict with file:line evidence
319
- MODE: analysis
320
- CONTEXT: @{modified_files} | Passing: {passing} | Fixed: {fixed}
321
- EXPECTED: JSON {verdict: passed|concerns_found, regression_risk: low|medium|high, concerns: [{criterion_id, file, line, description}]}
322
- CONSTRAINTS: Read-only | Check ALL passing criteria for regressions
323
- " --role review --mode analysis
324
- ```
325
- 4. Append evidence (fix), update understanding.md section 5 → S_VERIFY
326
-
327
- Commit: `"odyssey-planex({slug}): FIX — targeted fix for failing criteria"`
328
-
329
- ### A_GENERALIZE
330
-
331
- Base shared_actions. Pattern source: implementation patterns.
332
-
333
- Commit: `"odyssey-planex({slug}): GENERALIZE pattern scan complete"`
334
-
335
- ### A_DISCOVER
336
-
337
- Base shared_actions. Planex override: discovery finding needing same implementation → route back to S_EXECUTE (not S_FIX).
338
-
339
- Commit: `"odyssey-planex({slug}): DISCOVER findings classified"`
340
-
341
- ### A_RECORD
342
-
343
- Base shared_actions. Planex additions:
344
- 1. Iteration summary: what worked, what needed rework, fix cycle patterns
345
- 2. Learnings structured per Knowledge Persistence table: problem scenario + fix iteration process + final approach + applicable scope
346
-
347
- **Completion summary:**
348
- ```
349
- --- PLANEX ODYSSEY COMPLETE ---
350
- Requirement: {requirement}
351
- Criteria: {passed}/{total} passed
352
- Iterations: {N} cycles
353
- Patterns: {patterns_extracted} ({by_layer} distribution)
354
- Scan hits: {total_hits} ({cross_layer_confirmed} cross-layer confirmed)
355
- Issues: {N} created | Decisions: {N} resolved, {M} pending, {K} deferred
356
- Learnings: {N} spec entries
357
- Self-iter: {N} rounds across {M} stages
358
- Goals: {done}/{total} confirmed ({skipped} skipped)
359
- Status: {ALL_PASSED|PARTIAL|ESCALATED}
360
- ---
361
- ```
362
-
363
- Commit: `"odyssey-planex({slug}): RECORD — session summary"`
364
-
365
- </actions>
366
-
367
- <appendix>
368
-
369
- ### `-y` planex-specific points
370
-
371
- | Decision Point | Normal | `-y` |
372
- |---------------|--------|------|
373
- | S_INTAKE criteria confirmation | ask_user | auto-derive, `deferred` |
374
- | S_EXECUTE execution options | ask_user | use defaults (auto/Skip/Auto), `confirmed: true` |
375
- | S_EXECUTE task blocked (3 retries) | ask_user: continue or stop | auto continue, log blocked |
376
- | S_VERIFY manual criterion | ask_user | `deferred` |
377
- | S_VERIFY max iteration reached | ask_user | auto accept, `deferred` |
378
-
379
- ### Goal Prompt convergence rules
380
-
381
- ```
382
- Exhaustive iteration: until all acceptance_criteria[*].status==passed
383
- AND phase_goals_all_done=true. Verify failure auto-triggers fix->re-verify loop.
384
- Each fix round re-verifies; new criterion violations continue fixing within max_iterations.
385
- No "close enough" — all criteria must ALL pass.
386
- ```
387
-
388
- ### Iteration Model
389
-
390
- ```
391
- S_EXECUTE → S_VERIFY ──all pass──→ S_GENERALIZE → S_DISCOVER → S_RECORD
392
- │ │
393
- some fail + iter < max no hits ─→ S_RECORD
394
-
395
- S_FIX ──→ S_VERIFY (loop)
396
- ```
397
-
398
- Max iterations (default 3) prevents infinite loops. Each iteration records criteria_before, gaps_fixed, criteria_after.
399
-
400
- </appendix>
401
-
402
- </state_machine>
403
-
404
- <error_codes>
405
- | Code | Severity | Condition | Recovery |
406
- |------|----------|-----------|----------|
407
- | E001 | error | No requirement provided | Provide requirement |
408
- | W001 | warning | No acceptance criteria derived | Manual definition needed |
409
- | W002 | warning | Max iterations reached, criteria still failing | Escalate to user |
410
- | W003 | warning | CLI review regression concern | Review before next iteration |
411
- </error_codes>
412
-
413
- <success_criteria>
414
- - [ ] Requirement parsed with >=1 acceptance criterion (verify_method assigned)
415
- - [ ] Plan tasks mapped to criteria; execution options confirmed
416
- - [ ] Tasks dispatched via resolved executor with deviation rule (max 3 retries)
417
- - [ ] Post-execution validation gate run (unless --skip-verify)
418
- - [ ] Every criterion verified per method; failing targeted fix (not re-implementation)
419
- - [ ] Iteration count tracked and max respected; unfixed criteria individually classified
420
- - [ ] understanding.md sections 1-8 updated per phase; phase_goals G1-G7 audited
421
- - [ ] Generalization + discovery completed (unless --skip-generalize)
422
- - [ ] Quality Gate self-iteration triggered when insufficient
423
- - [ ] Goal Prompt displayed once after intake; `-y` mode: no blocking prompts
424
- - [ ] Session resumable via -c; completion summary output
425
- </success_criteria>
426
-
427
- <next_step_routing>
428
- | Condition | Next |
429
- |-----------|------|
430
- | All criteria passed | `/odyssey-review-test-fix <changed-files>` |
431
- | Max iterations, still failing | `/odyssey-debug "<failing criterion>"` |
432
- | Formal review | `/quality-review <phase>` |
433
- | Issues from discoveries | `/manage-issue list --source planex-odyssey` |
434
- | Pattern worth documenting | `/learn-decompose <module>` |
435
- </next_step_routing>
436
- </output>
17
+ <base>@~/.maestro/workflows/odyssey-base.md</base>
18
+
19
+ <purpose>
20
+ Requirement-to-delivery closed loop: parse requirement → define acceptance criteria →
21
+ plan → execute → verify → fix gaps → iterate until ALL criteria pass.
22
+ </purpose>
23
+
24
+ <boundary>
25
+ **In scope:** Single requirement delivery loop — from requirement parsing to all acceptance criteria passing + generalization.
26
+ **Out of scope:** Multi-requirement orchestration → `/maestro-roadmap` | Deep debugging → `/odyssey-debug` | Code review → `/odyssey-review-test-fix` | UI optimization → `/odyssey-ui`
27
+
28
+ **`--template <name>`:**
29
+
30
+ | Template | Criteria pattern | Use case |
31
+ |----------|-----------------|----------|
32
+ | `feature` | User story acceptance + boundary tests + UI verification | New feature |
33
+ | `bugfix` | Regression tests + root cause confirmation + boundary coverage | Bug fix |
34
+ | `refactor` | Behavior preservation + performance baseline + API compatibility | Refactoring |
35
+ | `migration` | Data consistency + rollback verification + performance comparison | Data/API migration |
36
+ | `api-endpoint` | Request/response contract + error handling + permission checks | API development |
37
+ </boundary>
38
+
39
+ <context>
40
+ $ARGUMENTS
41
+
42
+ **Flags:**
43
+
44
+ | Flag | Description | Default |
45
+ |------|-------------|---------|
46
+ | `--template <name>` | Predefined requirement template | — |
47
+ | `--max-iterations N` | Max verify-fix cycles before escalation | 3 |
48
+ | `--skip-generalize` | Skip S_GENERALIZE + S_DISCOVER | false |
49
+ | `--auto` | CLI delegate calls without confirmation | false |
50
+ | `--method agent\|cli\|auto` | Execution method | `auto` |
51
+ | `--executor <tool>` | Explicit executor tool for CLI delegate | First enabled |
52
+ | `--skip-verify` | Skip post-execution validation gate | false |
53
+ | `--heartbeat` | Enable periodic progress heartbeat | false |
54
+ | `-y` | Auto-confirm — decisions recorded as `deferred` | false |
55
+ | `-c` | Resume most recent session | — |
56
+
57
+ **Session**: `.workflow/scratch/{YYYYMMDD}-planex-odyssey-{slug}/`
58
+ **Output**: `session.json` | `evidence.ndjson` | `understanding.md`
59
+
60
+ **Output boundary**: ALL session artifacts MUST target the session directory (`.workflow/scratch/{YYYYMMDD}-planex-odyssey-{slug}/`) or `.workflow/state.json` only. Source code modifications during S_EXECUTE and S_FIX are in-scope but MUST be committed per action. NEVER write session artifacts outside these paths.
61
+
62
+ **session.json planex-specific fields:**
63
+ ```json
64
+ { "requirement": "",
65
+ "acceptance_criteria": [{"id":"AC1","criterion":"","verify_method":"test|grep|cli-review|manual","status":"pending","evidence":"","passed_at":null}],
66
+ "plan": {"tasks":[{"id":"T1","title":"","description":"","criteria_refs":["AC1"],"status":"pending","files_modified":[],"domain":"general","executor":"agent"}],"created_at":""},
67
+ "execution_config": {"method":"auto","default_executor":"","domain_routing":{"frontend":"","backend":"","default":"agent"},"code_review_tool":"Skip","verification_tool":"Auto","confirmed":false},
68
+ "iterations": [{"iteration":1,"started_at":"","completed_at":"","criteria_before":{"passed":0,"total":0},"criteria_after":{"passed":0,"total":0},"gaps_fixed":[],"files_modified":[]}],
69
+ "current_iteration": 0,
70
+ "patterns": [{"id":"P1","source":"AC1 fix","layer":"syntax|semantic|structural","signature":"","description":"","risk":"","fix_template":""}],
71
+ "generalization_stats": "-> base shared_schemas" }
72
+ ```
73
+
74
+ **evidence.ndjson phases:** `planning|execution|verification|fix|decision|generalization|discovery|self-iteration`
75
+
76
+ **understanding.md 8 sections:**
77
+ 1. Requirement & Criteria <- S_INTAKE | 2. Plan <- S_PLAN | 3. Execution <- S_EXECUTE
78
+ 4. Verification <- S_VERIFY | 5. Fix Log <- S_FIX | 6. Generalization <- S_GENERALIZE
79
+ 7. Discoveries <- S_DISCOVER | 8. Learnings <- S_RECORD
80
+
81
+ **phase_goals[]:**
82
+
83
+ | ID | Goal | done_when | phase | skip_when |
84
+ |----|------|-----------|-------|-----------|
85
+ | G1 | Acceptance criteria defined | >=1 criterion in acceptance_criteria[] | S_INTAKE | — |
86
+ | G2 | Plan created | session.json.plan populated | S_PLAN | — |
87
+ | G3 | Implementation complete | all plan tasks executed | S_EXECUTE | |
88
+ | G4 | All criteria pass | all acceptance_criteria[].status == passed | S_VERIFY | |
89
+ | G5 | Pattern generalized | patterns[] >=1 entry | S_GENERALIZE | skip_generalize |
90
+ | G6 | Discoveries triaged | all scan hits classified | S_DISCOVER | skip_generalize |
91
+ | G7 | Learnings persisted | spec entries created OR no actionable | S_RECORD | — |
92
+
93
+ **Knowledge Persistence (written to understanding.md section 8):**
94
+
95
+ | Category | Content | Follow-up |
96
+ |----------|---------|-----------|
97
+ | Multi-round fix cycle pattern | Problem scenario + fix iteration + final approach | `/spec-add debug` |
98
+ | Reusable implementation pattern | Pattern + applicable scope + code template | `/spec-add coding` |
99
+ | Acceptance criteria template | Standard template + verify_method suggestion | `/spec-add review` |
100
+ | Generalization pattern | Signature + risk + fix template | `/spec-add coding` |
101
+ </context>
102
+
103
+ <invariants>
104
+ Base execution_discipline #1-5.
105
+ 6. **Acceptance criteria are sacred** — no "close enough", no manual override without explicit escalation
106
+ 7. **Generalize is mandatory** — S_GENERALIZE and S_DISCOVER execute unless `skip_generalize == true`. "All criteria passed" or context pressure are NOT valid reasons to skip. The phase itself determines whether patterns exist.
107
+ </invariants>
108
+
109
+ <self_iteration>
110
+ Applies to: **S_PLAN, S_VERIFY, S_GENERALIZE**. Logic in base.
111
+ </self_iteration>
112
+
113
+ <execution>
114
+ Follow base execution discipline completely. Actions defined in state_machine below.
115
+
116
+ ### Phase Gates (MANDATORY, BLOCKING)
117
+
118
+ **GATE 1: INTAKE PLAN**
119
+ - REQUIRED: Requirement parsed, >=1 acceptance criterion defined with verify_method assigned.
120
+ - REQUIRED: session.json initialized, understanding.md §1 written, G1 marked done.
121
+ - BLOCKED if: no requirement provided (E001) or zero criteria derived (W001).
122
+
123
+ **GATE 2: PLAN → EXECUTE**
124
+ - REQUIRED: Plan tasks decomposed with criteria_refs mapping each task to acceptance criteria.
125
+ - REQUIRED: session.json.plan populated, understanding.md §2 updated, G2 marked done.
126
+ - BLOCKED if: plan has zero tasks or unmapped criteria.
127
+
128
+ **GATE 3: EXECUTE VERIFY**
129
+ - REQUIRED: All plan tasks executed (or marked blocked after 3 retries per deviation rule).
130
+ - REQUIRED: execution_config confirmed, per-task evidence logged, understanding.md §3 updated, G3 marked done.
131
+ - BLOCKED if: tasks still pending execution.
132
+
133
+ **GATE 4: VERIFY FIX / GENERALIZE**
134
+ - REQUIRED: Every acceptance criterion verified by its assigned method (test/grep/cli-review/manual).
135
+ - REQUIRED: Per-criterion evidence logged with pass/fail status and iteration count.
136
+ - BLOCKED if: verification incomplete all criteria must be checked before routing decision.
137
+ - Route: all passed GENERALIZE (or RECORD if skip_generalize). Some failed + iteration < max → FIX.
138
+
139
+ **GATE 5: FIX VERIFY**
140
+ - REQUIRED: current_iteration incremented, targeted fixes applied for each failed criterion.
141
+ - REQUIRED: Fix evidence logged, understanding.md §5 updated.
142
+ - BLOCKED if: no fix attempted for failing criteria.
143
+
144
+ **GATE 6: GENERALIZE → DISCOVER**
145
+ - REQUIRED: ALL 3 layers (syntax/semantic/structural) attempted with evidence logged.
146
+ - REQUIRED: generalization_stats written with by_layer entries for all 3 layers, G5 marked done.
147
+ - BLOCKED if: any layer not attempted (thoroughness floor violation).
148
+
149
+ **GATE 7: DISCOVER RECORD**
150
+ - REQUIRED: All hits triaged with per-item classification and reason.
151
+ - REQUIRED: remaining_actionable == 0 OR loops >= max_loops with per-item reasons logged.
152
+ - REQUIRED: G6 marked done.
153
+ - BLOCKED if: unclassified hits remain.
154
+
155
+ </execution>
156
+
157
+ <state_machine>
158
+
159
+ <states>
160
+ S_INTAKE S_PLAN S_EXECUTE S_VERIFY → S_FIX → S_GENERALIZE → S_DISCOVER → S_RECORD → END
161
+ </states>
162
+
163
+ <transitions>
164
+ S_INTAKE → S_INTAKE : -c + session found (resume)
165
+ S_INTAKE S_PLAN : requirement + criteria defined
166
+ S_INTAKE → S_INTAKE : no requirement → ask_user
167
+
168
+ S_PLAN → S_EXECUTE
169
+ S_EXECUTE → S_VERIFY
170
+
171
+ S_VERIFY → S_GENERALIZE : all passed AND NOT skip_generalize
172
+ S_VERIFY → S_RECORD : all passed AND skip_generalize
173
+ S_VERIFY → S_FIX : some failed AND iteration < max
174
+ S_VERIFY S_PLAN : fundamental plan flaw → cross_phase_loops++ (replan). **Criteria preservation:** acceptance_criteria[] statuses are preserved; only plan.tasks[] are regenerated. Previously passed criteria retain `passed` status; failed criteria reset to `pending` for re-verification after new plan execution.
175
+ S_VERIFY → S_RECORD : some failed AND iteration >= max (escalate)
176
+
177
+ S_FIX → S_VERIFY (loop)
178
+
179
+ S_GENERALIZE → S_DISCOVER : hits found
180
+ S_GENERALIZE S_RECORD : all 3 layers scanned with evidence, total_hits == 0
181
+
182
+ S_DISCOVER S_EXECUTE : discovery finds area needing same implementation cross_phase_loops++
183
+ S_DISCOVER S_RECORD : triage complete AND remaining_actionable == 0
184
+ S_DISCOVER → S_RECORD : loops >= max_loops → log per-item reasons
185
+
186
+ S_RECORD → END
187
+ </transitions>
188
+
189
+ <actions>
190
+
191
+ ### A_INTAKE
192
+
193
+ 1. Parse requirement and flags, generate slug, create SESSION_DIR
194
+ 2. **Define acceptance criteria** analyze requirement derive testable criteria. Each gets `verify_method`: test | grep | cli-review | manual
195
+ - Normal: ask_user to confirm/edit
196
+ - `-y`: auto-derive, record `{"phase":"decision","type":"criteria-confirmation","status":"deferred"}`
197
+ 3. Search prior knowledge: `maestro search`, related sessions
198
+ 4. Write session.json + understanding.md section 1. Mark G1 done. Emit Goal Prompt.
199
+
200
+ Commit: `"odyssey-planex({slug}): INTAKE — parse requirement and define criteria"`
201
+
202
+ ### A_PLAN
203
+
204
+ 1. Decompose requirement into ordered tasks mapped to acceptance criteria
205
+ 2. CLI-assisted planning (optional):
206
+ ```bash
207
+ maestro delegate "PURPOSE: Create implementation plan for: {requirement}
208
+ TASK: Decompose into subtasks | Map to acceptance criteria | Identify dependencies
209
+ MODE: analysis
210
+ CONTEXT: @**/* | Criteria: {criteria_summary}
211
+ EXPECTED: JSON [{task_id, title, description, criteria_refs, deps}]
212
+ " --role analyze --mode analysis
213
+ ```
214
+ Run with `run_in_background: true`, wait for callback.
215
+ 3. Write session.json.plan, append evidence (planning), update understanding.md section 2. Mark G2 done.
216
+
217
+ Commit: `"odyssey-planex({slug}): PLAN — create execution plan"`
218
+
219
+ ### A_EXECUTE
220
+
221
+ #### Step 1: Execution Options Confirmation
222
+
223
+ **Skip if** `-y` flag OR `--method` explicitly set OR `execution_config.confirmed == true` (resume).
224
+
225
+ Load available tools: `maestro delegate-config show --json`.
226
+
227
+ Present ask_user with 3 questions:
228
+ 1. **Executor** — Auto (domain routing) | delegate_subagent(all tasks) | specific CLI tool | Other (custom domain routing)
229
+ 2. **Review** — Skip | {tool} review (git diff quality check)
230
+ 3. **Verify** — Auto (delegate convergence + structure + anti-pattern check) | specific tool | Skip
231
+
232
+ Parse response → write `execution_config` to session.json, set `confirmed: true`. `--skip-verify` overrides verification to `"Skip"`.
233
+
234
+ #### Step 2: Executor Resolution
235
+
236
+ Per-task domain routing (when method == "auto"):
237
+
238
+ | Domain | Keywords / Patterns | Extensions |
239
+ |--------|-------------------|------------|
240
+ | frontend | UI, component, page, style, layout, CSS, view | .tsx/.jsx/.vue/.css/.html/.svelte |
241
+ | backend | API, server, database, service, algorithm, worker | .go/.rs/.java/.py/.sql/.proto |
242
+ | general | mixed, config, tests, unclear | .ts/.js/other |
243
+
244
+ Resolution: `execution_config.domain_routing[domain]` fallback `domain_routing.default` ("agent").
245
+
246
+ #### Step 3: Task Execution
247
+
248
+ Execute tasks per plan order. Independent tasks may run in parallel.
249
+
250
+ **Agent path:**
251
+ ```
252
+ Spawn Agent with: task definition, acceptance criteria refs, prior task summaries, specs_content
253
+ Agent implements → verifies convergence → auto-fix (max 3) → returns result
254
+ ```
255
+
256
+ **CLI path:**
257
+ ```bash
258
+ maestro delegate "PURPOSE: Implement task ${task_id}: ${title}; success = criteria ${criteria_refs} satisfied
259
+ TASK: ${description} | Read existing code first | Verify convergence criteria after changes
260
+ MODE: write
261
+ CONTEXT: @${scope}/**/* | Criteria: ${criteria_summary}
262
+ EXPECTED: Working code changes, convergence evidence, summary of what was done
263
+ CONSTRAINTS: Scope limited to task files | Follow project specs
264
+
265
+ ## Acceptance Criteria (must satisfy)
266
+ ${criteria_refs.map(ref => criteria[ref].criterion).join('\n')}
267
+
268
+ ## Implementation Steps
269
+ ${task.description}
270
+
271
+ ## Project Specs
272
+ ${specs_content}
273
+
274
+ ## Prior Task Summaries
275
+ ${prior_summaries}
276
+ " --to ${resolved_executor} --mode write --id planex-${slug}-${task_id}
277
+ ```
278
+
279
+ Run with `run_in_background: true`, wait for callback.
280
+
281
+ **Deviation Rule** max 3 auto-fix attempts per task:
282
+ 1. First attempt: normal dispatch
283
+ 2. Retry: `--resume planex-${slug}-${task_id}` with simplified prompt
284
+ 3. Final: fallback to Agent path
285
+ 4. All 3 fail → mark task `blocked`, record checkpoint, continue remaining tasks
286
+
287
+ #### Step 4: Per-Task Evidence
288
+
289
+ Per completed task:
290
+ - Record evidence: `{"phase":"execution","type":"task-completed","task_id":"T1","executor":"agent|agy|...","files_modified":[],"summary":"","attempt":1}`
291
+ - Update task status in session.json plan
292
+
293
+ #### Step 5: Post-Execution Validation
294
+
295
+ **Skip if** `execution_config.verification_tool == "Skip"` OR `--skip-verify` OR no completed tasks.
296
+
297
+ **Check 1: Summary Consistency** — cross-check task status vs actual file changes (git diff).
298
+
299
+ **Check 2: CLI Verification Gate** delegate to external model:
300
+ ```bash
301
+ maestro delegate "PURPOSE: Verify execution output meets acceptance criteria; success = all criteria verified with file:line evidence
302
+ TASK:
303
+ 1. CONVERGENCE: For each criterion, read actual code, verify behavior exists, report status with evidence
304
+ 2. EXISTENCE: Verify all expected files exist on disk
305
+ 3. SUBSTANCE: Verify real implementation — flag stubs, placeholders, TODO-only
306
+ 4. ANTI-PATTERNS: Scan for TODO/FIXME/HACK, console.log debug, disabled tests
307
+ MODE: analysis
308
+ CONTEXT: @${modified_files}
309
+ EXPECTED: JSON { convergence: [{criterion, status, evidence}], issues: [{type, file, line, severity}], overall: passed|gaps_found }
310
+ CONSTRAINTS: Read-only | Check ALL criteria exhaustively | Evidence must be file:line
311
+
312
+ ## Acceptance Criteria (verify each)
313
+ ${acceptance_criteria.map(c => c.criterion).join('\n')}
314
+
315
+ ## Modified Files
316
+ ${modified_files.join('\n')}
317
+ " --to ${execution_config.verification_tool} --mode analysis
318
+ ```
319
+
320
+ Run with `run_in_background: true`, wait for callback.
321
+
322
+ On result:
323
+ - `overall == "passed"` proceed to S_VERIFY with boosted confidence
324
+ - `overall == "gaps_found"` → log findings, proceed to S_VERIFY
325
+
326
+ **Check 3: Code Review** (if `execution_config.code_review_tool != "Skip"`):
327
+ ```bash
328
+ maestro delegate "Review git diff for correctness, style, bugs" --to ${code_review_tool} --mode analysis --rule analysis-review-code-quality
329
+ ```
330
+
331
+ #### Step 6: Completion
332
+
333
+ Update understanding.md section 3. Mark G3 done.
334
+
335
+ Commit: `"odyssey-planex({slug}): EXECUTE — implementation complete"`
336
+
337
+ ### A_VERIFY
338
+
339
+ Iron gateevery acceptance criterion checked objectively.
340
+
341
+ **Verify each criterion by method:**
342
+
343
+ | Method | Action |
344
+ |--------|--------|
345
+ | `test` | Run relevant tests, check pass/fail |
346
+ | `grep` | Grep for expected pattern |
347
+ | `cli-review` | `maestro delegate "PURPOSE: Verify criterion {criterion_id}: {criterion}\nTASK: Read implementation code \| Check behavior matches criterion \| Report pass/fail with file:line evidence\nMODE: analysis\nCONTEXT: @{relevant_files}\nEXPECTED: JSON {criterion_id, status: passed\|failed, evidence: [{file, line, detail}]}" --role review --mode analysis` |
348
+ | `manual` | Normal: ask_user / `-y`: record `deferred` |
349
+
350
+ Record per criterion: `{"phase":"verification","type":"criterion-check","criterion_id":"AC1","method":"","result":"passed|failed","evidence":"","iteration":N}`. Update acceptance_criteria[].status. Append to iterations[].
351
+
352
+ Update understanding.md section 4 with pass/fail table.
353
+
354
+ **Route:** all passed → mark G4 done → next state. Some failed + iteration < max → S_FIX. Some failed + iteration >= max → Normal: ask_user (continue/lower bar/accept) / `-y`: `deferred`, proceed S_RECORD.
355
+
356
+ Commit: `"odyssey-planex({slug}): VERIFY — acceptance check"`
357
+
358
+ ### A_FIX
359
+
360
+ 1. Increment current_iteration
361
+ 2. For each failed criterion: diagnose gap → targeted code fix
362
+ 3. CLI fix review (optional):
363
+ ```bash
364
+ maestro delegate "PURPOSE: Review fixes for failing criteria; success = no regressions and fixes correct
365
+ TASK: Check fix correctness | Verify no regressions on passing criteria | Report verdict with file:line evidence
366
+ MODE: analysis
367
+ CONTEXT: @{modified_files} | Passing: {passing} | Fixed: {fixed}
368
+ EXPECTED: JSON {verdict: passed|concerns_found, regression_risk: low|medium|high, concerns: [{criterion_id, file, line, description}]}
369
+ CONSTRAINTS: Read-only | Check ALL passing criteria for regressions
370
+ " --role review --mode analysis
371
+ ```
372
+ 4. Append evidence (fix), update understanding.md section 5 → S_VERIFY
373
+
374
+ Commit: `"odyssey-planex({slug}): FIX targeted fix for failing criteria"`
375
+
376
+ ### A_GENERALIZE
377
+
378
+ **MANDATORY — executes unless `skip_generalize == true`. "All criteria passed" or context pressure are NOT valid skip reasons.**
379
+
380
+ Pattern source: implementation patterns from executed tasks.
381
+
382
+ **Step 1 3-layer pattern extraction** from implementation:
383
+
384
+ | Layer | Method | Targets |
385
+ |-------|--------|---------|
386
+ | Syntax | Build regex from implementation diffs → Grep | API contract patterns, validation shapes, error response format, config structure |
387
+ | Semantic | Understand implementation pattern → Agent scan | Similar feature needs elsewhere, analogous data flows, parallel business logic |
388
+ | Structural | Find modules with same structure / dependency shape | Parallel module structures, sibling endpoints, same-shape services |
389
+
390
+ Write `session.json.patterns[]`: `[{id, source, layer, signature, description, risk, fix_template, confidence}]`
391
+
392
+ **Thoroughness floor:** ALL 3 layers must be attempted and logged. Each layer records search method, scope, hit count in evidence phase=generalization. "No hits" requires all 3 layers to return 0 with logged evidence.
393
+
394
+ **Step 2 — 4-agent concurrent scan** (single message, 4 Agents):
395
+
396
+ | Agent | Strategy | Scope |
397
+ |-------|----------|-------|
398
+ | Syntax grep | Grep regex from pattern signatures | Full project |
399
+ | Semantic scan | Implementation pattern check | Related modules |
400
+ | Structural match | Find structurally similar modules | Full project |
401
+ | Historical grep | `git log -S` for pattern signatures | Git history |
402
+
403
+ **Step 3 — Cross-layer dedup:** multi-layer hit → boost | single-layer → `needs_review` | historically fixed → `regression_risk`
404
+
405
+ **Step 4 Iterative deepening:** Module with ≥3 hits → targeted deep scan (max 1 round).
406
+
407
+ **Step 5 Persist:** Update understanding.md section 6 + write `session.json.generalization_stats`:
408
+ ```json
409
+ {"patterns_extracted": 0, "total_hits": 0, "cross_layer_confirmed": 0, "regression_risks": 0, "by_layer": {"syntax": 0, "semantic": 0, "structural": 0}, "deepening_triggered": false}
410
+ ```
411
+
412
+ **Transition guard:** `S_GENERALIZE → S_RECORD` requires `by_layer` has entries for all 3 layers with search evidence logged. Mark G5 done.
413
+
414
+ Commit: `"odyssey-planex({slug}): GENERALIZE pattern scan complete"`
415
+
416
+ ### A_DISCOVER
417
+
418
+ **Executes whenever `total_hits > 0`. Cannot be skipped without `skip_generalize == true`.**
419
+
420
+ 1. **Triage** each hit with ±10 lines context classify:
421
+ - `bug` area needing same implementation (missing feature parity)
422
+ - `risk` potential inconsistency or missing pattern application
423
+ - `safe` false positive (must log individual reason blanket "pre-existing" forbidden)
424
+
425
+ 2. **Route (planex-specific — routes to S_EXECUTE, not S_FIX):**
426
+
427
+ | Classification | Action |
428
+ |---------------|--------|
429
+ | needs same implementation | Route to S_EXECUTE with new task, `cross_phase_loops++` |
430
+ | risk + guard addable | Fix directly |
431
+ | risk + complex | Create issue |
432
+ | safe | Skip with logged per-item reason |
433
+
434
+ Normal: ask_user per hit | `-y`: auto-route to execute, create issue for rest
435
+
436
+ 3. **Cross-phase loops:** `loops >= max_loops` → must log per-item reasons, advance to S_RECORD.
437
+
438
+ 4. Append evidence phase=discovery. Update understanding.md section 7. Mark G6 done.
439
+
440
+ Commit: `"odyssey-planex({slug}): DISCOVER — findings classified"`
441
+
442
+ ### A_RECORD
443
+
444
+ 1. Iteration summary: what worked, what needed rework, fix cycle patterns
445
+ 2. understanding.md section 8 — learnings by Knowledge Persistence categories:
446
+ - Multi-round fix cycle pattern → `/spec-add debug`
447
+ - Reusable implementation pattern → `/spec-add coding`
448
+ - Acceptance criteria template → `/spec-add review`
449
+ - Generalization pattern → `/spec-add coding`
450
+
451
+ 3. Mark G7 done. Pending decisions: Normal → ask_user | `-y` → skip (show deferred count).
452
+
453
+ 4. **Goal audit (hardened):**
454
+ - `done` → confirmed
455
+ - `skipped` → confirmed ONLY if corresponding `skip_when` flag is true
456
+ - **Hard rule:** G5 and G6 CANNOT be `skipped` unless `skip_generalize == true`. Pending without flag → `failed` (Normal: ask_user | `-y`: record `failed`)
457
+ - `phase_goals_all_done = true` only when all goals pass this audit
458
+
459
+ 5. `current_state = "COMPLETED"`, emit completion summary.
460
+
461
+ **Completion summary:**
462
+ ```
463
+ --- PLANEX ODYSSEY COMPLETE ---
464
+ Requirement: {requirement}
465
+ Criteria: {passed}/{total} passed
466
+ Iterations: {N} cycles
467
+ Patterns: {patterns_extracted} ({by_layer} distribution)
468
+ Scan hits: {total_hits} ({cross_layer_confirmed} cross-layer confirmed)
469
+ Issues: {N} created | Decisions: {N} resolved, {M} pending, {K} deferred
470
+ Learnings: {N} spec entries
471
+ Self-iter: {N} rounds across {M} stages
472
+ Goals: {done}/{total} confirmed ({skipped} skipped)
473
+ Status: {ALL_PASSED|PARTIAL|ESCALATED}
474
+ ---
475
+ ```
476
+
477
+ Commit: `"odyssey-planex({slug}): RECORD — session summary"`
478
+
479
+ </actions>
480
+
481
+ <appendix>
482
+
483
+ ### `-y` planex-specific points
484
+
485
+ | Decision Point | Normal | `-y` |
486
+ |---------------|--------|------|
487
+ | S_INTAKE criteria confirmation | ask_user | auto-derive, `deferred` |
488
+ | S_EXECUTE execution options | ask_user | use defaults (auto/Skip/Auto), `confirmed: true` |
489
+ | S_EXECUTE task blocked (3 retries) | ask_user: continue or stop | auto continue, log blocked |
490
+ | S_VERIFY manual criterion | ask_user | `deferred` |
491
+ | S_VERIFY max iteration reached | ask_user | auto accept, `deferred` |
492
+ | A_DISCOVER hit routing | ask_user | auto-route to execute, create issue for rest |
493
+
494
+ ### Goal Prompt convergence rules
495
+
496
+ ```
497
+ Exhaustive iteration: until all acceptance_criteria[*].status==passed
498
+ AND phase_goals_all_done=true. Verify failure auto-triggers fix->re-verify loop.
499
+ Each fix round re-verifies; new criterion violations continue fixing within max_iterations.
500
+ No "close enough" — all criteria must ALL pass.
501
+ ```
502
+
503
+ ### Iteration Model
504
+
505
+ ```
506
+ S_EXECUTE → S_VERIFY ──all pass──→ S_GENERALIZE → S_DISCOVER → S_RECORD
507
+ │ │
508
+ some fail + iter < max 3-layer scan, 0 hits ─→ S_RECORD
509
+
510
+ S_FIX ──→ S_VERIFY (loop)
511
+ ```
512
+
513
+ Max iterations (default 3) prevents infinite loops. Each iteration records criteria_before, gaps_fixed, criteria_after.
514
+
515
+ </appendix>
516
+
517
+ </state_machine>
518
+
519
+ <error_codes>
520
+ | Code | Severity | Condition | Recovery |
521
+ |------|----------|-----------|----------|
522
+ | E001 | error | No requirement provided | Provide requirement |
523
+ | W001 | warning | No acceptance criteria derived | Manual definition needed |
524
+ | W002 | warning | Max iterations reached, criteria still failing | Escalate to user |
525
+ | W003 | warning | CLI review regression concern | Review before next iteration |
526
+ | W004 | warning | Generalization 0 hits after full 3-layer scan | Advance to S_RECORD (requires all 3 layers attempted with evidence) |
527
+ </error_codes>
528
+
529
+ <success_criteria>
530
+ - [ ] Requirement parsed with >=1 acceptance criterion (verify_method assigned)
531
+ - [ ] Plan tasks mapped to criteria; execution options confirmed
532
+ - [ ] Tasks dispatched via resolved executor with deviation rule (max 3 retries)
533
+ - [ ] Post-execution validation gate run (unless --skip-verify)
534
+ - [ ] Every criterion verified per method; failing → targeted fix (not re-implementation)
535
+ - [ ] Iteration count tracked and max respected; unfixed criteria individually classified
536
+ - [ ] understanding.md sections 1-8 updated per phase; phase_goals G1-G7 audited
537
+ - [ ] Generalization + discovery completed (unless --skip-generalize)
538
+ - [ ] Quality Gate self-iteration triggered when insufficient
539
+ - [ ] Goal Prompt displayed once after intake; `-y` mode: no blocking prompts
540
+ - [ ] Session resumable via -c; completion summary output
541
+ </success_criteria>
542
+
543
+ <next_step_routing>
544
+ | Condition | Next |
545
+ |-----------|------|
546
+ | All criteria passed | `/odyssey-review-test-fix <changed-files>` |
547
+ | Max iterations, still failing | `/odyssey-debug "<failing criterion>"` |
548
+ | Formal review | `/quality-review <phase>` |
549
+ | Issues from discoveries | `/manage-issue list --source planex-odyssey` |
550
+ | Pattern worth documenting | `/learn-decompose <module>` |
551
+ </next_step_routing>
552
+ </output>