maestro-flow 0.5.37 → 0.5.39

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 (216) hide show
  1. package/.agents/skills/maestro/SKILL.md +11 -5
  2. package/.agents/skills/maestro-ralph/SKILL.md +80 -12
  3. package/.agents/skills/maestro-ralph-execute/SKILL.md +17 -6
  4. package/.agents/skills/manage-drift-realign/SKILL.md +153 -0
  5. package/.agents/skills/odyssey-debug/SKILL.md +90 -269
  6. package/.agents/skills/odyssey-improve/SKILL.md +39 -240
  7. package/.agents/skills/odyssey-planex/SKILL.md +21 -105
  8. package/.agents/skills/odyssey-review-test-fix/SKILL.md +98 -318
  9. package/.agents/skills/odyssey-ui/SKILL.md +82 -265
  10. package/.agy/skills/maestro/SKILL.md +11 -5
  11. package/.agy/skills/maestro-ralph/SKILL.md +80 -12
  12. package/.agy/skills/maestro-ralph-execute/SKILL.md +17 -6
  13. package/.agy/skills/manage-drift-realign/SKILL.md +153 -0
  14. package/.agy/skills/odyssey-debug/SKILL.md +90 -269
  15. package/.agy/skills/odyssey-improve/SKILL.md +39 -240
  16. package/.agy/skills/odyssey-planex/SKILL.md +21 -105
  17. package/.agy/skills/odyssey-review-test-fix/SKILL.md +98 -318
  18. package/.agy/skills/odyssey-ui/SKILL.md +82 -265
  19. package/.claude/commands/maestro-ralph-execute.md +17 -6
  20. package/.claude/commands/maestro-ralph.md +80 -12
  21. package/.claude/commands/maestro.md +11 -5
  22. package/.claude/commands/manage-drift-realign.md +151 -0
  23. package/.claude/commands/odyssey-debug.md +90 -269
  24. package/.claude/commands/odyssey-improve.md +39 -240
  25. package/.claude/commands/odyssey-planex.md +21 -105
  26. package/.claude/commands/odyssey-review-test-fix.md +98 -318
  27. package/.claude/commands/odyssey-ui.md +82 -265
  28. package/.codex/skills/maestro/SKILL.md +16 -8
  29. package/.codex/skills/maestro-ralph/SKILL.md +138 -11
  30. package/.codex/skills/maestro-ralph-execute/SKILL.md +17 -6
  31. package/.codex/skills/manage-drift-realign/SKILL.md +471 -0
  32. package/.codex/skills/odyssey-debug/SKILL.md +167 -338
  33. package/.codex/skills/odyssey-improve/SKILL.md +226 -395
  34. package/.codex/skills/odyssey-planex/SKILL.md +317 -159
  35. package/.codex/skills/odyssey-review-test-fix/SKILL.md +137 -255
  36. package/.codex/skills/odyssey-ui/SKILL.md +197 -338
  37. package/README.md +25 -8
  38. package/README.zh-CN.md +6 -6
  39. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +23 -2
  40. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +242 -26
  41. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -1
  42. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +2 -0
  43. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +92 -29
  44. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  45. package/dashboard/dist-server/src/commands/hooks.d.ts +2 -1
  46. package/dashboard/dist-server/src/commands/hooks.js +16 -9
  47. package/dashboard/dist-server/src/commands/hooks.js.map +1 -1
  48. package/dashboard/dist-server/src/commands/install-backend.d.ts +10 -0
  49. package/dashboard/dist-server/src/commands/install-backend.js +69 -0
  50. package/dashboard/dist-server/src/commands/install-backend.js.map +1 -1
  51. package/dashboard/dist-server/src/core/component-defs.d.ts +11 -0
  52. package/dashboard/dist-server/src/core/component-defs.js +34 -2
  53. package/dashboard/dist-server/src/core/component-defs.js.map +1 -1
  54. package/dashboard/dist-server/src/hooks/kg-sync-hook.js +5 -0
  55. package/dashboard/dist-server/src/hooks/kg-sync-hook.js.map +1 -1
  56. package/dashboard/dist-server/src/hooks/session-context.js +276 -3
  57. package/dashboard/dist-server/src/hooks/session-context.js.map +1 -1
  58. package/dashboard/dist-server/src/search/daemon-client.d.ts +8 -3
  59. package/dashboard/dist-server/src/search/daemon-client.js +20 -0
  60. package/dashboard/dist-server/src/search/daemon-client.js.map +1 -1
  61. package/dist/src/cli.js +3 -2
  62. package/dist/src/cli.js.map +1 -1
  63. package/dist/src/commands/domain.d.ts.map +1 -1
  64. package/dist/src/commands/domain.js +12 -3
  65. package/dist/src/commands/domain.js.map +1 -1
  66. package/dist/src/commands/hooks.d.ts +2 -1
  67. package/dist/src/commands/hooks.d.ts.map +1 -1
  68. package/dist/src/commands/hooks.js +16 -9
  69. package/dist/src/commands/hooks.js.map +1 -1
  70. package/dist/src/commands/install-backend.d.ts +10 -0
  71. package/dist/src/commands/install-backend.d.ts.map +1 -1
  72. package/dist/src/commands/install-backend.js +69 -0
  73. package/dist/src/commands/install-backend.js.map +1 -1
  74. package/dist/src/commands/install.js +34 -2
  75. package/dist/src/commands/install.js.map +1 -1
  76. package/dist/src/commands/ralph.d.ts.map +1 -1
  77. package/dist/src/commands/ralph.js +8 -0
  78. package/dist/src/commands/ralph.js.map +1 -1
  79. package/dist/src/commands/search.d.ts.map +1 -1
  80. package/dist/src/commands/search.js +59 -6
  81. package/dist/src/commands/search.js.map +1 -1
  82. package/dist/src/commands/spec.d.ts.map +1 -1
  83. package/dist/src/commands/spec.js +15 -0
  84. package/dist/src/commands/spec.js.map +1 -1
  85. package/dist/src/commands/timeline.d.ts +14 -0
  86. package/dist/src/commands/timeline.d.ts.map +1 -0
  87. package/dist/src/commands/timeline.js +377 -0
  88. package/dist/src/commands/timeline.js.map +1 -0
  89. package/dist/src/core/component-defs.d.ts +11 -0
  90. package/dist/src/core/component-defs.d.ts.map +1 -1
  91. package/dist/src/core/component-defs.js +34 -2
  92. package/dist/src/core/component-defs.js.map +1 -1
  93. package/dist/src/core/install-executor.d.ts.map +1 -1
  94. package/dist/src/core/install-executor.js +11 -1
  95. package/dist/src/core/install-executor.js.map +1 -1
  96. package/dist/src/core/install-profile.d.ts.map +1 -1
  97. package/dist/src/core/install-profile.js +52 -17
  98. package/dist/src/core/install-profile.js.map +1 -1
  99. package/dist/src/hooks/kg-sync-hook.d.ts.map +1 -1
  100. package/dist/src/hooks/kg-sync-hook.js +5 -0
  101. package/dist/src/hooks/kg-sync-hook.js.map +1 -1
  102. package/dist/src/hooks/session-context.d.ts.map +1 -1
  103. package/dist/src/hooks/session-context.js +276 -3
  104. package/dist/src/hooks/session-context.js.map +1 -1
  105. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  106. package/dist/src/i18n/locales/en.js +4 -1
  107. package/dist/src/i18n/locales/en.js.map +1 -1
  108. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  109. package/dist/src/i18n/locales/zh.js +4 -1
  110. package/dist/src/i18n/locales/zh.js.map +1 -1
  111. package/dist/src/i18n/types.d.ts +3 -0
  112. package/dist/src/i18n/types.d.ts.map +1 -1
  113. package/dist/src/ralph/cmd-complete.d.ts +4 -0
  114. package/dist/src/ralph/cmd-complete.d.ts.map +1 -1
  115. package/dist/src/ralph/cmd-complete.js +8 -0
  116. package/dist/src/ralph/cmd-complete.js.map +1 -1
  117. package/dist/src/ralph/cmd-next.js +58 -8
  118. package/dist/src/ralph/cmd-next.js.map +1 -1
  119. package/dist/src/ralph/status-schema.d.ts +29 -2
  120. package/dist/src/ralph/status-schema.d.ts.map +1 -1
  121. package/dist/src/ralph/status-schema.js +1 -1
  122. package/dist/src/search/daemon-client.d.ts +8 -3
  123. package/dist/src/search/daemon-client.d.ts.map +1 -1
  124. package/dist/src/search/daemon-client.js +20 -0
  125. package/dist/src/search/daemon-client.js.map +1 -1
  126. package/dist/src/search/daemon.d.ts +3 -3
  127. package/dist/src/search/daemon.d.ts.map +1 -1
  128. package/dist/src/search/daemon.js +9 -3
  129. package/dist/src/search/daemon.js.map +1 -1
  130. package/dist/src/tui/install-ui/ComponentGrid.d.ts.map +1 -1
  131. package/dist/src/tui/install-ui/ComponentGrid.js +71 -38
  132. package/dist/src/tui/install-ui/ComponentGrid.js.map +1 -1
  133. package/dist/src/tui/install-ui/ComponentGrid.logic.d.ts +12 -3
  134. package/dist/src/tui/install-ui/ComponentGrid.logic.d.ts.map +1 -1
  135. package/dist/src/tui/install-ui/ComponentGrid.logic.js +21 -4
  136. package/dist/src/tui/install-ui/ComponentGrid.logic.js.map +1 -1
  137. package/dist/src/tui/install-ui/CyberItem.d.ts +3 -1
  138. package/dist/src/tui/install-ui/CyberItem.d.ts.map +1 -1
  139. package/dist/src/tui/install-ui/CyberItem.js +6 -5
  140. package/dist/src/tui/install-ui/CyberItem.js.map +1 -1
  141. package/dist/src/tui/install-ui/GroupedHub.d.ts +9 -0
  142. package/dist/src/tui/install-ui/GroupedHub.d.ts.map +1 -1
  143. package/dist/src/tui/install-ui/GroupedHub.js +54 -47
  144. package/dist/src/tui/install-ui/GroupedHub.js.map +1 -1
  145. package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
  146. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  147. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  148. package/dist/src/tui/install-ui/InstallFlow.js +54 -5
  149. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  150. package/dist/src/tui/install-ui/types.d.ts +1 -0
  151. package/dist/src/tui/install-ui/types.d.ts.map +1 -1
  152. package/dist/src/tui/install-ui/types.js.map +1 -1
  153. package/dist/src/tui/install-ui/useInstallFlowState.d.ts +8 -2
  154. package/dist/src/tui/install-ui/useInstallFlowState.d.ts.map +1 -1
  155. package/dist/src/tui/install-ui/useInstallFlowState.js +145 -15
  156. package/dist/src/tui/install-ui/useInstallFlowState.js.map +1 -1
  157. package/dist/src/utils/update-notices.js +12 -0
  158. package/dist/src/utils/update-notices.js.map +1 -1
  159. package/package.json +1 -1
  160. package/workflows/agy-instructions.md +127 -88
  161. package/workflows/analyze.md +2 -2
  162. package/workflows/auto-test.md +7 -1
  163. package/workflows/blueprint.md +22 -19
  164. package/workflows/brainstorm.md +11 -3
  165. package/workflows/business-test.md +4 -0
  166. package/workflows/codebase-rebuild.md +8 -1
  167. package/workflows/codebase-refresh.md +7 -1
  168. package/workflows/codex-instructions.md +1 -1
  169. package/workflows/debug.md +5 -2
  170. package/workflows/domain-add.md +6 -0
  171. package/workflows/drift-realign.md +396 -0
  172. package/workflows/execute.md +5 -4
  173. package/workflows/explore-usage.md +2 -2
  174. package/workflows/finish-work.md +6 -6
  175. package/workflows/fork.md +2 -2
  176. package/workflows/grill.md +6 -5
  177. package/workflows/harvest.md +2 -2
  178. package/workflows/impeccable.md +3 -2
  179. package/workflows/init.md +7 -7
  180. package/workflows/integration-test.md +1 -0
  181. package/workflows/issue-gaps-analyze.codex.md +2 -0
  182. package/workflows/issue-gaps-analyze.md +4 -4
  183. package/workflows/issue-plan.md +1 -1
  184. package/workflows/knowhow.md +7 -1
  185. package/workflows/knowledge-audit.md +1 -1
  186. package/workflows/maestro-super.md +2 -2
  187. package/workflows/maestro.md +3 -3
  188. package/workflows/map.md +2 -2
  189. package/workflows/milestone-audit.md +1 -1
  190. package/workflows/milestone-complete.md +1 -1
  191. package/workflows/odyssey-base.md +258 -0
  192. package/workflows/plan.md +7 -6
  193. package/workflows/quick.md +8 -6
  194. package/workflows/ralph-amend-goal.md +177 -0
  195. package/workflows/refactor.md +2 -0
  196. package/workflows/retrospective.md +7 -3
  197. package/workflows/review.md +6 -4
  198. package/workflows/roadmap-common.md +3 -3
  199. package/workflows/roadmap.md +8 -5
  200. package/workflows/spec-generate.md +23 -18
  201. package/workflows/specs-load.md +1 -1
  202. package/workflows/specs-setup.md +2 -0
  203. package/workflows/sync.md +4 -2
  204. package/workflows/test-gen.md +1 -1
  205. package/workflows/test.md +1 -1
  206. package/workflows/ui-codify-extract.md +1 -0
  207. package/workflows/ui-codify-knowhow.md +1 -1
  208. package/workflows/ui-codify-package.md +1 -1
  209. package/workflows/ui-codify.md +9 -7
  210. package/workflows/ui-design.md +9 -7
  211. package/workflows/ui-style.md +6 -4
  212. package/workflows/verify.md +4 -4
  213. package/workflows/wiki-connect.md +2 -0
  214. package/workflows/wiki-digest.md +5 -3
  215. package/workflows/wiki-manage.md +4 -0
  216. package/workflows/maestro.codex.md +0 -365
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  name: odyssey-ui
3
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]'
4
+ argument-hint: '"<target>" [--dimensions <list>] [--skip-fix] [--skip-generalize] [--auto] [-y] [-c] [--heartbeat]'
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
 
