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,254 +14,389 @@ 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
- archaeology → explore → multi-dimensional review → fix ALL findings → confirm → generalize → discover → persist. Zero-residual: every finding gets an action.
21
- </purpose>
22
-
23
- <boundary>
24
- **In scope:** Multi-dimensional deep review of target code → exhaustive fix ALL findings by severity → generalize patterns project-wide.
25
- **Out of scope:** Root cause debug → `/odyssey-debug` | Feature implementation → `/odyssey-planex` | UI visual optimization → `/odyssey-ui`
26
-
27
- **Exploration freedom:** Free within boundary — cross-dimension correlation, git history tracing, project-wide generalization scan. Fix ALL findings within fix_threshold (default: all).
28
- **Zero-residual:** Every finding MUST have a concrete action (fix / issue / decision). "Report and shelve" and "pre-existing skip" are forbidden.
29
- </boundary>
30
-
31
- <context>
32
- $ARGUMENTS
33
-
34
- **Target resolution:**
35
-
36
- | Input | Resolution |
37
- |-------|-----------|
38
- | File/dir path | Review those files |
39
- | `HEAD` / `staged` | `git diff HEAD` / `git diff --staged` |
40
- | Phase number | state.json → changed files |
41
- | PR number | `git diff main...HEAD` |
42
-
43
- **Flags:** `--dimensions <list>` subset of review dimensions | `--fix-threshold <level>` severity cutoff (default: all) | `--skip-fix` skip S_FIX+S_CONFIRM | `--skip-generalize` skip S_GENERALIZE+S_DISCOVER | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
44
-
45
- **Session**: `.workflow/scratch/{YYYYMMDD}-review-odyssey-{slug}/`
46
- **Output**: `session.json` | `evidence.ndjson` | `explore.json` | `understanding.md`
47
-
48
- **session.json review-specific fields:**
49
- ```json
50
- { "target": "", "dimensions": [], "review_result": {"remaining_actionable": 0},
51
- "patterns": [], "confirmation": null, "generalization_stats": null }
52
- ```
53
-
54
- **evidence.ndjson phases:** `archaeology|explore|review|fix|discovery|decision|self-iteration`
55
-
56
- **phase_goals[]:**
57
-
58
- | ID | Goal | done_when | phase | skip_when |
59
- |----|------|-----------|-------|-----------|
60
- | G1 | Review completed | all dimensions reviewed | S_REVIEW | |
61
- | G2 | Explore context | explore.json populated | S_EXPLORE | — |
62
- | G3 | Zero remaining | `remaining_actionable == 0` | S_CONFIRM | skip_fix |
63
- | G4 | Pattern generalized | patterns[] >=1 | S_GENERALIZE | skip_generalize |
64
- | G5 | Discoveries triaged | all hits classified | S_DISCOVER | skip_generalize |
65
- | G6 | Learnings persisted | spec entries or no actionable | S_RECORD | |
66
-
67
- **understanding.md8 sections:**
68
- 1. Target & Scope ← S_INTAKE | 2. Archaeology ← S_ARCHAEOLOGY | 3. Exploration ← S_EXPLORE
69
- 4. Review Results ← S_REVIEW | 5. Fix & Confirmation ← S_FIX+S_CONFIRM
70
- 6. GeneralizationS_GENERALIZE | 7. DiscoveriesS_DISCOVER | 8. LearningsS_RECORD
71
-
72
- Specs: `maestro load --type spec --category review`
73
-
74
- **Knowledge Persistence categories (section 8):**
75
-
76
- | Category | Content | Follow-up |
77
- |----------|---------|-----------|
78
- | Cross-dimension recurring pattern | Pattern + affected dimensions + coding standard | `/spec-add review` |
79
- | Security finding | Vulnerability type + triggers + fix approach | `/spec-add debug` |
80
- | Architecture violation pattern | Violation + correct boundary + verification | `/spec-add arch` |
81
- | Reusable generalization pattern | Signature + risk + fix template + scope | `/spec-add coding` |
82
- </context>
83
-
84
- <invariants>
85
- All invariants defined in base.
86
- </invariants>
87
-
88
- <self_iteration>
89
- Applies to: **S_ARCHAEOLOGY, S_EXPLORE, S_REVIEW, S_FIX, S_GENERALIZE**. Logic in base.
90
- </self_iteration>
91
-
92
- <state_machine>
93
-
94
- <states>
95
- S_INTAKE → S_ARCHAEOLOGY → S_EXPLORE → S_REVIEW → S_FIX → S_CONFIRM → S_GENERALIZE → S_DISCOVER → S_RECORD → END
96
- </states>
97
-
98
- <transitions>
99
- S_INTAKE → S_INTAKE : -c + session found → A_RESUME_SESSION
100
- S_INTAKE → S_ARCHAEOLOGY : target resolved A_INTAKE
101
- S_INTAKE → S_INTAKE : no target ask_user
102
-
103
- S_ARCHAEOLOGY S_EXPLORE : complete
104
- S_EXPLORE → S_REVIEW : complete
105
-
106
- S_REVIEW → S_FIX : !skip_fix AND findings
107
- S_REVIEW → S_GENERALIZE : skip_fix OR no findings, !skip_generalize
108
- S_REVIEW → S_RECORD : both skip
109
-
110
- S_FIX → S_CONFIRM : tier complete
111
- S_CONFIRM → S_GENERALIZE : confirmed, !skip_generalize
112
- S_CONFIRM → S_RECORD : confirmed, skip_generalize
113
- S_CONFIRM S_FIX : needs_rework
114
-
115
- S_GENERALIZE → S_DISCOVER : similar code found
116
- S_GENERALIZE → S_RECORD : no similar code
117
-
118
- S_DISCOVER S_FIX : fixable sibling cross_phase_loops++
119
- S_DISCOVER → S_REVIEW : new target, loops < max_loops → cross_phase_loops++
120
- S_DISCOVER → S_RECORD : remaining_actionable == 0 OR loops >= max_loops
121
- </transitions>
122
-
123
- <actions>
124
-
125
- ### A_INTAKE
126
- 1. Parse target + flags file list. Create SESSION_DIR, derive phase_goals[]
127
- 2. `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + Grep keywords
128
- 3. Write `session.json` + `understanding.md` section 1, emit Goal Prompt
129
-
130
- Commit: `"odyssey-review({slug}): INTAKE parse target and load context"`
131
-
132
- ### A_RESUME_SESSION
133
- Glob latest session read `session.json` jump to `current_state`.
134
-
135
- ### A_ARCHAEOLOGY
136
- 2 parallel Agents: Timeline (`git log --oneline -20 -- {files}`) + Blame (top 3 files `git blame -L {region}`). Evidence phase=archaeology.
137
-
138
- **Error handling:** If any archaeology agent fails (Timeline or Blame), log W003 and proceed with available results. If delegate fails, log W003 and proceed with local agent results only.
139
-
140
- `maestro delegate --role analyze --mode analysis` (`run_in_background: true`):
141
- - PURPOSE: Review recent modifications related to {target}
142
- - EXPECTED: JSON [{commit_sha, risk_level, analysis, could_cause_issue, explanation}]
143
-
144
- Update section 2. Commit: `"odyssey-review({slug}): ARCHAEOLOGY — git history analysis"`
145
-
146
- ### A_EXPLORE
147
- Skip if no CLI tools (W006).
148
-
149
- `maestro delegate --role explore --mode analysis` (`run_in_background: true`):
150
- - PURPOSE: Call chains, recent changes, error gaps, similar patterns
151
- - EXPECTED: JSON {call_chains, recent_changes, error_gaps, similar_patterns}
152
-
153
- Write `explore.json` + evidence phase=explore. Update section 3. Mark G2. Commit: `"odyssey-review({slug}): EXPLORE — codebase exploration"`
154
-
155
- ### A_REVIEW
156
- Spawn N parallel Agents, one per dimension:
157
- - **Correctness**: logic errors, boundary conditions, null/undefined, race conditions
158
- - **Security**: injection, XSS, CSRF, data exposure, auth bypass
159
- - **Performance**: hot paths, N+1, memory leaks, unnecessary recomputation
160
- - **Architecture**: layer violations, circular deps, interface contracts, SoC
161
-
162
- Each returns `[{title, severity, file, line, description, suggestion, cwe}]`. Merge → evidence phase=review. Write `review_result` + section 4 severity matrix. Mark G1.
163
-
164
- Commit: `"odyssey-review({slug}): REVIEW — multi-dimension review complete"`
165
-
166
- ### A_FIX
167
- Exhaustive iterative fix descend by severity until `remaining_actionable == 0`.
168
-
169
- ```
170
- for tier in [critical, high, medium, low].filter(>= threshold):
171
- for each unfixed candidate: read +/-20 lines fix evidence phase=fix
172
- re-review modified area (new findings → append, continue; max 2 per tier)
173
- tier done → auto-commit
174
- ```
175
-
176
- Normal: ask_user per tier. `-y`: auto-fix all.
177
- Remaining > 0 retry (max_fix_rounds = 5). Unchanged 2 rounds classify each individually. After 5 rounds with remaining > 0 → escalate: Normal: ask_user (continue/accept/reclassify) | `-y`: classify remaining as `deferred`, proceed.
178
- Blanket "pre-existing" forbidden.
179
-
180
- Commit per tier: `"odyssey-review({slug}): FIX-{tier} — {N} items fixed"`
181
-
182
- ### A_CONFIRM
183
- Run tests + `maestro delegate --role review --mode analysis` (`run_in_background: true`) for zero-residual review.
184
- - `remaining == 0 AND new == 0` → confirmed, mark G3
185
- - Otherwise → needs_rework → S_FIX
186
-
187
- Update `confirmation` + `remaining_actionable` + section 5.
188
-
189
- Commit: `"odyssey-review({slug}): CONFIRM zero-residual verified"`
190
-
191
- ### A_GENERALIZE, A_DISCOVER, A_RECORD
192
- Base shared_actions. Review overrides:
193
- - **A_GENERALIZE** pattern source: findings with severity >= medium
194
- - **A_RECORD** learnings per Knowledge Persistence table
195
-
196
- **Completion summary:**
197
- ```
198
- --- REVIEW-TEST-FIX ODYSSEY COMPLETE ---
199
- Target: {target} Dimensions: {dims}
200
- Findings: {C}C {H}H {M}M {L}L Fix: {fixed}, confirmed={yes|skip}
201
- Patterns: {N} ({by_layer}) Scan hits: {total} ({cross} cross-layer)
202
- Issues: {N} created
203
- Decisions: {N} resolved, {M} pending, {K} deferred
204
- Learnings: {N} persisted
205
- Self-iter: {N} rounds across {M} stages
206
- Goals: {done}/{total} ({skipped} skipped)
207
- ---
208
- ```
209
-
210
- </actions>
211
-
212
- <appendix>
213
-
214
- ### `-y` review-specific points
215
-
216
- | Decision Point | Normal | `-y` |
217
- |---------------|--------|------|
218
- | S_FIX tier candidates | ask_user | auto-fix, deferred |
219
- | S_FIX re-review new findings | ask_user | auto-append |
220
- | S_CONFIRM needs_rework | Display → S_FIX | auto proceed |
221
-
222
- ### Goal Prompt convergence rules
223
-
224
- ```
225
- Stop when remaining_actionable == 0, confirmation == confirmed,
226
- generalization exhausted, phase_goals_all_done=true.
227
- Fix iterates by severity tier; each tier re-reviews modified area, new findings appended.
228
- Every finding must have action (fix/issue/decision). Decision pending must ask_user.
229
- ```
230
-
231
- </appendix>
232
-
233
- </state_machine>
234
-
235
- <error_codes>
236
- | Code | Severity | Condition | Recovery |
237
- |------|----------|-----------|----------|
238
- | E001 | error | No target specified | Provide target |
239
- | E002 | error | Target path not found | Check path |
240
- | W001 | warning | No git history | Proceed |
241
- | W002 | warning | Some dimension agents failed | Partial coverage |
242
- | W003 | warning | Archaeology agent or delegate failure | Proceed with available results |
243
- </error_codes>
244
-
245
- <success_criteria>
246
- - [ ] Session + 4 output files + prior knowledge searched
247
- - [ ] Archaeology + CLI review → evidence phase=archaeology
248
- - [ ] CLI exploration explore.json + evidence phase=explore
249
- - [ ] All dimensions reviewed, ALL findings fixed (remaining_actionable == 0)
250
- - [ ] Per-tier re-review gate; every unfixed finding individually classified
251
- - [ ] understanding.md sections 1-8 progressive
252
- - [ ] Fix + confirmed (unless --skip-fix)
253
- - [ ] Generalization + scan (unless --skip-generalize)
254
- - [ ] Discoveries classified; unfixed findings individually justified
255
- - [ ] phase_goals G1-G6 audited, Goal Prompt once, `-y` no blocking, -c resumable
256
- - [ ] Completion summary
257
- </success_criteria>
258
-
259
- <next_step_routing>
260
- | Condition | Next |
261
- |-----------|------|
262
- | Deeper debug needed | `/odyssey-debug "<finding>"` |
263
- | Issues created | `/manage-issue list --source review-odyssey` |
264
- | Document pattern | `/learn-decompose <module>` |
265
- | Plan fixes | `/maestro-plan --gaps` |
266
- </next_step_routing>
267
- </output>
17
+ <base>@~/.maestro/workflows/odyssey-base.md</base>
18
+
19
+ <purpose>
20
+ archaeology → explore → multi-dimensional review → fix ALL findings → confirm → generalize → discover → persist. Zero-residual: every finding gets an action.
21
+ </purpose>
22
+
23
+ <boundary>
24
+ **In scope:** Multi-dimensional deep review of target code → exhaustive fix ALL findings by severity → generalize patterns project-wide.
25
+ **Out of scope:** Root cause debug → `/odyssey-debug` | Feature implementation → `/odyssey-planex` | UI visual optimization → `/odyssey-ui`
26
+
27
+ **Exploration freedom:** Free within boundary — cross-dimension correlation, git history tracing, project-wide generalization scan. Fix ALL findings within fix_threshold (default: all).
28
+ **Zero-residual:** Every finding MUST have a concrete action (fix / issue / decision). "Report and shelve" and "pre-existing skip" are forbidden.
29
+ </boundary>
30
+
31
+ <context>
32
+ $ARGUMENTS
33
+
34
+ **Target resolution:**
35
+
36
+ | Input | Resolution |
37
+ |-------|-----------|
38
+ | File/dir path | Review those files |
39
+ | `HEAD` / `staged` | `git diff HEAD` / `git diff --staged` |
40
+ | Phase number | state.json → changed files |
41
+ | PR number | `git diff main...HEAD` |
42
+
43
+ **Flags:** `--dimensions <list>` subset of review dimensions | `--fix-threshold <level>` severity cutoff (default: all) | `--skip-fix` skip S_FIX+S_CONFIRM | `--skip-generalize` skip S_GENERALIZE+S_DISCOVER | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
44
+
45
+ **Session**: `.workflow/scratch/{YYYYMMDD}-review-odyssey-{slug}/`
46
+ **Output**: `session.json` | `evidence.ndjson` | `explore.json` | `understanding.md`
47
+
48
+ **Output boundary**: ALL session artifacts MUST target the session directory (`.workflow/scratch/{YYYYMMDD}-review-odyssey-{slug}/`) or `.workflow/state.json` only. Source code modifications during S_FIX are in-scope but MUST be committed per action. NEVER write session artifacts outside these paths.
49
+
50
+ **session.json review-specific fields:**
51
+ ```json
52
+ { "target": "", "dimensions": [], "review_result": {"remaining_actionable": 0},
53
+ "patterns": [], "confirmation": null, "generalization_stats": null }
54
+ ```
55
+
56
+ **evidence.ndjson phases:** `archaeology|explore|review|fix|discovery|decision|self-iteration`
57
+
58
+ **phase_goals[]:**
59
+
60
+ | ID | Goal | done_when | phase | skip_when |
61
+ |----|------|-----------|-------|-----------|
62
+ | G1 | Review completed | all dimensions reviewed | S_REVIEW | |
63
+ | G2 | Explore context | explore.json populated | S_EXPLORE | |
64
+ | G3 | Zero remaining | `remaining_actionable == 0` | S_CONFIRM | skip_fix |
65
+ | G4 | Pattern generalized | patterns[] >=1 | S_GENERALIZE | skip_generalize |
66
+ | G5 | Discoveries triaged | all hits classified | S_DISCOVER | skip_generalize |
67
+ | G6 | Learnings persisted | spec entries or no actionable | S_RECORD | |
68
+
69
+ **understanding.md 8 sections:**
70
+ 1. Target & Scope S_INTAKE | 2. ArchaeologyS_ARCHAEOLOGY | 3. ExplorationS_EXPLORE
71
+ 4. Review Results ← S_REVIEW | 5. Fix & Confirmation ← S_FIX+S_CONFIRM
72
+ 6. Generalization S_GENERALIZE | 7. Discoveries ← S_DISCOVER | 8. Learnings ← S_RECORD
73
+
74
+ Specs: `maestro load --type spec --category review`
75
+
76
+ **Knowledge Persistence categories (section 8):**
77
+
78
+ | Category | Content | Follow-up |
79
+ |----------|---------|-----------|
80
+ | Cross-dimension recurring pattern | Pattern + affected dimensions + coding standard | `/spec-add review` |
81
+ | Security finding | Vulnerability type + triggers + fix approach | `/spec-add debug` |
82
+ | Architecture violation pattern | Violation + correct boundary + verification | `/spec-add arch` |
83
+ | Reusable generalization pattern | Signature + risk + fix template + scope | `/spec-add coding` |
84
+ </context>
85
+
86
+ <invariants>
87
+ All invariants defined in base.
88
+ 6. **Generalize is mandatory** — S_GENERALIZE and S_DISCOVER execute unless `skip_generalize == true`. "Zero remaining" or context pressure are NOT valid reasons to skip. The phase itself determines whether patterns exist.
89
+ </invariants>
90
+
91
+ <self_iteration>
92
+ Applies to: **S_ARCHAEOLOGY, S_EXPLORE, S_REVIEW, S_FIX, S_GENERALIZE**. Logic in base.
93
+ </self_iteration>
94
+
95
+ <execution>
96
+ Follow base execution discipline completely. Actions defined in state_machine below.
97
+
98
+ ### Phase Gates (MANDATORY, BLOCKING)
99
+
100
+ **GATE 1: INTAKEARCHAEOLOGY**
101
+ - REQUIRED: Target resolved to file list, SESSION_DIR created, session.json initialized.
102
+ - REQUIRED: phase_goals[] derived from flags, understanding.md §1 written.
103
+ - BLOCKED if: no target specified (E001) or target path not found (E002).
104
+
105
+ **GATE 2: ARCHAEOLOGY → EXPLORE**
106
+ - REQUIRED: Git history analysis completed (timeline + blame agents), evidence phase=archaeology logged.
107
+ - REQUIRED: understanding.md §2 updated.
108
+ - BLOCKED if: both archaeology agents failed AND delegate failed (partial results via W003 are acceptable).
109
+
110
+ **GATE 3: EXPLORE → REVIEW**
111
+ - REQUIRED: explore.json written with call_chains/recent_changes/error_gaps/similar_patterns (or W006 skip logged).
112
+ - REQUIRED: Evidence phase=explore logged, understanding.md §3 updated, G2 marked done.
113
+ - BLOCKED if: exploration started but not completed (W006 skip is acceptable, incomplete is not).
114
+
115
+ **GATE 4: REVIEW FIX**
116
+ - REQUIRED: All dimension agents completed, findings merged with severity classification.
117
+ - REQUIRED: review_result written to session.json, understanding.md §4 with severity matrix, G1 marked done.
118
+ - BLOCKED if: zero dimensions reviewed (W002 partial is allowed, zero is not).
119
+
120
+ **GATE 5: FIX CONFIRM**
121
+ - REQUIRED: Current severity tier fully addressed — all findings in tier fixed or individually classified.
122
+ - REQUIRED: Per-fix evidence phase=fix logged, auto-commit per tier.
123
+ - BLOCKED if: tier incomplete — no partial tier advancement.
124
+
125
+ **GATE 6: CONFIRM → GENERALIZE**
126
+ - REQUIRED: Tests pass, remaining_actionable == 0, new findings == 0.
127
+ - REQUIRED: confirmation written, understanding.md §5 updated, G3 marked done.
128
+ - BLOCKED if: needs_rework route back to S_FIX.
129
+
130
+ **GATE 7: GENERALIZE DISCOVER**
131
+ - REQUIRED: ALL 3 layers (syntax/semantic/structural) attempted with evidence logged.
132
+ - REQUIRED: generalization_stats written with by_layer entries for all 3 layers, G4 marked done.
133
+ - BLOCKED if: any layer not attempted (thoroughness floor violation).
134
+
135
+ **GATE 8: DISCOVER → RECORD**
136
+ - REQUIRED: All hits triaged with per-item classification and reason.
137
+ - REQUIRED: remaining_actionable == 0 OR loops >= max_loops with per-item reasons logged.
138
+ - REQUIRED: G5 marked done.
139
+ - BLOCKED if: unclassified hits remain.
140
+
141
+ </execution>
142
+
143
+ <state_machine>
144
+
145
+ <states>
146
+ S_INTAKE → S_ARCHAEOLOGY → S_EXPLORE → S_REVIEW → S_FIX → S_CONFIRM → S_GENERALIZE → S_DISCOVER → S_RECORD → END
147
+ </states>
148
+
149
+ <transitions>
150
+ S_INTAKE → S_INTAKE : -c + session found A_RESUME_SESSION
151
+ S_INTAKE → S_ARCHAEOLOGY : target resolved A_INTAKE
152
+ S_INTAKE → S_INTAKE : no target → ask_user
153
+
154
+ S_ARCHAEOLOGY → S_EXPLORE : complete
155
+ S_EXPLORE → S_REVIEW : complete
156
+
157
+ S_REVIEW → S_FIX : !skip_fix AND findings
158
+ S_REVIEW → S_GENERALIZE : skip_fix OR no findings, !skip_generalize
159
+ S_REVIEW → S_RECORD : both skip
160
+
161
+ S_FIX → S_CONFIRM : tier complete
162
+ S_CONFIRM S_GENERALIZE : confirmed, !skip_generalize
163
+ S_CONFIRM → S_RECORD : confirmed, skip_generalize
164
+ S_CONFIRM → S_FIX : needs_rework
165
+
166
+ S_GENERALIZE → S_DISCOVER : similar code found
167
+ S_GENERALIZE S_RECORD : all 3 layers scanned with evidence, total_hits == 0
168
+
169
+ S_DISCOVER → S_FIX : fixable sibling → cross_phase_loops++
170
+ S_DISCOVER S_REVIEW : new target, loops < max_loops → cross_phase_loops++
171
+ S_DISCOVER S_RECORD : remaining_actionable == 0 OR loops >= max_loops
172
+ </transitions>
173
+
174
+ <actions>
175
+
176
+ ### A_INTAKE
177
+ 1. Parse target + flagsfile list. Create SESSION_DIR, derive phase_goals[]
178
+ 2. `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + Grep keywords
179
+ 3. Write `session.json` + `understanding.md` section 1, emit Goal Prompt
180
+
181
+ Commit: `"odyssey-review({slug}): INTAKE — parse target and load context"`
182
+
183
+ ### A_RESUME_SESSION
184
+ Glob latest session read `session.json`jump to `current_state`.
185
+
186
+ ### A_ARCHAEOLOGY
187
+ 2 parallel Agents: Timeline (`git log --oneline -20 -- {files}`) + Blame (top 3 files `git blame -L {region}`). Evidence phase=archaeology.
188
+
189
+ **Error handling:** If any archaeology agent fails (Timeline or Blame), log W003 and proceed with available results. If delegate fails, log W003 and proceed with local agent results only.
190
+
191
+ `maestro delegate --role analyze --mode analysis` (`run_in_background: true`):
192
+ - PURPOSE: Review recent modifications related to {target}
193
+ - EXPECTED: JSON [{commit_sha, risk_level, analysis, could_cause_issue, explanation}]
194
+
195
+ Update section 2. Commit: `"odyssey-review({slug}): ARCHAEOLOGY — git history analysis"`
196
+
197
+ ### A_EXPLORE
198
+ Skip if no CLI tools (W006).
199
+
200
+ `maestro delegate --role explore --mode analysis` (`run_in_background: true`):
201
+ - PURPOSE: Call chains, recent changes, error gaps, similar patterns
202
+ - EXPECTED: JSON {call_chains, recent_changes, error_gaps, similar_patterns}
203
+
204
+ Write `explore.json` + evidence phase=explore. Update section 3. Mark G2. Commit: `"odyssey-review({slug}): EXPLORE — codebase exploration"`
205
+
206
+ ### A_REVIEW
207
+ Spawn N parallel Agents, one per dimension:
208
+ - **Correctness**: logic errors, boundary conditions, null/undefined, race conditions
209
+ - **Security**: injection, XSS, CSRF, data exposure, auth bypass
210
+ - **Performance**: hot paths, N+1, memory leaks, unnecessary recomputation
211
+ - **Architecture**: layer violations, circular deps, interface contracts, SoC
212
+
213
+ Each returns `[{title, severity, file, line, description, suggestion, cwe}]`. Merge → evidence phase=review. Write `review_result` + section 4 severity matrix. Mark G1.
214
+
215
+ Commit: `"odyssey-review({slug}): REVIEW — multi-dimension review complete"`
216
+
217
+ ### A_FIX
218
+ Exhaustive iterative fix descend by severity until `remaining_actionable == 0`.
219
+
220
+ ```
221
+ for tier in [critical, high, medium, low].filter(>= threshold):
222
+ for each unfixed candidate: read +/-20 lines → fix → evidence phase=fix
223
+ re-review modified area (new findings → append, continue; max 2 per tier)
224
+ tier done → auto-commit
225
+ ```
226
+
227
+ Normal: ask_user per tier. `-y`: auto-fix all.
228
+ Remaining > 0 retry (max_fix_rounds = 5). Unchanged 2 rounds → classify each individually. After 5 rounds with remaining > 0 → escalate: Normal: ask_user (continue/accept/reclassify) | `-y`: classify remaining as `deferred`, proceed.
229
+ Blanket "pre-existing" forbidden.
230
+
231
+ Commit per tier: `"odyssey-review({slug}): FIX-{tier} — {N} items fixed"`
232
+
233
+ ### A_CONFIRM
234
+ Run tests + `maestro delegate --role review --mode analysis` (`run_in_background: true`) for zero-residual review.
235
+ - `remaining == 0 AND new == 0` → confirmed, mark G3
236
+ - Otherwise needs_rework S_FIX
237
+
238
+ Update `confirmation` + `remaining_actionable` + section 5.
239
+
240
+ Commit: `"odyssey-review({slug}): CONFIRM zero-residual verified"`
241
+
242
+ ### A_GENERALIZE
243
+
244
+ **MANDATORY — executes unless `skip_generalize == true`. Prior-phase convergence, "zero remaining," or context pressure are NOT valid skip reasons.**
245
+
246
+ Pattern source: review findings with severity >= medium.
247
+
248
+ **Step 1 3-layer pattern extraction** from confirmed findings:
249
+
250
+ | Layer | Method | Targets |
251
+ |-------|--------|---------|
252
+ | Syntax | Build regex from fix diffs → Grep | Unchecked return values, deprecated API calls, missing type assertion, unhandled await |
253
+ | Semantic | Understand anti-pattern per dimension Agent scan | Logic inversion in edge case, unhandled rejection, incomplete state machine transition |
254
+ | Structural | Find files with same handler/validator shape | Similar route handlers, parallel DTO validators, analogous test fixtures |
255
+
256
+ Write `session.json.patterns[]`: `[{id, source, layer, signature, description, risk, fix_template, confidence}]`
257
+
258
+ **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.
259
+
260
+ **Step 2 4-agent concurrent scan** (single message, 4 Agents):
261
+
262
+ | Agent | Strategy | Scope |
263
+ |-------|----------|-------|
264
+ | Syntax grep | Grep regex from pattern signatures | Full project |
265
+ | Semantic scan | Per-dimension anti-pattern check | Related modules |
266
+ | Structural match | Find structurally similar files | Full project |
267
+ | Historical grep | `git log -S` for pattern signatures | Git history |
268
+
269
+ **Step 3 — Cross-layer dedup:** multi-layer hit → boost | single-layer → `needs_review` | historically fixed → `regression_risk`
270
+
271
+ **Step 4 — Iterative deepening:** Module with ≥3 hits → targeted deep scan (max 1 round).
272
+
273
+ **Step 5 — Persist:** Update understanding.md section 6 + write `session.json.generalization_stats`:
274
+ ```json
275
+ {"patterns_extracted": 0, "total_hits": 0, "cross_layer_confirmed": 0, "regression_risks": 0, "by_layer": {"syntax": 0, "semantic": 0, "structural": 0}, "deepening_triggered": false}
276
+ ```
277
+
278
+ **Transition guard:** `S_GENERALIZE → S_RECORD` requires `by_layer` has entries for all 3 layers with search evidence logged. Mark G4 done.
279
+
280
+ Commit: `"odyssey-review({slug}): GENERALIZE — pattern scan complete"`
281
+
282
+ ### A_DISCOVER
283
+
284
+ **Executes whenever `total_hits > 0`. Cannot be skipped without `skip_generalize == true`.**
285
+
286
+ 1. **Triage** each hit with ±10 lines context → classify:
287
+ - `bug` — same defect pattern confirmed in sibling code
288
+ - `risk` — potential issue needing guard
289
+ - `safe` — false positive (must log individual reason — blanket "pre-existing" forbidden)
290
+
291
+ 2. **Route:**
292
+
293
+ | Classification | Action |
294
+ |---------------|--------|
295
+ | fixable sibling | Immediate fix → back to S_FIX, `cross_phase_loops++` |
296
+ | new target needing review | Route to S_REVIEW, `cross_phase_loops++` |
297
+ | risk + guard addable | Fix directly |
298
+ | risk + complex | Create issue |
299
+ | safe | Skip with logged per-item reason |
300
+
301
+ Normal: ask_user per hit | `-y`: auto-fix with template, create issue for rest
302
+
303
+ 3. **Cross-phase loops:** `loops >= max_loops` → must log per-item reasons, advance to S_RECORD.
304
+
305
+ 4. Append evidence phase=discovery. Update understanding.md section 7. Mark G5 done.
306
+
307
+ Commit: `"odyssey-review({slug}): DISCOVER — sibling triage complete"`
308
+
309
+ ### A_RECORD
310
+
311
+ 1. Finalize understanding.md section 8 — learnings by Knowledge Persistence categories:
312
+ - Cross-dimension recurring pattern → `/spec-add review`
313
+ - Security finding → `/spec-add debug`
314
+ - Architecture violation pattern → `/spec-add arch`
315
+ - Reusable generalization pattern → `/spec-add coding`
316
+
317
+ 2. Mark G6 done. Pending decisions: Normal → ask_user | `-y` → skip (show deferred count).
318
+
319
+ 3. **Goal audit (hardened):**
320
+ - `done` → confirmed
321
+ - `skipped` → confirmed ONLY if corresponding `skip_when` flag is true
322
+ - **Hard rule:** G4 and G5 CANNOT be `skipped` unless `skip_generalize == true`. Pending without flag → `failed` (Normal: ask_user | `-y`: record `failed`)
323
+ - `phase_goals_all_done = true` only when all goals pass this audit
324
+
325
+ 4. `current_state = "COMPLETED"`, emit completion summary.
326
+
327
+ **Completion summary:**
328
+ ```
329
+ --- REVIEW-TEST-FIX ODYSSEY COMPLETE ---
330
+ Target: {target} Dimensions: {dims}
331
+ Findings: {C}C {H}H {M}M {L}L Fix: {fixed}, confirmed={yes|skip}
332
+ Patterns: {N} ({by_layer}) Scan hits: {total} ({cross} cross-layer)
333
+ Issues: {N} created
334
+ Decisions: {N} resolved, {M} pending, {K} deferred
335
+ Learnings: {N} persisted
336
+ Self-iter: {N} rounds across {M} stages
337
+ Goals: {done}/{total} ({skipped} skipped)
338
+ ---
339
+ ```
340
+
341
+ Commit: `"odyssey-review({slug}): RECORD — summary and knowledge persistence"`
342
+
343
+ </actions>
344
+
345
+ <appendix>
346
+
347
+ ### `-y` review-specific points
348
+
349
+ | Decision Point | Normal | `-y` |
350
+ |---------------|--------|------|
351
+ | S_FIX tier candidates | ask_user | auto-fix, deferred |
352
+ | S_FIX re-review new findings | ask_user | auto-append |
353
+ | S_CONFIRM needs_rework | Display → S_FIX | auto proceed |
354
+ | A_DISCOVER hit routing | ask_user | auto-fix with template, create issue for rest |
355
+
356
+ ### Goal Prompt convergence rules
357
+
358
+ ```
359
+ Stop when remaining_actionable == 0, confirmation == confirmed,
360
+ generalization exhausted, phase_goals_all_done=true.
361
+ Fix iterates by severity tier; each tier re-reviews modified area, new findings appended.
362
+ Every finding must have action (fix/issue/decision). Decision pending must ask_user.
363
+ ```
364
+
365
+ </appendix>
366
+
367
+ </state_machine>
368
+
369
+ <error_codes>
370
+ | Code | Severity | Condition | Recovery |
371
+ |------|----------|-----------|----------|
372
+ | E001 | error | No target specified | Provide target |
373
+ | E002 | error | Target path not found | Check path |
374
+ | W001 | warning | No git history | Proceed |
375
+ | W002 | warning | Some dimension agents failed | Partial coverage |
376
+ | W003 | warning | Archaeology agent or delegate failure | Proceed with available results |
377
+ | W004 | warning | Generalization 0 hits after full 3-layer scan | Advance to S_RECORD (requires all 3 layers attempted with evidence) |
378
+ </error_codes>
379
+
380
+ <success_criteria>
381
+ - [ ] Session + 4 output files + prior knowledge searched
382
+ - [ ] Archaeology + CLI review → evidence phase=archaeology
383
+ - [ ] CLI exploration → explore.json + evidence phase=explore
384
+ - [ ] All dimensions reviewed, ALL findings fixed (remaining_actionable == 0)
385
+ - [ ] Per-tier re-review gate; every unfixed finding individually classified
386
+ - [ ] understanding.md sections 1-8 progressive
387
+ - [ ] Fix + confirmed (unless --skip-fix)
388
+ - [ ] Generalization + scan (unless --skip-generalize)
389
+ - [ ] Discoveries classified; unfixed findings individually justified
390
+ - [ ] phase_goals G1-G6 audited, Goal Prompt once, `-y` no blocking, -c resumable
391
+ - [ ] Completion summary
392
+ </success_criteria>
393
+
394
+ <next_step_routing>
395
+ | Condition | Next |
396
+ |-----------|------|
397
+ | Deeper debug needed | `/odyssey-debug "<finding>"` |
398
+ | Issues created | `/manage-issue list --source review-odyssey` |
399
+ | Document pattern | `/learn-decompose <module>` |
400
+ | Plan fixes | `/maestro-plan --gaps` |
401
+ </next_step_routing>
402
+ </output>