ultra-builder-pro-cli 0.5.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 (206) hide show
  1. package/.ultra-template/delivery-report.json +9 -0
  2. package/.ultra-template/docs/research/README.md +53 -0
  3. package/.ultra-template/specs/architecture.md +250 -0
  4. package/.ultra-template/specs/discovery.md +248 -0
  5. package/.ultra-template/specs/product.md +223 -0
  6. package/.ultra-template/tasks/contexts/TEMPLATE.md +57 -0
  7. package/.ultra-template/tasks/tasks.json +33 -0
  8. package/.ultra-template/test-report.json +8 -0
  9. package/CHANGELOG.md +194 -0
  10. package/LICENSE +21 -0
  11. package/README.md +187 -0
  12. package/adapters/_shared/codex-assets.cjs +1128 -0
  13. package/adapters/_shared/codex-ultra-tools-entry.cjs +11 -0
  14. package/adapters/_shared/file-ops.cjs +115 -0
  15. package/adapters/_shared/frontmatter.cjs +52 -0
  16. package/adapters/_shared/handbook.cjs +144 -0
  17. package/adapters/_shared/md-to-toml.cjs +54 -0
  18. package/adapters/_shared/path-rewrite.cjs +79 -0
  19. package/adapters/_shared/rtk-detect.cjs +86 -0
  20. package/adapters/_shared/runtime-assets.cjs +70 -0
  21. package/adapters/_shared/settings-merge.cjs +76 -0
  22. package/adapters/_shared/tests/file-ops.test.cjs +54 -0
  23. package/adapters/_shared/tests/frontmatter.test.cjs +47 -0
  24. package/adapters/_shared/tests/handbook.test.cjs +86 -0
  25. package/adapters/_shared/tests/md-to-toml.test.cjs +48 -0
  26. package/adapters/_shared/tests/path-rewrite.test.cjs +60 -0
  27. package/adapters/_shared/tests/resolve-target.test.cjs +85 -0
  28. package/adapters/_shared/tests/rtk-detect.test.cjs +116 -0
  29. package/adapters/_shared/tests/runtime-assets.test.cjs +107 -0
  30. package/adapters/_shared/tests/settings-merge.test.cjs +85 -0
  31. package/adapters/_shared/tests/validate.test.cjs +30 -0
  32. package/adapters/_shared/validate.cjs +24 -0
  33. package/adapters/claude.js +182 -0
  34. package/adapters/codex.js +385 -0
  35. package/adapters/gemini.js +204 -0
  36. package/adapters/opencode.js +506 -0
  37. package/adapters/tests/claude.test.cjs +117 -0
  38. package/adapters/tests/codex-hook.test.cjs +90 -0
  39. package/adapters/tests/codex.test.cjs +356 -0
  40. package/adapters/tests/gemini.test.cjs +112 -0
  41. package/adapters/tests/opencode.test.cjs +246 -0
  42. package/agents/code-reviewer.md +102 -0
  43. package/agents/debugger.md +127 -0
  44. package/agents/review-code.md +125 -0
  45. package/agents/review-comments.md +98 -0
  46. package/agents/review-coordinator.md +146 -0
  47. package/agents/review-design.md +133 -0
  48. package/agents/review-errors.md +87 -0
  49. package/agents/review-tests.md +93 -0
  50. package/agents/tdd-runner.md +92 -0
  51. package/bin/handbook.js +54 -0
  52. package/bin/install.js +254 -0
  53. package/bin/orchestrator.js +214 -0
  54. package/commands/learn.md +41 -0
  55. package/commands/ultra-deliver.md +45 -0
  56. package/commands/ultra-dev.md +50 -0
  57. package/commands/ultra-init.md +51 -0
  58. package/commands/ultra-plan.md +49 -0
  59. package/commands/ultra-research.md +59 -0
  60. package/commands/ultra-status.md +46 -0
  61. package/commands/ultra-test.md +48 -0
  62. package/commands/ultra-think.md +45 -0
  63. package/docs/AGENT-CONTEXT.md +143 -0
  64. package/docs/ARCHITECTURE.md +197 -0
  65. package/docs/COMMIT-HASH-BACKFILL.md +101 -0
  66. package/docs/LEGACY-HERMES.md +1175 -0
  67. package/docs/PLAN.zh-CN.md +1683 -0
  68. package/docs/ROADMAP.md +102 -0
  69. package/docs/RUNTIME-COMPAT-MATRIX.md +98 -0
  70. package/docs/STATE-DB-ACCESS-POLICY.md +109 -0
  71. package/docs/USER-HANDBOOK-CONTRACT.md +61 -0
  72. package/hooks/README.md +24 -0
  73. package/hooks/active_task_context.py +44 -0
  74. package/hooks/adapters/codex.py +302 -0
  75. package/hooks/health_check.py +61 -0
  76. package/hooks/pre_stop_check.py +56 -0
  77. package/hooks/subagent_tracker.py +116 -0
  78. package/hooks/workflow_checkpoint.py +56 -0
  79. package/hooks/workflow_context.py +63 -0
  80. package/hooks/workflow_resume.py +50 -0
  81. package/mcp-server/lib/init-project.cjs +162 -0
  82. package/mcp-server/lib/llm-client.cjs +157 -0
  83. package/mcp-server/lib/llm-client.test.cjs +156 -0
  84. package/mcp-server/lib/plan-store.cjs +96 -0
  85. package/mcp-server/lib/plan-store.test.cjs +132 -0
  86. package/mcp-server/lib/prd-parser.cjs +110 -0
  87. package/mcp-server/lib/prd-parser.test.cjs +171 -0
  88. package/mcp-server/lib/pricing.cjs +53 -0
  89. package/mcp-server/lib/projector.cjs +158 -0
  90. package/mcp-server/lib/state-db.cjs +113 -0
  91. package/mcp-server/lib/state-db.test.cjs +116 -0
  92. package/mcp-server/lib/state-ops.cjs +725 -0
  93. package/mcp-server/lib/task-expander.cjs +123 -0
  94. package/mcp-server/lib/task-expander.test.cjs +253 -0
  95. package/mcp-server/lib/telemetry.cjs +72 -0
  96. package/mcp-server/lib/topo.cjs +131 -0
  97. package/mcp-server/lib/topo.test.cjs +158 -0
  98. package/mcp-server/server.cjs +482 -0
  99. package/mcp-server/tests/circuit-breaker.test.cjs +125 -0
  100. package/mcp-server/tests/commit-hash-flow.test.cjs +117 -0
  101. package/mcp-server/tests/concurrency-update.test.cjs +96 -0
  102. package/mcp-server/tests/concurrency.test.cjs +112 -0
  103. package/mcp-server/tests/db-ops.test.cjs +117 -0
  104. package/mcp-server/tests/init-project.test.cjs +141 -0
  105. package/mcp-server/tests/migrate.test.cjs +144 -0
  106. package/mcp-server/tests/projector.test.cjs +130 -0
  107. package/mcp-server/tests/server-contract.test.cjs +750 -0
  108. package/mcp-server/tests/staleness.test.cjs +190 -0
  109. package/mcp-server/tests/state-ops.test.cjs +286 -0
  110. package/mcp-server/tests/tagged-tasks.test.cjs +163 -0
  111. package/mcp-server/tests/telemetry.test.cjs +205 -0
  112. package/orchestrator/auto-merge.cjs +109 -0
  113. package/orchestrator/code-graph-watcher.cjs +121 -0
  114. package/orchestrator/daemon.cjs +112 -0
  115. package/orchestrator/dispatch-rules.cjs +93 -0
  116. package/orchestrator/parallel-orchestrator.cjs +195 -0
  117. package/orchestrator/planner/expand-prompt.cjs +62 -0
  118. package/orchestrator/planner/expand-prompt.test.cjs +52 -0
  119. package/orchestrator/planner/plan-builder.cjs +116 -0
  120. package/orchestrator/planner/plan-builder.test.cjs +165 -0
  121. package/orchestrator/planner/prd-prompt.cjs +44 -0
  122. package/orchestrator/planner/prd-prompt.test.cjs +30 -0
  123. package/orchestrator/recovery.cjs +70 -0
  124. package/orchestrator/session-runner.cjs +224 -0
  125. package/orchestrator/skill-miner.cjs +133 -0
  126. package/orchestrator/tests/auto-merge.test.cjs +216 -0
  127. package/orchestrator/tests/code-graph-watcher.test.cjs +183 -0
  128. package/orchestrator/tests/daemon.test.cjs +260 -0
  129. package/orchestrator/tests/dispatch-rules.test.cjs +122 -0
  130. package/orchestrator/tests/parallel-orchestrator.test.cjs +233 -0
  131. package/orchestrator/tests/phase-8b-gate.test.cjs +183 -0
  132. package/orchestrator/tests/recovery.test.cjs +190 -0
  133. package/orchestrator/tests/session-runner.test.cjs +314 -0
  134. package/orchestrator/tests/skill-miner.test.cjs +147 -0
  135. package/orchestrator/tests/worktree-manager.test.cjs +148 -0
  136. package/orchestrator/worktree-manager.cjs +131 -0
  137. package/output-styles/coding-vibes.md +67 -0
  138. package/output-styles/structural-thinking.md +61 -0
  139. package/package.json +109 -0
  140. package/settings.json +8 -0
  141. package/skills/cc-collab/SKILL.md +41 -0
  142. package/skills/code-review-expert/SKILL.md +118 -0
  143. package/skills/code-review-expert/references/code-quality-checklist.md +112 -0
  144. package/skills/code-review-expert/references/integration-checklist.md +46 -0
  145. package/skills/code-review-expert/references/removal-plan.md +52 -0
  146. package/skills/code-review-expert/references/security-checklist.md +100 -0
  147. package/skills/code-review-expert/references/solid-checklist.md +65 -0
  148. package/skills/codex-collab/SKILL.md +52 -0
  149. package/skills/codex-collab/evals/evals.json +40 -0
  150. package/skills/gemini-collab/SKILL.md +51 -0
  151. package/skills/gemini-collab/evals/evals.json +42 -0
  152. package/skills/integration-rules/SKILL.md +71 -0
  153. package/skills/learn/SKILL.md +117 -0
  154. package/skills/security-rules/SKILL.md +60 -0
  155. package/skills/testing-rules/SKILL.md +56 -0
  156. package/skills/ultra-deliver/SKILL.md +171 -0
  157. package/skills/ultra-dev/SKILL.md +324 -0
  158. package/skills/ultra-init/SKILL.md +148 -0
  159. package/skills/ultra-plan/SKILL.md +314 -0
  160. package/skills/ultra-research/SKILL.md +156 -0
  161. package/skills/ultra-research/steps/step-00-problem-validation.md +154 -0
  162. package/skills/ultra-research/steps/step-01-opportunity-discovery.md +172 -0
  163. package/skills/ultra-research/steps/step-02-market-assessment.md +195 -0
  164. package/skills/ultra-research/steps/step-03-competitive-landscape.md +197 -0
  165. package/skills/ultra-research/steps/step-04-product-strategy.md +196 -0
  166. package/skills/ultra-research/steps/step-05-assumptions-validation.md +234 -0
  167. package/skills/ultra-research/steps/step-10-user-personas.md +169 -0
  168. package/skills/ultra-research/steps/step-11-user-scenarios.md +181 -0
  169. package/skills/ultra-research/steps/step-20-user-stories.md +156 -0
  170. package/skills/ultra-research/steps/step-21-features-scope.md +157 -0
  171. package/skills/ultra-research/steps/step-22-success-metrics.md +195 -0
  172. package/skills/ultra-research/steps/step-30-architecture-context.md +154 -0
  173. package/skills/ultra-research/steps/step-31-solution-strategy.md +172 -0
  174. package/skills/ultra-research/steps/step-32-building-blocks.md +188 -0
  175. package/skills/ultra-research/steps/step-40-deployment.md +123 -0
  176. package/skills/ultra-research/steps/step-41-quality-risks.md +135 -0
  177. package/skills/ultra-research/steps/step-99-synthesis.md +188 -0
  178. package/skills/ultra-review/SKILL.md +437 -0
  179. package/skills/ultra-review/references/unified-schema.md +127 -0
  180. package/skills/ultra-review/scripts/review_verdict_update.py +99 -0
  181. package/skills/ultra-review/scripts/review_wait.py +120 -0
  182. package/skills/ultra-status/SKILL.md +162 -0
  183. package/skills/ultra-test/SKILL.md +195 -0
  184. package/skills/ultra-think/SKILL.md +109 -0
  185. package/skills/ultra-verify/SKILL.md +111 -0
  186. package/skills/ultra-verify/evals/evals.json +51 -0
  187. package/skills/ultra-verify/references/confidence-system.md +38 -0
  188. package/skills/ultra-verify/references/cross-verify-modes.md +73 -0
  189. package/skills/ultra-verify/scripts/verify_wait.py +131 -0
  190. package/spec/cli-protocol.md +118 -0
  191. package/spec/mcp-tools.yaml +658 -0
  192. package/spec/schemas/command-manifest.schema.json +47 -0
  193. package/spec/schemas/context-file.v4.5.schema.json +54 -0
  194. package/spec/schemas/mcp-tools.schema.json +136 -0
  195. package/spec/schemas/skill-manifest.schema.json +94 -0
  196. package/spec/schemas/state-db.sql +154 -0
  197. package/spec/schemas/tasks.v4.5.schema.json +66 -0
  198. package/ultra-tools/cli.cjs +121 -0
  199. package/ultra-tools/commands/db.cjs +175 -0
  200. package/ultra-tools/commands/legacy-memory.cjs +159 -0
  201. package/ultra-tools/commands/migrate.cjs +354 -0
  202. package/ultra-tools/commands/session.cjs +180 -0
  203. package/ultra-tools/commands/status.cjs +158 -0
  204. package/ultra-tools/commands/task.cjs +95 -0
  205. package/ultra-tools/legacy-memory.test.cjs +80 -0
  206. package/ultra-tools/status-command.test.cjs +132 -0