8
+ <base>@~/.maestro/workflows/odyssey-base.md</base>
9
+
8
10
  <purpose>
9
- Deep UI polish cycle: survey (design tokens + pattern inventory) -> audit (6 dimensions) ->
10
- diverge (creative exploration) -> fix -> verify -> generalize -> discover -> record.
11
+ Deep UI polish cycle: survey 6-dimension audit divergent creative exploration
12
+ fix verify generalize discover persist. Every pixel is a learning opportunity.
11
13
 
12
14
  Core philosophy:
13
15
  - **Every pixel tells a story** — subtle details create the experience
@@ -22,407 +24,264 @@ Core philosophy:
22
24
  </purpose>
23
25
 
24
26
  <boundary>
25
- **范围内:** 目标组件/页面的视觉体验优化 — 6 维度审查 → 发散探索 → 修复 → 泛化兄弟组件
26
- **范围外:** 后端逻辑 / 数据模型 / API → `$odyssey-planex` | 深度 bug → `$odyssey-debug` | 代码质量 → `$odyssey-review-test-fix`
27
- **探索自由度:** 边界内最大自由 — S_DIVERGE 鼓励发散思维,不设创意上限。在约束下尽可能完善每个像素。
28
-
27
+ **范围内:** 目标组件/页面的视觉体验优化 — 审查 6 维度 → 发散探索 → 修复 → 泛化到兄弟组件
28
+ **范围外:** 后端逻辑 / 数据模型 / API 设计 / 业务规则 → `$odyssey-planex` | 深度 bug 调查 → `$odyssey-debug` | 代码质量审查 → `$odyssey-review-test-fix`
29
+ **探索自由度:** 边界内最大自由 — S_DIVERGE 阶段鼓励发散思维,不设创意上限。审查 + 发散可发现任何视觉/交互/可访问性细节。在约束下尽可能完善每个像素。
29
30
  **Zero-residual principle:** Every finding/idea MUST have a concrete action (fix / issue / decision). "Report and shelve" is not allowed. "Pre-existing design debt" is not a valid skip reason — if discovered within scope, it must be addressed.
