pi-maestro-flow 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/README.md +124 -0
  2. package/agents/aggregator.md +27 -0
  3. package/agents/cli-explore-agent.md +188 -0
  4. package/agents/cross-role-reviewer.md +171 -0
  5. package/agents/delegate.md +19 -0
  6. package/agents/explorer.md +23 -0
  7. package/agents/impeccable-agent.md +99 -0
  8. package/agents/ralph-executor.md +81 -0
  9. package/agents/reference.md +24 -0
  10. package/agents/role-design-author.md +220 -0
  11. package/agents/team-supervisor.md +143 -0
  12. package/agents/team-worker.md +237 -0
  13. package/agents/ui-design-agent.md +270 -0
  14. package/agents/workflow-analyzer.md +116 -0
  15. package/agents/workflow-codebase-mapper.md +77 -0
  16. package/agents/workflow-collab-planner.md +147 -0
  17. package/agents/workflow-debugger.md +104 -0
  18. package/agents/workflow-executor.md +133 -0
  19. package/agents/workflow-external-researcher.md +86 -0
  20. package/agents/workflow-integration-checker.md +83 -0
  21. package/agents/workflow-nyquist-auditor.md +85 -0
  22. package/agents/workflow-phase-researcher.md +85 -0
  23. package/agents/workflow-plan-checker.md +100 -0
  24. package/agents/workflow-planner.md +200 -0
  25. package/agents/workflow-project-researcher.md +74 -0
  26. package/agents/workflow-research-synthesizer.md +70 -0
  27. package/agents/workflow-reviewer.md +82 -0
  28. package/agents/workflow-roadmapper.md +81 -0
  29. package/agents/workflow-verifier.md +120 -0
  30. package/package.json +58 -0
  31. package/skills/codify-to-knowhow/SKILL.md +167 -0
  32. package/skills/delegation-check/SKILL.md +297 -0
  33. package/skills/domain-add/SKILL.md +75 -0
  34. package/skills/insight-challenge/SKILL.md +226 -0
  35. package/skills/learn-decompose/SKILL.md +124 -0
  36. package/skills/learn-follow/SKILL.md +163 -0
  37. package/skills/learn-investigate/SKILL.md +160 -0
  38. package/skills/learn-second-opinion/SKILL.md +128 -0
  39. package/skills/maestro/SKILL.md +239 -0
  40. package/skills/maestro-amend/SKILL.md +169 -0
  41. package/skills/maestro-analyze/SKILL.md +173 -0
  42. package/skills/maestro-blueprint/SKILL.md +159 -0
  43. package/skills/maestro-brainstorm/SKILL.md +193 -0
  44. package/skills/maestro-collab/SKILL.md +181 -0
  45. package/skills/maestro-companion/SKILL.md +536 -0
  46. package/skills/maestro-composer/SKILL.md +192 -0
  47. package/skills/maestro-execute/SKILL.md +193 -0
  48. package/skills/maestro-fork/SKILL.md +104 -0
  49. package/skills/maestro-grill/SKILL.md +151 -0
  50. package/skills/maestro-guard/SKILL.md +124 -0
  51. package/skills/maestro-help/SKILL.md +328 -0
  52. package/skills/maestro-impeccable/SKILL.md +302 -0
  53. package/skills/maestro-init/SKILL.md +151 -0
  54. package/skills/maestro-merge/SKILL.md +90 -0
  55. package/skills/maestro-milestone-audit/SKILL.md +117 -0
  56. package/skills/maestro-milestone-complete/SKILL.md +133 -0
  57. package/skills/maestro-milestone-release/SKILL.md +131 -0
  58. package/skills/maestro-next/SKILL.md +269 -0
  59. package/skills/maestro-overlay/SKILL.md +203 -0
  60. package/skills/maestro-plan/SKILL.md +194 -0
  61. package/skills/maestro-player/SKILL.md +184 -0
  62. package/skills/maestro-quick/SKILL.md +117 -0
  63. package/skills/maestro-ralph/SKILL.md +905 -0
  64. package/skills/maestro-ralph-cli/SKILL.md +976 -0
  65. package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
  66. package/skills/maestro-ralph-execute/SKILL.md +409 -0
  67. package/skills/maestro-ralph-v2/SKILL.md +1198 -0
  68. package/skills/maestro-roadmap/SKILL.md +157 -0
  69. package/skills/maestro-swarm-workflow/SKILL.md +272 -0
  70. package/skills/maestro-tools-execute/SKILL.md +143 -0
  71. package/skills/maestro-tools-register/SKILL.md +192 -0
  72. package/skills/maestro-ui-codify/SKILL.md +127 -0
  73. package/skills/maestro-universal-workflow/SKILL.md +622 -0
  74. package/skills/maestro-update/SKILL.md +156 -0
  75. package/skills/manage-codebase-rebuild/SKILL.md +111 -0
  76. package/skills/manage-drift-realign/SKILL.md +159 -0
  77. package/skills/manage-harvest/SKILL.md +121 -0
  78. package/skills/manage-issue/SKILL.md +88 -0
  79. package/skills/manage-issue-discover/SKILL.md +104 -0
  80. package/skills/manage-kg-extractors/SKILL.md +147 -0
  81. package/skills/manage-knowhow/SKILL.md +102 -0
  82. package/skills/manage-knowhow-capture/SKILL.md +109 -0
  83. package/skills/manage-knowledge-audit/SKILL.md +147 -0
  84. package/skills/manage-status/SKILL.md +80 -0
  85. package/skills/manage-wiki/SKILL.md +104 -0
  86. package/skills/odyssey-debug/SKILL.md +344 -0
  87. package/skills/odyssey-improve/SKILL.md +423 -0
  88. package/skills/odyssey-planex/SKILL.md +542 -0
  89. package/skills/odyssey-review-test-fix/SKILL.md +392 -0
  90. package/skills/odyssey-ui/SKILL.md +388 -0
  91. package/skills/prompt-generator/SKILL.md +470 -0
  92. package/skills/quality-auto-test/SKILL.md +168 -0
  93. package/skills/quality-debug/SKILL.md +176 -0
  94. package/skills/quality-refactor/SKILL.md +108 -0
  95. package/skills/quality-retrospective/SKILL.md +134 -0
  96. package/skills/quality-review/SKILL.md +169 -0
  97. package/skills/quality-sync/SKILL.md +90 -0
  98. package/skills/quality-test/SKILL.md +183 -0
  99. package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
  100. package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
  101. package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
  102. package/skills/scholar-citation-verify/SKILL.md +166 -0
  103. package/skills/scholar-citation-verify/references/api-usage.md +372 -0
  104. package/skills/scholar-citation-verify/references/common-errors.md +384 -0
  105. package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
  106. package/skills/scholar-experiment/SKILL.md +321 -0
  107. package/skills/scholar-ideation/SKILL.md +288 -0
  108. package/skills/scholar-latex-organizer/SKILL.md +186 -0
  109. package/skills/scholar-publish/SKILL.md +220 -0
  110. package/skills/scholar-rebuttal-pro/README.md +313 -0
  111. package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
  112. package/skills/scholar-review/SKILL.md +227 -0
  113. package/skills/scholar-thesis-docx/README.md +111 -0
  114. package/skills/scholar-thesis-docx/README_EN.md +108 -0
  115. package/skills/scholar-thesis-docx/SKILL.md +212 -0
  116. package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
  117. package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
  118. package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
  119. package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
  120. package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
  121. package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
  122. package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
  123. package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
  124. package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
  125. package/skills/scholar-writing/SKILL.md +296 -0
  126. package/skills/security-audit/SKILL.md +244 -0
  127. package/skills/skill-generator/SKILL.md +472 -0
  128. package/skills/skill-iter-tune/SKILL.md +382 -0
  129. package/skills/skill-simplify/SKILL.md +63 -0
  130. package/skills/skill-tuning/SKILL.md +174 -0
  131. package/skills/spec-add/SKILL.md +105 -0
  132. package/skills/spec-load/SKILL.md +98 -0
  133. package/skills/spec-remove/SKILL.md +74 -0
  134. package/skills/spec-setup/SKILL.md +75 -0
  135. package/skills/team-adversarial-swarm/SKILL.md +233 -0
  136. package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
  137. package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
  138. package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  139. package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  140. package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  141. package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  142. package/skills/team-arch-opt/SKILL.md +158 -0
  143. package/skills/team-brainstorm/SKILL.md +171 -0
  144. package/skills/team-coordinate/SKILL.md +266 -0
  145. package/skills/team-designer/SKILL.md +160 -0
  146. package/skills/team-executor/SKILL.md +189 -0
  147. package/skills/team-frontend/SKILL.md +136 -0
  148. package/skills/team-frontend-debug/SKILL.md +198 -0
  149. package/skills/team-interactive-craft/SKILL.md +141 -0
  150. package/skills/team-issue/SKILL.md +171 -0
  151. package/skills/team-lifecycle-v4/SKILL.md +209 -0
  152. package/skills/team-motion-design/SKILL.md +142 -0
  153. package/skills/team-perf-opt/SKILL.md +175 -0
  154. package/skills/team-planex/SKILL.md +137 -0
  155. package/skills/team-quality-assurance/SKILL.md +147 -0
  156. package/skills/team-review/SKILL.md +147 -0
  157. package/skills/team-roadmap-dev/SKILL.md +169 -0
  158. package/skills/team-swarm/SKILL.md +178 -0
  159. package/skills/team-swarm/scripts/aco.py +473 -0
  160. package/skills/team-swarm/scripts/pheromone.py +144 -0
  161. package/skills/team-swarm/scripts/scoring.py +92 -0
  162. package/skills/team-swarm/scripts/test_aco.py +475 -0
  163. package/skills/team-tech-debt/SKILL.md +128 -0
  164. package/skills/team-testing/SKILL.md +143 -0
  165. package/skills/team-ui-polish/SKILL.md +141 -0
  166. package/skills/team-uidesign/SKILL.md +144 -0
  167. package/skills/team-ultra-analyze/SKILL.md +173 -0
  168. package/skills/team-ux-improve/SKILL.md +151 -0
  169. package/skills/team-visual-a11y/SKILL.md +156 -0
  170. package/skills/workflow-skill-designer/SKILL.md +496 -0
  171. package/src/extension/index.ts +222 -0
  172. package/src/extension/schemas.ts +131 -0
  173. package/src/providers/cli-tools-loader.ts +74 -0
  174. package/src/providers/provider-registry.ts +130 -0
  175. package/src/tools/delegate.ts +85 -0
  176. package/src/tools/explore.ts +134 -0
  177. package/src/tools/moa.ts +213 -0
  178. package/src/tools/status.ts +99 -0
  179. package/src/tools/wait.ts +166 -0
