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,284 +14,420 @@ allowed-tools:
14
14
  - view_file
15
15
  - write_to_file
16
16
  ---
17
- <base>@~/.maestro/workflows/odyssey-base.md</base>
18
-
19
- <purpose>
20
- survey → 6-dimension audit → diagnose → fix → verify → generalize → discover → persist.
21
- Exhaustive iteration until zero remaining actionable findings.
22
- </purpose>
23
-
24
- <boundary>
25
- **In scope:** Runtime quality improvement — performance/security/architecture/reliability/observability/maintainability audit → diagnose → fix → generalize.
26
- **Out of scope:** UI visual → `/odyssey-ui` | New features → `/odyssey-planex` | Single bug → `/odyssey-debug` | Style review → `/odyssey-review-test-fix`
27
- **Exploration freedom:** Free exploration within boundary — profiling, security scanning, architecture analysis, dependency audit.
28
- **Zero-residual:** Every finding MUST have a concrete action (fix / issue / decision). "Report and shelve" is not allowed. "Pre-existing issue" is not a valid skip reason.
29
- </boundary>
30
-
31
- <context>
32
- $ARGUMENTS
33
-
34
- **Target resolution:**
35
- | Input | Resolution |
36
- |-------|-----------|
37
- | Module/dir path | Audit that module |
38
- | `HEAD` / `staged` | Review changes in diff |
39
- | Feature area keyword | Resolve to related files |
40
- | `--all` | Full project scan (use with caution) |
41
-
42
- **Flags:** `--dimensions <list>` dimension subset | `--fix-threshold <severity>` fix cutoff (default: all) | `--skip-fix` audit+diagnose only | `--skip-generalize` skip S_GENERALIZE+S_DISCOVER | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
43
-
44
- **Dimensions (6):**
45
- 1. **performance** — hot paths, N+1 queries, memory allocation, cache efficiency, bundle size, lazy loading
46
- 2. **security** — OWASP Top 10, injection, auth bypass, data exposure, dependency vulnerabilities, secrets
47
- 3. **architecture** — layer violations, circular dependencies, coupling metrics, interface contracts, SRP violations
48
- 4. **reliability** — error handling gaps, retry logic, timeout handling, graceful degradation, resource cleanup
49
- 5. **observability** — logging coverage, metric gaps, trace propagation, error reporting, health checks
50
- 6. **maintainability** — code complexity (cyclomatic), dead code, test coverage gaps, documentation debt
51
-
52
- **Session**: `.workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`
53
- **Output**: `session.json` | `evidence.ndjson` | `understanding.md`
54
-
55
- **session.json improve-specific fields:**
56
- ```json
57
- { "target": "", "dimensions": [], "baseline_metrics": {},
58
- "audit_result": {}, "diagnoses": [], "confirmation": null,
59
- "generalization_stats": null }
60
- ```
61
-
62
- **evidence.ndjson phases:** `survey|audit|diagnosis|fix|discovery|decision|self-iteration`
63
- - `survey`: `category` (dependency|complexity|coverage|error_pattern), `detail`
64
- - `audit`: `dimension`, `severity`, `measurement`
65
- - `diagnosis`: `finding_ref`, `hypothesis`, `result` (confirmed|disproved|inconclusive), `root_cause`
66
- - `fix`: `finding_ref`, `change_summary`, `risk`
67
- - `discovery`: `file`, `line`, `classification` (safe|risk|issue), `action` (fix|issue|decision|skip)
68
- - `decision`: `question`, `options`, `context`, `status` (pending|resolved|deferred), `resolution`
69
- - `self-iteration`: `stage`, `round`, `assessment`, `expansion`
70
-
71
- **phase_goals[]:**
72
-
73
- | ID | Goal | Phase | skip_when |
74
- |----|------|-------|-----------|
75
- | G1 | Survey completed | S_SURVEY | |
76
- | G2 | Audit completed | S_AUDIT | — |
77
- | G3 | Diagnosis completed | S_DIAGNOSE | — |
78
- | G4 | Zero remaining: all findings fixed and verified | S_VERIFY | skip_fix |
79
- | G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
80
- | G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
81
- | G7 | Learnings persisted | S_RECORD | |
82
-
83
- **understanding.md9 sections:**
84
- 1. Target & Baseline ← S_INTAKE | 2. Current State Survey ← S_SURVEY | 3. Audit Findings ← S_AUDIT
85
- 4. Root Cause Diagnosis ← S_DIAGNOSE | 5. Fix & Verification ← S_FIX+S_VERIFY
86
- 6. GeneralizationS_GENERALIZE | 7. DiscoveriesS_DISCOVER
87
- 8. Improvement MetricsS_RECORD (before/after) | 9. Engineering LearningsS_RECORD
88
-
89
- **Knowledge Persistence categories (§9):**
90
-
91
- | Category | Content | Follow-up |
92
- |----------|---------|-----------|
93
- | Performance pattern | Bottleneck type + fix approach + measurement method | `/spec-add coding` |
94
- | Security rule | Vulnerability class + fix + prevention method | `/spec-add debug` |
95
- | Architecture constraint | Violation description + correct boundary + check method | `/spec-add arch` |
96
- | Reliability pattern | Failure mode + handling strategy + verification method | `/spec-add coding` |
97
- </context>
98
-
99
- <invariants>
100
- All invariants (evidence append-only, session-as-state, phase goal tracking, auto-commit, zero-residual) defined in base.
101
- </invariants>
102
-
103
- <self_iteration>
104
- Applies to: **S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE**. Logic in base.
105
- </self_iteration>
106
-
107
- <state_machine>
108
-
109
- <states>
110
- S_INTAKE → S_SURVEY → S_AUDIT → S_DIAGNOSE → S_FIX → S_VERIFY → S_GENERALIZE → S_DISCOVER → S_RECORD → END
111
- </states>
112
-
113
- <transitions>
114
- S_INTAKE → S_INTAKE : -c + session found → A_RESUME
115
- S_INTAKE → S_SURVEY : target resolved A_INTAKE
116
- S_INTAKE → S_INTAKE : no target ask_question
117
-
118
- S_SURVEY → S_AUDIT : complete
119
-
120
- S_AUDIT → S_DIAGNOSE : critical/high findings exist
121
- S_AUDIT → S_GENERALIZE : no critical/high, !skip_generalize
122
- S_AUDIT → S_RECORD : no findings OR skip_generalize
123
-
124
- S_DIAGNOSE → S_FIX : root causes identified, !skip_fix
125
- S_DIAGNOSE → S_GENERALIZE : root causes identified, skip_fix, !skip_generalize
126
- S_DIAGNOSE → S_RECORD : root causes identified, skip_fix, skip_generalize
127
- S_DIAGNOSE → S_DIAGNOSE : hypotheses failed, retries < 3 A_ESCALATE_DIAGNOSIS
128
- S_DIAGNOSE S_RECORD : retries >= 3 INCONCLUSIVE
129
-
130
- S_FIX → S_VERIFY : fix implemented
131
-
132
- S_VERIFY → S_GENERALIZE : verified, !skip_generalize
133
- S_VERIFY S_RECORD : verified, skip_generalize
134
- S_VERIFY → S_FIX : needs_rework
135
-
136
- S_GENERALIZES_DISCOVER : hits found
137
- S_GENERALIZE → S_RECORD : no hits
138
-
139
- S_DISCOVER → S_DIAGNOSE : new critical issue → cross_phase_loops++
140
- S_DISCOVER → S_FIX : same-pattern fix, !skip_fix cross_phase_loops++
141
- S_DISCOVER → S_RECORD : remaining_actionable == 0
142
- S_DISCOVER → S_RECORD : loops >= max_loops MUST log per-item reasons
143
-
144
- S_RECORD → END : complete
145
- </transitions>
146
-
147
- <actions>
148
-
149
- ### A_INTAKE
150
- 1. Parse arguments: target description, flags, `--dimensions` subset
151
- 2. Generate slug, create `SESSION_DIR`
152
- 3. Search: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load coding/debug
153
- 4. **Baseline capture**: Record current metrics (test pass rate, bundle size, dependency count, complexity hotspots) to `session.json.baseline_metrics`
154
- 5. Derive `phase_goals[]` from flags
155
- 6. Write `session.json` + `understanding.md` §1, emit Goal Prompt
156
-
157
- Commit: `"odyssey-improve({slug}): INTAKE — parse target and capture baseline"`
158
-
159
- ### A_RESUME
160
- Glob latest session → read `session.json` → display summary → jump to `current_state`.
161
-
162
- ### A_SURVEY
163
- Current state survey — understand what exists before proposing changes.
164
-
165
- 1. Dependency audit (package.json/lock), complexity scan (size/nesting), test coverage map, error handling scan (empty catch, unhandled promise)
166
- 2. **CLI-assisted** (optional): `maestro delegate --role analyze --mode analysis` for dependency health, complexity hotspots, coverage gaps, error patterns. Execute `run_in_background: true`.
167
- 3. Evidence phase=survey. Update §2. Mark G1.
168
-
169
- Commit: `"odyssey-improve({slug}): SURVEY — current state analysis"`
170
-
171
- ### A_AUDIT
172
- Spawn 6 parallel Agents (one per dimension, or `--dimensions` subset).
173
- Each returns: `[{title, severity, dimension, file, line, description, suggestion, measurement}]`
174
-
175
- Mergeevidence phase=audit. Write `session.json.audit_result`.
176
- Update §3 (findings by dimension + severity matrix). Mark G2.
177
-
178
- Commit: `"odyssey-improve({slug}): AUDIT multi-dimension review"`
179
-
180
- ### A_DIAGNOSE
181
- Root cause analysis for critical/high findings — don't fix symptoms.
182
-
183
- 1. Group by dimension, prioritize by severity. For each: hypothesis → trace code path + git history → evidence phase=diagnosis
184
- 2. Ambiguity evidence phase=decision; Normal: ask_question | `-y`: defer
185
- 3. CLI-assisted for complex findings: `maestro delegate --role analyze --mode analysis` (`run_in_background: true`)
186
- 4. Write `session.json.diagnoses[]`. Update §4. Mark G3.
187
-
188
- Commit: `"odyssey-improve({slug}): DIAGNOSE root cause analysis"`
189
-
190
- ### A_ESCALATE_DIAGNOSIS
191
- `retries++`. < 3: `maestro delegate --role analyze`, new hypotheses, S_DIAGNOSE. >= 3: Normal ask_question | `-y` → INCONCLUSIVE → S_RECORD.
192
-
193
- ### A_FIX
194
- 1. Exhaustive fix: ALL diagnosed issues by severity tier (critical → high → medium → low within fix_threshold), one dimension at a time. After each tier, re-verify **current tier's dimension only** (not all dimensions) — new findings at same or higher severity append to current tier. Cross-dimension regression checks run once at S_VERIFY after all tiers complete.
195
- 2. For each fix: implement → evidence phase=fix
196
- 3. Normal: ask_question per-fix confirmation | `-y`: auto-proceed, record `deferred`
197
-
198
- Commit: `"odyssey-improve({slug}): FIX — improvements applied"`
199
-
200
- ### A_VERIFY
201
- 1. Run tests covering modified areas
202
- 2. Re-capture metrics, compare with `session.json.baseline_metrics`
203
- 3. CLI-assisted: `maestro delegate --role review --mode analysis` (`run_in_background: true`)
204
- 4. `needs_rework` S_FIX. `verified` mark G4, advance.
205
- 5. Write `session.json.confirmation`. Update §5 (before/after metrics table).
206
-
207
- Commit: `"odyssey-improve({slug}): VERIFY — improvements verified"`
208
-
209
- ### A_GENERALIZE, A_DISCOVER, A_RECORD
210
- Base shared_actions. Improve overrides:
211
- - **A_GENERALIZE** pattern source: diagnoses + fixes
212
- - **A_RECORD** §8: improvement metrics (before/after comparison from baseline_metrics vs current). §9: learnings per Knowledge Persistence table. Completion summary lists suggested `/spec-add` commands.
213
-
214
- **Completion summary:**
215
- ```
216
- --- IMPROVE ODYSSEY COMPLETE ---
217
- Target: {target}
218
- Dimensions: {dimensions}
219
- Findings: {critical}C / {high}H / {medium}M / {low}L
220
- Diagnosed: {count}
221
- Fixed: {count} ({verified} verified)
222
- Metrics: {improved} improved / {regressed} regressed
223
- Patterns: {count} ({by_layer})
224
- Scan hits: {total} ({cross_layer_confirmed} confirmed)
225
- Issues: {N} created
226
- Decisions: {N} resolved, {M} pending, {K} deferred
227
- Learnings: {N} persisted
228
- Self-iter: {N} rounds across {M} stages
229
- Cross-loops: {N}
230
- Goals: {done}/{total} ({skipped} skipped)
231
- ---
232
- ```
233
-
234
- </actions>
235
-
236
- <appendix>
237
-
238
- ### `-y` improve-specific points
239
-
240
- | Decision Point | Normal | `-y` |
241
- |---------------|--------|------|
242
- | A_FIX improvement confirmation | ask_question | auto-proceed, `deferred` |
243
- | A_DIAGNOSE ambiguity | ask_question | best-effort, `deferred` |
244
- | A_ESCALATE 3-strike | ask_question 3-way | auto INCONCLUSIVE |
245
- | A_DISCOVER hit routing | ask_question | auto create issue |
246
- | A_DISCOVER ambiguous items | ask_question | all `deferred` |
247
-
248
- `deferred` items shown in completion summary; recoverable via `-c`.
249
-
250
- ### Goal Prompt convergence rules
251
-
252
- ```
253
- Exhaust iteration until all findings actioned (fix/issue/decision)
254
- and phase_goals_all_done=true.
255
- Fix by severity tiers, re-verify after each tier.
256
- Baseline captured before fix, compared after to confirm improvement.
257
- Pending decisions must ask_question — no silent resolve.
258
- ```
259
-
260
- </appendix>
261
-
262
- </state_machine>
263
-
264
- <error_codes>
265
- | Code | Severity | Condition | Recovery |
266
- |------|----------|-----------|----------|
267
- | E001 | error | No target specified | Provide target or use -c |
268
- | E002 | error | Target path not found | Check path |
269
- | W001 | warning | No dependency manifest found | Proceed without dep audit |
270
- | W002 | warning | Some dimension agents failed | Partial audit coverage |
271
- </error_codes>
272
-
273
- <success_criteria>
274
- - [ ] Target resolved, baseline metrics captured
275
- - [ ] Survey + 6-dimension audit with structured findings and severity matrix
276
- - [ ] Root causes diagnosed for critical/high findings
277
- - [ ] Improvements implemented and verified with before/after metrics (unless --skip-fix)
278
- - [ ] Multi-layer generalization + cross-phase loops (unless --skip-generalize)
279
- - [ ] Every unfixed finding has individual classification and reason
280
- - [ ] understanding.md §8 (metrics) and §9 (learnings) completed
281
- - [ ] phase_goals G1-G7 tracked and audited
282
- - [ ] Session resumable via -c
283
- - [ ] Completion summary
284
- </success_criteria>
285
-
286
- <next_step_routing>
287
- | Condition | Next |
288
- |-----------|------|
289
- | Security findings need deep investigation | `/odyssey-debug "<finding>"` |
290
- | UI-related findings | `/odyssey-ui "<component>"` |
291
- | Issues created from discoveries | `/manage-issue list --source improve-odyssey` |
292
- | Architecture pattern to document | `/spec-add arch "..."` |
293
- | Performance pattern to persist | `/spec-add coding "..."` |
294
- | Formal review of changes | `/odyssey-review-test-fix <changed-files>` |
295
- | Pending decisions | Filter evidence phase=decision status=pending |
296
- </next_step_routing>
297
- </output>
17
+ <base>@~/.maestro/workflows/odyssey-base.md</base>
18
+
19
+ <purpose>
20
+ survey → 6-dimension audit → diagnose → fix → verify → generalize → discover → persist.
21
+ Exhaustive iteration until zero remaining actionable findings.
22
+ </purpose>
23
+
24
+ <boundary>
25
+ **In scope:** Runtime quality improvement — performance/security/architecture/reliability/observability/maintainability audit → diagnose → fix → generalize.
26
+ **Out of scope:** UI visual → `/odyssey-ui` | New features → `/odyssey-planex` | Single bug → `/odyssey-debug` | Style review → `/odyssey-review-test-fix`
27
+ **Exploration freedom:** Free exploration within boundary — profiling, security scanning, architecture analysis, dependency audit.
28
+ **Zero-residual:** Every finding MUST have a concrete action (fix / issue / decision). "Report and shelve" is not allowed. "Pre-existing issue" is not a valid skip reason.
29
+ </boundary>
30
+
31
+ <context>
32
+ $ARGUMENTS
33
+
34
+ **Target resolution:**
35
+ | Input | Resolution |
36
+ |-------|-----------|
37
+ | Module/dir path | Audit that module |
38
+ | `HEAD` / `staged` | Review changes in diff |
39
+ | Feature area keyword | Resolve to related files |
40
+ | `--all` | Full project scan (use with caution) |
41
+
42
+ **Flags:** `--dimensions <list>` dimension subset | `--fix-threshold <severity>` fix cutoff (default: all) | `--skip-fix` audit+diagnose only | `--skip-generalize` skip S_GENERALIZE+S_DISCOVER | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
43
+
44
+ **Dimensions (6):**
45
+ 1. **performance** — hot paths, N+1 queries, memory allocation, cache efficiency, bundle size, lazy loading
46
+ 2. **security** — OWASP Top 10, injection, auth bypass, data exposure, dependency vulnerabilities, secrets
47
+ 3. **architecture** — layer violations, circular dependencies, coupling metrics, interface contracts, SRP violations
48
+ 4. **reliability** — error handling gaps, retry logic, timeout handling, graceful degradation, resource cleanup
49
+ 5. **observability** — logging coverage, metric gaps, trace propagation, error reporting, health checks
50
+ 6. **maintainability** — code complexity (cyclomatic), dead code, test coverage gaps, documentation debt
51
+
52
+ **Session**: `.workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`
53
+ **Output**: `session.json` | `evidence.ndjson` | `understanding.md`
54
+
55
+ **Output boundary**: ALL file writes MUST target the session directory (`.workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`) or `.workflow/state.json` only. Source code modifications during S_FIX are in-scope but MUST be committed per action. NEVER write artifacts outside these paths.
56
+
57
+ **session.json improve-specific fields:**
58
+ ```json
59
+ { "target": "", "dimensions": [], "baseline_metrics": {},
60
+ "audit_result": {}, "diagnoses": [], "confirmation": null,
61
+ "generalization_stats": null }
62
+ ```
63
+
64
+ **evidence.ndjson phases:** `survey|audit|diagnosis|fix|discovery|decision|self-iteration`
65
+ - `survey`: `category` (dependency|complexity|coverage|error_pattern), `detail`
66
+ - `audit`: `dimension`, `severity`, `measurement`
67
+ - `diagnosis`: `finding_ref`, `hypothesis`, `result` (confirmed|disproved|inconclusive), `root_cause`
68
+ - `fix`: `finding_ref`, `change_summary`, `risk`
69
+ - `discovery`: `file`, `line`, `classification` (safe|risk|issue), `action` (fix|issue|decision|skip)
70
+ - `decision`: `question`, `options`, `context`, `status` (pending|resolved|deferred), `resolution`
71
+ - `self-iteration`: `stage`, `round`, `assessment`, `expansion`
72
+
73
+ **phase_goals[]:**
74
+
75
+ | ID | Goal | Phase | skip_when |
76
+ |----|------|-------|-----------|
77
+ | G1 | Survey completed | S_SURVEY | — |
78
+ | G2 | Audit completed | S_AUDIT | |
79
+ | G3 | Diagnosis completed | S_DIAGNOSE | |
80
+ | G4 | Zero remaining: all findings fixed and verified | S_VERIFY | skip_fix |
81
+ | G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
82
+ | G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
83
+ | G7 | Learnings persisted | S_RECORD | |
84
+
85
+ **understanding.md 9 sections:**
86
+ 1. Target & Baseline S_INTAKE | 2. Current State Survey S_SURVEY | 3. Audit Findings ← S_AUDIT
87
+ 4. Root Cause Diagnosis S_DIAGNOSE | 5. Fix & Verification S_FIX+S_VERIFY
88
+ 6. Generalization ← S_GENERALIZE | 7. Discoveries ← S_DISCOVER
89
+ 8. Improvement Metrics ← S_RECORD (before/after) | 9. Engineering Learnings ← S_RECORD
90
+
91
+ **Knowledge Persistence categories (§9):**
92
+
93
+ | Category | Content | Follow-up |
94
+ |----------|---------|-----------|
95
+ | Performance pattern | Bottleneck type + fix approach + measurement method | `/spec-add coding` |
96
+ | Security rule | Vulnerability class + fix + prevention method | `/spec-add debug` |
97
+ | Architecture constraint | Violation description + correct boundary + check method | `/spec-add arch` |
98
+ | Reliability pattern | Failure mode + handling strategy + verification method | `/spec-add coding` |
99
+ </context>
100
+
101
+ <invariants>
102
+ All invariants (evidence append-only, session-as-state, phase goal tracking, auto-commit, zero-residual) defined in base.
103
+ 6. **Generalize is mandatory** — S_GENERALIZE and S_DISCOVER execute unless `skip_generalize == true`. "All verified" or context pressure are NOT valid reasons to skip. The phase itself determines whether patterns exist.
104
+ </invariants>
105
+
106
+ <self_iteration>
107
+ Applies to: **S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE**. Logic in base.
108
+ </self_iteration>
109
+
110
+ <execution>
111
+ Follow base execution discipline completely. Actions defined in state_machine below.
112
+
113
+ ### Phase Gates (MANDATORY, BLOCKING)
114
+
115
+ **GATE 1: INTAKESURVEY**
116
+ - REQUIRED: Target resolved, SESSION_DIR created, session.json initialized with baseline_metrics.
117
+ - REQUIRED: phase_goals[] derived from flags.
118
+ - BLOCKED if: no target specified (E001) or target path not found (E002).
119
+
120
+ **GATE 2: SURVEY AUDIT**
121
+ - REQUIRED: Current state survey completed — dependency audit, complexity scan, test coverage map, error handling scan.
122
+ - REQUIRED: Evidence phase=survey logged, understanding.md §2 updated, G1 marked done.
123
+ - BLOCKED if: survey incomplete — all 4 scan types must be attempted.
124
+
125
+ **GATE 3: AUDIT DIAGNOSE**
126
+ - REQUIRED: All dimension agents completed (or --dimensions subset), findings merged with severity classification.
127
+ - REQUIRED: audit_result written to session.json, understanding.md §3 with severity matrix, G2 marked done.
128
+ - BLOCKED if: zero dimensions reviewed (W002 partial is allowed, zero is not).
129
+
130
+ **GATE 4: DIAGNOSE → FIX**
131
+ - REQUIRED: Root causes identified for all critical/high findings with evidence.
132
+ - REQUIRED: diagnoses[] written, understanding.md §4 updated, G3 marked done.
133
+ - BLOCKED if: hypotheses failed 3 times without escalation decision (A_ESCALATE_DIAGNOSIS).
134
+
135
+ **GATE 5: FIX → VERIFY**
136
+ - REQUIRED: ALL findings within fix_threshold fixed by severity tier (critical high medium → low).
137
+ - REQUIRED: Per-fix evidence phase=fix logged.
138
+ - BLOCKED if: tier incomplete — each tier must be fully addressed before advancing.
139
+
140
+ **GATE 6: VERIFYGENERALIZE**
141
+ - REQUIRED: Tests pass, metrics re-captured, before/after comparison logged.
142
+ - REQUIRED: confirmation written, understanding.md §5 updated, G4 marked done.
143
+ - BLOCKED if: needs_rework → route back to S_FIX.
144
+
145
+ **GATE 7: GENERALIZE → DISCOVER**
146
+ - REQUIRED: ALL 3 layers (syntax/semantic/structural) attempted with evidence logged.
147
+ - REQUIRED: generalization_stats written with by_layer entries for all 3 layers, G5 marked done.
148
+ - BLOCKED if: any layer not attempted (thoroughness floor violation).
149
+
150
+ **GATE 8: DISCOVER RECORD**
151
+ - REQUIRED: All hits triaged with per-item classification and reason.
152
+ - REQUIRED: remaining_actionable == 0 OR loops >= max_loops with per-item reasons logged.
153
+ - REQUIRED: G6 marked done.
154
+ - BLOCKED if: unclassified hits remain.
155
+
156
+ </execution>
157
+
158
+ <state_machine>
159
+
160
+ <states>
161
+ S_INTAKE → S_SURVEY → S_AUDIT → S_DIAGNOSE → S_FIX → S_VERIFY → S_GENERALIZE → S_DISCOVER → S_RECORD → END
162
+ </states>
163
+
164
+ <transitions>
165
+ S_INTAKE S_INTAKE : -c + session found A_RESUME
166
+ S_INTAKE S_SURVEY : target resolved A_INTAKE
167
+ S_INTAKE S_INTAKE : no target ask_question
168
+
169
+ S_SURVEY → S_AUDIT : complete
170
+
171
+ S_AUDIT → S_DIAGNOSE : critical/high findings exist
172
+ S_AUDIT S_GENERALIZE : no critical/high, !skip_generalize
173
+ S_AUDIT → S_RECORD : no findings OR skip_generalize
174
+
175
+ S_DIAGNOSES_FIX : root causes identified, !skip_fix
176
+ S_DIAGNOSE S_GENERALIZE : root causes identified, skip_fix, !skip_generalize
177
+ S_DIAGNOSE → S_RECORD : root causes identified, skip_fix, skip_generalize
178
+ S_DIAGNOSE → S_DIAGNOSE : hypotheses failed, retries < 3 → A_ESCALATE_DIAGNOSIS
179
+ S_DIAGNOSE → S_RECORD : retries >= 3 → INCONCLUSIVE
180
+
181
+ S_FIX → S_VERIFY : fix implemented
182
+
183
+ S_VERIFY S_GENERALIZE : verified, !skip_generalize
184
+ S_VERIFYS_RECORD : verified, skip_generalize
185
+ S_VERIFY S_FIX : needs_rework
186
+
187
+ S_GENERALIZE → S_DISCOVER : hits found
188
+ S_GENERALIZE → S_RECORD : all 3 layers scanned with evidence, total_hits == 0
189
+
190
+ S_DISCOVER → S_DIAGNOSE : new critical issue → cross_phase_loops++
191
+ S_DISCOVER S_FIX : same-pattern fix, !skip_fixcross_phase_loops++
192
+ S_DISCOVER → S_RECORD : remaining_actionable == 0
193
+ S_DISCOVER → S_RECORD : loops >= max_loops → MUST log per-item reasons
194
+
195
+ S_RECORD → END : complete
196
+ </transitions>
197
+
198
+ <actions>
199
+
200
+ ### A_INTAKE
201
+ 1. Parse arguments: target description, flags, `--dimensions` subset
202
+ 2. Generate slug, create `SESSION_DIR`
203
+ 3. Search: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load coding/debug
204
+ 4. **Baseline capture**: Record current metrics (test pass rate, bundle size, dependency count, complexity hotspots) to `session.json.baseline_metrics`
205
+ 5. Derive `phase_goals[]` from flags
206
+ 6. Write `session.json` + `understanding.md` §1, emit Goal Prompt
207
+
208
+ Commit: `"odyssey-improve({slug}): INTAKE — parse target and capture baseline"`
209
+
210
+ ### A_RESUME
211
+ Glob latest session read `session.json` → display summary → jump to `current_state`.
212
+
213
+ ### A_SURVEY
214
+ Current state survey — understand what exists before proposing changes.
215
+
216
+ 1. Dependency audit (package.json/lock), complexity scan (size/nesting), test coverage map, error handling scan (empty catch, unhandled promise)
217
+ 2. **CLI-assisted** (optional): `maestro delegate --role analyze --mode analysis` for dependency health, complexity hotspots, coverage gaps, error patterns. Execute `run_in_background: true`.
218
+ 3. Evidence phase=survey. Update §2. Mark G1.
219
+
220
+ Commit: `"odyssey-improve({slug}): SURVEY — current state analysis"`
221
+
222
+ ### A_AUDIT
223
+ Spawn 6 parallel Agents (one per dimension, or `--dimensions` subset).
224
+ Each returns: `[{title, severity, dimension, file, line, description, suggestion, measurement}]`
225
+
226
+ Merge evidence phase=audit. Write `session.json.audit_result`.
227
+ Update §3 (findings by dimension + severity matrix). Mark G2.
228
+
229
+ Commit: `"odyssey-improve({slug}): AUDIT — multi-dimension review"`
230
+
231
+ ### A_DIAGNOSE
232
+ Root cause analysis for critical/high findings — don't fix symptoms.
233
+
234
+ 1. Group by dimension, prioritize by severity. For each: hypothesis → trace code path + git history → evidence phase=diagnosis
235
+ 2. Ambiguity → evidence phase=decision; Normal: ask_question | `-y`: defer
236
+ 3. CLI-assisted for complex findings: `maestro delegate --role analyze --mode analysis` (`run_in_background: true`)
237
+ 4. Write `session.json.diagnoses[]`. Update §4. Mark G3.
238
+
239
+ Commit: `"odyssey-improve({slug}): DIAGNOSE — root cause analysis"`
240
+
241
+ ### A_ESCALATE_DIAGNOSIS
242
+ `retries++`. < 3: `maestro delegate --role analyze`, new hypotheses, → S_DIAGNOSE. >= 3: Normal → ask_question | `-y` → INCONCLUSIVE → S_RECORD.
243
+
244
+ ### A_FIX
245
+ 1. Exhaustive fix: ALL diagnosed issues by severity tier (critical → high → medium → low within fix_threshold), one dimension at a time. After each tier, re-verify **current tier's dimension only** (not all dimensions) — new findings at same or higher severity append to current tier. Cross-dimension regression checks run once at S_VERIFY after all tiers complete.
246
+ 2. For each fix: implement evidence phase=fix
247
+ 3. Normal: ask_question per-fix confirmation | `-y`: auto-proceed, record `deferred`
248
+
249
+ Commit: `"odyssey-improve({slug}): FIX — improvements applied"`
250
+
251
+ ### A_VERIFY
252
+ 1. Run tests covering modified areas
253
+ 2. Re-capture metrics, compare with `session.json.baseline_metrics`
254
+ 3. CLI-assisted: `maestro delegate --role review --mode analysis` (`run_in_background: true`)
255
+ 4. `needs_rework` S_FIX. `verified` mark G4, advance.
256
+ 5. Write `session.json.confirmation`. Update §5 (before/after metrics table).
257
+
258
+ Commit: `"odyssey-improve({slug}): VERIFY — improvements verified"`
259
+
260
+ ### A_GENERALIZE
261
+
262
+ **MANDATORY — executes unless `skip_generalize == true`. Prior-phase convergence, "all verified," or context pressure are NOT valid skip reasons.**
263
+
264
+ Pattern source: diagnosed root causes + applied fixes across all dimensions.
265
+
266
+ **Step 1 — 3-layer pattern extraction** from diagnoses and fixes:
267
+
268
+ | Layer | Method | Targets |
269
+ |-------|--------|---------|
270
+ | Syntax | Build regex from fix diffs Grep | N+1 query patterns, missing error type check, unescaped interpolation, inline eval |
271
+ | Semantic | Understand anti-pattern per dimension → Agent scan | Cache bypass in hot path, auth check gap, circular import chain, missing timeout |
272
+ | Structural | Find modules with same shape / dependency graph | Controllers sharing validation shape, middleware with same hook pattern, parallel services |
273
+
274
+ Write `session.json.patterns[]`: `[{id, source, layer, signature, description, risk, fix_template, confidence}]`
275
+
276
+ **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.
277
+
278
+ **Step 2 4-agent concurrent scan** (single message, 4 Agents):
279
+
280
+ | Agent | Strategy | Scope |
281
+ |-------|----------|-------|
282
+ | Syntax grep | Grep regex from pattern signatures | Full project |
283
+ | Semantic scan | Per-dimension anti-pattern check | Related modules |
284
+ | Structural match | Find structurally similar files | Full project |
285
+ | Historical grep | `git log -S` for pattern signatures | Git history |
286
+
287
+ **Step 3 — Cross-layer dedup:** multi-layer hit → boost | single-layer → `needs_review` | historically fixed → `regression_risk`
288
+
289
+ **Step 4 Iterative deepening:** Module with ≥3 hits → targeted deep scan (max 1 round).
290
+
291
+ **Step 5 Persist:** Update understanding.md §6 + write `session.json.generalization_stats`:
292
+ ```json
293
+ {"patterns_extracted": 0, "total_hits": 0, "cross_layer_confirmed": 0, "regression_risks": 0, "by_layer": {"syntax": 0, "semantic": 0, "structural": 0}, "deepening_triggered": false}
294
+ ```
295
+
296
+ **Transition guard:** `S_GENERALIZE → S_RECORD` requires `by_layer` has entries for all 3 layers with search evidence logged. Mark G5 done.
297
+
298
+ Commit: `"odyssey-improve({slug}): GENERALIZE — generalization scan complete"`
299
+
300
+ ### A_DISCOVER
301
+
302
+ **Executes whenever `total_hits > 0`. Cannot be skipped without `skip_generalize == true`.**
303
+
304
+ 1. **Triage** each hit with ±10 lines context → classify:
305
+ - `bug` — confirmed improvement defect (same dimension)
306
+ - `risk` — potential degradation or violation
307
+ - `safe` — false positive (must log individual reason — blanket "pre-existing" forbidden)
308
+
309
+ 2. **Route:**
310
+
311
+ | Classification | Action |
312
+ |---------------|--------|
313
+ | bug + fix_template applicable | Immediate fix → back to S_FIX |
314
+ | bug + cross-module decision or no template | Create issue (fix suggestion + impact + dimension) |
315
+ | risk + guard addable directly | Fix directly |
316
+ | risk + complex | Create issue |
317
+ | safe | Skip with logged per-item reason |
318
+
319
+ Normal: ask_question per hit | `-y`: auto-fix bugs with fix_template, create issue for rest
320
+
321
+ 3. **Cross-phase loops:** `cross_phase_loops++` on fix/diagnose return. `loops >= max_loops` → must log per-item reasons.
322
+
323
+ 4. Append evidence phase=discovery. Update understanding.md §7. Mark G6 done.
324
+
325
+ Commit: `"odyssey-improve({slug}): DISCOVER — discovery triage complete"`
326
+
327
+ ### A_RECORD
328
+
329
+ 1. understanding.md §8: improvement metrics — before/after comparison from `baseline_metrics` vs current. Re-capture metrics, build comparison table.
330
+ 2. understanding.md §9: learnings by Knowledge Persistence categories:
331
+ - Performance pattern → `/spec-add coding`
332
+ - Security rule → `/spec-add debug`
333
+ - Architecture constraint → `/spec-add arch`
334
+ - Reliability pattern → `/spec-add coding`
335
+ Completion summary lists suggested `/spec-add` commands.
336
+
337
+ 3. Mark G7 done. Pending decisions: Normal → ask_question | `-y` → skip (show deferred count).
338
+
339
+ 4. **Goal audit (hardened):**
340
+ - `done` → confirmed
341
+ - `skipped` → confirmed ONLY if corresponding `skip_when` flag is true
342
+ - **Hard rule:** G5 and G6 CANNOT be `skipped` unless `skip_generalize == true`. Pending without flag → `failed` (Normal: ask_question | `-y`: record `failed`)
343
+ - `phase_goals_all_done = true` only when all goals pass this audit
344
+
345
+ 5. `current_state = "COMPLETED"`, emit completion summary.
346
+
347
+ **Completion summary:**
348
+ ```
349
+ --- IMPROVE ODYSSEY COMPLETE ---
350
+ Target: {target}
351
+ Dimensions: {dimensions}
352
+ Findings: {critical}C / {high}H / {medium}M / {low}L
353
+ Diagnosed: {count}
354
+ Fixed: {count} ({verified} verified)
355
+ Metrics: {improved} improved / {regressed} regressed
356
+ Patterns: {count} ({by_layer})
357
+ Scan hits: {total} ({cross_layer_confirmed} confirmed)
358
+ Issues: {N} created
359
+ Decisions: {N} resolved, {M} pending, {K} deferred
360
+ Learnings: {N} persisted
361
+ Self-iter: {N} rounds across {M} stages
362
+ Cross-loops: {N}
363
+ Goals: {done}/{total} ({skipped} skipped)
364
+ ---
365
+ ```
366
+
367
+ Commit: `"odyssey-improve({slug}): RECORD — summary and knowledge persistence"`
368
+
369
+ </actions>
370
+
371
+ <appendix>
372
+
373
+ ### `-y` improve-specific points
374
+
375
+ | Decision Point | Normal | `-y` |
376
+ |---------------|--------|------|
377
+ | A_FIX improvement confirmation | ask_question | auto-proceed, `deferred` |
378
+ | A_DIAGNOSE ambiguity | ask_question | best-effort, `deferred` |
379
+ | A_ESCALATE 3-strike | ask_question 3-way | auto INCONCLUSIVE |
380
+ | A_DISCOVER hit routing | ask_question | auto create issue |
381
+ | A_DISCOVER ambiguous items | ask_question | all `deferred` |
382
+
383
+ `deferred` items shown in completion summary; recoverable via `-c`.
384
+
385
+ ### Goal Prompt convergence rules
386
+
387
+ ```
388
+ Exhaust iteration until all findings actioned (fix/issue/decision)
389
+ and phase_goals_all_done=true.
390
+ Fix by severity tiers, re-verify after each tier.
391
+ Baseline captured before fix, compared after to confirm improvement.
392
+ Pending decisions must ask_question — no silent resolve.
393
+ ```
394
+
395
+ </appendix>
396
+
397
+ </state_machine>
398
+
399
+ <error_codes>
400
+ | Code | Severity | Condition | Recovery |
401
+ |------|----------|-----------|----------|
402
+ | E001 | error | No target specified | Provide target or use -c |
403
+ | E002 | error | Target path not found | Check path |
404
+ | W001 | warning | No dependency manifest found | Proceed without dep audit |
405
+ | W002 | warning | Some dimension agents failed | Partial audit coverage |
406
+ | W003 | warning | Generalization 0 hits after full 3-layer scan | Advance to S_RECORD (requires all 3 layers attempted with evidence) |
407
+ </error_codes>
408
+
409
+ <success_criteria>
410
+ - [ ] Target resolved, baseline metrics captured
411
+ - [ ] Survey + 6-dimension audit with structured findings and severity matrix
412
+ - [ ] Root causes diagnosed for critical/high findings
413
+ - [ ] Improvements implemented and verified with before/after metrics (unless --skip-fix)
414
+ - [ ] Multi-layer generalization + cross-phase loops (unless --skip-generalize)
415
+ - [ ] Every unfixed finding has individual classification and reason
416
+ - [ ] understanding.md §8 (metrics) and §9 (learnings) completed
417
+ - [ ] phase_goals G1-G7 tracked and audited
418
+ - [ ] Session resumable via -c
419
+ - [ ] Completion summary
420
+ </success_criteria>
421
+
422
+ <next_step_routing>
423
+ | Condition | Next |
424
+ |-----------|------|
425
+ | Security findings need deep investigation | `/odyssey-debug "<finding>"` |
426
+ | UI-related findings | `/odyssey-ui "<component>"` |
427
+ | Issues created from discoveries | `/manage-issue list --source improve-odyssey` |
428
+ | Architecture pattern to document | `/spec-add arch "..."` |
429
+ | Performance pattern to persist | `/spec-add coding "..."` |
430
+ | Formal review of changes | `/odyssey-review-test-fix <changed-files>` |
431
+ | Pending decisions | Filter evidence phase=decision status=pending |
432
+ </next_step_routing>
433
+ </output>