31
+ ⚠️ **Decision gate** — ONLY these qualify as decisions (not fixes):
32
+ - Brand/style direction requiring human creative judgment
33
+ - Layout restructuring that changes user flow significantly
34
+ - Requires new design tokens or breaking component API
35
+ ❌ "Unsure how to fix", "Large scope", "Pre-existing issue" are NOT valid decision reasons — either fix it, or explain specifically why it's unfixable
30
36
  </boundary>
31
37
 
32
- <execution_discipline>
33
- **三条铁律(所有阶段适用):**
34
- 1. **Phase auto-commit** — 阶段完成后**自动** `git commit`,无需用户确认(session.json/evidence.ndjson 不纳入)
35
- 2. **Confident edits only, but must attempt** — only modify what you're confident about; record decisions only when genuinely requiring human judgment
36
- - High visual certainty (missing hover state, insufficient contrast, etc.) → fix directly
37
- - Design direction uncertain (color choices, layout restructure, etc.) → record decision for user judgment
38
- - No speculative changes, especially brand/style-level modifications
39
- - ⚠️ **Decision gate** — ONLY these qualify as decisions (not fixes):
40
- - Brand/style direction requiring human creative judgment
41
- - Layout restructuring that changes user flow significantly
42
- - Requires new design tokens or breaking component API
43
- - ❌ "Unsure how to fix", "Large scope", "Pre-existing issue" are NOT valid decision reasons — either fix it, or explain specifically why it's unfixable
44
- 3. **多 CLI 辅助** — survey 用 `--role explore`,audit/diverge 用 `--role analyze`,fix 前后用 `--role review`
45
- </execution_discipline>
46
-
47
38
  <context>
48
39
  $ARGUMENTS — target and optional flags.
49
40
 
50
- **Target resolution:**
51
- | Input | Resolution |
52
- |-------|-----------|
53
- | Component path | Review those component files |
54
- | Page/route | Resolve route to component tree |
55
- | `HEAD` / `staged` | `git diff HEAD` / `git diff --staged` (UI files only) |
56
- | Feature area | Grep for feature keyword, collect UI files |
41
+ **Target resolution:** Component path → audit component | Page/route → audit page | `staged`/`HEAD` → diff UI changes | Feature area → resolve to components/pages
57
42
 
58
43
  **Flags:**
59
- | Flag | Effect |
60
- |------|--------|
61
- | `--dimensions <list>` | Comma-separated subset (default: all 6) |
62
- | `--skip-fix` | Audit-only skip S_FIX and S_VERIFY |
63
- | `--skip-generalize` | Skip S_GENERALIZE and S_DISCOVER |
64
- | `--auto` | CLI delegates without confirmation |
65
- | `-y` | Auto-confirm at all decision points (see appendix) |
66
- | `-c` | Resume most recent session |
67
-
68
- **Dimensions (6):** visual-hierarchy, interaction-states, accessibility, responsiveness, micro-interactions, edge-cases
44
+ | Flag | Effect | Default |
45
+ |------|--------|---------|
46
+ | `--dimensions <list>` | Comma-separated subset of 6 dimensions | all 6 |
47
+ | `--fix-threshold <severity>` | 修复到哪个 severity 为止 | all |
48
+ | `--skip-fix` | Audit + diverge only, no code changes | false |
49
+ | `--skip-generalize` | Skip S_GENERALIZE and S_DISCOVER | false |
50
+ | `--auto` | CLI delegates without confirmation | false |
51
+ | `-y` | Auto-confirm all decisions (see appendix) | false |
52
+ | `-c` | Resume most recent session | — |
53
+ | `--heartbeat` | Enable heartbeat progress reporting | false |
69
54
 