@@ -0,0 +1,154 @@
1
+ # Step 00: Problem Validation
2
+
3
+ ## MANDATORY EXECUTION RULES
4
+
5
+ - NEVER skip this step — unvalidated problems lead to wasted research
6
+ - DO NOT generate solutions — this step validates the PROBLEM only
7
+ - ASK questions ONE AT A TIME via AskUserQuestion — do not batch
8
+ - PUSH on vague answers — "interesting" is not validation, "paying for it" is
9
+ - WRITE output to spec file BEFORE presenting to user
10
+ - ALL output in English (spec files); conversation in Chinese
11
+
12
+ ## PREREQUISITES
13
+
14
+ - `.ultra/specs/discovery.md` exists (created by /ultra-init)
15
+ - User has provided initial product idea or description
16
+
17
+ ## CONTEXT BOUNDARIES
18
+
19
+ - Focus: Is this problem real, painful, and worth solving?
20
+ - NOT about solutions, features, or architecture
21
+ - NOT about market size (that's step-02)
22
+ - You are a skeptical advisor, not a cheerleader
23
+
24
+ ## EXECUTION SEQUENCE
25
+
26
+ ### 1. Detect Product Stage
27
+
28
+ Ask via AskUserQuestion to determine which forcing questions apply:
29
+
30
+ | Stage | Indicators | Questions |
31
+ |-------|-----------|-----------|
32
+ | Pre-product (idea, no users) | No existing product | Q1, Q2, Q3 |
33
+ | Has users (not paying) | Product exists, free users | Q2, Q4, Q5 |
34
+ | Has paying customers | Revenue exists | Q4, Q5, Q6 |
35
+ | Pure engineering/infra | Internal tool, no market | Q2, Q4 only |
36
+
37
+ ### 2. Ask Forcing Questions (ONE AT A TIME)
38
+
39
+ For each applicable question, ask via AskUserQuestion. Push until you hear the "evidence" column — not the "red flags" column.
40
+
41
+ #### Q1: Demand Reality
42
+ **Ask**: "What is the strongest evidence someone actually wants this — not 'is interested,' but would be genuinely upset if it disappeared?"
43
+ - **Push until you hear**: Specific behavior — paying, expanding usage, panicking when it breaks
44
+ - **Red flags**: "People say it's interesting", waitlist signups, VC enthusiasm
45
+
46
+ #### Q2: Status Quo
47
+ **Ask**: "What are users doing RIGHT NOW to solve this — even badly? What does that workaround cost them?"
48
+ - **Push until you hear**: Specific workflow — hours wasted, dollars lost, tools duct-taped together
49
+ - **Red flags**: "Nothing — no solution exists" (if nobody is doing anything, the problem may not be painful enough)
50
+
51
+ #### Q3: Desperate Specificity
52
+ **Ask**: "Name the actual human who needs this most. Title? What gets them promoted? What gets them fired?"
53
+ - **Push until you hear**: A name, a role, a specific consequence they face
54
+ - **Red flags**: Category-level answers: "enterprises", "SMBs", "marketing teams"
55
+
56
+ #### Q4: Narrowest Wedge
57
+ **Ask**: "What is the smallest version someone would pay real money for — this week, not after you build the platform?"
58
+ - **Push until you hear**: One feature, one workflow, shippable in days
59
+ - **Red flags**: "Need full platform first", "can't strip it down"
60
+
61
+ #### Q5: Observation & Surprise
62
+ **Ask**: "Have you watched someone use this without helping them? What surprised you?"
63
+ - **Push until you hear**: A specific surprise that contradicted assumptions
64
+ - **Red flags**: "We sent a survey", "nothing surprising"
65
+
66
+ #### Q6: Future-Fit
67
+ **Ask**: "If the world looks meaningfully different in 3 years, does your product become more essential or less?"
68
+ - **Push until you hear**: Specific claim about how user's world changes and why that increases value
69
+ - **Red flags**: "Market growing 20% per year", "AI makes everything better"
70
+
71
+ ### 3. Smart-Skip Rules
72
+
73
+ - If an earlier answer already covers a later question, skip it
74
+ - If user says "just do it" or provides a fully formed plan → fast-track with note
75
+ - Maximum 4 questions per session — prioritize by stage
76
+
77
+ ### 4. Synthesize & Write Output
78
+
79
+ **WRITE IMMEDIATELY** to `.ultra/specs/discovery.md` §0:
80
+
81
+ ```markdown
82
+ ## §0 Problem Validation Summary
83
+
84
+ ### Product Stage
85
+ - **Stage**: [Pre-product / Has users / Has paying customers / Engineering/Infra]
86
+ - **Evidence**: [What indicates this stage]
87
+
88
+ ### Demand Signal
89
+ - **Strength**: [Strong / Moderate / Weak / Unvalidated]
90
+ - **Evidence**: [Specific behaviors observed]
91
+ - **Risk**: [What could invalidate this demand]
92
+
93
+ ### Status Quo Analysis
94
+ - **Current solutions**: [What users do today]
95
+ - **Cost of workaround**: [Time, money, friction]
96
+ - **Switching motivation**: [Why they'd change]
97
+
98
+ ### Target User Profile
99
+ - **Primary**: [Specific role/person description]
100
+ - **Stakes**: [What gets them promoted / fired]
101
+ - **Pain frequency**: [Daily / Weekly / Occasional]
102
+
103
+ ### Narrowest Wedge
104
+ - **MVP scope**: [Single feature/workflow]
105
+ - **Willingness to pay**: [Evidence level]
106
+ - **Ship timeline**: [Days / Weeks / Months]
107
+
108
+ ### Validation Confidence
109
+ - **Overall**: [X]%
110
+ - **Strongest signal**: [What gives most confidence]
111
+ - **Biggest risk**: [What could be wrong]
112
+ - **Recommended next step**: [Proceed / Investigate further / Pivot]
113
+ ```
114
+
115
+ ### 5. Present to User and Gate
116
+
117
+ Show the Problem Validation Summary to user.
118
+
119
+ Present assessment honestly — if the problem feels weak, say so. Better to catch it now.
120
+
121
+ ```
122
+ [C] Continue — Problem validated, proceed to Opportunity Discovery
123
+ [R] Revise — Discuss specific concerns before proceeding
124
+ [P] Pivot — Problem is weak, explore different angle
125
+ ```
126
+
127
+ **HALT — wait for user response before proceeding.**
128
+
129
+ ### 6. Handle Response
130
+
131
+ - **[C]**: Load next step: `./step-01-opportunity-discovery.md`
132
+ - **[R]**: Discuss concerns, revise §0, re-present
133
+ - **[P]**: Help user reframe the problem, restart step-00
134
+
135
+ ## SUCCESS METRICS
136
+
137
+ - Product stage correctly identified
138
+ - At least 2 forcing questions asked and answered with evidence
139
+ - Problem Validation Summary written to discovery.md §0
140
+ - Confidence assessment is honest (not inflated)
141
+ - User has explicitly confirmed [C] before proceeding
142
+
143
+ ## FAILURE MODES
144
+
145
+ - Asking all 6 questions regardless of stage (wastes user time)
146
+ - Accepting vague answers without pushing ("people are interested" → push harder)
147
+ - Skipping this step because user seems confident
148
+ - Inflating confidence to keep user happy
149
+ - Not writing output before presenting to user
150
+ - Proceeding without explicit [C] confirmation
151
+
152
+ ## NEXT STEP
153
+
154
+ After user selects [C], read and follow: `./step-01-opportunity-discovery.md`
@@ -0,0 +1,172 @@
1
+ # Step 01: Opportunity Discovery
2
+
3
+ ## MANDATORY EXECUTION RULES
4
+
5
+ - WEB SEARCH REQUIRED — verify opportunities against real market data
6
+ - Frame opportunities from CUSTOMER perspective, not product perspective
7
+ - Generate multiple solutions per opportunity — never commit to the first idea
8
+ - WRITE output to spec file BEFORE presenting to user
9
+ - ALL output in English (spec files); conversation in Chinese
10
+
11
+ ## PREREQUISITES
12
+
13
+ - Step 00 (Problem Validation) completed with [C]
14
+ - `.ultra/specs/discovery.md` §0 exists
15
+
16
+ ## CONTEXT BOUNDARIES
17
+
18
+ - Focus: Map the opportunity space using Opportunity Solution Tree (Teresa Torres)
19
+ - Opportunities are CUSTOMER NEEDS, not features
20
+ - Frame as: "I struggle to..." / "I wish I could..." / "It frustrates me that..."
21
+ - Based on *Continuous Discovery Habits* methodology
22
+
23
+ ## SEARCH STRATEGY (MANDATORY)
24
+
25
+ Execute these web searches in parallel:
26
+
27
+ ```
28
+ Search: "{{product_domain}} user pain points complaints"
29
+ Search: "{{product_domain}} customer needs unmet"
30
+ Search: "{{product_domain}} market gaps opportunities"
31
+ Search: "{{product_domain}} user research findings"
32
+ ```
33
+
34
+ Citation requirement: Every factual claim MUST include `Source: [URL]`
35
+ No-source claims → mark as `⚠️ Speculation`
36
+
37
+ ## EXECUTION SEQUENCE
38
+
39
+ ### 1. Define Desired Outcome
40
+
41
+ Ask user via AskUserQuestion:
42
+ "What single measurable business/product outcome are we pursuing? (e.g., 'Reduce customer onboarding time by 50%', 'Reach $1M ARR in 12 months')"
43
+
44
+ If user is unsure, help them formulate one from step-00 findings.
45
+
46
+ ### 2. Map Opportunity Space
47
+
48
+ Using web search results + step-00 insights, identify 5-8 customer opportunities.
49
+
50
+ **Frame each opportunity from customer perspective:**
51
+ - BAD: "Add AI-powered search" (this is a solution)
52
+ - GOOD: "I struggle to find relevant results in large document collections" (this is an opportunity)
53
+
54
+ ### 3. Prioritize Opportunities
55
+
56
+ Score each opportunity using Dan Olsen's Opportunity Score:
57
+
58
+ ```
59
+ Opportunity Score = Importance × (1 - Satisfaction)
60
+ ```
61
+
62
+ Where:
63
+ - **Importance** (1-10): How much does this matter to the target user?
64
+ - **Satisfaction** (0-1): How well do current solutions address this? (0 = not at all, 1 = perfectly)
65
+
66
+ Rank by score. Focus on top 2-3 opportunities.
67
+
68
+ ### 4. Solution Brainstorm
69
+
70
+ For each top opportunity (top 2-3), generate 3+ solution approaches from different perspectives:
71
+
72
+ | Perspective | Approach |
73
+ |------------|---------|
74
+ | PM perspective | User workflow optimization |
75
+ | Designer perspective | Experience/interaction innovation |
76
+ | Engineer perspective | Technical capability leverage |
77
+
78
+ **Rule**: Never commit to the first idea. The best solution often emerges from comparing alternatives.
79
+
80
+ ### 5. Write Output
81
+
82
+ **WRITE IMMEDIATELY** to `.ultra/specs/discovery.md` §1:
83
+
84
+ ```markdown
85
+ ## §1 Opportunity Space
86
+
87
+ ### Desired Outcome
88
+ - **Outcome**: [Single measurable outcome]
89
+ - **Metric**: [How we measure it]
90
+ - **Timeline**: [When we expect to see movement]
91
+
92
+ ### Opportunity Map
93
+
94
+ | # | Opportunity (Customer Framing) | Importance | Satisfaction | Score | Source |
95
+ |---|-------------------------------|-----------|-------------|-------|--------|
96
+ | O1 | "I struggle to..." | 9 | 0.2 | 7.2 | [URL] |
97
+ | O2 | "I wish I could..." | 8 | 0.3 | 5.6 | [URL] |
98
+ | O3 | "It frustrates me that..." | 7 | 0.4 | 4.2 | [URL] |
99
+ | O4 | ... | ... | ... | ... | ... |
100
+ | O5 | ... | ... | ... | ... | ... |
101
+
102
+ ### Prioritized Opportunities (Top 3)
103
+
104
+ #### Opportunity 1: [Customer-framed description]
105
+ - **Importance**: [X]/10 — [Why this matters]
106
+ - **Current satisfaction**: [X] — [How users cope today]
107
+ - **Score**: [X]
108
+ - **Evidence**: [Source URL]
109
+
110
+ **Solution Approaches:**
111
+ 1. **PM approach**: [Description] — Pros: [...] Cons: [...]
112
+ 2. **Design approach**: [Description] — Pros: [...] Cons: [...]
113
+ 3. **Engineering approach**: [Description] — Pros: [...] Cons: [...]
114
+
115
+ #### Opportunity 2: [Customer-framed description]
116
+ [Same structure]
117
+
118
+ #### Opportunity 3: [Customer-framed description]
119
+ [Same structure]
120
+
121
+ ### Opportunities Deprioritized
122
+ | # | Opportunity | Score | Reason for Deprioritization |
123
+ |---|------------|-------|-----------------------------|
124
+ | O4 | ... | ... | [Why not now] |
125
+ | O5 | ... | ... | [Why not now] |
126
+
127
+ ### Key Insight
128
+ [One paragraph: What is the non-obvious insight from this opportunity analysis?]
129
+ ```
130
+
131
+ ### 6. Present to User and Gate
132
+
133
+ Show the Opportunity Space summary. Highlight:
134
+ - The top 3 opportunities and why they ranked highest
135
+ - Any surprising findings from web research
136
+ - Which solution approaches seem most promising
137
+
138
+ ```
139
+ [C] Continue — Opportunity space mapped, proceed to Market Assessment
140
+ [R] Revise — Adjust opportunity scoring or add missing opportunities
141
+ [D] Discuss — Explore specific opportunities in more depth
142
+ ```
143
+
144
+ **HALT — wait for user response before proceeding.**
145
+
146
+ ### 7. Handle Response
147
+
148
+ - **[C]**: Load next step: `./step-02-market-assessment.md`
149
+ - **[R]**: Revise scoring/opportunities, update discovery.md §1, re-present
150
+ - **[D]**: Deep-dive into specific opportunity, then re-present gate
151
+
152
+ ## SUCCESS METRICS
153
+
154
+ - Desired outcome is specific and measurable
155
+ - At least 5 opportunities identified, framed from customer perspective
156
+ - Opportunity scores calculated with importance and satisfaction ratings
157
+ - Top 3 opportunities each have 3+ solution approaches
158
+ - All factual claims have source citations
159
+ - Output written to discovery.md §1
160
+
161
+ ## FAILURE MODES
162
+
163
+ - Framing opportunities as features/solutions instead of customer needs
164
+ - Scoring without web research evidence
165
+ - Only generating 1 solution per opportunity
166
+ - Accepting user's first solution idea without exploring alternatives
167
+ - Missing citation sources for market claims
168
+ - Not writing output before presenting to user
169
+
170
+ ## NEXT STEP
171
+
172
+ After user selects [C], read and follow: `./step-02-market-assessment.md`
@@ -0,0 +1,195 @@
1
+ # Step 02: Market Assessment
2
+
3
+ ## MANDATORY EXECUTION RULES
4
+
5
+ - WEB SEARCH REQUIRED — no market sizing without real data
6
+ - USE DUAL APPROACH — both top-down and bottom-up estimates required
7
+ - CROSS-VALIDATE — if top-down and bottom-up differ by >3x, investigate why
8
+ - CITE EVERY NUMBER — no unsupported market figures
9
+ - WRITE output to spec file BEFORE presenting to user
10
+ - ALL output in English (spec files); conversation in Chinese
11
+
12
+ ## PREREQUISITES
13
+
14
+ - Step 01 (Opportunity Discovery) completed with [C]
15
+ - `.ultra/specs/discovery.md` §0-1 exist
16
+
17
+ ## CONTEXT BOUNDARIES
18
+
19
+ - Focus: How big is this market? Is it worth pursuing?
20
+ - Use the prioritized opportunities from step-01 to scope the market
21
+ - This is about MARKET SIZE, not competitive positioning (that's step-03)
22
+
23
+ ## SEARCH STRATEGY (MANDATORY)
24
+
25
+ Execute these web searches in parallel:
26
+
27
+ ```
28
+ Search: "{{product_domain}} market size TAM 2024 2025 2026"
29
+ Search: "{{product_domain}} market growth rate CAGR forecast"
30
+ Search: "{{product_domain}} industry revenue report"
31
+ Search: "{{product_domain}} market segmentation analysis"
32
+ Search: "{{product_domain}} pricing model average revenue per user"
33
+ ```
34
+
35
+ **Source priority**: Industry reports (Gartner, Statista, IBISWorld, Grand View Research) > Company filings > News articles > Blog posts
36
+
37
+ ## EXECUTION SEQUENCE
38
+
39
+ ### 1. Top-Down Estimate (TAM → SAM → SOM)
40
+
41
+ Start with the broadest market definition and narrow down:
42
+
43
+ **TAM (Total Addressable Market)**:
44
+ - What is the total global market for this category?
45
+ - Search for industry reports with specific dollar figures
46
+ - Include year and source for every number
47
+
48
+ **SAM (Serviceable Available Market)**:
49
+ - What slice of TAM can we actually serve?
50
+ - Filter by: geography, customer segment, technology fit, regulatory access
51
+ - Show the filtering logic explicitly
52
+
53
+ **SOM (Serviceable Obtainable Market)**:
54
+ - What can we realistically capture in 1-3 years?
55
+ - Consider: team size, distribution, brand, competition
56
+ - Be honest — first-year SOM for a startup is tiny
57
+
58
+ ### 2. Bottom-Up Estimate
59
+
60
+ Calculate independently from unit economics:
61
+
62
+ ```
63
+ SOM = Target customers × Conversion rate × Average revenue per customer × Retention
64
+ ```
65
+
66
+ For each variable:
67
+ - **Target customers**: How many potential users in your target segment? (Source required)
68
+ - **Conversion rate**: What % will actually adopt? (Industry benchmark required)
69
+ - **ARPU**: What will they pay? (Comparable pricing data required)
70
+ - **Retention**: Annual retention rate? (Industry benchmark required)
71
+
72
+ ### 3. Cross-Validation
73
+
74
+ Compare top-down SOM vs bottom-up SOM:
75
+ - If within 2x: Good — use the average
76
+ - If 2-3x apart: Acceptable — note the range and explain the gap
77
+ - If >3x apart: Investigate — one of your assumptions is wrong
78
+
79
+ ### 4. Growth Driver Analysis
80
+
81
+ Identify 3-5 factors that will grow or shrink this market:
82
+
83
+ For each driver:
84
+ - **Direction**: Expanding or contracting?
85
+ - **Magnitude**: How much impact?
86
+ - **Timeline**: When does this take effect?
87
+ - **Evidence**: Source URL
88
+
89
+ ### 5. Write Output
90
+
91
+ **WRITE IMMEDIATELY** to `.ultra/specs/discovery.md` §2:
92
+
93
+ ```markdown
94
+ ## §2 Market Assessment
95
+
96
+ ### Market Sizing Summary
97
+
98
+ | Metric | Current Estimate | 2-3 Year Projection | Source |
99
+ |--------|-----------------|---------------------|--------|
100
+ | TAM | $[X]B | $[X]B | [URL] |
101
+ | SAM | $[X]M | $[X]M | [URL] |
102
+ | SOM | $[X]M | $[X]M | Calculated |
103
+
104
+ ### Top-Down Analysis
105
+
106
+ #### TAM: $[X]B ([Year])
107
+ - **Definition**: [What market category]
108
+ - **Source**: [Report name + URL]
109
+ - **Growth**: [X]% CAGR ([Year]-[Year])
110
+
111
+ #### SAM: $[X]M
112
+ - **TAM filter 1**: [Geographic] — reduces to $[X]B
113
+ - **TAM filter 2**: [Segment] — reduces to $[X]M
114
+ - **TAM filter 3**: [Technology fit] — reduces to $[X]M
115
+
116
+ #### SOM: $[X]M (Year 1-3)
117
+ - **Realistic capture**: [X]% of SAM
118
+ - **Basis**: [Why this share is achievable]
119
+ - **Comparable**: [Similar company achieved X% in Y time]
120
+
121
+ ### Bottom-Up Analysis
122
+
123
+ | Variable | Value | Source |
124
+ |----------|-------|--------|
125
+ | Target customers | [N] | [URL or calculation] |
126
+ | Conversion rate | [X]% | [Industry benchmark + URL] |
127
+ | ARPU (annual) | $[X] | [Comparable pricing + URL] |
128
+ | Retention rate | [X]% | [Industry benchmark + URL] |
129
+ | **Year 1 Revenue** | **$[X]** | **Calculated** |
130
+ | **Year 3 Revenue** | **$[X]** | **Calculated** |
131
+
132
+ ### Cross-Validation
133
+ - **Top-down SOM**: $[X]M
134
+ - **Bottom-up Year 3**: $[X]M
135
+ - **Ratio**: [X]x
136
+ - **Assessment**: [Within range / Gap explanation]
137
+
138
+ ### Growth Drivers
139
+
140
+ | # | Driver | Direction | Impact | Timeline | Source |
141
+ |---|--------|-----------|--------|----------|--------|
142
+ | 1 | [Technology trend] | Expanding | High | 1-2yr | [URL] |
143
+ | 2 | [Regulatory change] | Expanding | Medium | 2-3yr | [URL] |
144
+ | 3 | [Demographic shift] | Expanding | Medium | 3-5yr | [URL] |
145
+ | 4 | [Competitive pressure] | Contracting | Low | Now | [URL] |
146
+
147
+ ### Market Assessment Confidence
148
+ - **Overall confidence**: [X]%
149
+ - **Strongest data point**: [What we're most sure about]
150
+ - **Weakest assumption**: [What could be most wrong]
151
+ - **Recommendation**: [Market worth pursuing / Needs more validation / Too small]
152
+ ```
153
+
154
+ ### 6. Present to User and Gate
155
+
156
+ Show the Market Assessment summary. Highlight:
157
+ - Whether top-down and bottom-up estimates align
158
+ - The single biggest growth driver
159
+ - Any concerns about market size or timing
160
+
161
+ ```
162
+ [C] Continue — Market assessed, proceed to Competitive Landscape
163
+ [R] Revise — Adjust assumptions or investigate discrepancies
164
+ [S] Search more — Need additional data on specific aspect
165
+ ```
166
+
167
+ **HALT — wait for user response before proceeding.**
168
+
169
+ ### 7. Handle Response
170
+
171
+ - **[C]**: Load next step: `./step-03-competitive-landscape.md`
172
+ - **[R]**: Revise assumptions, update discovery.md §2, re-present
173
+ - **[S]**: Execute targeted searches, update analysis, re-present
174
+
175
+ ## SUCCESS METRICS
176
+
177
+ - Both top-down AND bottom-up estimates completed
178
+ - Every dollar figure has a source citation
179
+ - Cross-validation performed with gap analysis
180
+ - At least 3 growth drivers identified with evidence
181
+ - Confidence assessment is honest
182
+ - Output written to discovery.md §2
183
+
184
+ ## FAILURE MODES
185
+
186
+ - Using only top-down OR only bottom-up (need both)
187
+ - Market figures without source citations
188
+ - Inflating SOM to make the opportunity look bigger
189
+ - Ignoring >3x gap between top-down and bottom-up
190
+ - Using stale data (>2 years old) without noting limitations
191
+ - Not writing output before presenting to user
192
+
193
+ ## NEXT STEP
194
+
195
+ After user selects [C], read and follow: `./step-03-competitive-landscape.md`