@@ -0,0 +1,388 @@
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 Arguments: <target> [--dimensions <list>] [--fix-threshold <severity>] [--skip-fix] [--skip-generalize] [--auto] [-y] [-c] [--heartbeat]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <base>@~/.maestro/workflows/odyssey-base.md</base>
8
+
9
+ <purpose>
10
+ survey → 6-dimension audit → divergent exploration → fix → verify → generalize → discover → persist.
11
+ Exhaustive iteration until all findings addressed or deferred.
12
+ </purpose>
13
+
14
+ <boundary>
15
+ **In scope:** Target component/page visual experience optimization — audit 6 dimensions, divergent exploration, fix, generalize to sibling components.
16
+ **Out of scope:** Backend/data/API → `/odyssey-planex` | Deep bug investigation → `/odyssey-debug` | Code quality review → `/odyssey-review-test-fix`
17
+
18
+ **Decision gate** — ONLY these qualify as decisions:
19
+ - Brand/style direction requiring human creative judgment
20
+ - Layout restructuring that changes user flow significantly
21
+ - Requires new design tokens or breaking component API
22
+ </boundary>
23
+
24
+ <context>
25
+ $ARGUMENTS
26
+
27
+ **Target resolution:** Component path → audit component | Page/route → audit page | `staged`/`HEAD` → diff UI changes | Feature area → resolve to components/pages
28
+
29
+ **Flags:** `--dimensions <list>` dimension subset | `--fix-threshold <severity>` | `--skip-fix` audit+diverge only | `--skip-generalize` skip generalize+discover | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
30
+
31
+ **Session**: `.workflow/scratch/{YYYYMMDD}-ui-odyssey-{slug}/`
32
+ **Output**: `session.json` | `evidence.ndjson` | `understanding.md`
33
+
34
+ **Output boundary**: ALL session artifacts MUST target the session directory (`.workflow/scratch/{YYYYMMDD}-ui-odyssey-{slug}/`) or `.workflow/state.json` only. Source code modifications during S_FIX are in-scope but MUST be committed per action. NEVER write session artifacts outside these paths.
35
+
36
+ **session.json — ui-specific fields:**
37
+ ```json
38
+ { "target": "", "dimensions": [],
39
+ "audit_result": { "dimensions_audited": 0, "finding_count": 0, "severity_distribution": {} },
40
+ "diverge_result": { "improvements_proposed": 0, "creative_ideas": 0 },
41
+ "patterns": [], "confirmation": null, "generalization_stats": null }
42
+ ```
43
+
44
+ **evidence.ndjson phases:** `survey|audit|diverge|fix|discovery|decision|self-iteration`
45
+
46
+ **phase_goals[]:**
47
+
48
+ | ID | Goal | Phase | skip_when |
49
+ |----|------|-------|-----------|
50
+ | G1 | Survey completed | S_SURVEY | — |
51
+ | G2 | Audit completed | S_AUDIT | — |
52
+ | G3 | Divergent exploration done | S_DIVERGE | — |
53
+ | G4 | Zero remaining: all findings/ideas fixed and verified | S_VERIFY | skip_fix |
54
+ | G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
55
+ | G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
56
+ | G7 | Learnings persisted | S_RECORD | — |
57
+
58
+ **understanding.md — 8 sections:**
59
+ 1. Target & Design Context ← S_INTAKE | 2. Survey ← S_SURVEY | 3. Audit ← S_AUDIT
60
+ 4. Diverge ← S_DIVERGE | 5. Verify ← S_VERIFY | 6. Generalize ← S_GENERALIZE
61
+ 7. Discover ← S_DISCOVER | 8. Learnings ← S_RECORD
62
+
63
+ **Knowledge Persistence categories (section 8):**
64
+
65
+ | Category | Content | Follow-up |
66
+ |----------|---------|-----------|
67
+ | Design pattern | Component pattern + applicable scenarios + token references | `/spec-add ui` |
68
+ | Interaction spec | State definitions + transition rules + feedback patterns | `/spec-add ui` |
69
+ | Accessibility rule | WCAG requirement + implementation approach | `/spec-add ui` |
70
+ | Reusable generalization pattern | Pattern signature + application scope | `/spec-add coding` |
71
+ </context>
72
+
73
+ <invariants>
74
+ 1-5 in base. UI-specific:
75
+ 6. **Browser is truth** — verify in real rendering, not just code review
76
+ 7. **Diverge before converge** — explore creatively first, then implement methodically
77
+ 8. **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.
78
+ </invariants>
79
+
80
+ <self_iteration>
81
+ Applies to: **S_SURVEY, S_AUDIT, S_DIVERGE, S_GENERALIZE**. Logic in base.
82
+ </self_iteration>
83
+
84
+ <execution>
85
+ Follow base execution discipline completely. Actions defined in state_machine below.
86
+
87
+ ### Phase Gates (MANDATORY, BLOCKING)
88
+
89
+ **GATE 1: INTAKE → SURVEY**
90
+ - REQUIRED: Target resolved, SESSION_DIR created, session.json initialized.
91
+ - REQUIRED: phase_goals[] derived from flags, understanding.md §1 written.
92
+ - BLOCKED if: no target specified (E001) or target path not found (E002).
93
+
94
+ **GATE 2: SURVEY → AUDIT**
95
+ - REQUIRED: Design system inventory + current state analysis completed.
96
+ - REQUIRED: Evidence phase=survey logged, understanding.md §2 updated, G1 marked done.
97
+ - BLOCKED if: survey incomplete — token scan and styling analysis must both be attempted.
98
+
99
+ **GATE 3: AUDIT → DIVERGE**
100
+ - REQUIRED: All 6 dimension agents completed (or --dimensions subset), findings merged with severity classification.
101
+ - REQUIRED: audit_result written to session.json, understanding.md §3 with severity matrix, G2 marked done.
102
+ - BLOCKED if: zero dimensions reviewed (W002 partial is allowed, zero is not).
103
+
104
+ **GATE 4: DIVERGE → FIX**
105
+ - REQUIRED: Both parallel agents (Polish + Delight) completed, ideas consolidated with audit findings.
106
+ - REQUIRED: diverge_result written, understanding.md §4 updated, G3 marked done.
107
+ - BLOCKED if: divergent exploration not attempted.
108
+
109
+ **GATE 5: FIX → VERIFY**
110
+ - REQUIRED: ALL findings/ideas within fix_threshold fixed by priority tier.
111
+ - REQUIRED: Per-fix evidence phase=fix logged.
112
+ - BLOCKED if: tier incomplete — each tier must be fully addressed before advancing.
113
+
114
+ **GATE 6: VERIFY → GENERALIZE**
115
+ - REQUIRED: Tests pass (lint, unit, visual regression), delegate verification completed.
116
+ - REQUIRED: confirmation written, understanding.md §5 updated, G4 marked done.
117
+ - BLOCKED if: needs_rework → route back to S_FIX.
118
+
119
+ **GATE 7: GENERALIZE → DISCOVER**
120
+ - REQUIRED: ALL 3 layers (syntax/semantic/structural) attempted with evidence logged.
121
+ - REQUIRED: generalization_stats written with by_layer entries for all 3 layers, G5 marked done.
122
+ - BLOCKED if: any layer not attempted (thoroughness floor violation).
123
+
124
+ **GATE 8: DISCOVER → RECORD**
125
+ - REQUIRED: All hits triaged with per-item classification and reason.
126
+ - REQUIRED: remaining_actionable == 0 OR loops >= max_loops with per-item reasons logged.
127
+ - REQUIRED: G6 marked done.
128
+ - BLOCKED if: unclassified hits remain.
129
+
130
+ </execution>
131
+
132
+ <state_machine>
133
+
134
+ <states>
135
+ S_INTAKE → S_SURVEY → S_AUDIT → S_DIVERGE → S_FIX → S_VERIFY → S_GENERALIZE → S_DISCOVER → S_RECORD → END
136
+ </states>
137
+
138
+ <transitions>
139
+ S_INTAKE → S_INTAKE : -c + session found → A_RESUME
140
+ S_INTAKE → S_SURVEY : target resolved → A_INTAKE
141
+ S_INTAKE → S_INTAKE : no target → AskUserQuestion
142
+
143
+ S_SURVEY → S_AUDIT : complete
144
+ S_AUDIT → S_DIVERGE : complete
145
+
146
+ S_DIVERGE → S_FIX : !skip_fix AND actionable findings/ideas
147
+ S_DIVERGE → S_GENERALIZE : (skip_fix OR no actionable) AND !skip_generalize
148
+ S_DIVERGE → S_RECORD : (skip_fix OR no actionable) AND skip_generalize
149
+
150
+ S_FIX → S_VERIFY : fix implemented
151
+ S_VERIFY → S_GENERALIZE : verified, !skip_generalize
152
+ S_VERIFY → S_RECORD : verified, skip_generalize
153
+ S_VERIFY → S_FIX : needs_rework
154
+
155
+ S_GENERALIZE → S_DISCOVER : similar code found
156
+ S_GENERALIZE → S_RECORD : all 3 layers scanned with evidence, total_hits == 0
157
+
158
+ S_DISCOVER → S_AUDIT : new component to audit → cross_phase_loops++
159
+ S_DISCOVER → S_FIX : fixable sibling, !skip_fix → cross_phase_loops++
160
+ S_DISCOVER → S_RECORD : remaining_actionable == 0 OR loops >= max_loops → log per-item reasons
161
+
162
+ S_RECORD → END : complete
163
+ </transitions>
164
+
165
+ <actions>
166
+
167
+ ### A_INTAKE
168
+ 1. Parse arguments: target, flags, `--dimensions` subset
169
+ 2. Generate slug, create SESSION_DIR
170
+ 3. `maestro search` + Glob prior sessions + ARCHITECTURE.md + spec load ui/coding
171
+ 4. Derive `phase_goals[]` from flags
172
+ 5. Write `session.json` + `understanding.md` section 1, emit Goal Prompt
173
+
174
+ Commit: `"odyssey-ui({slug}): INTAKE — parse target and load context"`
175
+
176
+ ### A_RESUME
177
+ Glob latest session → read `session.json` → jump to `current_state`.
178
+
179
+ ### A_SURVEY
180
+ 1. **Design system inventory**: Scan for design tokens, CSS variables, theme imports
181
+ 2. **Current state analysis**: Styling patterns, layout strategy, component hierarchy
182
+ 3. **CLI-assisted**: `maestro delegate --role analyze --mode analysis` — survey tokens, spacing, typography, hierarchy, consistency
183
+ 4. Append evidence phase=survey. Update section 2. Mark G1.
184
+
185
+ Commit: `"odyssey-ui({slug}): SURVEY — design token inventory"`
186
+
187
+ ### A_AUDIT
188
+ Spawn 6 parallel Agents (one per dimension, or `--dimensions` subset):
189
+
190
+ | Dimension | Focus |
191
+ |-----------|-------|
192
+ | visual_hierarchy | Spacing, typography scale, color contrast, alignment, whitespace, visual weight |
193
+ | interaction_states | Hover, focus, active, disabled, loading, error, empty, selected states |
194
+ | accessibility | WCAG AA contrast, focus management, aria labels, keyboard nav, screen reader |
195
+ | responsiveness | Breakpoints, overflow, touch targets, fluid typography, container queries |
196
+ | micro_interactions | Transitions, animations, feedback indicators, loading states, progress |
197
+ | edge_cases | Long text truncation, empty data, error states, extreme values, i18n, RTL |
198
+
199
+ Each returns `[{title, severity, file, line, description, suggestion, dimension}]`.
200
+ Merge → evidence phase=audit. Write `audit_result`. Update section 3 with severity matrix. Mark G2.
201
+
202
+ Commit: `"odyssey-ui({slug}): AUDIT — 6-dimension review"`
203
+
204
+ ### A_DIVERGE
205
+ Goes beyond defect fixing — "what would make this delightful?"
206
+
207
+ **Step 1 — 2 parallel Agents:**
208
+ - **Polish Agent**: Shadows, borders, transitions, hover states, feedback, empty states, skeleton loading, scroll behavior
209
+ - **Delight Agent**: Motion design, progressive disclosure, smart defaults, contextual hints, celebratory feedback, personality in copy
210
+
211
+ Each returns `[{idea, category (polish|delight), impact, effort, description, inspiration}]`
212
+
213
+ **Step 2 — CLI-assisted**: `maestro delegate --role analyze --mode analysis` — polish opportunities, micro-interactions, visual rhythm, delight moments
214
+
215
+ **Step 3 — Consolidate**: Merge audit findings + divergent ideas → prioritized list (severity x impact x effort).
216
+ Append evidence phase=diverge. Update section 4. Mark G3.
217
+
218
+ Commit: `"odyssey-ui({slug}): DIVERGE — creative exploration"`
219
+
220
+ ### A_FIX
221
+ Skip if `--skip-fix`.
222
+ 1. **Exhaustive fix**: ALL findings/ideas by priority tier (critical → high → medium → low + high-impact ideas). After each tier, re-review — new findings append.
223
+ 2. Each fix → evidence phase=fix
224
+ 3. Normal: AskUserQuestion per-fix | `-y`: auto-proceed, record `deferred`
225
+
226
+ Commit: `"odyssey-ui({slug}): FIX — implement improvements"`
227
+
228
+ ### A_VERIFY
229
+ 1. Run tests (lint, unit, visual regression)
230
+ 2. `maestro delegate --role review --mode analysis` — visual correctness, interaction states, accessibility, responsive
231
+ 3. `needs_rework` → S_FIX. `verified` → mark G4. Update section 5, write `confirmation`.
232
+
233
+ Commit: `"odyssey-ui({slug}): VERIFY — visual verification"`
234
+
235
+ ### A_GENERALIZE
236
+
237
+ **MANDATORY — executes unless `skip_generalize == true`. Prior-phase convergence, "all verified," or context pressure are NOT valid skip reasons.**
238
+
239
+ Pattern source: audit findings + diverge ideas (severity >= medium OR impact = high).
240
+
241
+ **Step 1 — 3-layer pattern extraction** from UI findings and creative improvements:
242
+
243
+ | Layer | Method | Targets |
244
+ |-------|--------|---------|
245
+ | Syntax | Build regex from fix diffs → Grep | Hardcoded px values, missing aria attributes, inline color values, raw z-index |
246
+ | Semantic | Understand UI anti-pattern → Agent scan | Inconsistent spacing scale, missing hover/focus states, keyboard nav gaps, contrast violations |
247
+ | Structural | Find components with same layout/state shape | Sibling components with same template, parallel page layouts, shared form patterns |
248
+
249
+ Write `session.json.patterns[]`: `[{id, source, layer, signature, description, risk, fix_template, confidence}]`
250
+
251
+ **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.
252
+
253
+ **Step 2 — 4-agent concurrent scan** (single message, 4 Agents):
254
+
255
+ | Agent | Strategy | Scope |
256
+ |-------|----------|-------|
257
+ | Syntax grep | Grep regex from pattern signatures | Full project |
258
+ | Semantic scan | UI anti-pattern check (states, a11y, spacing) | Related components |
259
+ | Structural match | Find structurally similar components/pages | Full project |
260
+ | Historical grep | `git log -S` for pattern signatures | Git history |
261
+
262
+ **Step 3 — Cross-layer dedup:** multi-layer hit → boost | single-layer → `needs_review` | historically fixed → `regression_risk`
263
+
264
+ **Step 4 — Iterative deepening:** Component with ≥3 hits → targeted deep scan (max 1 round).
265
+
266
+ **Step 5 — Persist:** Update understanding.md section 6 + write `session.json.generalization_stats`:
267
+ ```json
268
+ {"patterns_extracted": 0, "total_hits": 0, "cross_layer_confirmed": 0, "regression_risks": 0, "by_layer": {"syntax": 0, "semantic": 0, "structural": 0}, "deepening_triggered": false}
269
+ ```
270
+
271
+ **Transition guard:** `S_GENERALIZE → S_RECORD` requires `by_layer` has entries for all 3 layers with search evidence logged. Mark G5 done.
272
+
273
+ Commit: `"odyssey-ui({slug}): GENERALIZE — pattern scan complete"`
274
+
275
+ ### A_DISCOVER
276
+
277
+ **Executes whenever `total_hits > 0`. Cannot be skipped without `skip_generalize == true`.**
278
+
279
+ 1. **Triage** each hit with ±10 lines context → classify:
280
+ - `bug` — confirmed UI defect in sibling component (missing state, broken a11y, inconsistent token)
281
+ - `risk` — potential visual/UX degradation
282
+ - `safe` — false positive (must log individual reason — blanket "pre-existing" forbidden)
283
+
284
+ 2. **Route:**
285
+
286
+ | Classification | Action |
287
+ |---------------|--------|
288
+ | new component needing audit | Route to S_AUDIT, `cross_phase_loops++` |
289
+ | fixable sibling (same pattern) | Immediate fix → back to S_FIX, `cross_phase_loops++` |
290
+ | risk + guard addable | Fix directly |
291
+ | risk + design decision needed | Create issue |
292
+ | safe | Skip with logged per-item reason |
293
+
294
+ Normal: AskUserQuestion per hit | `-y`: auto-fix with template, create issue for rest
295
+
296
+ 3. **Cross-phase loops:** `loops >= max_loops` → must log per-item reasons, advance to S_RECORD.
297
+
298
+ 4. Append evidence phase=discovery. Update understanding.md section 7. Mark G6 done.
299
+
300
+ Commit: `"odyssey-ui({slug}): DISCOVER — sibling triage complete"`
301
+
302
+ ### A_RECORD
303
+
304
+ 1. Finalize understanding.md section 8 — learnings by Knowledge Persistence categories:
305
+ - Design pattern: component pattern + applicable scenarios + token references → `/spec-add ui`
306
+ - Interaction spec: state definitions + transition rules + feedback patterns → `/spec-add ui`
307
+ - Accessibility rule: WCAG requirement + implementation approach → `/spec-add ui`
308
+ - Reusable generalization pattern: signature + application scope → `/spec-add coding`
309
+
310
+ 2. Mark G7 done. Pending decisions: Normal → AskUserQuestion | `-y` → skip (show deferred count).
311
+
312
+ 3. **Goal audit (hardened):**
313
+ - `done` → confirmed
314
+ - `skipped` → confirmed ONLY if corresponding `skip_when` flag is true
315
+ - **Hard rule:** G5 and G6 CANNOT be `skipped` unless `skip_generalize == true`. Pending without flag → `failed` (Normal: AskUserQuestion | `-y`: record `failed`)
316
+ - `phase_goals_all_done = true` only when all goals pass this audit
317
+
318
+ 4. `current_state = "COMPLETED"`, emit completion summary.
319
+
320
+ **Completion summary:**
321
+ ```
322
+ --- UI ODYSSEY COMPLETE ---
323
+ Target: {target} | Dimensions: {dimensions_audited}
324
+ Findings: {C}C {H}H {M}M {L}L | Diverge: {improvements} polish + {creative} delight
325
+ Fix: {fixed_count} applied, verified={yes|skipped}
326
+ Patterns: {extracted} ({by_layer})
327
+ Scan hits: {total} ({cross_layer} cross-layer)
328
+ Issues: {N} created
329
+ Decisions: {N} resolved, {M} pending, {K} deferred
330
+ Learnings: {N} persisted
331
+ Self-iter: {N} rounds
332
+ Goals: {done}/{total} ({skipped} skipped)
333
+ ---
334
+ ```
335
+
336
+ Commit: `"odyssey-ui({slug}): RECORD — summary and knowledge persistence"`
337
+
338
+ </actions>
339
+
340
+ <appendix>
341
+
342
+ ### `-y` ui-specific points
343
+
344
+ | Decision Point | Normal | `-y` |
345
+ |---------------|--------|------|
346
+ | A_FIX improvement confirmation | AskUserQuestion | auto-proceed, deferred |
347
+ | A_DISCOVER hit routing | AskUserQuestion | auto-fix with template, create issue for rest |
348
+
349
+ ### Goal Prompt convergence rules
350
+
351
+ ```
352
+ Stop when audit + diverge findings all addressed (fix/issue/decision),
353
+ phase_goals_all_done=true. Fix by impact x severity per tier.
354
+ Re-review after each tier — new findings append and continue.
355
+ Pending decisions must AskUserQuestion — no self-resolve.
356
+ ```
357
+
358
+ </appendix>
359
+
360
+ </state_machine>
361
+
362
+ <error_codes>
363
+ | Code | Severity | Condition | Recovery |
364
+ |------|----------|-----------|----------|
365
+ | E001 | error | No target specified | Provide target |
366
+ | E002 | error | Target path not found | Check path |
367
+ | W001 | warning | No design system detected | Proceed with defaults |
368
+ | W002 | warning | Some dimension agents failed | Partial coverage |
369
+ | W003 | warning | Generalization 0 hits after full 3-layer scan | Advance to S_RECORD (requires all 3 layers attempted with evidence) |
370
+ </error_codes>
371
+
372
+ <success_criteria>
373
+ - [ ] 6-dimension audit with severity matrix + divergent exploration (polish + delight)
374
+ - [ ] Improvements implemented and verified (unless --skip-fix)
375
+ - [ ] Multi-layer generalization + discoveries classified (unless --skip-generalize)
376
+ - [ ] Every unfixed finding has individual classification and reason
377
+ - [ ] understanding.md section 8 finalized; phase_goals G1-G7 tracked; `-y` no blocking prompts
378
+ </success_criteria>
379
+
380
+ <next_step_routing>
381
+ | Condition | Next |
382
+ |-----------|------|
383
+ | Finding needs deeper debug | `/odyssey-debug "<finding>"` |
384
+ | Issues from discoveries | `/manage-issue list --source ui-odyssey` |
385
+ | Design pattern to document | `/spec-add ui "..."` |
386
+ | Full review of changes | `/odyssey-review-test-fix <changed-files>` |
387
+ | Sibling components to polish | `/odyssey-ui "<sibling>"` |
388
+ </next_step_routing>