70
55
  **Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-ui-odyssey-{slug}/`
71
56
 
72
- **Output — 3 files:**
73
- ```
74
- SESSION_DIR/
75
- ├── session.json # state + audit_result + diverge_result + patterns + phase_goals
76
- ├── evidence.ndjson # ALL evidence (phase: survey|audit|diverge|fix|discovery|decision|self-iteration)
77
- └── understanding.md # 8-section evolving narrative (§1-§8, one per major phase)
78
- ```
79
-
80
- **session.json schema:**
81
- ```json
82
- { "session_id": "ui-odyssey-{YYYYMMDD-HHmmss}", "target": "", "dimensions": [],
83
- "flags": { "skip_fix": false, "skip_generalize": false, "auto": false, "auto_confirm": false },
84
- "current_state": "S_INTAKE",
85
- "audit_result": { "dimensions_audited": [], "finding_count": 0, "severity_distribution": {} },
86
- "diverge_result": { "improvements_proposed": 0, "creative_ideas": 0 },
87
- "patterns": [], "generalization_stats": null,
88
- "phase_goals": [], "phase_goals_all_done": false, "self_iteration_log": [],
89
- "cross_phase_loops": 0, "max_loops": 5,
90
- "created_at": "", "updated_at": "" }
91
- ```
57
+ **Output — 3 files:** `session.json` (state + audit/diverge results + patterns + phase_goals) | `evidence.ndjson` (phases: survey, audit, diverge, fix, discovery, decision, self-iteration) | `understanding.md` (8-section narrative)
92
58
 
93
- **evidence.ndjson:** `{"ts":"","phase":"survey|audit|diverge|fix|discovery|decision|self-iteration","type":"","dimension":"","title":"","severity":"","file":"","line":0,"description":"","suggestion":""}`
94
-
95
- **phase_goals[] — auto-derived from flags:**
59
+ **session.json unique fields:** `target`, `dimensions`, `audit_result` {dimensions_audited, finding_count, severity_distribution}, `diverge_result` {improvements_proposed, creative_ideas}, `patterns[]` {id, source_finding, layer, signature, description, risk, fix_template, confidence}, `confirmation` {test_result, cli_review, overall}, `generalization_stats` {patterns_extracted, total_hits, cross_layer_confirmed, regression_risks, by_layer, deepening_triggered}
96
60
 
61
+ **phase_goals[]:**
97
62
  | ID | Goal | Phase | skip_when |
98
63
  |----|------|-------|-----------|
99
64
  | G1 | Survey completed | S_SURVEY | — |
100
65
  | G2 | Audit completed | S_AUDIT | — |
101
66
  | G3 | Divergent exploration done | S_DIVERGE | — |
102
- | G4 | Fix applied and verified | S_VERIFY | skip_fix |
67
+ | G4 | Zero remaining: all findings/ideas fixed and verified | S_VERIFY | skip_fix |
103
68
  | G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
104
69
  | G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
105
70
  | G7 | Learnings persisted | S_RECORD | — |
106
71
 
107
- Lifecycle: `pending -> done | skipped | failed` (all set `completion_confirmed`)
108
-
109
- **understanding.md — 8 sections:** SS1 Target & Context (S_INTAKE) | SS2 Visual Survey (S_SURVEY) | SS3 Audit Findings (S_AUDIT) | SS4 Divergent Exploration (S_DIVERGE) | SS5 Fix & Verification (S_FIX+S_VERIFY) | SS6 Generalization (S_GENERALIZE) | SS7 Discoveries (S_DISCOVER) | SS8 Design Learnings (S_RECORD)
110
-
111
- ### Pre-load
112
-
113
- | Layer | Command | Purpose |
114
- |-------|---------|---------|
115
- | Codebase docs | Read `.workflow/codebase/ARCHITECTURE.md` | Module boundaries |
116
- | Wiki search | `maestro search "<target keywords>" --json` | Prior UI decisions (top 5) |
117
- | UI specs | `maestro load --type spec --category ui` | Design tokens, standards |
118
- | Coding specs | `maestro load --type spec --category coding` | Coding conventions |
119
- | Role knowledge | `maestro search --category ui` -> select -> `maestro load --type knowhow --id <id>` | Domain knowledge |
120
- | Prior sessions | `Glob(".workflow/scratch/*-ui-odyssey-*")` | Related sessions |
72
+ **understanding.md:** §1 Target & Design Context | §2 Survey | §3 Audit | §4 Diverge | §5 Verify | §6 Generalize | §7 Discover | §8 Learnings
121
73
 
122
- ### Knowledge Persistence (two-step model)
74
+ ### Pre-load(可选,缺失不阻塞)
75
+ ARCHITECTURE.md | `maestro search "<target>" --json` (top 5) | `maestro load --type spec --category ui` | `maestro load --type spec --category coding` | `maestro search --category ui` → load knowhow | Glob prior sessions
123
76
 
124
- Write to understanding.md SS8 during execution (temporary). Completion summary suggests follow-up commands.
125
-
126
- | Category | Content | Follow-up |
127
- |----------|---------|-----------|
128
- | Design pattern | Component pattern + scenarios | `$spec-add ui "..."` |
129
- | Interaction spec | State defs + transition rules | `$spec-add ui "..."` |
130
- | Accessibility rule | WCAG req + implementation | `$spec-add ui "..."` |
131
- | Reusable generalization | Pattern signature + scope | `$spec-add coding "..."` |
77
+ ### Knowledge Persistence(S_RECORD 写入 understanding.md §8)
78
+ | 分类 | 写入内容 | 后续建议命令 |
79
+ |------|---------|-------------|
80
+ | 设计 pattern | 组件模式 + 适用场景 + token 引用 | `/spec-add ui "..."` |
81
+ | 交互规范 | 状态定义 + 转场规则 + 反馈模式 | `/spec-add ui "..."` |
82
+ | 可访问性规则 | WCAG 要求 + 实现方案 | `/spec-add ui "..."` |
83
+ | 可复用泛化 pattern | pattern 签名 + 应用范围 | `/spec-add coding "..."` |
132
84
  </context>
133
85
 
134
86
  <self_iteration>
135
- **Quality Gate** auto-evaluate after each analytical phase. Insufficient -> re-enter (max **3 rounds**).
136
-
137
- | Dimension | Sufficient | Insufficient |
138
- |-----------|-----------|-------------|
139
- | Coverage | All known related files/components analyzed | Missed targets discoverable via grep/glob |
140
- | Depth | >=80% findings have file:line evidence | Most findings lack specifics |
141
- | Actionability | Each conclusion has concrete next action | "Consider reviewing" without action |
142
-
143
- **Expansion:** Round 1 = widen scope (more directories, more components, deeper token scan). Round 2 = shift perspective (different audit angle, CLI delegate second opinion). Round 3 = combine both + targeted deep-dive on remaining gaps.
144
-
145
- **Applicable stages:** S_SURVEY, S_AUDIT, S_DIVERGE, S_GENERALIZE
146
-
147
- **Exit:** All sufficient -> advance | 3-round cap -> record gap, continue. Logged to `evidence.ndjson` + `session.json.self_iteration_log[]`.
87
+ 适用阶段: S_SURVEY, S_AUDIT, S_DIVERGE, S_GENERALIZE
148
88
  </self_iteration>
149
89
 
150
- <csv_schema>
151
-
152
- ### Shared Output Schema (all waves)
153
- ```json
154
- {
155
- "type": "object",
156
- "properties": {
157
- "id": { "type": "string" },
158
- "result_status": { "type": "string", "enum": ["completed", "failed"] },
159
- "findings": { "type": "string", "maxLength": 500 },
160
- "evidence": { "type": "string" },
161
- "error": { "type": "string" }
162
- },
163
- "required": ["id", "result_status", "findings"]
164
- }
165
- ```
166
-
167
- **Termination contract:** Call `report_agent_job_result` EXACTLY ONCE. Read-only. Do NOT modify source files, tasks.csv, wave-*.csv, results.csv, or call spawn_agents_on_csv.
168
-
169
- ### tasks.csv
170
- ```csv
171
- id,title,description,task_type,dimension,deps,wave,status,findings,evidence,error
172
- ```
173
-
174
- **Waves:**
175
- | Wave | Tasks | Parallelism |
176
- |------|-------|-------------|
177
- | 1 | Survey (design-tokens-audit, pattern-inventory) | 2 agents |
178
- | 2 | Audit (visual-hierarchy, interaction-states, accessibility, responsiveness, micro-interactions, edge-cases) | 6 agents |
179
- | 3 | Diverge (polish-agent, delight-agent) | 2 agents |
180
- | 4 | Generalization (syntax-grep, semantic-scan, structural-match, historical-grep) | 4 agents |
181
- </csv_schema>
182
-
183
- <invariants>
184
- 1. **Browser is truth** — code changes must be visually verifiable
185
- 2. **Diverge before converge** — S_DIVERGE runs before S_FIX, never skip
186
- 3. **Evidence append-only** evidence.ndjson is never overwritten
187
- 4. **Session is source of truth** — session.json holds all state
188
- 5. **Phase goal tracking** each stage MUST mark its goal on completion
189
- 6. **`-y` defers, never drops** auto-confirm records `deferred`, never silently skips
190
- 7. **CLI delegate is background** all `maestro delegate` calls use run_in_background
191
- 8. **Goal is outcome-oriented** — odyssey outputs prompt then continues
192
- 9. **Invariant violation = BLOCK** — violating any invariant blocks the operation
193
- </invariants>
194
-
195
- <execution>
196
-
197
- **States:** S_INTAKE -> S_SURVEY -> S_AUDIT -> S_DIVERGE -> S_FIX -> S_VERIFY -> S_GENERALIZE -> S_DISCOVER -> S_RECORD
198
- - S_FIX/S_VERIFY skip when `--skip-fix`
199
- - S_GENERALIZE/S_DISCOVER skip when `--skip-generalize`
200
-
201
- ### S_INTAKE
202
- 1. Parse target + flags -> resolve file list (filter to UI-relevant: `.tsx`, `.vue`, `.svelte`, `.css`, `.scss`, style files)
90
+ <state_machine>
91
+
92
+ <states>
93
+ S_INTAKE — Parse target, load design context, resume session PERSIST: session.json + understanding.md §1
94
+ S_SURVEY — Visual landscape: design tokens, pattern inventory PERSIST: evidence.ndjson (survey) + understanding.md §2
95
+ S_AUDIT — 6-dimension parallel review PERSIST: evidence.ndjson (audit) + understanding.md §3
96
+ S_DIVERGE — Divergent creative exploration: polish + delight PERSIST: evidence.ndjson (diverge) + understanding.md §4
97
+ S_FIX — Implement improvements (skip if --skip-fix) PERSIST: code changes + evidence.ndjson (fix)
98
+ S_VERIFY — Visual verification + test (skip if --skip-fix) PERSIST: session.json.confirmation + understanding.md §5
99
+ S_GENERALIZE Pattern extraction + 4-agent scan (skip if --skip-gen) PERSIST: session.json.patterns + understanding.md §6
100
+ S_DISCOVER — Classify hits, create issues (skip if --skip-gen) PERSIST: evidence.ndjson (discovery|decision) + understanding.md §7
101
+ S_RECORD — Design knowledge persistence + final report PERSIST: understanding.md §8 + spec entries
102
+ </states>
103
+
104
+ <transitions>
105
+ S_INTAKE:
106
+ → S_INTAKE WHEN -c + session found DO A_RESUME
107
+ S_SURVEY WHEN target resolved DO A_INTAKE
108
+ → S_INTAKE WHEN no target DO request_user_input
109
+
110
+ S_SURVEY → S_AUDIT DO A_SURVEY
111
+ S_AUDIT → S_DIVERGE DO A_AUDIT
112
+
113
+ S_DIVERGE:
114
+ → S_FIX WHEN !skip_fix AND actionable findings/ideas DO A_DIVERGE
115
+ S_GENERALIZE WHEN (skip_fix OR no actionable) AND !skip_gen DO A_DIVERGE
116
+ → S_RECORD WHEN (skip_fix OR no actionable) AND skip_gen DO A_DIVERGE
117
+
118
+ S_FIX → S_VERIFY DO A_FIX
119
+ S_VERIFY:
120
+ S_GENERALIZE WHEN verified AND !skip_gen DO A_VERIFY
121
+ → S_RECORD WHEN verified AND skip_gen DO A_VERIFY
122
+ → S_FIX WHEN needs_rework DO A_VERIFY
123
+
124
+ S_GENERALIZE:
125
+ S_DISCOVER WHEN hits found DO A_GENERALIZE
126
+ S_RECORD WHEN no hits DO A_GENERALIZE
127
+
128
+ S_DISCOVER S_AUDIT : new component to audit cross_phase_loops++
129
+ S_DISCOVER S_FIX : fixable sibling, !skip_fix cross_phase_loops++
130
+ S_DISCOVER S_RECORD : remaining_actionable == 0 OR loops >= max_loops (MUST log each unfixed item)
131
+
132
+ S_RECORD → END DO A_RECORD
133
+ </transitions>
134
+
135
+ <actions>
136
+
137
+ ### A_INTAKE
138
+ 1. Parse arguments: target, flags, `--dimensions` subset
203
139
  2. Generate slug, create `SESSION_DIR`
204
- 3. Search prior knowledge: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load (ui, coding)
140
+ 3. Pre-load: `maestro search` + Glob prior sessions + ARCHITECTURE.md + spec load ui/coding
205
141
  4. Derive `phase_goals[]` from flags (apply `skip_when`)
206
- 5. Write `session.json` + `understanding.md` SS1
207
- 6. Display Goal Prompt (appendix), continue without blocking
208
-
209
- **Resume (`-c`):** Glob latest session -> read `session.json` -> restore `current_state` -> jump.
210
-
211
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): S_INTAKE — 目标解析"`
212
-
213
- ### S_SURVEY
214
- **spawn_agents_on_csv (Wave 1):**
215
-
216
- Write `tasks.csv` with Wave 1 rows:
217
- ```csv
218
- "survey-tokens","Design Token Audit","Scan {target_files} for CSS variables, design tokens, theme values. Return [{token,usage_count,consistency,file,line}].","survey","","","1","pending","","",""
219
- "survey-patterns","Pattern Inventory","Catalog component patterns, layout, spacing, typography in {target_files}. Return [{pattern,files,consistency}].","survey","","","1","pending","","",""
220
- ```
221
- `spawn_agents_on_csv({ csv_path:"tasks.csv", max_concurrency:2, max_runtime_seconds:300, output_csv_path:"wave-1-results.csv", output_schema:SHARED_OUTPUT_SCHEMA })`
222
-
223
- Merge -> evidence.ndjson (phase: "survey"). Update SS2. Mark G1 done.
224
-
225
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): S_SURVEY — 调查"`
142
+ 5. Write `session.json` + `understanding.md` §1
143
+ 6. Emit Goal Prompt (see Appendix)
144
+ 📌 `git commit -m "odyssey-ui({slug}): INTAKE — 目标解析"`
226
145
 
