maestro-flow 0.5.3 → 0.5.31

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 (259) hide show
  1. package/.agents/skills/learn-follow/SKILL.md +114 -114
  2. package/.agents/skills/learn-investigate/SKILL.md +138 -139
  3. package/.agents/skills/learn-second-opinion/SKILL.md +105 -109
  4. package/.agents/skills/maestro/SKILL.md +2 -10
  5. package/.agents/skills/maestro-amend/SKILL.md +152 -152
  6. package/.agents/skills/maestro-analyze/SKILL.md +201 -252
  7. package/.agents/skills/maestro-blueprint/SKILL.md +175 -190
  8. package/.agents/skills/maestro-brainstorm/SKILL.md +196 -200
  9. package/.agents/skills/maestro-collab/SKILL.md +159 -159
  10. package/.agents/skills/maestro-companion/SKILL.md +517 -517
  11. package/.agents/skills/maestro-composer/SKILL.md +173 -164
  12. package/.agents/skills/maestro-execute/SKILL.md +169 -170
  13. package/.agents/skills/maestro-fork/SKILL.md +97 -96
  14. package/.agents/skills/maestro-grill/SKILL.md +161 -162
  15. package/.agents/skills/maestro-guard/SKILL.md +93 -92
  16. package/.agents/skills/maestro-impeccable/SKILL.md +296 -253
  17. package/.agents/skills/maestro-init/SKILL.md +117 -118
  18. package/.agents/skills/maestro-merge/SKILL.md +73 -66
  19. package/.agents/skills/maestro-milestone-audit/SKILL.md +4 -10
  20. package/.agents/skills/maestro-milestone-complete/SKILL.md +6 -7
  21. package/.agents/skills/maestro-milestone-release/SKILL.md +122 -131
  22. package/.agents/skills/maestro-next/SKILL.md +241 -245
  23. package/.agents/skills/maestro-overlay/SKILL.md +176 -166
  24. package/.agents/skills/maestro-plan/SKILL.md +211 -197
  25. package/.agents/skills/maestro-player/SKILL.md +167 -167
  26. package/.agents/skills/maestro-quick/SKILL.md +69 -63
  27. package/.agents/skills/maestro-ralph/SKILL.md +2 -36
  28. package/.agents/skills/maestro-ralph-beta/SKILL.md +861 -872
  29. package/.agents/skills/maestro-ralph-execute/SKILL.md +234 -234
  30. package/.agents/skills/maestro-roadmap/SKILL.md +159 -172
  31. package/.agents/skills/maestro-swarm-workflow/SKILL.md +229 -250
  32. package/.agents/skills/maestro-tools-execute/SKILL.md +108 -103
  33. package/.agents/skills/maestro-tools-register/SKILL.md +148 -143
  34. package/.agents/skills/maestro-ui-codify/SKILL.md +103 -86
  35. package/.agents/skills/maestro-universal-workflow/SKILL.md +534 -547
  36. package/.agents/skills/maestro-update/SKILL.md +109 -106
  37. package/.agents/skills/manage-codebase-rebuild/SKILL.md +73 -71
  38. package/.agents/skills/manage-harvest/SKILL.md +83 -81
  39. package/.agents/skills/manage-issue/SKILL.md +59 -60
  40. package/.agents/skills/manage-issue-discover/SKILL.md +70 -68
  41. package/.agents/skills/manage-kg-extractors/SKILL.md +130 -0
  42. package/.agents/skills/manage-knowhow/SKILL.md +70 -66
  43. package/.agents/skills/manage-knowhow-capture/SKILL.md +79 -69
  44. package/.agents/skills/manage-knowledge-audit/SKILL.md +91 -74
  45. package/.agents/skills/manage-status/SKILL.md +52 -42
  46. package/.agents/skills/manage-wiki/SKILL.md +69 -58
  47. package/.agents/skills/odyssey-debug/SKILL.md +445 -459
  48. package/.agents/skills/odyssey-improve/SKILL.md +477 -491
  49. package/.agents/skills/odyssey-planex/SKILL.md +576 -587
  50. package/.agents/skills/odyssey-review-test-fix/SKILL.md +400 -413
  51. package/.agents/skills/odyssey-ui/SKILL.md +431 -448
  52. package/.agents/skills/quality-auto-test/SKILL.md +140 -123
  53. package/.agents/skills/quality-debug/SKILL.md +145 -106
  54. package/.agents/skills/quality-refactor/SKILL.md +91 -53
  55. package/.agents/skills/quality-retrospective/SKILL.md +109 -63
  56. package/.agents/skills/quality-review/SKILL.md +141 -114
  57. package/.agents/skills/quality-sync/SKILL.md +74 -38
  58. package/.agents/skills/quality-test/SKILL.md +133 -103
  59. package/.agents/skills/security-audit/SKILL.md +217 -166
  60. package/.agents/skills/spec-add/SKILL.md +66 -59
  61. package/.agents/skills/spec-load/SKILL.md +68 -68
  62. package/.agents/skills/spec-remove/SKILL.md +42 -42
  63. package/.agents/skills/spec-setup/SKILL.md +38 -41
  64. package/.agy/skills/learn-follow/SKILL.md +114 -114
  65. package/.agy/skills/learn-investigate/SKILL.md +138 -139
  66. package/.agy/skills/learn-second-opinion/SKILL.md +105 -109
  67. package/.agy/skills/maestro/SKILL.md +2 -10
  68. package/.agy/skills/maestro-amend/SKILL.md +152 -152
  69. package/.agy/skills/maestro-analyze/SKILL.md +201 -252
  70. package/.agy/skills/maestro-blueprint/SKILL.md +175 -190
  71. package/.agy/skills/maestro-brainstorm/SKILL.md +196 -200
  72. package/.agy/skills/maestro-collab/SKILL.md +159 -159
  73. package/.agy/skills/maestro-companion/SKILL.md +517 -517
  74. package/.agy/skills/maestro-composer/SKILL.md +173 -164
  75. package/.agy/skills/maestro-execute/SKILL.md +169 -170
  76. package/.agy/skills/maestro-fork/SKILL.md +97 -96
  77. package/.agy/skills/maestro-grill/SKILL.md +161 -162
  78. package/.agy/skills/maestro-guard/SKILL.md +93 -92
  79. package/.agy/skills/maestro-impeccable/SKILL.md +296 -253
  80. package/.agy/skills/maestro-init/SKILL.md +117 -118
  81. package/.agy/skills/maestro-merge/SKILL.md +73 -66
  82. package/.agy/skills/maestro-milestone-audit/SKILL.md +4 -10
  83. package/.agy/skills/maestro-milestone-complete/SKILL.md +6 -7
  84. package/.agy/skills/maestro-milestone-release/SKILL.md +122 -131
  85. package/.agy/skills/maestro-next/SKILL.md +241 -245
  86. package/.agy/skills/maestro-overlay/SKILL.md +176 -166
  87. package/.agy/skills/maestro-plan/SKILL.md +211 -197
  88. package/.agy/skills/maestro-player/SKILL.md +167 -167
  89. package/.agy/skills/maestro-quick/SKILL.md +69 -63
  90. package/.agy/skills/maestro-ralph/SKILL.md +2 -36
  91. package/.agy/skills/maestro-ralph-beta/SKILL.md +861 -872
  92. package/.agy/skills/maestro-ralph-execute/SKILL.md +234 -234
  93. package/.agy/skills/maestro-roadmap/SKILL.md +159 -172
  94. package/.agy/skills/maestro-swarm-workflow/SKILL.md +229 -250
  95. package/.agy/skills/maestro-tools-execute/SKILL.md +108 -103
  96. package/.agy/skills/maestro-tools-register/SKILL.md +148 -143
  97. package/.agy/skills/maestro-ui-codify/SKILL.md +103 -86
  98. package/.agy/skills/maestro-universal-workflow/SKILL.md +534 -547
  99. package/.agy/skills/maestro-update/SKILL.md +109 -106
  100. package/.agy/skills/manage-codebase-rebuild/SKILL.md +73 -71
  101. package/.agy/skills/manage-harvest/SKILL.md +83 -81
  102. package/.agy/skills/manage-issue/SKILL.md +59 -60
  103. package/.agy/skills/manage-issue-discover/SKILL.md +70 -68
  104. package/.agy/skills/manage-kg-extractors/SKILL.md +130 -0
  105. package/.agy/skills/manage-knowhow/SKILL.md +70 -66
  106. package/.agy/skills/manage-knowhow-capture/SKILL.md +79 -69
  107. package/.agy/skills/manage-knowledge-audit/SKILL.md +91 -74
  108. package/.agy/skills/manage-status/SKILL.md +52 -42
  109. package/.agy/skills/manage-wiki/SKILL.md +69 -58
  110. package/.agy/skills/odyssey-debug/SKILL.md +445 -459
  111. package/.agy/skills/odyssey-improve/SKILL.md +477 -491
  112. package/.agy/skills/odyssey-planex/SKILL.md +576 -587
  113. package/.agy/skills/odyssey-review-test-fix/SKILL.md +400 -413
  114. package/.agy/skills/odyssey-ui/SKILL.md +431 -448
  115. package/.agy/skills/quality-auto-test/SKILL.md +140 -123
  116. package/.agy/skills/quality-debug/SKILL.md +145 -106
  117. package/.agy/skills/quality-refactor/SKILL.md +91 -53
  118. package/.agy/skills/quality-retrospective/SKILL.md +109 -63
  119. package/.agy/skills/quality-review/SKILL.md +141 -114
  120. package/.agy/skills/quality-sync/SKILL.md +74 -38
  121. package/.agy/skills/quality-test/SKILL.md +133 -103
  122. package/.agy/skills/security-audit/SKILL.md +217 -166
  123. package/.agy/skills/spec-add/SKILL.md +66 -59
  124. package/.agy/skills/spec-load/SKILL.md +68 -68
  125. package/.agy/skills/spec-remove/SKILL.md +42 -42
  126. package/.agy/skills/spec-setup/SKILL.md +38 -41
  127. package/.claude/commands/learn-follow.md +127 -127
  128. package/.claude/commands/learn-investigate.md +151 -152
  129. package/.claude/commands/learn-second-opinion.md +118 -122
  130. package/.claude/commands/maestro-amend.md +164 -164
  131. package/.claude/commands/maestro-analyze.md +215 -266
  132. package/.claude/commands/maestro-blueprint.md +189 -204
  133. package/.claude/commands/maestro-brainstorm.md +209 -213
  134. package/.claude/commands/maestro-collab.md +172 -172
  135. package/.claude/commands/maestro-companion.md +531 -531
  136. package/.claude/commands/maestro-composer.md +188 -179
  137. package/.claude/commands/maestro-execute.md +183 -184
  138. package/.claude/commands/maestro-fork.md +111 -110
  139. package/.claude/commands/maestro-grill.md +175 -176
  140. package/.claude/commands/maestro-guard.md +103 -102
  141. package/.claude/commands/maestro-impeccable.md +311 -268
  142. package/.claude/commands/maestro-init.md +130 -131
  143. package/.claude/commands/maestro-merge.md +87 -80
  144. package/.claude/commands/maestro-milestone-audit.md +4 -10
  145. package/.claude/commands/maestro-milestone-complete.md +6 -7
  146. package/.claude/commands/maestro-milestone-release.md +136 -145
  147. package/.claude/commands/maestro-next.md +253 -257
  148. package/.claude/commands/maestro-overlay.md +188 -178
  149. package/.claude/commands/maestro-plan.md +225 -211
  150. package/.claude/commands/maestro-player.md +182 -182
  151. package/.claude/commands/maestro-quick.md +83 -77
  152. package/.claude/commands/maestro-ralph-beta.md +875 -886
  153. package/.claude/commands/maestro-ralph-execute.md +247 -247
  154. package/.claude/commands/maestro-ralph.md +2 -36
  155. package/.claude/commands/maestro-roadmap.md +173 -186
  156. package/.claude/commands/maestro-swarm-workflow.md +243 -264
  157. package/.claude/commands/maestro-tools-execute.md +122 -117
  158. package/.claude/commands/maestro-tools-register.md +162 -157
  159. package/.claude/commands/maestro-ui-codify.md +117 -100
  160. package/.claude/commands/maestro-universal-workflow.md +548 -561
  161. package/.claude/commands/maestro-update.md +122 -119
  162. package/.claude/commands/maestro.md +2 -10
  163. package/.claude/commands/manage-codebase-rebuild.md +87 -85
  164. package/.claude/commands/manage-harvest.md +97 -95
  165. package/.claude/commands/manage-issue-discover.md +83 -81
  166. package/.claude/commands/manage-issue.md +72 -73
  167. package/.claude/commands/manage-kg-extractors.md +128 -0
  168. package/.claude/commands/manage-knowhow-capture.md +92 -82
  169. package/.claude/commands/manage-knowhow.md +83 -79
  170. package/.claude/commands/manage-knowledge-audit.md +105 -88
  171. package/.claude/commands/manage-status.md +62 -52
  172. package/.claude/commands/manage-wiki.md +82 -71
  173. package/.claude/commands/odyssey-debug.md +459 -473
  174. package/.claude/commands/odyssey-improve.md +491 -505
  175. package/.claude/commands/odyssey-planex.md +590 -601
  176. package/.claude/commands/odyssey-review-test-fix.md +414 -427
  177. package/.claude/commands/odyssey-ui.md +445 -462
  178. package/.claude/commands/quality-auto-test.md +153 -136
  179. package/.claude/commands/quality-debug.md +159 -120
  180. package/.claude/commands/quality-refactor.md +105 -67
  181. package/.claude/commands/quality-retrospective.md +123 -77
  182. package/.claude/commands/quality-review.md +155 -128
  183. package/.claude/commands/quality-sync.md +88 -52
  184. package/.claude/commands/quality-test.md +147 -117
  185. package/.claude/commands/security-audit.md +230 -179
  186. package/.claude/commands/spec-add.md +77 -70
  187. package/.claude/commands/spec-load.md +78 -78
  188. package/.claude/commands/spec-remove.md +55 -55
  189. package/.claude/commands/spec-setup.md +49 -52
  190. package/dist/src/cli.js +1 -1
  191. package/dist/src/cli.js.map +1 -1
  192. package/dist/src/commands/kg.d.ts.map +1 -1
  193. package/dist/src/commands/kg.js +11 -5
  194. package/dist/src/commands/kg.js.map +1 -1
  195. package/dist/src/graph/kg/extraction/code/code-extractor.d.ts +2 -0
  196. package/dist/src/graph/kg/extraction/code/code-extractor.d.ts.map +1 -1
  197. package/dist/src/graph/kg/extraction/code/code-extractor.js +32 -3
  198. package/dist/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  199. package/dist/src/graph/kg/extraction/code/plugin-engine.d.ts +35 -0
  200. package/dist/src/graph/kg/extraction/code/plugin-engine.d.ts.map +1 -0
  201. package/dist/src/graph/kg/extraction/code/plugin-engine.js +573 -0
  202. package/dist/src/graph/kg/extraction/code/plugin-engine.js.map +1 -0
  203. package/dist/src/graph/kg/extraction/code/plugin-types.d.ts +95 -0
  204. package/dist/src/graph/kg/extraction/code/plugin-types.d.ts.map +1 -0
  205. package/dist/src/graph/kg/extraction/code/plugin-types.js +5 -0
  206. package/dist/src/graph/kg/extraction/code/plugin-types.js.map +1 -0
  207. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  208. package/dist/src/graph/kg/extraction/orchestrator.js +17 -5
  209. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  210. package/dist/src/graph/kg/schema.sql +16 -11
  211. package/dist/src/graph/kg/surface/cli.d.ts.map +1 -1
  212. package/dist/src/graph/kg/surface/cli.js +153 -56
  213. package/dist/src/graph/kg/surface/cli.js.map +1 -1
  214. package/dist/src/hooks/workspace.d.ts +4 -2
  215. package/dist/src/hooks/workspace.d.ts.map +1 -1
  216. package/dist/src/hooks/workspace.js +6 -2
  217. package/dist/src/hooks/workspace.js.map +1 -1
  218. package/package.json +91 -91
  219. package/workflows/analyze.md +25 -49
  220. package/workflows/auto-test.md +699 -699
  221. package/workflows/blueprint.md +403 -431
  222. package/workflows/brainstorm.md +54 -195
  223. package/workflows/business-test.md +570 -570
  224. package/workflows/claude-instructions.md +23 -51
  225. package/workflows/codex-instructions.md +27 -77
  226. package/workflows/coding-philosophy.md +69 -69
  227. package/workflows/command-authoring.md +823 -823
  228. package/workflows/debug.md +43 -98
  229. package/workflows/delegate-usage.md +39 -241
  230. package/workflows/execute.md +4 -53
  231. package/workflows/grill.md +12 -56
  232. package/workflows/harvest.md +22 -68
  233. package/workflows/init.md +148 -148
  234. package/workflows/instruction-authoring-guide.md +97 -0
  235. package/workflows/issue-execute.md +110 -110
  236. package/workflows/issue-gaps-analyze.codex.md +260 -260
  237. package/workflows/issue-gaps-analyze.md +216 -216
  238. package/workflows/issue-plan.md +110 -110
  239. package/workflows/issue.md +338 -346
  240. package/workflows/knowhow.md +0 -32
  241. package/workflows/learn.md +277 -277
  242. package/workflows/maestro-chain-execute.md +20 -20
  243. package/workflows/refactor.md +22 -44
  244. package/workflows/retrospective.md +16 -65
  245. package/workflows/review.md +446 -486
  246. package/workflows/roadmap.md +35 -132
  247. package/workflows/skill-authoring.md +265 -265
  248. package/workflows/spec-generate.md +470 -470
  249. package/workflows/specs-remove.md +104 -104
  250. package/workflows/sync.md +11 -41
  251. package/workflows/test-gen.md +226 -226
  252. package/workflows/test.md +385 -475
  253. package/workflows/ui-design.md +391 -391
  254. package/workflows/ui-style.md +199 -199
  255. package/workflows/wiki-connect.md +151 -151
  256. package/workflows/wiki-digest.md +178 -178
  257. package/workflows/wiki-manage.md +109 -109
  258. package/workflows/cli-tools-usage.md +0 -252
  259. package/workflows/delegate-protocol.codex.md +0 -65