227
- ### S_AUDIT
228
- **spawn_agents_on_csv (Wave 2)** 6 agents:
146
+ ### A_RESUME
147
+ Find latest session via Glob → read `session.json` → display summary → jump to `current_state`.
229
148
 
230
- Append Wave 2 rows to `tasks.csv`:
231
- ```csv
232
- "audit-hierarchy","Visual Hierarchy","Spacing, typography scale, contrast, alignment, whitespace, visual weight","audit","visual-hierarchy","","2","pending","","",""
233
- "audit-interaction","Interaction States","hover/focus/active/disabled/loading/error/empty/selected states","audit","interaction-states","","2","pending","","",""
234
- "audit-a11y","Accessibility","WCAG AA contrast, focus mgmt, aria, keyboard nav, screen reader","audit","accessibility","","2","pending","","",""
235
- "audit-responsive","Responsiveness","Breakpoints, overflow, touch targets >=44px, fluid typography","audit","responsiveness","","2","pending","","",""
236
- "audit-motion","Micro-interactions","Transitions, animations, feedback, loading states, scroll behavior","audit","micro-interactions","","2","pending","","",""
237
- "audit-edge","Edge Cases","Long text, empty data, error states, extreme values, i18n, RTL","audit","edge-cases","","2","pending","","",""
238
- ```
239
- `spawn_agents_on_csv({ csv_path:"tasks.csv", max_concurrency:6, max_runtime_seconds:600, output_csv_path:"wave-2-results.csv", output_schema:SHARED_OUTPUT_SCHEMA })`
149
+ ### A_SURVEY
150
+ 1. **Design system inventory**: Scan for design tokens, CSS variables, theme imports
151
+ 2. **Current state analysis**: Styling patterns, layout strategy, component hierarchy
152
+ 3. **spawn_agents_on_csv (Wave 1)** — 2 agents: design-tokens-audit, pattern-inventory
153
+ 4. Append evidence (phase: "survey"). Update §2. Mark G1 done.
154
+ 📌 `git commit -m "odyssey-ui({slug}): SURVEY — 视觉调查"`
240
155
 
241
- Merge -> evidence.ndjson (phase: "audit"). Write `audit_result` with dimensions, finding count, severity distribution. Update SS3. Mark G2 done.
156
+ ### A_AUDIT
157
+ **spawn_agents_on_csv (Wave 2)** — 6 parallel agents (one per dimension, or `--dimensions` subset):
242
158
 
243
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): S_AUDIT — 审查"`
159
+ | Dimension | Focus |
160
+ |-----------|-------|
161
+ | visual_hierarchy | Spacing, typography scale, color contrast, alignment, whitespace, visual weight |
162
+ | interaction_states | Hover, focus, active, disabled, loading, error, empty, selected states |
163
+ | accessibility | WCAG AA contrast, focus management, aria labels, keyboard nav, screen reader |
164
+ | responsiveness | Breakpoints, overflow, touch targets, fluid typography, container queries |
165
+ | micro_interactions | Transitions, animations, feedback indicators, loading states, progress |
166
+ | edge_cases | Long text truncation, empty data, error states, extreme values, i18n, RTL |
244
167
 
245
- ### S_DIVERGE
246
- **spawn_agents_on_csv (Wave 3)** 2 agents:
168
+ Each returns `[{title, severity, file, line, description, suggestion, dimension}]`.
169
+ Merge → evidence (phase: "audit"). Write `audit_result`. Update §3 (severity matrix). Mark G2 done.
170
+ 📌 `git commit -m "odyssey-ui({slug}): AUDIT — 多维审查"`
247
171
 
248
- Append Wave 3 rows to `tasks.csv`:
249
- ```csv
250
- "diverge-polish","Polish Agent","Missing subtle details: shadows, borders, transitions, hover feedback, empty states, skeleton loading, scroll behavior. Return [{idea,category:'polish',impact,effort,description}].","diverge","","","3","pending","","",""
251
- "diverge-delight","Delight Agent","What makes this memorable: motion design, progressive disclosure, smart defaults, celebratory feedback, personality. Return [{idea,category:'delight',impact,effort,description}].","diverge","","","3","pending","","",""
252
- ```
253
- `spawn_agents_on_csv({ csv_path:"tasks.csv", max_concurrency:2, max_runtime_seconds:300, output_csv_path:"wave-3-results.csv", output_schema:SHARED_OUTPUT_SCHEMA })`
254
-
255
- **Optional CLI delegate** for creative review:
256
- ```bash
257
- maestro delegate "PURPOSE: Creative UI review for: {target}
258
- TASK: Identify polish opportunities | Suggest delight moments | Evaluate visual rhythm
259
- MODE: analysis CONTEXT: @{target_files} | Survey: {token_summary} | Audit: {top_findings}
260
- EXPECTED: JSON [{idea, category, impact, effort, description}]
261
- CONSTRAINTS: User-perceptible improvements only
262
- " --role analyze --mode analysis
263
- ```
264
- Execute with `run_in_background: true`, then wait for callback (do NOT halt the Odyssey flow).
172
+ ### A_DIVERGE
173
+ Goes beyond defect fixing — "what would make this delightful?"
265
174
 
266
- Consolidate: audit findings + divergent ideas -> prioritized improvement list (impact/effort matrix). Write `diverge_result`. Update SS4. Mark G3 done.
175
+ **Step 1 spawn_agents_on_csv (Wave 3)** 2 parallel agents:
176
+ - **Polish Agent**: Shadows, borders, transitions, hover states, feedback, empty states, skeleton loading, scroll behavior
177
+ - **Delight Agent**: Motion design, progressive disclosure, smart defaults, contextual hints, celebratory feedback, personality in copy
267
178
 
268
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): S_DIVERGE — 发散"`
179
+ Each returns `[{idea, category (polish|delight), impact, effort, description, inspiration}]`
269
180
 
270
- ### S_FIX
271
- Skip if `--skip-fix`. **穷尽修复** ALL audit findings + divergent ideas(按 impact×severity 递降),不限于 high severity。每轮修复后 re-review,新发现追加。
272
- **Normal**: `request_user_input` to confirm. **`-y`**: auto-fix, record `deferred`.
273
- Implement highest impact first. Record evidence (phase: "fix").
181
+ **Step 2 — CLI-assisted** (optional): `maestro delegate` with `--role analyze` — polish opportunities, micro-interactions, visual rhythm, delight moments
274
182
 
275
- 📌 **Auto-commit**: `git add -A && git commit -m "odyssey-ui({slug}): S_FIX 修复"`
183
+ **Step 3 — Consolidate**: Merge audit findings + divergent ideas prioritized list (severity x impact x effort).
184
+ Append evidence (phase: "diverge"). Update §4. Mark G3 done.
185
+ 📌 `git commit -m "odyssey-ui({slug}): DIVERGE — 发散探索"`
276
186
 
277
- ### S_VERIFY
187
+ ### A_FIX
278
188
  Skip if `--skip-fix`.