@@ -1,462 +1,445 @@
1
- ---
2
- name: odyssey-ui
3
- description: Long-running UI optimization cycle — visual survey, multi-dimensional audit, divergent exploration, fix, verify, generalize, and design knowledge persistence
4
- argument-hint: "<target> [--dimensions <list>] [--skip-fix] [--skip-generalize] [--auto] [-y] [-c]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Edit
9
- - Bash
10
- - Glob
11
- - Grep
12
- - Agent
13
- - AskUserQuestion
14
- ---
15
- <purpose>
16
- Deep UI polish cycle: survey (capture current state)audit (6 dimensions) diverge (creative
17
- exploration beyond bugs) → fix → verify → generalize (举一反三) → discover → persist.
18
-
19
- Unlike `maestro-impeccable` (single command/chain execution), this is a persistent session with
20
- evidence trails, decision journal, and iterative improvement. Every visual detail is an opportunity
21
- to learn and replicate.
22
-
23
- Core philosophy:
24
- - **Every pixel tells a story** — subtle details create the experience
25
- - **Diverge before converge** — explore creatively, then implement methodically
26
- - **Find one, polish all** — a single improvement reveals a class of opportunities
27
- - **Browser is truth** — verify in real rendering, not just in code
28
-
29
- **三句哲学约束(穷尽迭代):**
30
- 1. **零遗留** 每个 finding/idea 必须是 action item(修复 / issue / 决策),不允许只报告不处理
31
- 2. **穷尽迭代** impact×severity 递降逐轮修复,直到 0 remaining actionable findings 才退出 fix loop
32
- 3. **改进即标准** — 每次修复后重审同区域,发现新视觉问题继续修,直到该区域无可改善
33
-
34
- Entry: `/odyssey-ui "target"` (full cycle) | `-c` (resume) | `--skip-fix` (audit-only)
35
- </purpose>
36
-
37
- <boundary>
38
- **范围内:** 目标组件/页面的视觉体验优化 审查 6 维度 发散探索 修复 → 泛化到兄弟组件
39
- **范围外:** 后端逻辑 / 数据模型 / API 设计 / 业务规则 → `/odyssey-planex` | 深度 bug 调查 → `/odyssey-debug` | 代码质量审查 → `/odyssey-review-test-fix`
40
- **探索自由度:** 边界内最大自由 S_DIVERGE 阶段鼓励发散思维,不设创意上限。审查 + 发散可发现任何视觉/交互/可访问性细节。在约束下尽可能完善每个像素。
41
- </boundary>
42
-
43
- <execution_discipline>
44
- **三条铁律(所有阶段适用):**
45
-
46
- 1. **Phase auto-commit** — 每个阶段完成后**自动** `git commit`,无需用户确认
47
- - 代码变更 + understanding.md → `git add` → `git commit -m "odyssey-ui({slug}): {phase} — {摘要}"`
48
- - session.json / evidence.ndjson 为运行时状态,不纳入 commit
49
-
50
- 2. **有把握才改** 仅修改自己有把握的内容;不确定的记录决策等人判断
51
- - 视觉确定性高(缺少 hover state、对比度不足等)→ 直接修复
52
- - 设计方向不确定(色彩选择、布局重构等)→ 记录 decision 等用户判断
53
- - 禁止猜测性修改,尤其是品牌/风格层面的改动
54
-
55
- 3. **多 CLI 辅助** — 利用 `maestro delegate` 调用多个 CLI 工具交叉验证
56
- - survey 阶段: `--role explore` 发现设计系统用法
57
- - audit/diverge: `--role analyze` 获取多视角创意
58
- - fix 前后: `--role review` 确认视觉正确性
59
- </execution_discipline>
60
-
61
- <context>
62
- $ARGUMENTS target and optional flags.
63
-
64
- **Target resolution:**
65
- | Input | Resolution |
66
- |-------|-----------|
67
- | Component path | Audit that component |
68
- | Page/route path | Audit that page |
69
- | `staged` / `HEAD` | Review UI changes in diff |
70
- | Feature area name | Resolve to related components/pages |
71
-
72
- **Flags:**
73
- | Flag | Effect | Default |
74
- |------|--------|---------|
75
- | `--dimensions <list>` | Comma-separated subset of 6 dimensions | all 6 |
76
- | `--fix-threshold <severity>` | 修复到哪个 severity 为止(all = 全部修复)| all |
77
- | `--skip-fix` | Audit + diverge only, no code changes | false |
78
- | `--skip-generalize` | Skip S_GENERALIZE and S_DISCOVER | false |
79
- | `--auto` | CLI delegates without confirmation | false |
80
- | `-y` | Auto-confirm all decisions (see appendix) | false |
81
- | `-c` | Resume most recent session | |
82
-
83
- **Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-ui-odyssey-{slug}/`
84
-
85
- **Output 3 files:**
86
- ```
87
- SESSION_DIR/
88
- ├── session.json # state + audit_result + diverge_result + patterns + phase_goals
89
- ├── evidence.ndjson # append-only (phase: survey|audit|diverge|fix|discovery|decision|self-iteration)
90
- └── understanding.md # 8-section evolving narrative
91
- ```
92
-
93
- **session.json schema:**
94
- ```json
95
- {
96
- "session_id": "ui-odyssey-{YYYYMMDD-HHmmss}",
97
- "target": "", "dimensions": [],
98
- "flags": { "skip_fix": false, "skip_generalize": false, "auto": false, "auto_confirm": false },
99
- "current_state": "S_INTAKE",
100
- "audit_result": { "dimensions_audited": [], "finding_count": 0, "severity_distribution": { "critical": 0, "high": 0, "medium": 0, "low": 0 } },
101
- "diverge_result": { "improvements_proposed": 0, "creative_ideas": 0 },
102
- "patterns": [{ "id": "P1", "source_finding": "F1", "layer": "syntax|semantic|structural", "signature": "", "description": "", "risk": "", "fix_template": "", "confidence": "high|medium|low" }],
103
- "confirmation": { "test_result": {}, "cli_review": {}, "overall": "confirmed|needs_rework" },
104
- "generalization_stats": { "patterns_extracted": 0, "total_hits": 0, "cross_layer_confirmed": 0, "regression_risks": 0, "by_layer": {}, "deepening_triggered": false },
105
- "phase_goals": [], "phase_goals_all_done": false,
106
- "self_iteration_log": [],
107
- "cross_phase_loops": 0, "max_loops": 3,
108
- "created_at": "", "updated_at": ""
109
- }
110
- ```
111
-
112
- **evidence.ndjson unified schema:** `{"ts":"","phase":"<phase>","type":"<type>","dimension":"","title":"","severity":"","file":"","line":0,"description":"","suggestion":"","category":"","impact":"","effort":""}`
113
-
114
- **phase_goals[]:**
115
- | ID | Goal | Phase | skip_when |
116
- |----|------|-------|-----------|
117
- | G1 | Survey completed | S_SURVEY | |
118
- | G2 | Audit completed | S_AUDIT | |
119
- | G3 | Divergent exploration done | S_DIVERGE | |
120
- | G4 | Zero remaining: all findings/ideas fixed and verified | 0 remaining actionable within fix_threshold | S_VERIFY | skip_fix |
121
- | G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
122
- | G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
123
- | G7 | Learnings persisted | S_RECORD | — |
124
-
125
- Lifecycle: `pending done | skipped | failed` (all set `completion_confirmed`)
126
-
127
- ### Pre-load(可选,缺失不阻塞)
128
-
129
- | 层级 | 命令 | 作用 |
130
- |------|------|------|
131
- | Codebase docs | Read `.workflow/codebase/ARCHITECTURE.md` | 模块边界,组件结构 |
132
- | Wiki search | `maestro search "<target keywords>" --json` | 先前 UI 决策(取 top 5) |
133
- | UI specs | `maestro spec load --category ui` | 设计规范、token、组件约定 |
134
- | Coding specs | `maestro spec load --category coding` | 编码规范 |
135
- | Role knowledge | `maestro search --category ui` → 选相关 → `maestro wiki load <id>` | 累积设计知识 |
136
- | Prior sessions | `Glob(".workflow/scratch/*-ui-odyssey-*")` | 相关会话 |
137
-
138
- ### Knowledge Persistence(S_RECORD 中写入产出文件)
139
-
140
- S_RECORD 阶段将可沉淀知识 **写入 understanding.md §8 Learnings**,按以下分类结构化:
141
-
142
- | 分类 | 写入内容 | 后续建议命令 |
143
- |------|---------|-------------|
144
- | 设计 pattern | 组件模式 + 适用场景 + token 引用 | `/spec-add ui "..."` |
145
- | 交互规范 | 状态定义 + 转场规则 + 反馈模式 | `/spec-add ui "..."` |
146
- | 可访问性规则 | WCAG 要求 + 实现方案 | `/spec-add ui "..."` |
147
- | 可复用泛化 pattern | pattern 签名 + 应用范围 | `/spec-add coding "..."` |
148
-
149
- **两步模式:** 执行中写入产出文件(临时记录)→ 任务完成后用户通过 next_step_routing 沉淀为永久知识。执行过程中不调用外部 Skill。
150
- </context>
151
-
152
- <self_iteration>
153
- **Quality Gate** — auto-evaluate after each analytical phase. Insufficient → re-enter (max 2 rounds).
154
-
155
- | Dimension | Sufficient | Insufficient |
156
- |-----------|-----------|-------------|
157
- | Coverage | All target components/pages analyzed across dimensions | Missed files discoverable via grep/glob |
158
- | Depth | ≥80% findings have file:line evidence | Most findings lack specifics |
159
- | Actionability | Each conclusion has concrete improvement action | "Consider reviewing" without action |
160
-
161
- **Expansion:** Round 1 = widen scope (more components, deeper import chain, extra delegate angles). Round 2 = shift perspective (different CLI tool, reverse dependency trace, manual code reading).
162
-
163
- **Log:** `evidence.ndjson ← {"phase":"self-iteration","type":"quality-gate","stage":"S_XXX","round":N,"assessment":{},"expansion":""}`
164
-
165
- **Applicable stages:** S_SURVEY, S_AUDIT, S_DIVERGE, S_GENERALIZE
166
- </self_iteration>
167
-
168
- <state_machine>
169
-
170
- <states>
171
- S_INTAKE — Parse target, load design context, resume session PERSIST: session.json + understanding.md §1
172
- S_SURVEY — Visual landscape: design tokens, pattern inventory PERSIST: evidence.ndjson (survey) + understanding.md §2
173
- S_AUDIT 6-dimension parallel review PERSIST: evidence.ndjson (audit) + understanding.md §3
174
- S_DIVERGE — Divergent creative exploration: polish + delight PERSIST: evidence.ndjson (diverge) + understanding.md §4
175
- S_FIX — Implement improvements (skip if --skip-fix) PERSIST: code changes + evidence.ndjson (fix)
176
- S_VERIFY — Visual verification + test (skip if --skip-fix) PERSIST: session.json.confirmation + understanding.md §5
177
- S_GENERALIZE Pattern extraction + 4-agent scan (skip if --skip-gen) PERSIST: session.json.patterns + understanding.md §6
178
- S_DISCOVER — Classify hits, create issues (skip if --skip-gen) PERSIST: evidence.ndjson (discovery|decision) + understanding.md §7
179
- S_RECORD — Design knowledge persistence + final report PERSIST: understanding.md §8 + spec entries
180
- </states>
181
-
182
- <transitions>
183
- S_INTAKE:
184
- S_INTAKE WHEN -c + session found DO A_RESUME
185
- S_SURVEY WHEN target resolved DO A_INTAKE
186
- → S_INTAKE WHEN no target DO AskUserQuestion
187
-
188
- S_SURVEY S_AUDIT DO A_SURVEY
189
-
190
- S_AUDIT → S_DIVERGE DO A_AUDIT
191
-
192
- S_DIVERGE:
193
- S_FIX WHEN !skip_fix AND actionable findings/ideas DO A_DIVERGE
194
- → S_GENERALIZE WHEN (skip_fix OR no actionable) AND !skip_gen DO A_DIVERGE
195
- S_RECORD WHEN (skip_fix OR no actionable) AND skip_gen DO A_DIVERGE
196
-
197
- S_FIX → S_VERIFY DO A_FIX
198
-
199
- S_VERIFY:
200
- S_GENERALIZE WHEN verified AND !skip_gen DO A_VERIFY
201
- S_RECORD WHEN verified AND skip_gen DO A_VERIFY
202
- S_FIX WHEN needs_rework DO A_VERIFY
203
-
204
- S_GENERALIZE:
205
- S_DISCOVER WHEN hits found DO A_GENERALIZE
206
- S_RECORD WHEN no hits DO A_GENERALIZE
207
-
208
- S_DISCOVER S_AUDIT : discovery reveals new component to audit, loops < max_loops → cross_phase_loops++
209
- S_DISCOVER → S_FIX : discovery finds fixable sibling, !skip_fix, loops < max_loops → cross_phase_loops++
210
- S_DISCOVER → S_RECORD : triage complete OR loops >= max_loops (剩余项 → issue/decision)
211
-
212
- S_RECORD → END DO A_RECORD
213
- </transitions>
214
-
215
- <actions>
216
-
217
- ### A_INTAKE
218
- 1. Parse arguments: target description, flags, `--dimensions` subset
219
- 2. Generate slug, create `SESSION_DIR`
220
- 3. Search: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load ui/coding
221
- 4. Derive `phase_goals[]` from flags (apply `skip_when`)
222
- 5. Write `session.json` + `understanding.md` §1 (Target & Design Context)
223
- 6. Emit Goal Prompt (see Appendix)
224
-
225
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): INTAKE — 目标解析"`
226
-
227
- ### A_RESUME
228
- Find latest session via Glob → read `session.json` → display summary → jump to `current_state`.
229
-
230
- ### A_SURVEY
231
- Visual landscape survey understand the current state before proposing changes.
232
-
233
- 1. **Design system inventory**: Scan target files for design tokens, CSS variables, theme imports. Catalog what's used.
234
- 2. **Current state analysis**: Read component code, identify styling patterns, layout strategy, component hierarchy.
235
- 3. **CLI-assisted survey** (optional):
236
- ```bash
237
- maestro delegate "PURPOSE: Survey UI design state of: {target}
238
- TASK: Identify design tokens in use | Catalog spacing/typography patterns | Map component hierarchy | Check consistency with design system
239
- MODE: analysis
240
- CONTEXT: @{target_files}
241
- EXPECTED: JSON {tokens_used, spacing_patterns, typography_scale, component_hierarchy, consistency_issues}
242
- " --role analyze --mode analysis
243
- ```
244
- Run_in_background, STOP, wait for callback.
245
-
246
- 4. Append evidence.ndjson (phase: "survey"). Update `understanding.md` §2. Mark G1 done.
247
-
248
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): SURVEY — 视觉调查"`
249
-
250
- ### A_AUDIT
251
- Spawn 6 parallel Agents (one per dimension, or `--dimensions` subset):
252
-
253
- | Agent | Dimension | Focus |
254
- |-------|-----------|-------|
255
- | Visual Hierarchy | visual_hierarchy | Spacing, typography scale, color contrast, alignment, whitespace, visual weight |
256
- | Interaction States | interaction_states | Hover, focus, active, disabled, loading, error, empty, selected states |
257
- | Accessibility | accessibility | WCAG AA contrast, focus management, aria labels, keyboard nav, screen reader |
258
- | Responsiveness | responsiveness | Breakpoints, overflow, touch targets, fluid typography, container queries |
259
- | Micro-interactions | micro_interactions | Transitions, animations, feedback indicators, loading states, progress |
260
- | Edge Cases | edge_cases | Long text truncation, empty data, error states, extreme values, i18n, RTL |
261
-
262
- Each returns `[{title, severity, file, line, description, suggestion, dimension}]`.
263
- Merge evidence.ndjson (phase: "audit"). Write `session.json.audit_result`.
264
- Update `understanding.md` §3 (findings by dimension + severity matrix). Mark G2 done.
265
-
266
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): AUDIT 多维审查"`
267
-
268
- ### A_DIVERGE
269
- **The unique phase** divergent creative exploration. Goes beyond defect fixing to ask "what would make this delightful?"
270
-
271
- **Step 1 — Creative exploration (2 parallel Agents):**
272
-
273
- | Agent | Angle | Prompt Focus |
274
- |-------|-------|-------------|
275
- | Polish Agent | "What subtle details are missing?" | Shadows, borders, transitions, hover states, feedback, empty states, skeleton loading, scroll behavior |
276
- | Delight Agent | "What would make this experience memorable?" | Motion design, progressive disclosure, smart defaults, contextual hints, celebratory feedback, personality in copy |
277
-
278
- Each returns: `[{idea, category (polish|delight), impact (high|medium|low), effort (small|medium|large), description, inspiration}]`
279
-
280
- **Step 2 — CLI-assisted design review** (optional):
281
- ```bash
282
- maestro delegate "PURPOSE: Creative UI review of: {target}
283
- TASK: Identify polish opportunities | Suggest micro-interaction improvements | Review visual rhythm and harmony | Propose delight moments
284
- MODE: analysis
285
- CONTEXT: @{target_files} | Audit summary: {audit_findings_summary}
286
- EXPECTED: JSON [{category, idea, rationale, reference}]
287
- " --role analyze --mode analysis
288
- ```
289
- Run_in_background, STOP, wait for callback.
290
-
291
- **Step 3 Consolidate**: Merge audit findings + divergent ideas → prioritized improvement list (severity x impact x effort matrix).
292
- Append evidence.ndjson (phase: "diverge"). Update `understanding.md` §4. Mark G3 done.
293
-
294
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): DIVERGE — 发散探索"`
295
-
296
- ### A_FIX
297
- Skip if `--skip-fix`. Implement improvements prioritized by impact.
298
-
299
- 1. **穷尽修复**: Fix ALL findings/ideas by priority tier (critical→high→medium→low + high-impact ideas), not just top items. After each tier, re-review modified area — new findings append.
300
- 2. For each fix: implement → append evidence.ndjson (phase: "fix")
301
- 3. **Normal**: AskUserQuestion per-fix confirmation. **`-y`**: auto-proceed, record `deferred`.
302
-
303
- 📌 **Auto-commit**: `git add -A && git commit -m "odyssey-ui({slug}): FIX — 优化实现"`
304
-
305
- ### A_VERIFY
306
- Visual verification confirm improvements work in practice.
307
-
308
- 1. Run tests if applicable (lint, unit, visual regression)
309
- 2. **CLI-assisted visual review**:
310
- ```bash
311
- maestro delegate "PURPOSE: Verify UI improvements for: {target}
312
- TASK: Check visual correctness | Verify interaction states | Confirm accessibility | Test responsive behavior
313
- MODE: analysis
314
- CONTEXT: @{modified_files} | Improvements: {fix_summary}
315
- EXPECTED: JSON {verdict, verified_improvements, remaining_issues, regression_risk}
316
- " --role review --mode analysis
317
- ```
318
- Run_in_background, STOP, wait for callback.
319
-
320
- 3. `needs_rework` → S_FIX. `verified` → mark G4 done, advance.
321
- 4. Update `understanding.md` §5. Write `session.json.confirmation`.
322
-
323
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): VERIFY — 验证"`
324
-
325
- ### A_GENERALIZE
326
- Multi-layer pattern extraction from findings + improvements 4-agent scan cross-layer dedup.
327
-
328
- **Pattern extraction** from audit findings + diverge ideas (severity >= medium OR impact = high):
329
-
330
- | Layer | Method | Example |
331
- |-------|--------|---------|
332
- | Syntax | Regex direct Grep | Missing `aria-label`, hardcoded px values, inline styles |
333
- | Semantic | Agent understands anti-pattern → scans | Inconsistent hover states, missing loading feedback |
334
- | Structural | File/module structure similarity | Same component type missing responsive treatment |
335
-
336
- Write `session.json.patterns[]`.
337
-
338
- **4-agent parallel scan** (single message):
339
-
340
- | Agent | Strategy | Scope |
341
- |-------|----------|-------|
342
- | Syntax grep | Grep CSS/style patterns matching found issues | Full project |
343
- | Semantic scan | Find components with same interaction pattern but missing states | Related modules |
344
- | Structural match | Find structurally similar components (same imports, layout) | Full project |
345
- | Historical grep | `git log -S "{pattern}"` for when similar UI patterns were introduced/fixed | Git history |
346
-
347
- **Cross-layer dedup**: Multi-layer hit → boost confidence. Single-layer `needs_review`. Historical match on fixed code → `regression_risk`.
348
-
349
- **Iterative deepening**: Module with ≥3 hits targeted deep scan (max 1 round).
350
-
351
- Update `understanding.md` §6 (per-pattern summary, cross-layer matrix). Write `session.json.generalization_stats`. Mark G5 done.
352
-
353
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): GENERALIZE — 泛化扫描"`
354
-
355
- ### A_DISCOVER
356
- Classify each hit: `needs_treatment` / `low_risk` / `already_handled`.
357
- **Normal**: AskUserQuestion for routing. **`-y`**: auto create issue, `deferred`.
358
- Append evidence (phase: "discovery" + "decision"). Update `understanding.md` §7. Mark G6 done.
359
-
360
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): DISCOVER — 发现分类"`
361
-
362
- ### A_RECORD
363
- 1. Finalize `understanding.md` §8: design learnings
364
- 2. Write learnings to understanding.md §8: Knowledge Persistence 表分类记录(临时),completion summary 列出建议的 `/spec-add` 命令
365
- 3. Pending decisions: **Normal** → AskUserQuestion. **`-y`** → skip, display deferred count
366
- 4. **Goal audit**: all `phase_goals[*].completion_confirmed` true → `phase_goals_all_done = true`. Any false: **Normal** → AskUserQuestion (回退/跳过/接受) | **`-y`** → auto accept
367
- 5. Mark G7 done. `current_state = "COMPLETED"`. Emit completion summary:
368
- ```
369
- --- UI ODYSSEY COMPLETE ---
370
- Target: {target}
371
- Dimensions: {dimensions_audited}
372
- Findings: {C}C {H}H {M}M {L}L
373
- Diverge: {improvements} polish + {creative} delight ideas
374
- Fix: {fixed_count} applied, verified={yes|skipped}
375
- Patterns: {extracted} ({by_layer} distribution)
376
- Scan hits: {total} ({cross_layer} cross-layer confirmed)
377
- Issues: {N} created
378
- Decisions: {N} resolved, {M} pending, {K} deferred
379
- Learnings: {N} entries in understanding.md §8
380
- Self-iter: {N} quality gate rounds across {M} stages
381
- Goals: {done}/{total} ({skipped} skipped)
382
- ---
383
- ```
384
-
385
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): RECORD — 会话总结"`
386
-
387
- </actions>
388
-
389
- <appendix>
390
-
391
- ### Goal Prompt Template
392
- **⚠️ 时机守卫:仅在 A_INTAKE 完成后显示一次(session 创建后、开始 survey 前)。A_RECORD 完成时禁止重新显示。**
393
-
394
- ```
395
- 📋 UI Odyssey 会话已创建。可随时复制以下 /goal 设定终止条件(执行过程中输入即可):
396
-
397
- /goal 穷尽迭代:直到 session.json audit + diverge findings 均已处理(fix/issue/decision)
398
- 且 phase_goals_all_done=true 才停。修复按 impact×severity 逐轮迭代。
399
- 每轮修复后重审修改区域,新发现追加继续修。
400
- 遇到 phase=decision pending 必须 AskUserQuestion。不允许"只报告不处理"。
401
- ```
402
-
403
- 完成时仅输出 completion summary,不重复此提示。
404
-
405
- ### `-y` Auto-Confirm (5 decision points)
406
- | Decision Point | Normal | `-y` |
407
- |----------------|--------|------|
408
- | A_FIX improvement confirmation | AskUserQuestion | auto-proceed, `deferred` |
409
- | A_DISCOVER hit routing | AskUserQuestion | auto create issue, `deferred` |
410
- | A_DISCOVER ambiguous items | AskUserQuestion | all `deferred` |
411
- | A_RECORD pending decisions | AskUserQuestion | skip, show deferred count |
412
- | A_RECORD goal audit | AskUserQuestion | auto accept |
413
-
414
- `deferred` items shown as "待决策" in completion summary; recoverable via `-c`.
415
-
416
- ### Phase Goal Lifecycle
417
- `pending done (confirmed=true)` normal | `pending skipped (confirmed=true)` flags/manual | `pending failed (confirmed=false)` exception
418
-
419
- `phase_goals_all_done = true` only when ALL goals have `completion_confirmed == true`.
420
-
421
- </appendix>
422
-
423
- </state_machine>
424
-
425
- <error_codes>
426
- | Code | Severity | Condition | Recovery |
427
- |------|----------|-----------|----------|
428
- | E001 | error | No target specified | Provide target |
429
- | E002 | error | Target path not found | Check path |
430
- | E003 | error | Resume but no session found | Start new session |
431
- | W001 | warning | No design system detected | Proceed with defaults |
432
- | W002 | warning | Some dimension agents failed | Partial coverage |
433
- | W003 | warning | Generalization 0 hits | Skip discovery |
434
- | W004 | warning | Delegate parse failed | Use raw output |
435
- </error_codes>
436
-
437
- <success_criteria>
438
- - [ ] Target resolved and session created
439
- - [ ] Design system inventory captured in survey
440
- - [ ] All dimensions audited (6 parallel agents) with structured findings
441
- - [ ] Severity matrix produced
442
- - [ ] Divergent exploration: polish + delight ideas generated
443
- - [ ] Improvements implemented and verified (unless --skip-fix)
444
- - [ ] Multi-layer generalization scan + cross-layer dedup (unless --skip-generalize)
445
- - [ ] Quality Gate self-iteration triggered when insufficient
446
- - [ ] Discoveries classified and routed
447
- - [ ] understanding.md §8 finalized with design learnings
448
- - [ ] phase_goals G1-G7 tracked and audited
449
- - [ ] Goal Prompt displayed once
450
- - [ ] `-y`: no blocking prompts, deferred counted
451
- - [ ] Session resumable via -c
452
- </success_criteria>
453
-
454
- <next_step_routing>
455
- | Condition | Next step |
456
- |-----------|-----------|
457
- | Finding needs deeper debug | `/odyssey-debug "<finding>"` |
458
- | Issues created from discoveries | `/manage-issue list --source ui-odyssey` |
459
- | Design pattern worth documenting | `/spec-add ui "..."` |
460
- | Want full review of changes | `/odyssey-review-test-fix <changed-files>` |
461
- | Sibling components to polish | `/odyssey-ui "<sibling>"` |
462
- </next_step_routing>
1
+ ---
2
+ name: odyssey-ui
3
+ description: Long-running UI optimization cycle — visual survey, multi-dimensional audit, divergent exploration, fix, verify, generalize, and design knowledge persistence
4
+ argument-hint: "<target> [--dimensions <list>] [--skip-fix] [--skip-generalize] [--auto] [-y] [-c]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Deep UI polish cycle: survey 6-dimension auditdivergent creative exploration
17
+ fix → verify → generalize → discover → persist. Every pixel is a learning opportunity.
18
+ </purpose>
19
+
20
+ <boundary>
21
+ **范围内:** 目标组件/页面的视觉体验优化 审查 6 维度 → 发散探索 → 修复 → 泛化到兄弟组件
22
+ **范围外:** 后端逻辑 / 数据模型 / API 设计 / 业务规则 → `/odyssey-planex` | 深度 bug 调查 → `/odyssey-debug` | 代码质量审查 → `/odyssey-review-test-fix`
23
+ **探索自由度:** 边界内最大自由 — S_DIVERGE 阶段鼓励发散思维,不设创意上限。审查 + 发散可发现任何视觉/交互/可访问性细节。在约束下尽可能完善每个像素。
24
+ </boundary>
25
+
26
+ <execution_discipline>
27
+ **三条铁律(所有阶段适用):**
28
+
29
+ 1. **Phase auto-commit** — 每个阶段完成后**自动** `git commit`,无需用户确认
30
+ - 代码变更 + understanding.md `git add` `git commit -m "odyssey-ui({slug}): {phase} {摘要}"`
31
+ - session.json / evidence.ndjson 为运行时状态,不纳入 commit
32
+
33
+ 2. **有把握才改** — 仅修改自己有把握的内容;不确定的记录决策等人判断
34
+ - 视觉确定性高(缺少 hover state、对比度不足等)→ 直接修复
35
+ - 设计方向不确定(色彩选择、布局重构等)→ 记录 decision 等用户判断
36
+ - 禁止猜测性修改,尤其是品牌/风格层面的改动
37
+
38
+ 3. **多 CLI 辅助** 利用 `maestro delegate` 调用多个 CLI 工具交叉验证
39
+ - survey 阶段: `--role explore` 发现设计系统用法
40
+ - audit/diverge: `--role analyze` 获取多视角创意
41
+ - fix 前后: `--role review` 确认视觉正确性
42
+ </execution_discipline>
43
+
44
+ <context>
45
+ $ARGUMENTS — target and optional flags.
46
+
47
+ **Target resolution:**
48
+ | Input | Resolution |
49
+ |-------|-----------|
50
+ | Component path | Audit that component |
51
+ | Page/route path | Audit that page |
52
+ | `staged` / `HEAD` | Review UI changes in diff |
53
+ | Feature area name | Resolve to related components/pages |
54
+
55
+ **Flags:**
56
+ | Flag | Effect | Default |
57
+ |------|--------|---------|
58
+ | `--dimensions <list>` | Comma-separated subset of 6 dimensions | all 6 |
59
+ | `--fix-threshold <severity>` | 修复到哪个 severity 为止(all = 全部修复)| all |
60
+ | `--skip-fix` | Audit + diverge only, no code changes | false |
61
+ | `--skip-generalize` | Skip S_GENERALIZE and S_DISCOVER | false |
62
+ | `--auto` | CLI delegates without confirmation | false |
63
+ | `-y` | Auto-confirm all decisions (see appendix) | false |
64
+ | `-c` | Resume most recent session | — |
65
+
66
+ **Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-ui-odyssey-{slug}/`
67
+
68
+ **Output 3 files:**
69
+ ```
70
+ SESSION_DIR/
71
+ ├── session.json # state + audit_result + diverge_result + patterns + phase_goals
72
+ ├── evidence.ndjson # append-only (phase: survey|audit|diverge|fix|discovery|decision|self-iteration)
73
+ └── understanding.md # 8-section evolving narrative
74
+ ```
75
+
76
+ **session.json schema:**
77
+ ```json
78
+ {
79
+ "session_id": "ui-odyssey-{YYYYMMDD-HHmmss}",
80
+ "target": "", "dimensions": [],
81
+ "flags": { "skip_fix": false, "skip_generalize": false, "auto": false, "auto_confirm": false },
82
+ "current_state": "S_INTAKE",
83
+ "audit_result": { "dimensions_audited": [], "finding_count": 0, "severity_distribution": { "critical": 0, "high": 0, "medium": 0, "low": 0 } },
84
+ "diverge_result": { "improvements_proposed": 0, "creative_ideas": 0 },
85
+ "patterns": [{ "id": "P1", "source_finding": "F1", "layer": "syntax|semantic|structural", "signature": "", "description": "", "risk": "", "fix_template": "", "confidence": "high|medium|low" }],
86
+ "confirmation": { "test_result": {}, "cli_review": {}, "overall": "confirmed|needs_rework" },
87
+ "generalization_stats": { "patterns_extracted": 0, "total_hits": 0, "cross_layer_confirmed": 0, "regression_risks": 0, "by_layer": {}, "deepening_triggered": false },
88
+ "phase_goals": [], "phase_goals_all_done": false,
89
+ "self_iteration_log": [],
90
+ "cross_phase_loops": 0, "max_loops": 3,
91
+ "created_at": "", "updated_at": ""
92
+ }
93
+ ```
94
+
95
+ **evidence.ndjson unified schema:** `{"ts":"","phase":"<phase>","type":"<type>","dimension":"","title":"","severity":"","file":"","line":0,"description":"","suggestion":"","category":"","impact":"","effort":""}`
96
+
97
+ **phase_goals[]:**
98
+ | ID | Goal | Phase | skip_when |
99
+ |----|------|-------|-----------|
100
+ | G1 | Survey completed | S_SURVEY | |
101
+ | G2 | Audit completed | S_AUDIT | — |
102
+ | G3 | Divergent exploration done | S_DIVERGE | |
103
+ | G4 | Zero remaining: all findings/ideas fixed and verified | 0 remaining actionable within fix_threshold | S_VERIFY | skip_fix |
104
+ | G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
105
+ | G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
106
+ | G7 | Learnings persisted | S_RECORD | — |
107
+
108
+ Lifecycle: `pending done | skipped | failed` (all set `completion_confirmed`)
109
+
110
+ ### Pre-load(可选,缺失不阻塞)
111
+
112
+ | 层级 | 命令 | 作用 |
113
+ |------|------|------|
114
+ | Codebase docs | Read `.workflow/codebase/ARCHITECTURE.md` | 模块边界,组件结构 |
115
+ | Wiki search | `maestro search "<target keywords>" --json` | 先前 UI 决策(取 top 5) |
116
+ | UI specs | `maestro spec load --category ui` | 设计规范、token、组件约定 |
117
+ | Coding specs | `maestro spec load --category coding` | 编码规范 |
118
+ | Role knowledge | `maestro search --category ui` → 选相关 → `maestro wiki load <id>` | 累积设计知识 |
119
+ | Prior sessions | `Glob(".workflow/scratch/*-ui-odyssey-*")` | 相关会话 |
120
+
121
+ ### Knowledge Persistence(S_RECORD 中写入产出文件)
122
+
123
+ S_RECORD 阶段将可沉淀知识 **写入 understanding.md §8 Learnings**,按以下分类结构化:
124
+
125
+ | 分类 | 写入内容 | 后续建议命令 |
126
+ |------|---------|-------------|
127
+ | 设计 pattern | 组件模式 + 适用场景 + token 引用 | `/spec-add ui "..."` |
128
+ | 交互规范 | 状态定义 + 转场规则 + 反馈模式 | `/spec-add ui "..."` |
129
+ | 可访问性规则 | WCAG 要求 + 实现方案 | `/spec-add ui "..."` |
130
+ | 可复用泛化 pattern | pattern 签名 + 应用范围 | `/spec-add coding "..."` |
131
+
132
+ **两步模式:** 执行中写入产出文件(临时记录)→ 任务完成后用户通过 next_step_routing 沉淀为永久知识。执行过程中不调用外部 Skill。
133
+ </context>
134
+
135
+ <self_iteration>
136
+ **Quality Gate** auto-evaluate after each analytical phase. Insufficient → re-enter (max 2 rounds).
137
+
138
+ | Dimension | Sufficient | Insufficient |
139
+ |-----------|-----------|-------------|
140
+ | Coverage | All target components/pages analyzed across dimensions | Missed files discoverable via grep/glob |
141
+ | Depth | ≥80% findings have file:line evidence | Most findings lack specifics |
142
+ | Actionability | Each conclusion has concrete improvement action | "Consider reviewing" without action |
143
+
144
+ **Expansion:** Round 1 = widen scope (more components, deeper import chain, extra delegate angles). Round 2 = shift perspective (different CLI tool, reverse dependency trace, manual code reading).
145
+
146
+ **Log:** `evidence.ndjson {"phase":"self-iteration","type":"quality-gate","stage":"S_XXX","round":N,"assessment":{},"expansion":""}`
147
+
148
+ **Applicable stages:** S_SURVEY, S_AUDIT, S_DIVERGE, S_GENERALIZE
149
+ </self_iteration>
150
+
151
+ <state_machine>
152
+
153
+ <states>
154
+ S_INTAKE — Parse target, load design context, resume session PERSIST: session.json + understanding.md §1
155
+ S_SURVEY — Visual landscape: design tokens, pattern inventory PERSIST: evidence.ndjson (survey) + understanding.md §2
156
+ S_AUDIT — 6-dimension parallel review PERSIST: evidence.ndjson (audit) + understanding.md §3
157
+ S_DIVERGE — Divergent creative exploration: polish + delight PERSIST: evidence.ndjson (diverge) + understanding.md §4
158
+ S_FIX — Implement improvements (skip if --skip-fix) PERSIST: code changes + evidence.ndjson (fix)
159
+ S_VERIFY — Visual verification + test (skip if --skip-fix) PERSIST: session.json.confirmation + understanding.md §5
160
+ S_GENERALIZE — Pattern extraction + 4-agent scan (skip if --skip-gen) PERSIST: session.json.patterns + understanding.md §6
161
+ S_DISCOVER — Classify hits, create issues (skip if --skip-gen) PERSIST: evidence.ndjson (discovery|decision) + understanding.md §7
162
+ S_RECORD — Design knowledge persistence + final report PERSIST: understanding.md §8 + spec entries
163
+ </states>
164
+
165
+ <transitions>
166
+ S_INTAKE:
167
+ → S_INTAKE WHEN -c + session found DO A_RESUME
168
+ → S_SURVEY WHEN target resolved DO A_INTAKE
169
+ → S_INTAKE WHEN no target DO AskUserQuestion
170
+
171
+ S_SURVEY → S_AUDIT DO A_SURVEY
172
+
173
+ S_AUDIT → S_DIVERGE DO A_AUDIT
174
+
175
+ S_DIVERGE:
176
+ S_FIX WHEN !skip_fix AND actionable findings/ideas DO A_DIVERGE
177
+ S_GENERALIZE WHEN (skip_fix OR no actionable) AND !skip_gen DO A_DIVERGE
178
+ S_RECORD WHEN (skip_fix OR no actionable) AND skip_gen DO A_DIVERGE
179
+
180
+ S_FIX → S_VERIFY DO A_FIX
181
+
182
+ S_VERIFY:
183
+ → S_GENERALIZE WHEN verified AND !skip_gen DO A_VERIFY
184
+ S_RECORD WHEN verified AND skip_gen DO A_VERIFY
185
+ S_FIX WHEN needs_rework DO A_VERIFY
186
+
187
+ S_GENERALIZE:
188
+ S_DISCOVER WHEN hits found DO A_GENERALIZE
189
+ → S_RECORD WHEN no hits DO A_GENERALIZE
190
+
191
+ S_DISCOVER → S_AUDIT : discovery reveals new component to audit, loops < max_loops → cross_phase_loops++
192
+ S_DISCOVER → S_FIX : discovery finds fixable sibling, !skip_fix, loops < max_loops → cross_phase_loops++
193
+ S_DISCOVER S_RECORD : triage complete OR loops >= max_loops (剩余项 → issue/decision)
194
+
195
+ S_RECORD END DO A_RECORD
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 ui/coding
204
+ 4. Derive `phase_goals[]` from flags (apply `skip_when`)
205
+ 5. Write `session.json` + `understanding.md` §1 (Target & Design Context)
206
+ 6. Emit Goal Prompt (see Appendix)
207
+
208
+ 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): INTAKE 目标解析"`
209
+
210
+ ### A_RESUME
211
+ Find latest session via Glob → read `session.json` → display summary → jump to `current_state`.
212
+
213
+ ### A_SURVEY
214
+ Visual landscape survey — understand the current state before proposing changes.
215
+
216
+ 1. **Design system inventory**: Scan target files for design tokens, CSS variables, theme imports. Catalog what's used.
217
+ 2. **Current state analysis**: Read component code, identify styling patterns, layout strategy, component hierarchy.
218
+ 3. **CLI-assisted survey** (optional):
219
+ ```bash
220
+ maestro delegate "PURPOSE: Survey UI design state of: {target}
221
+ TASK: Identify design tokens in use | Catalog spacing/typography patterns | Map component hierarchy | Check consistency with design system
222
+ MODE: analysis
223
+ CONTEXT: @{target_files}
224
+ EXPECTED: JSON {tokens_used, spacing_patterns, typography_scale, component_hierarchy, consistency_issues}
225
+ " --role analyze --mode analysis
226
+ ```
227
+ Run_in_background, STOP, wait for callback.
228
+
229
+ 4. Append evidence.ndjson (phase: "survey"). Update `understanding.md` §2. Mark G1 done.
230
+
231
+ 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): SURVEY — 视觉调查"`
232
+
233
+ ### A_AUDIT
234
+ Spawn 6 parallel Agents (one per dimension, or `--dimensions` subset):
235
+
236
+ | Agent | Dimension | Focus |
237
+ |-------|-----------|-------|
238
+ | Visual Hierarchy | visual_hierarchy | Spacing, typography scale, color contrast, alignment, whitespace, visual weight |
239
+ | Interaction States | interaction_states | Hover, focus, active, disabled, loading, error, empty, selected states |
240
+ | Accessibility | accessibility | WCAG AA contrast, focus management, aria labels, keyboard nav, screen reader |
241
+ | Responsiveness | responsiveness | Breakpoints, overflow, touch targets, fluid typography, container queries |
242
+ | Micro-interactions | micro_interactions | Transitions, animations, feedback indicators, loading states, progress |
243
+ | Edge Cases | edge_cases | Long text truncation, empty data, error states, extreme values, i18n, RTL |
244
+
245
+ Each returns `[{title, severity, file, line, description, suggestion, dimension}]`.
246
+ Merge evidence.ndjson (phase: "audit"). Write `session.json.audit_result`.
247
+ Update `understanding.md` §3 (findings by dimension + severity matrix). Mark G2 done.
248
+
249
+ 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): AUDIT — 多维审查"`
250
+
251
+ ### A_DIVERGE
252
+ **The unique phase** — divergent creative exploration. Goes beyond defect fixing to ask "what would make this delightful?"
253
+
254
+ **Step 1 — Creative exploration (2 parallel Agents):**
255
+
256
+ | Agent | Angle | Prompt Focus |
257
+ |-------|-------|-------------|
258
+ | Polish Agent | "What subtle details are missing?" | Shadows, borders, transitions, hover states, feedback, empty states, skeleton loading, scroll behavior |
259
+ | Delight Agent | "What would make this experience memorable?" | Motion design, progressive disclosure, smart defaults, contextual hints, celebratory feedback, personality in copy |
260
+
261
+ Each returns: `[{idea, category (polish|delight), impact (high|medium|low), effort (small|medium|large), description, inspiration}]`
262
+
263
+ **Step 2 CLI-assisted design review** (optional):
264
+ ```bash
265
+ maestro delegate "PURPOSE: Creative UI review of: {target}
266
+ TASK: Identify polish opportunities | Suggest micro-interaction improvements | Review visual rhythm and harmony | Propose delight moments
267
+ MODE: analysis
268
+ CONTEXT: @{target_files} | Audit summary: {audit_findings_summary}
269
+ EXPECTED: JSON [{category, idea, rationale, reference}]
270
+ " --role analyze --mode analysis
271
+ ```
272
+ Run_in_background, STOP, wait for callback.
273
+
274
+ **Step 3 — Consolidate**: Merge audit findings + divergent ideas → prioritized improvement list (severity x impact x effort matrix).
275
+ Append evidence.ndjson (phase: "diverge"). Update `understanding.md` §4. Mark G3 done.
276
+
277
+ 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): DIVERGE — 发散探索"`
278
+
279
+ ### A_FIX
280
+ Skip if `--skip-fix`. Implement improvements prioritized by impact.
281
+
282
+ 1. **穷尽修复**: Fix ALL findings/ideas by priority tier (critical→high→medium→low + high-impact ideas), not just top items. After each tier, re-review modified area — new findings append.
283
+ 2. For each fix: implement append evidence.ndjson (phase: "fix")
284
+ 3. **Normal**: AskUserQuestion per-fix confirmation. **`-y`**: auto-proceed, record `deferred`.
285
+
286
+ 📌 **Auto-commit**: `git add -A && git commit -m "odyssey-ui({slug}): FIX 优化实现"`
287
+
288
+ ### A_VERIFY
289
+ Visual verification confirm improvements work in practice.
290
+
291
+ 1. Run tests if applicable (lint, unit, visual regression)
292
+ 2. **CLI-assisted visual review**:
293
+ ```bash
294
+ maestro delegate "PURPOSE: Verify UI improvements for: {target}
295
+ TASK: Check visual correctness | Verify interaction states | Confirm accessibility | Test responsive behavior
296
+ MODE: analysis
297
+ CONTEXT: @{modified_files} | Improvements: {fix_summary}
298
+ EXPECTED: JSON {verdict, verified_improvements, remaining_issues, regression_risk}
299
+ " --role review --mode analysis
300
+ ```
301
+ Run_in_background, STOP, wait for callback.
302
+
303
+ 3. `needs_rework` S_FIX. `verified` mark G4 done, advance.
304
+ 4. Update `understanding.md` §5. Write `session.json.confirmation`.
305
+
306
+ 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): VERIFY — 验证"`
307
+
308
+ ### A_GENERALIZE
309
+ Multi-layer pattern extraction from findings + improvements → 4-agent scan → cross-layer dedup.
310
+
311
+ **Pattern extraction** from audit findings + diverge ideas (severity >= medium OR impact = high):
312
+
313
+ | Layer | Method | Example |
314
+ |-------|--------|---------|
315
+ | Syntax | Regex → direct Grep | Missing `aria-label`, hardcoded px values, inline styles |
316
+ | Semantic | Agent understands anti-pattern → scans | Inconsistent hover states, missing loading feedback |
317
+ | Structural | File/module structure similarity | Same component type missing responsive treatment |
318
+
319
+ Write `session.json.patterns[]`.
320
+
321
+ **4-agent parallel scan** (single message):
322
+
323
+ | Agent | Strategy | Scope |
324
+ |-------|----------|-------|
325
+ | Syntax grep | Grep CSS/style patterns matching found issues | Full project |
326
+ | Semantic scan | Find components with same interaction pattern but missing states | Related modules |
327
+ | Structural match | Find structurally similar components (same imports, layout) | Full project |
328
+ | Historical grep | `git log -S "{pattern}"` for when similar UI patterns were introduced/fixed | Git history |
329
+
330
+ **Cross-layer dedup**: Multi-layer hit boost confidence. Single-layer → `needs_review`. Historical match on fixed code → `regression_risk`.
331
+
332
+ **Iterative deepening**: Module with ≥3 hits targeted deep scan (max 1 round).
333
+
334
+ Update `understanding.md` §6 (per-pattern summary, cross-layer matrix). Write `session.json.generalization_stats`. Mark G5 done.
335
+
336
+ 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): GENERALIZE — 泛化扫描"`
337
+
338
+ ### A_DISCOVER
339
+ Classify each hit: `needs_treatment` / `low_risk` / `already_handled`.
340
+ **Normal**: AskUserQuestion for routing. **`-y`**: auto create issue, `deferred`.
341
+ Append evidence (phase: "discovery" + "decision"). Update `understanding.md` §7. Mark G6 done.
342
+
343
+ 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): DISCOVER 发现分类"`
344
+
345
+ ### A_RECORD
346
+ 1. Finalize `understanding.md` §8: design learnings
347
+ 2. Write learnings to understanding.md §8: Knowledge Persistence 表分类记录(临时),completion summary 列出建议的 `/spec-add` 命令
348
+ 3. Pending decisions: **Normal** → AskUserQuestion. **`-y`** → skip, display deferred count
349
+ 4. **Goal audit**: all `phase_goals[*].completion_confirmed` true`phase_goals_all_done = true`. Any false: **Normal** → AskUserQuestion (回退/跳过/接受) | **`-y`** → auto accept
350
+ 5. Mark G7 done. `current_state = "COMPLETED"`. Emit completion summary:
351
+ ```
352
+ --- UI ODYSSEY COMPLETE ---
353
+ Target: {target}
354
+ Dimensions: {dimensions_audited}
355
+ Findings: {C}C {H}H {M}M {L}L
356
+ Diverge: {improvements} polish + {creative} delight ideas
357
+ Fix: {fixed_count} applied, verified={yes|skipped}
358
+ Patterns: {extracted} ({by_layer} distribution)
359
+ Scan hits: {total} ({cross_layer} cross-layer confirmed)
360
+ Issues: {N} created
361
+ Decisions: {N} resolved, {M} pending, {K} deferred
362
+ Learnings: {N} entries in understanding.md §8
363
+ Self-iter: {N} quality gate rounds across {M} stages
364
+ Goals: {done}/{total} ({skipped} skipped)
365
+ ---
366
+ ```
367
+
368
+ 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): RECORD — 会话总结"`
369
+
370
+ </actions>
371
+
372
+ <appendix>
373
+
374
+ ### Goal Prompt Template
375
+ **⚠️ 时机守卫:仅在 A_INTAKE 完成后显示一次(session 创建后、开始 survey 前)。A_RECORD 完成时禁止重新显示。**
376
+
377
+ ```
378
+ 📋 UI Odyssey 会话已创建。可随时复制以下 /goal 设定终止条件(执行过程中输入即可):
379
+
380
+ /goal 穷尽迭代:直到 session.json audit + diverge findings 均已处理(fix/issue/decision)
381
+ phase_goals_all_done=true 才停。修复按 impact×severity 逐轮迭代。
382
+ 每轮修复后重审修改区域,新发现追加继续修。
383
+ 遇到 phase=decision 的 pending 必须 AskUserQuestion。不允许"只报告不处理"。
384
+ ```
385
+
386
+ 完成时仅输出 completion summary,不重复此提示。
387
+
388
+ ### `-y` Auto-Confirm (5 decision points)
389
+ | Decision Point | Normal | `-y` |
390
+ |----------------|--------|------|
391
+ | A_FIX improvement confirmation | AskUserQuestion | auto-proceed, `deferred` |
392
+ | A_DISCOVER hit routing | AskUserQuestion | auto create issue, `deferred` |
393
+ | A_DISCOVER ambiguous items | AskUserQuestion | all `deferred` |
394
+ | A_RECORD pending decisions | AskUserQuestion | skip, show deferred count |
395
+ | A_RECORD goal audit | AskUserQuestion | auto accept |
396
+
397
+ `deferred` items shown as "待决策" in completion summary; recoverable via `-c`.
398
+
399
+ ### Phase Goal Lifecycle
400
+ `pending → done (confirmed=true)` normal | `pending skipped (confirmed=true)` flags/manual | `pending → failed (confirmed=false)` exception
401
+
402
+ `phase_goals_all_done = true` only when ALL goals have `completion_confirmed == true`.
403
+
404
+ </appendix>
405
+
406
+ </state_machine>
407
+
408
+ <error_codes>
409
+ | Code | Severity | Condition | Recovery |
410
+ |------|----------|-----------|----------|
411
+ | E001 | error | No target specified | Provide target |
412
+ | E002 | error | Target path not found | Check path |
413
+ | E003 | error | Resume but no session found | Start new session |
414
+ | W001 | warning | No design system detected | Proceed with defaults |
415
+ | W002 | warning | Some dimension agents failed | Partial coverage |
416
+ | W003 | warning | Generalization 0 hits | Skip discovery |
417
+ | W004 | warning | Delegate parse failed | Use raw output |
418
+ </error_codes>
419
+
420
+ <success_criteria>
421
+ - [ ] Target resolved and session created
422
+ - [ ] Design system inventory captured in survey
423
+ - [ ] All dimensions audited (6 parallel agents) with structured findings
424
+ - [ ] Severity matrix produced
425
+ - [ ] Divergent exploration: polish + delight ideas generated
426
+ - [ ] Improvements implemented and verified (unless --skip-fix)
427
+ - [ ] Multi-layer generalization scan + cross-layer dedup (unless --skip-generalize)
428
+ - [ ] Quality Gate self-iteration triggered when insufficient
429
+ - [ ] Discoveries classified and routed
430
+ - [ ] understanding.md §8 finalized with design learnings
431
+ - [ ] phase_goals G1-G7 tracked and audited
432
+ - [ ] Goal Prompt displayed once
433
+ - [ ] `-y`: no blocking prompts, deferred counted
434
+ - [ ] Session resumable via -c
435
+ </success_criteria>
436
+
437
+ <next_step_routing>
438
+ | Condition | Next step |
439
+ |-----------|-----------|
440
+ | Finding needs deeper debug | `/odyssey-debug "<finding>"` |
441
+ | Issues created from discoveries | `/manage-issue list --source ui-odyssey` |
442
+ | Design pattern worth documenting | `/spec-add ui "..."` |
443
+ | Want full review of changes | `/odyssey-review-test-fix <changed-files>` |
444
+ | Sibling components to polish | `/odyssey-ui "<sibling>"` |
445
+ </next_step_routing>