279
-
280
- 1. **Tests**: run covering tests on modified files
281
- 2. **CLI visual review**: delegate `--role review --mode analysis` for visual correctness + regression check (execute with `run_in_background: true`, then wait for callback — do NOT halt the Odyssey flow)
282
- 3. `needs_rework` -> S_FIX (loop). `confirmed` -> mark G4 done, advance
283
- 4. Update SS5
284
-
285
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): S_VERIFY 验证"`
286
-
287
- ### S_GENERALIZE
288
- Skip if `--skip-generalize`.
289
-
290
- **Step 1 — Multi-layer pattern extraction** from audit + diverge findings:
291
-
292
- | Layer | Method | Example |
293
- |-------|--------|---------|
294
- | Syntax | Regex patterns (direct Grep) | Missing `focus-visible`, hardcoded colors, `!important` |
295
- | Semantic | Agent anti-pattern scan | Missing hover state on interactive element, no empty state |
296
- | Structural | File/module similarity | Same component structure missing accessibility attrs |
297
-
298
- Write `session.json.patterns[]`: `[{id, source_finding, layer, signature, description, risk, fix_template}]`
299
-
300
- **Step 2 — 4-agent scan (spawn_agents_on_csv, Wave 4):**
301
-
302
- Append Wave 4 rows to `tasks.csv`:
303
- ```csv
304
- "gen-syntax","Syntax Grep","Grep CSS/style patterns matching '${signatures}' across project","generalization","syntax","","4","pending","","",""
305
- "gen-semantic","Semantic Scan","Find components with same interaction pattern but missing states","generalization","semantic","","4","pending","","",""
306
- "gen-structural","Structural Match","Find structurally similar components, check for same issues","generalization","structural","","4","pending","","",""
307
- "gen-historical","Historical Grep","git log -S '${signature}' for UI pattern history","generalization","historical","","4","pending","","",""
308
- ```
309
- `spawn_agents_on_csv({ csv_path:"tasks.csv", max_concurrency:4, max_runtime_seconds:600, output_csv_path:"wave-4-results.csv", output_schema:SHARED_OUTPUT_SCHEMA })`
310
-
311
- **Step 3 — Cross-layer dedup**: Multi-layer hit -> boost confidence. Single -> `needs_review`. Historical fix -> `regression_risk`.
312
-
313
- **Step 4 — Iterative deepening**: module >= 3 hits -> targeted deep scan. Max 1 round.
314
-
315
- **Step 5 — Quality Gate** (self-iteration).
316
-
317
- **Step 6:** Write `generalization_stats`. Update SS6. Mark G5 done.
318
-
319
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): S_GENERALIZE — 泛化"`
320
-
321
- ### S_DISCOVER
322
- Skip if no generalization hits.
323
-
324
- 1. **Triage** each hit: read +-10 lines -> classify `needs_treatment` / `low_risk` / `already_handled`
325
- 2. **Route**:
326
- - `needs_treatment` + directly fixable → **fix immediately** → back to S_FIX
327
- - `needs_treatment` + requires design direction decision → create issue (with fix suggestion)
328
- - `low_risk` → evaluate if a quick guard/improvement is feasible; if yes, fix it
329
- - `already_handled` → mark skip
330
- See appendix `-y` behavior. Append evidence (phase: "discovery" + "decision")
331
- 3. **Cross-phase loop**:
332
- - `S_DISCOVER → S_RECORD` : triage complete AND remaining_actionable == 0
333
- - `S_DISCOVER → S_RECORD` : loops >= max_loops → MUST log each unfixed item with specific reason (blanket "pre-existing" is forbidden)
334
- - new component to audit → S_AUDIT (cross_phase_loops++)
335
- - fixable sibling → S_FIX (!skip_fix, cross_phase_loops++)
336
- 4. Update SS7. Mark G6 done.
337
-
338
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): S_DISCOVER — 发现"`
339
-
340
- ### S_RECORD
341
- 1. Finalize SS8: structured by Knowledge Persistence table (temporary)
342
- 2. Mark G7 done. Pending decisions: **Normal** -> `request_user_input`. **`-y`** -> skip, show deferred count
343
- 3. **Goal audit**: all confirmed -> `phase_goals_all_done = true`. Any false: **Normal** -> `request_user_input`. **`-y`** -> auto accept
344
- 4. **Completion**: `current_state = "COMPLETED"`, emit summary:
189
+ 1. **穷尽修复**: ALL findings/ideas by priority tier (critical→high→medium→low + high-impact ideas). After each tier, re-review — new findings append.
190
+ 2. Each fix evidence (phase: "fix")
191
+ 3. **Normal**: request_user_input per-fix. **`-y`**: auto-proceed, record `deferred`.
192
+ 📌 `git commit -m "odyssey-ui({slug}): FIX 优化实现"`
193
+
194
+ ### A_VERIFY
195
+ 1. Run tests (lint, unit, visual regression)
196
+ 2. **CLI-assisted**: `maestro delegate` with `--role review` — visual correctness, interaction states, accessibility, responsive
197
+ 3. `needs_rework` → S_FIX. `verified` → mark G4 done. Update §5, write `confirmation`.
198
+ 📌 `git commit -m "odyssey-ui({slug}): VERIFY — 验证"`
199
+
200
+ ### A_GENERALIZE
201
+ 按 base A_GENERALIZE 执行。Pattern 来源: audit findings + diverge ideas (severity >= medium OR impact = high)。
202
+ **spawn_agents_on_csv (Wave 4)** 4 agents: syntax-grep, semantic-scan, structural-match, historical-grep.
203
+ Mark G5 done.
204
+ 📌 `git commit -m "odyssey-ui({slug}): GENERALIZE 泛化扫描"`
205
+
206
+ ### A_DISCOVER
207
+ 按 base A_DISCOVER 执行。Mark G6 done.
208
+ 📌 `git commit -m "odyssey-ui({slug}): DISCOVER 发现分类"`
209
+
210
+ ### A_RECORD
211
+ 1. Finalize §8: 按 Knowledge Persistence 表分类记录,completion summary 列出建议的 `/spec-add` 命令
212
+ 2. Pending decisions: **Normal** request_user_input. **`-y`** → skip, show deferred count
213
+ 3. Goal audit: all confirmed → `phase_goals_all_done = true`. **Normal** → request_user_input | **`-y`** → auto accept
214
+ 4. Mark G7 done. Emit completion summary:
345
215
  ```
346
216
  --- UI ODYSSEY COMPLETE ---
347
- Target: {target} Dimensions: {audited}
348
- Survey: {token_count} tokens, {pattern_count} patterns
349
- Audit: {C}C {H}H {M}M {L}L Diverge: {improvements} + {ideas} creative
350
- Fix: {F} applied, {S} skipped Patterns: {N} ({by_layer})
351
- Scan: {total} hits ({cross_layer} cross-layer) Issues: {N}
352
- Decisions: {resolved}/{pending}/{deferred} Self-iter: {R} rounds / {P} phases
353
- Goals: {done}/{total} ({skipped} skipped)
217
+ Target: {target} | Dimensions: {dimensions_audited}
218
+ Findings: {C}C {H}H {M}M {L}L | Diverge: {improvements} polish + {creative} delight
219
+ Fix: {fixed_count} applied, verified={yes|skipped}
220
+ Patterns: {extracted} ({by_layer}) | Scan hits: {total} ({cross_layer} cross-layer)
221
+ Issues: {N} | Decisions: {N} resolved, {M} pending, {K} deferred
222
+ Learnings: {N} entries | Self-iter: {N} rounds | Goals: {done}/{total} ({skipped} skipped)
354
223
  ---
355
224
  ```
356
- **Next steps:** `$odyssey-review-test-fix`, `$manage-issue list --source ui-odyssey`, `$maestro-impeccable`, `$maestro-plan --gaps`
225
+ 📌 `git commit -m "odyssey-ui({slug}): RECORD — 会话总结"`
357
226
 
358
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-ui({slug}): S_RECORD — 总结"`
359
- </execution>
227
+ </actions>
360
228
 
361
229
  <appendix>
362
230
 
363
231
  ### Goal Prompt Template
364
-
365
- **Time guard: display ONCE after S_INTAKE completes (session created, before survey). NEVER redisplay at S_RECORD completion.**
232
+ **⚠️ 仅在 A_INTAKE 完成后显示一次。A_RECORD 完成时禁止重新显示。**
366
233
 
367
234
  ```
368
- UI Odyssey session created. Copy the following /goal to set termination conditions at any time:
235
+ 📋 UI Odyssey 会话已创建。可随时复制以下 /goal 设定终止条件:
369
236
 
370
- /goal 穷尽迭代:直到所有 audit + diverge findings 均已处理(fix/issue/decision)
237
+ /goal 完成以下目标:
238
+ {for each G in phase_goals where status != "skipped":}
239
+ - {G.id}: {G.goal} — 完成条件: {G.done_when}
240
+ {end for}
241
+ 穷尽迭代:直到 audit + diverge findings 均已处理(fix/issue/decision)
371
242
  且 phase_goals_all_done=true 才停。修复按 impact×severity 逐轮迭代。
372
- 每轮修复后重审修改区域,新发现追加继续。
373
- phase=decision pending 必须 request_user_input。不允许遗留。
243
+ 每轮修复后重审修改区域,新发现追加继续修。
244
+ 遇到 phase=decision pending 必须 request_user_input。不允许"只报告不处理"。
374
245
  ```
375
246
 
376
- Odyssey outputs prompt then continues without blocking. `/goal` entered by user at any time.
247
+ ### `-y` Auto-Confirm (5 decision points)
248
+ | Decision Point | Normal | `-y` |
249
+ |----------------|--------|------|
250
+ | A_FIX improvement confirmation | request_user_input | auto-proceed, `deferred` |
251
+ | A_DISCOVER hit routing | request_user_input | auto create issue, `deferred` |
252
+ | A_DISCOVER ambiguous items | request_user_input | all `deferred` |
253
+ | A_RECORD pending decisions | request_user_input | skip, show deferred count |
254
+ | A_RECORD goal audit | request_user_input | auto accept |
377
255
 
378
- ### `-y` Auto-Confirm Behavior
379
-
380
- | Decision Point | Normal | `-y` mode |
381
- |----------------|--------|-----------|
382
- | S_DIVERGE consolidation | request_user_input for priority | auto-rank by impact/effort |
383
- | S_FIX fix candidates | request_user_input to confirm | auto-fix high-impact, `deferred` |
384
- | S_DISCOVER bug routing | request_user_input per hit | auto create issue, `deferred` |
385
- | S_DISCOVER ambiguous | request_user_input batch | all `deferred` |
386
- | S_RECORD pending decisions | request_user_input per-item | skip, show deferred count |
387
- | S_RECORD goal audit | request_user_input 3-way | auto accept current state |
388
-
389
- `deferred` items shown in summary; recoverable via `-c`.
390
-
391
- ### Phase Goal Lifecycle
392
-
393
- `pending -> done (confirmed=true)` normal | `pending -> skipped (confirmed=true)` flags/manual | `pending -> failed (confirmed=false)` incomplete
394
-
395
- `phase_goals_all_done = true` only when ALL goals have `completion_confirmed == true`.
256
+ `deferred` "待决策" in completion summary; recoverable via `-c`.
396
257
 
397
258
  </appendix>
398
259
 
260
+ </state_machine>
261
+
399
262
  <error_codes>
400
263
  | Code | Severity | Condition | Recovery |
401
264
  |------|----------|-----------|----------|
402
- | E001 | error | No target and no session to resume | Provide target or use -c |
403
- | E002 | error | Target not found or no UI files | Check path, ensure UI files exist |
404
- | E003 | error | Resume but no session found | Start new session |
405
- | W001 | warning | No relevant git history | Proceed with limited context |
406
- | W002 | warning | Audit dimension agent failed | Partial coverage, note gap |
407
- | W003 | warning | Generalization scan 0 hits | Skip discovery |
408
- | W004 | warning | Delegate parse failed | Use raw output |
265
+ | E001 | error | No target specified | Provide target |
266
+ | E002 | error | Target path not found | Check path |
267
+ | W001 | warning | No design system detected | Proceed with defaults |
268
+ | W002 | warning | Some dimension agents failed | Partial coverage |
409
269
  </error_codes>
410
270
 
411
271
  <success_criteria>
412
- - [ ] Target resolved to UI files, session created with 3 output files
413
- - [ ] Prior knowledge searched (maestro search + sessions + architecture + ui specs)
414
- - [ ] Survey via spawn Wave 1, evidence phase=survey
415
- - [ ] All 6 dimensions audited via spawn Wave 2, severity matrix produced
416
- - [ ] Divergent exploration via spawn Wave 3, prioritized improvement list
417
- - [ ] Fixes applied highest-impact-first and verified (unless --skip-fix)
418
- - [ ] `--skip-fix`: no source code modifications
419
- - [ ] Generalization via spawn Wave 4 + cross-layer dedup (unless --skip-generalize)
420
- - [ ] Discoveries classified and routed
421
- - [ ] understanding.md tracks all 8 sections progressively
422
- - [ ] phase_goals G1-G7 derived from flags, each phase marks its goal
423
- - [ ] Goal Prompt displayed once; `-y` auto-resolves/defers
424
- - [ ] State saved at each transition (resumable via -c)
425
- - [ ] Quality Gate self-iteration logged in self_iteration_log
426
- - [ ] Completion summary with all stats
427
- - [ ] **Every unfixed finding has individual classification and reason** — blanket "pre-existing" labels are forbidden
272
+ - [ ] 6-dimension audit with severity matrix + divergent exploration (polish + delight)
273
+ - [ ] Improvements implemented and verified (unless --skip-fix)
274
+ - [ ] Multi-layer generalization + discoveries classified (unless --skip-generalize)
275
+ - [ ] Every unfixed finding has individual classification and reason
276
+ - [ ] understanding.md §8 finalized; phase_goals G1-G7 tracked; `-y` no blocking prompts
428
277
  </success_criteria>
278
+
279
+ <next_step_routing>
280
+ | Condition | Next step |
281
+ |-----------|-----------|
282
+ | Finding needs deeper debug | `$odyssey-debug "<finding>"` |
283
+ | Issues created from discoveries | `/manage-issue list --source ui-odyssey` |
284
+ | Design pattern worth documenting | `/spec-add ui "..."` |
285
+ | Want full review of changes | `$odyssey-review-test-fix <changed-files>` |
286
+ | Sibling components to polish | `$odyssey-ui "<sibling>"` |
287
+ </next_step_routing>