qualia-framework 2.1.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 (261) hide show
  1. package/README.md +50 -0
  2. package/bin/cli.js +519 -0
  3. package/framework/agents/architecture-strategist.md +53 -0
  4. package/framework/agents/backend-agent.md +150 -0
  5. package/framework/agents/code-simplicity-reviewer.md +86 -0
  6. package/framework/agents/frontend-agent.md +111 -0
  7. package/framework/agents/kieran-typescript-reviewer.md +96 -0
  8. package/framework/agents/performance-oracle.md +111 -0
  9. package/framework/agents/qualia-codebase-mapper.md +760 -0
  10. package/framework/agents/qualia-debugger.md +1203 -0
  11. package/framework/agents/qualia-executor.md +881 -0
  12. package/framework/agents/qualia-integration-checker.md +423 -0
  13. package/framework/agents/qualia-phase-researcher.md +453 -0
  14. package/framework/agents/qualia-plan-checker.md +699 -0
  15. package/framework/agents/qualia-planner.md +1241 -0
  16. package/framework/agents/qualia-project-researcher.md +602 -0
  17. package/framework/agents/qualia-research-synthesizer.md +236 -0
  18. package/framework/agents/qualia-roadmapper.md +605 -0
  19. package/framework/agents/qualia-verifier.md +685 -0
  20. package/framework/agents/team-orchestrator.md +228 -0
  21. package/framework/agents/teams/full-stack-team.md +48 -0
  22. package/framework/agents/teams/optimize-team.md +53 -0
  23. package/framework/agents/teams/review-team.md +62 -0
  24. package/framework/agents/teams/ship-team.md +86 -0
  25. package/framework/agents/test-agent.md +182 -0
  26. package/framework/askpass.sh +2 -0
  27. package/framework/commands/design.md +53 -0
  28. package/framework/commands/quick-db.md +22 -0
  29. package/framework/config/retention.json +35 -0
  30. package/framework/core/PRINCIPLES.md +77 -0
  31. package/framework/hooks/auto-format.sh +45 -0
  32. package/framework/hooks/block-env-edit.sh +42 -0
  33. package/framework/hooks/branch-guard.sh +46 -0
  34. package/framework/hooks/confirm-delete.sh +56 -0
  35. package/framework/hooks/migration-validate.sh +68 -0
  36. package/framework/hooks/notification-speak.sh +15 -0
  37. package/framework/hooks/pre-commit.sh +80 -0
  38. package/framework/hooks/pre-compact.sh +55 -0
  39. package/framework/hooks/pre-deploy-gate.sh +151 -0
  40. package/framework/hooks/qualia-colors.sh +32 -0
  41. package/framework/hooks/retention-cleanup.sh +43 -0
  42. package/framework/hooks/save-session-state.sh +153 -0
  43. package/framework/hooks/session-context-loader.sh +28 -0
  44. package/framework/hooks/session-learn.sh +30 -0
  45. package/framework/knowledge/claudecode-bible.md +1384 -0
  46. package/framework/knowledge/client-prefs.md +22 -0
  47. package/framework/knowledge/common-fixes.md +25 -0
  48. package/framework/knowledge/deployment-map.md +35 -0
  49. package/framework/knowledge/email-signature.html +1 -0
  50. package/framework/knowledge/employees.md +8 -0
  51. package/framework/knowledge/learned-patterns.md +51 -0
  52. package/framework/knowledge/optimization-research-2026.md +137 -0
  53. package/framework/knowledge/qualia-context.md +67 -0
  54. package/framework/knowledge/supabase-patterns.md +50 -0
  55. package/framework/knowledge/voice-agent-patterns.md +46 -0
  56. package/framework/qualia-engine/VERSION +1 -0
  57. package/framework/qualia-engine/bin/qualia-tools.js +2160 -0
  58. package/framework/qualia-engine/bin/qualia-tools.test.js +1054 -0
  59. package/framework/qualia-engine/references/checkpoints.md +775 -0
  60. package/framework/qualia-engine/references/continuation-format.md +249 -0
  61. package/framework/qualia-engine/references/decimal-phase-calculation.md +65 -0
  62. package/framework/qualia-engine/references/design-quality.md +56 -0
  63. package/framework/qualia-engine/references/git-integration.md +254 -0
  64. package/framework/qualia-engine/references/git-planning-commit.md +50 -0
  65. package/framework/qualia-engine/references/model-profile-resolution.md +32 -0
  66. package/framework/qualia-engine/references/model-profiles.md +73 -0
  67. package/framework/qualia-engine/references/phase-argument-parsing.md +61 -0
  68. package/framework/qualia-engine/references/planning-config.md +195 -0
  69. package/framework/qualia-engine/references/questioning.md +141 -0
  70. package/framework/qualia-engine/references/tdd.md +263 -0
  71. package/framework/qualia-engine/references/ui-brand.md +160 -0
  72. package/framework/qualia-engine/references/verification-patterns.md +612 -0
  73. package/framework/qualia-engine/templates/DEBUG.md +159 -0
  74. package/framework/qualia-engine/templates/DESIGN.md +81 -0
  75. package/framework/qualia-engine/templates/UAT.md +247 -0
  76. package/framework/qualia-engine/templates/codebase/architecture.md +255 -0
  77. package/framework/qualia-engine/templates/codebase/concerns.md +310 -0
  78. package/framework/qualia-engine/templates/codebase/conventions.md +307 -0
  79. package/framework/qualia-engine/templates/codebase/integrations.md +280 -0
  80. package/framework/qualia-engine/templates/codebase/stack.md +186 -0
  81. package/framework/qualia-engine/templates/codebase/structure.md +285 -0
  82. package/framework/qualia-engine/templates/codebase/testing.md +480 -0
  83. package/framework/qualia-engine/templates/config.json +35 -0
  84. package/framework/qualia-engine/templates/context.md +283 -0
  85. package/framework/qualia-engine/templates/continue-here.md +78 -0
  86. package/framework/qualia-engine/templates/debug-subagent-prompt.md +91 -0
  87. package/framework/qualia-engine/templates/discovery.md +146 -0
  88. package/framework/qualia-engine/templates/milestone-archive.md +123 -0
  89. package/framework/qualia-engine/templates/milestone.md +115 -0
  90. package/framework/qualia-engine/templates/phase-prompt.md +567 -0
  91. package/framework/qualia-engine/templates/planner-subagent-prompt.md +117 -0
  92. package/framework/qualia-engine/templates/project.md +184 -0
  93. package/framework/qualia-engine/templates/projects/ai-agent.md +156 -0
  94. package/framework/qualia-engine/templates/projects/mobile-app.md +181 -0
  95. package/framework/qualia-engine/templates/projects/voice-agent.md +134 -0
  96. package/framework/qualia-engine/templates/projects/website.md +137 -0
  97. package/framework/qualia-engine/templates/requirements.md +231 -0
  98. package/framework/qualia-engine/templates/research-project/ARCHITECTURE.md +204 -0
  99. package/framework/qualia-engine/templates/research-project/FEATURES.md +147 -0
  100. package/framework/qualia-engine/templates/research-project/PITFALLS.md +200 -0
  101. package/framework/qualia-engine/templates/research-project/STACK.md +120 -0
  102. package/framework/qualia-engine/templates/research-project/SUMMARY.md +170 -0
  103. package/framework/qualia-engine/templates/research.md +552 -0
  104. package/framework/qualia-engine/templates/roadmap.md +202 -0
  105. package/framework/qualia-engine/templates/state.md +176 -0
  106. package/framework/qualia-engine/templates/summary-complex.md +59 -0
  107. package/framework/qualia-engine/templates/summary-minimal.md +41 -0
  108. package/framework/qualia-engine/templates/summary-standard.md +48 -0
  109. package/framework/qualia-engine/templates/summary.md +246 -0
  110. package/framework/qualia-engine/templates/user-setup.md +311 -0
  111. package/framework/qualia-engine/templates/verification-report.md +322 -0
  112. package/framework/qualia-engine/workflows/add-phase.md +179 -0
  113. package/framework/qualia-engine/workflows/add-todo.md +157 -0
  114. package/framework/qualia-engine/workflows/audit-milestone.md +241 -0
  115. package/framework/qualia-engine/workflows/check-todos.md +176 -0
  116. package/framework/qualia-engine/workflows/complete-milestone.md +858 -0
  117. package/framework/qualia-engine/workflows/diagnose-issues.md +219 -0
  118. package/framework/qualia-engine/workflows/discovery-phase.md +289 -0
  119. package/framework/qualia-engine/workflows/discuss-phase.md +534 -0
  120. package/framework/qualia-engine/workflows/execute-phase.md +559 -0
  121. package/framework/qualia-engine/workflows/execute-plan.md +438 -0
  122. package/framework/qualia-engine/workflows/help.md +470 -0
  123. package/framework/qualia-engine/workflows/insert-phase.md +220 -0
  124. package/framework/qualia-engine/workflows/list-phase-assumptions.md +178 -0
  125. package/framework/qualia-engine/workflows/map-codebase.md +327 -0
  126. package/framework/qualia-engine/workflows/new-milestone.md +363 -0
  127. package/framework/qualia-engine/workflows/new-project.md +1037 -0
  128. package/framework/qualia-engine/workflows/pause-work.md +122 -0
  129. package/framework/qualia-engine/workflows/plan-milestone-gaps.md +256 -0
  130. package/framework/qualia-engine/workflows/plan-phase.md +422 -0
  131. package/framework/qualia-engine/workflows/progress.md +354 -0
  132. package/framework/qualia-engine/workflows/quick.md +252 -0
  133. package/framework/qualia-engine/workflows/remove-phase.md +326 -0
  134. package/framework/qualia-engine/workflows/research-phase.md +74 -0
  135. package/framework/qualia-engine/workflows/resume-project.md +306 -0
  136. package/framework/qualia-engine/workflows/set-profile.md +80 -0
  137. package/framework/qualia-engine/workflows/settings.md +145 -0
  138. package/framework/qualia-engine/workflows/transition.md +556 -0
  139. package/framework/qualia-engine/workflows/update.md +197 -0
  140. package/framework/qualia-engine/workflows/verify-phase.md +195 -0
  141. package/framework/qualia-engine/workflows/verify-work.md +625 -0
  142. package/framework/rules/context7.md +11 -0
  143. package/framework/rules/deployment.md +29 -0
  144. package/framework/rules/frontend.md +33 -0
  145. package/framework/rules/security.md +12 -0
  146. package/framework/rules/speed.md +20 -0
  147. package/framework/scripts/__pycache__/say.cpython-314.pyc +0 -0
  148. package/framework/scripts/apply-retention.sh +120 -0
  149. package/framework/scripts/bootstrap-pop-os.sh +354 -0
  150. package/framework/scripts/claude-voice +13 -0
  151. package/framework/scripts/cleanup.sh +131 -0
  152. package/framework/scripts/cowork-mode.sh +141 -0
  153. package/framework/scripts/generate-project-claude-md.sh +153 -0
  154. package/framework/scripts/load-test-webhook.js +172 -0
  155. package/framework/scripts/say.py +236 -0
  156. package/framework/scripts/showcase-video-recorder/ffmpeg-builder.js +167 -0
  157. package/framework/scripts/showcase-video-recorder/playwright-helpers.js +216 -0
  158. package/framework/scripts/speak.py +55 -0
  159. package/framework/scripts/speak.sh +18 -0
  160. package/framework/scripts/status.sh +138 -0
  161. package/framework/scripts/sync-to-framework.sh +65 -0
  162. package/framework/scripts/voice-hotkey.py +227 -0
  163. package/framework/scripts/voice-input.sh +51 -0
  164. package/framework/skills/animate/SKILL.md +202 -0
  165. package/framework/skills/bolder/SKILL.md +144 -0
  166. package/framework/skills/browser-qa/SKILL.md +536 -0
  167. package/framework/skills/clarify/SKILL.md +179 -0
  168. package/framework/skills/colorize/SKILL.md +170 -0
  169. package/framework/skills/critique/SKILL.md +126 -0
  170. package/framework/skills/deep-research/SKILL.md +271 -0
  171. package/framework/skills/delight/SKILL.md +329 -0
  172. package/framework/skills/deploy/SKILL.md +261 -0
  173. package/framework/skills/deploy-verify/SKILL.md +377 -0
  174. package/framework/skills/deploy-verify/scripts/canary-check.sh +206 -0
  175. package/framework/skills/deploy-verify/scripts/check-console-errors.js +147 -0
  176. package/framework/skills/deploy-verify/scripts/check-cwv.js +139 -0
  177. package/framework/skills/deploy-verify/scripts/project-detect.sh +84 -0
  178. package/framework/skills/deploy-verify/scripts/verify.sh +548 -0
  179. package/framework/skills/design-quieter/SKILL.md +130 -0
  180. package/framework/skills/distill/SKILL.md +149 -0
  181. package/framework/skills/docs-lookup/SKILL.md +78 -0
  182. package/framework/skills/fcm-notifications/SKILL.md +125 -0
  183. package/framework/skills/financial-ledger/SKILL.md +1039 -0
  184. package/framework/skills/frontend-master/NOTICE.md +4 -0
  185. package/framework/skills/frontend-master/SKILL.md +127 -0
  186. package/framework/skills/frontend-master/reference/color-and-contrast.md +132 -0
  187. package/framework/skills/frontend-master/reference/interaction-design.md +123 -0
  188. package/framework/skills/frontend-master/reference/motion-design.md +99 -0
  189. package/framework/skills/frontend-master/reference/responsive-design.md +114 -0
  190. package/framework/skills/frontend-master/reference/spatial-design.md +100 -0
  191. package/framework/skills/frontend-master/reference/typography.md +131 -0
  192. package/framework/skills/frontend-master/reference/ux-writing.md +107 -0
  193. package/framework/skills/harden/SKILL.md +357 -0
  194. package/framework/skills/i18n-rtl/SKILL.md +752 -0
  195. package/framework/skills/learn/SKILL.md +71 -0
  196. package/framework/skills/memory/SKILL.md +50 -0
  197. package/framework/skills/mobile-expo/SKILL.md +864 -0
  198. package/framework/skills/mobile-expo/references/store-checklist.md +550 -0
  199. package/framework/skills/nestjs-backend/README.md +73 -0
  200. package/framework/skills/nestjs-backend/SKILL.md +446 -0
  201. package/framework/skills/nestjs-backend/references/templates.md +1173 -0
  202. package/framework/skills/normalize/SKILL.md +79 -0
  203. package/framework/skills/onboard/SKILL.md +242 -0
  204. package/framework/skills/polish/SKILL.md +209 -0
  205. package/framework/skills/pr/SKILL.md +66 -0
  206. package/framework/skills/qualia/SKILL.md +153 -0
  207. package/framework/skills/qualia-add-todo/SKILL.md +68 -0
  208. package/framework/skills/qualia-audit-milestone/SKILL.md +92 -0
  209. package/framework/skills/qualia-check-todos/SKILL.md +55 -0
  210. package/framework/skills/qualia-complete-milestone/SKILL.md +108 -0
  211. package/framework/skills/qualia-debug/SKILL.md +149 -0
  212. package/framework/skills/qualia-design/SKILL.md +203 -0
  213. package/framework/skills/qualia-discuss-phase/SKILL.md +72 -0
  214. package/framework/skills/qualia-execute-phase/SKILL.md +86 -0
  215. package/framework/skills/qualia-help/SKILL.md +67 -0
  216. package/framework/skills/qualia-idk/SKILL.md +352 -0
  217. package/framework/skills/qualia-list-phase-assumptions/SKILL.md +67 -0
  218. package/framework/skills/qualia-new-milestone/SKILL.md +72 -0
  219. package/framework/skills/qualia-new-project/SKILL.md +92 -0
  220. package/framework/skills/qualia-optimize/SKILL.md +417 -0
  221. package/framework/skills/qualia-pause-work/SKILL.md +96 -0
  222. package/framework/skills/qualia-plan-milestone-gaps/SKILL.md +57 -0
  223. package/framework/skills/qualia-plan-phase/SKILL.md +101 -0
  224. package/framework/skills/qualia-progress/SKILL.md +53 -0
  225. package/framework/skills/qualia-quick/SKILL.md +89 -0
  226. package/framework/skills/qualia-research-phase/SKILL.md +88 -0
  227. package/framework/skills/qualia-resume-work/SKILL.md +62 -0
  228. package/framework/skills/qualia-review/SKILL.md +263 -0
  229. package/framework/skills/qualia-start/SKILL.md +182 -0
  230. package/framework/skills/qualia-verify-work/SKILL.md +105 -0
  231. package/framework/skills/qualia-workflow/SKILL.md +130 -0
  232. package/framework/skills/rag/SKILL.md +750 -0
  233. package/framework/skills/responsive/SKILL.md +231 -0
  234. package/framework/skills/retro/SKILL.md +284 -0
  235. package/framework/skills/sakani-conventions/SKILL.md +136 -0
  236. package/framework/skills/sakani-conventions/evals/evals.json +23 -0
  237. package/framework/skills/sakani-conventions/references/entities.md +365 -0
  238. package/framework/skills/sakani-conventions/references/error-codes.md +95 -0
  239. package/framework/skills/seo-master/SKILL.md +490 -0
  240. package/framework/skills/seo-master/references/checklist.md +199 -0
  241. package/framework/skills/seo-master/references/structured-data.md +609 -0
  242. package/framework/skills/ship/SKILL.md +202 -0
  243. package/framework/skills/stack-researcher/SKILL.md +215 -0
  244. package/framework/skills/status/SKILL.md +154 -0
  245. package/framework/skills/status/scripts/health-check.sh +562 -0
  246. package/framework/skills/subscription-payments/SKILL.md +250 -0
  247. package/framework/skills/supabase/SKILL.md +973 -0
  248. package/framework/skills/supabase/references/templates.md +159 -0
  249. package/framework/skills/team/SKILL.md +67 -0
  250. package/framework/skills/test-runner/SKILL.md +202 -0
  251. package/framework/skills/voice-agent/SKILL.md +407 -0
  252. package/framework/skills/zoho-workflow/SKILL.md +51 -0
  253. package/framework/statusline-command.sh +117 -0
  254. package/package.json +24 -0
  255. package/profiles/fawzi.json +16 -0
  256. package/profiles/hasan.json +16 -0
  257. package/profiles/moayad.json +16 -0
  258. package/templates/CLAUDE-owner.md +52 -0
  259. package/templates/CLAUDE.md.hbs +58 -0
  260. package/templates/env.claude.template +12 -0
  261. package/templates/settings.json +141 -0
@@ -0,0 +1,1037 @@
1
+ <purpose>
2
+ Initialize a new project through unified flow: questioning, research (optional), requirements, roadmap. This is the most leveraged moment in any project — deep questioning here means better plans, better execution, better outcomes. One workflow takes you from idea to ready-for-planning.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read all files referenced by the invoking prompt's execution_context before starting.
7
+ </required_reading>
8
+
9
+ <process>
10
+
11
+ ## 1. Setup
12
+
13
+ **MANDATORY FIRST STEP — Execute these checks before ANY user interaction:**
14
+
15
+ ```bash
16
+ INIT=$(node /home/qualia/.claude/qualia-engine/bin/qualia-tools.js init new-project)
17
+ ```
18
+
19
+ Parse JSON for: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `commit_docs`, `project_exists`, `has_codebase_map`, `planning_exists`, `has_existing_code`, `has_package_file`, `is_brownfield`, `needs_codebase_map`, `has_git`.
20
+
21
+ **If `project_exists` is true:** Error — project already initialized. Use `/qualia:progress`.
22
+
23
+ **If `has_git` is false:** Initialize git:
24
+ ```bash
25
+ git init
26
+ ```
27
+
28
+ ## 2. Brownfield Offer
29
+
30
+ **If `needs_codebase_map` is true** (from init — existing code detected but no codebase map):
31
+
32
+ Use AskUserQuestion:
33
+ - header: "Existing Code"
34
+ - question: "I detected existing code in this directory. Would you like to map the codebase first?"
35
+ - options:
36
+ - "Map codebase first" — Run /qualia:map-codebase to understand existing architecture (Recommended)
37
+ - "Skip mapping" — Proceed with project initialization
38
+
39
+ **If "Map codebase first":**
40
+ ```
41
+ Run `/qualia:map-codebase` first, then return to `/qualia:new-project`
42
+ ```
43
+ Exit command.
44
+
45
+ **If "Skip mapping" OR `needs_codebase_map` is false:** Continue to Step 3.
46
+
47
+ ## 3. Deep Questioning
48
+
49
+ **Display stage banner:**
50
+
51
+ ```
52
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
53
+ Qualia ► QUESTIONING
54
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
55
+ ```
56
+
57
+ **Open the conversation:**
58
+
59
+ Ask inline (freeform, NOT AskUserQuestion):
60
+
61
+ "What do you want to build?"
62
+
63
+ Wait for their response. This gives you the context needed to ask intelligent follow-up questions.
64
+
65
+ **Follow the thread:**
66
+
67
+ Based on what they said, ask follow-up questions that dig into their response. Use AskUserQuestion with options that probe what they mentioned — interpretations, clarifications, concrete examples.
68
+
69
+ Keep following threads. Each answer opens new threads to explore. Ask about:
70
+ - What excited them
71
+ - What problem sparked this
72
+ - What they mean by vague terms
73
+ - What it would actually look like
74
+ - What's already decided
75
+
76
+ Consult `questioning.md` for techniques:
77
+ - Challenge vagueness
78
+ - Make abstract concrete
79
+ - Surface assumptions
80
+ - Find edges
81
+ - Reveal motivation
82
+
83
+ **Check context (background, not out loud):**
84
+
85
+ As you go, mentally check the context checklist from `questioning.md`. If gaps remain, weave questions naturally. Don't suddenly switch to checklist mode.
86
+
87
+ **Decision gate:**
88
+
89
+ When you could write a clear PROJECT.md, use AskUserQuestion:
90
+
91
+ - header: "Ready?"
92
+ - question: "I think I understand what you're after. Ready to create PROJECT.md?"
93
+ - options:
94
+ - "Create PROJECT.md" — Let's move forward
95
+ - "Keep exploring" — I want to share more / ask me more
96
+
97
+ If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
98
+
99
+ Loop until "Create PROJECT.md" selected.
100
+
101
+ ## 3.5. Template Selection
102
+
103
+ **Detect project type from questioning answers.** Look for signals:
104
+ - "website", "landing page", "marketing site", "SaaS" → `website`
105
+ - "chatbot", "AI assistant", "chat agent", "AI agent" → `ai-agent`
106
+ - "voice agent", "phone agent", "call bot", "VAPI", "Retell" → `voice-agent`
107
+ - "mobile app", "iOS", "Android", "React Native", "Expo" → `mobile-app`
108
+
109
+ **If a project type is detected:**
110
+
111
+ Use AskUserQuestion:
112
+ - header: "Template"
113
+ - question: "This looks like a {type} project. Use the {type} template? Pre-populates standard phases so you only plan what's unique."
114
+ - options:
115
+ - "Use template (Recommended)" — Pre-populate phases from {type} template, customize during roadmap
116
+ - "Skip template" — Build roadmap from scratch through full questioning
117
+
118
+ **If "Use template":**
119
+ 1. Read the template: `~/.claude/qualia-engine/templates/projects/{type}.md`
120
+ 2. Store template choice in memory for Step 8 (roadmap creation)
121
+ 3. Set `template_type` = detected type
122
+ 4. Set `template_phases` = phases from template file
123
+
124
+ **If "Skip template" OR no type detected:** Continue normally. Set `template_type` = null.
125
+
126
+ ## 4. Write PROJECT.md
127
+
128
+ Synthesize all context into `.planning/PROJECT.md` using the template from `templates/project.md`.
129
+
130
+ **For greenfield projects:**
131
+
132
+ Initialize requirements as hypotheses:
133
+
134
+ ```markdown
135
+ ## Requirements
136
+
137
+ ### Validated
138
+
139
+ (None yet — ship to validate)
140
+
141
+ ### Active
142
+
143
+ - [ ] [Requirement 1]
144
+ - [ ] [Requirement 2]
145
+ - [ ] [Requirement 3]
146
+
147
+ ### Out of Scope
148
+
149
+ - [Exclusion 1] — [why]
150
+ - [Exclusion 2] — [why]
151
+ ```
152
+
153
+ All Active requirements are hypotheses until shipped and validated.
154
+
155
+ **For brownfield projects (codebase map exists):**
156
+
157
+ Infer Validated requirements from existing code:
158
+
159
+ 1. Read `.planning/codebase/ARCHITECTURE.md` and `STACK.md`
160
+ 2. Identify what the codebase already does
161
+ 3. These become the initial Validated set
162
+
163
+ ```markdown
164
+ ## Requirements
165
+
166
+ ### Validated
167
+
168
+ - ✓ [Existing capability 1] — existing
169
+ - ✓ [Existing capability 2] — existing
170
+ - ✓ [Existing capability 3] — existing
171
+
172
+ ### Active
173
+
174
+ - [ ] [New requirement 1]
175
+ - [ ] [New requirement 2]
176
+
177
+ ### Out of Scope
178
+
179
+ - [Exclusion 1] — [why]
180
+ ```
181
+
182
+ **Key Decisions:**
183
+
184
+ Initialize with any decisions made during questioning:
185
+
186
+ ```markdown
187
+ ## Key Decisions
188
+
189
+ | Decision | Rationale | Outcome |
190
+ |----------|-----------|---------|
191
+ | [Choice from questioning] | [Why] | — Pending |
192
+ ```
193
+
194
+ **Last updated footer:**
195
+
196
+ ```markdown
197
+ ---
198
+ *Last updated: [date] after initialization*
199
+ ```
200
+
201
+ Do not compress. Capture everything gathered.
202
+
203
+ **Commit PROJECT.md:**
204
+
205
+ ```bash
206
+ mkdir -p .planning
207
+ node /home/qualia/.claude/qualia-engine/bin/qualia-tools.js commit "docs: initialize project" --files .planning/PROJECT.md
208
+ ```
209
+
210
+ ## 5. Workflow Preferences
211
+
212
+ **Round 1 — Core workflow settings (4 questions):**
213
+
214
+ ```
215
+ questions: [
216
+ {
217
+ header: "Mode",
218
+ question: "How do you want to work?",
219
+ multiSelect: false,
220
+ options: [
221
+ { label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
222
+ { label: "Interactive", description: "Confirm at each step" }
223
+ ]
224
+ },
225
+ {
226
+ header: "Depth",
227
+ question: "How thorough should planning be?",
228
+ multiSelect: false,
229
+ options: [
230
+ { label: "Quick", description: "Ship fast (3-5 phases, 1-3 plans each)" },
231
+ { label: "Standard", description: "Balanced scope and speed (5-8 phases, 3-5 plans each)" },
232
+ { label: "Comprehensive", description: "Thorough coverage (8-12 phases, 5-10 plans each)" }
233
+ ]
234
+ },
235
+ {
236
+ header: "Execution",
237
+ question: "Run plans in parallel?",
238
+ multiSelect: false,
239
+ options: [
240
+ { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
241
+ { label: "Sequential", description: "One plan at a time" }
242
+ ]
243
+ },
244
+ // Git Tracking: always committed. Removed as a question — .planning/ must be in git for team collaboration and portal sync.
245
+ ]
246
+ ```
247
+
248
+ **Round 2 — Workflow agents:**
249
+
250
+ These spawn additional agents during planning/execution. They add tokens and time but improve quality.
251
+
252
+ | Agent | When it runs | What it does |
253
+ |-------|--------------|--------------|
254
+ | **Researcher** | Before planning each phase | Investigates domain, finds patterns, surfaces gotchas |
255
+ | **Plan Checker** | After plan is created | Verifies plan actually achieves the phase goal |
256
+ | **Verifier** | After phase execution | Confirms must-haves were delivered |
257
+
258
+ All recommended for important projects. Skip for quick experiments.
259
+
260
+ ```
261
+ questions: [
262
+ {
263
+ header: "Research",
264
+ question: "Research before planning each phase? (adds tokens/time)",
265
+ multiSelect: false,
266
+ options: [
267
+ { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
268
+ { label: "No", description: "Plan directly from requirements" }
269
+ ]
270
+ },
271
+ {
272
+ header: "Plan Check",
273
+ question: "Verify plans will achieve their goals? (adds tokens/time)",
274
+ multiSelect: false,
275
+ options: [
276
+ { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
277
+ { label: "No", description: "Execute plans without verification" }
278
+ ]
279
+ },
280
+ {
281
+ header: "Verifier",
282
+ question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
283
+ multiSelect: false,
284
+ options: [
285
+ { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
286
+ { label: "No", description: "Trust execution, skip verification" }
287
+ ]
288
+ },
289
+ {
290
+ header: "Model Profile",
291
+ question: "Which AI models for planning agents?",
292
+ multiSelect: false,
293
+ options: [
294
+ { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
295
+ { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
296
+ { label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
297
+ ]
298
+ }
299
+ ]
300
+ ```
301
+
302
+ Create `.planning/config.json` with all settings:
303
+
304
+ ```json
305
+ {
306
+ "mode": "yolo|interactive",
307
+ "depth": "quick|standard|comprehensive",
308
+ "parallelization": true|false,
309
+ "commit_docs": true|false,
310
+ "model_profile": "quality|balanced|budget",
311
+ "workflow": {
312
+ "research": true|false,
313
+ "plan_check": true|false,
314
+ "verifier": true|false
315
+ }
316
+ }
317
+ ```
318
+
319
+ **commit_docs is always true.** Never add `.planning/` to `.gitignore` — it must be tracked for team collaboration and portal sync.
320
+
321
+ **Commit config.json:**
322
+
323
+ ```bash
324
+ node /home/qualia/.claude/qualia-engine/bin/qualia-tools.js commit "chore: add project config" --files .planning/config.json
325
+ ```
326
+
327
+ **Note:** Run `/qualia:settings` anytime to update these preferences.
328
+
329
+ ## 5.5. Resolve Model Profile
330
+
331
+ Use models from init: `researcher_model`, `synthesizer_model`, `roadmapper_model`.
332
+
333
+ ## 6. Research Decision
334
+
335
+ Use AskUserQuestion:
336
+ - header: "Research"
337
+ - question: "Research the domain ecosystem before defining requirements?"
338
+ - options:
339
+ - "Research first (Recommended)" — Discover standard stacks, expected features, architecture patterns
340
+ - "Skip research" — I know this domain well, go straight to requirements
341
+
342
+ **If "Research first":**
343
+
344
+ Display stage banner:
345
+ ```
346
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
347
+ Qualia ► RESEARCHING
348
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
349
+
350
+ Researching [domain] ecosystem...
351
+ ```
352
+
353
+ Create research directory:
354
+ ```bash
355
+ mkdir -p .planning/research
356
+ ```
357
+
358
+ **Determine milestone context:**
359
+
360
+ Check if this is greenfield or subsequent milestone:
361
+ - If no "Validated" requirements in PROJECT.md → Greenfield (building from scratch)
362
+ - If "Validated" requirements exist → Subsequent milestone (adding to existing app)
363
+
364
+ Display spawning indicator:
365
+ ```
366
+ ◆ Spawning 4 researchers in parallel...
367
+ → Stack research
368
+ → Features research
369
+ → Architecture research
370
+ → Pitfalls research
371
+ ```
372
+
373
+ Spawn 4 parallel qualia-project-researcher agents with rich context:
374
+
375
+ ```
376
+ Task(prompt="First, read /home/qualia/.claude/agents/qualia-project-researcher.md for your role and instructions.
377
+
378
+ <research_type>
379
+ Project Research — Stack dimension for [domain].
380
+ </research_type>
381
+
382
+ <milestone_context>
383
+ [greenfield OR subsequent]
384
+
385
+ Greenfield: Research the standard stack for building [domain] from scratch.
386
+ Subsequent: Research what's needed to add [target features] to an existing [domain] app. Don't re-research the existing system.
387
+ </milestone_context>
388
+
389
+ <question>
390
+ What's the standard 2025 stack for [domain]?
391
+ </question>
392
+
393
+ <project_context>
394
+ [PROJECT.md summary - core value, constraints, what they're building]
395
+ </project_context>
396
+
397
+ <downstream_consumer>
398
+ Your STACK.md feeds into roadmap creation. Be prescriptive:
399
+ - Specific libraries with versions
400
+ - Clear rationale for each choice
401
+ - What NOT to use and why
402
+ </downstream_consumer>
403
+
404
+ <quality_gate>
405
+ - [ ] Versions are current (verify with Context7/official docs, not training data)
406
+ - [ ] Rationale explains WHY, not just WHAT
407
+ - [ ] Confidence levels assigned to each recommendation
408
+ </quality_gate>
409
+
410
+ <output>
411
+ Write to: .planning/research/STACK.md
412
+ Use template: /home/qualia/.claude/qualia-engine/templates/research-project/STACK.md
413
+ </output>
414
+ ", subagent_type="general-purpose", model="{researcher_model}", description="Stack research")
415
+
416
+ Task(prompt="First, read /home/qualia/.claude/agents/qualia-project-researcher.md for your role and instructions.
417
+
418
+ <research_type>
419
+ Project Research — Features dimension for [domain].
420
+ </research_type>
421
+
422
+ <milestone_context>
423
+ [greenfield OR subsequent]
424
+
425
+ Greenfield: What features do [domain] products have? What's table stakes vs differentiating?
426
+ Subsequent: How do [target features] typically work? What's expected behavior?
427
+ </milestone_context>
428
+
429
+ <question>
430
+ What features do [domain] products have? What's table stakes vs differentiating?
431
+ </question>
432
+
433
+ <project_context>
434
+ [PROJECT.md summary]
435
+ </project_context>
436
+
437
+ <downstream_consumer>
438
+ Your FEATURES.md feeds into requirements definition. Categorize clearly:
439
+ - Table stakes (must have or users leave)
440
+ - Differentiators (competitive advantage)
441
+ - Anti-features (things to deliberately NOT build)
442
+ </downstream_consumer>
443
+
444
+ <quality_gate>
445
+ - [ ] Categories are clear (table stakes vs differentiators vs anti-features)
446
+ - [ ] Complexity noted for each feature
447
+ - [ ] Dependencies between features identified
448
+ </quality_gate>
449
+
450
+ <output>
451
+ Write to: .planning/research/FEATURES.md
452
+ Use template: /home/qualia/.claude/qualia-engine/templates/research-project/FEATURES.md
453
+ </output>
454
+ ", subagent_type="general-purpose", model="{researcher_model}", description="Features research")
455
+
456
+ Task(prompt="First, read /home/qualia/.claude/agents/qualia-project-researcher.md for your role and instructions.
457
+
458
+ <research_type>
459
+ Project Research — Architecture dimension for [domain].
460
+ </research_type>
461
+
462
+ <milestone_context>
463
+ [greenfield OR subsequent]
464
+
465
+ Greenfield: How are [domain] systems typically structured? What are major components?
466
+ Subsequent: How do [target features] integrate with existing [domain] architecture?
467
+ </milestone_context>
468
+
469
+ <question>
470
+ How are [domain] systems typically structured? What are major components?
471
+ </question>
472
+
473
+ <project_context>
474
+ [PROJECT.md summary]
475
+ </project_context>
476
+
477
+ <downstream_consumer>
478
+ Your ARCHITECTURE.md informs phase structure in roadmap. Include:
479
+ - Component boundaries (what talks to what)
480
+ - Data flow (how information moves)
481
+ - Suggested build order (dependencies between components)
482
+ </downstream_consumer>
483
+
484
+ <quality_gate>
485
+ - [ ] Components clearly defined with boundaries
486
+ - [ ] Data flow direction explicit
487
+ - [ ] Build order implications noted
488
+ </quality_gate>
489
+
490
+ <output>
491
+ Write to: .planning/research/ARCHITECTURE.md
492
+ Use template: /home/qualia/.claude/qualia-engine/templates/research-project/ARCHITECTURE.md
493
+ </output>
494
+ ", subagent_type="general-purpose", model="{researcher_model}", description="Architecture research")
495
+
496
+ Task(prompt="First, read /home/qualia/.claude/agents/qualia-project-researcher.md for your role and instructions.
497
+
498
+ <research_type>
499
+ Project Research — Pitfalls dimension for [domain].
500
+ </research_type>
501
+
502
+ <milestone_context>
503
+ [greenfield OR subsequent]
504
+
505
+ Greenfield: What do [domain] projects commonly get wrong? Critical mistakes?
506
+ Subsequent: What are common mistakes when adding [target features] to [domain]?
507
+ </milestone_context>
508
+
509
+ <question>
510
+ What do [domain] projects commonly get wrong? Critical mistakes?
511
+ </question>
512
+
513
+ <project_context>
514
+ [PROJECT.md summary]
515
+ </project_context>
516
+
517
+ <downstream_consumer>
518
+ Your PITFALLS.md prevents mistakes in roadmap/planning. For each pitfall:
519
+ - Warning signs (how to detect early)
520
+ - Prevention strategy (how to avoid)
521
+ - Which phase should address it
522
+ </downstream_consumer>
523
+
524
+ <quality_gate>
525
+ - [ ] Pitfalls are specific to this domain (not generic advice)
526
+ - [ ] Prevention strategies are actionable
527
+ - [ ] Phase mapping included where relevant
528
+ </quality_gate>
529
+
530
+ <output>
531
+ Write to: .planning/research/PITFALLS.md
532
+ Use template: /home/qualia/.claude/qualia-engine/templates/research-project/PITFALLS.md
533
+ </output>
534
+ ", subagent_type="general-purpose", model="{researcher_model}", description="Pitfalls research")
535
+ ```
536
+
537
+ After all 4 agents complete, spawn synthesizer to create SUMMARY.md:
538
+
539
+ ```
540
+ Task(prompt="
541
+ <task>
542
+ Synthesize research outputs into SUMMARY.md.
543
+ </task>
544
+
545
+ <research_files>
546
+ Read these files:
547
+ - .planning/research/STACK.md
548
+ - .planning/research/FEATURES.md
549
+ - .planning/research/ARCHITECTURE.md
550
+ - .planning/research/PITFALLS.md
551
+ </research_files>
552
+
553
+ <output>
554
+ Write to: .planning/research/SUMMARY.md
555
+ Use template: /home/qualia/.claude/qualia-engine/templates/research-project/SUMMARY.md
556
+ Commit after writing.
557
+ </output>
558
+ ", subagent_type="qualia-research-synthesizer", model="{synthesizer_model}", description="Synthesize research")
559
+ ```
560
+
561
+ Display research complete banner and key findings:
562
+ ```
563
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
564
+ Qualia ► RESEARCH COMPLETE ✓
565
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
566
+
567
+ ## Key Findings
568
+
569
+ **Stack:** [from SUMMARY.md]
570
+ **Table Stakes:** [from SUMMARY.md]
571
+ **Watch Out For:** [from SUMMARY.md]
572
+
573
+ Files: `.planning/research/`
574
+ ```
575
+
576
+ **If "Skip research":** Continue to Step 7.
577
+
578
+ ## 7. Define Requirements
579
+
580
+ Display stage banner:
581
+ ```
582
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
583
+ Qualia ► DEFINING REQUIREMENTS
584
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
585
+ ```
586
+
587
+ **Load context:**
588
+
589
+ Read PROJECT.md and extract:
590
+ - Core value (the ONE thing that must work)
591
+ - Stated constraints (budget, timeline, tech limitations)
592
+ - Any explicit scope boundaries
593
+
594
+ **If research exists:** Read research/FEATURES.md and extract feature categories.
595
+
596
+ **Present features by category:**
597
+
598
+ ```
599
+ Here are the features for [domain]:
600
+
601
+ ## Authentication
602
+ **Table stakes:**
603
+ - Sign up with email/password
604
+ - Email verification
605
+ - Password reset
606
+ - Session management
607
+
608
+ **Differentiators:**
609
+ - Magic link login
610
+ - OAuth (Google, GitHub)
611
+ - 2FA
612
+
613
+ **Research notes:** [any relevant notes]
614
+
615
+ ---
616
+
617
+ ## [Next Category]
618
+ ...
619
+ ```
620
+
621
+ **If no research:** Gather requirements through conversation instead.
622
+
623
+ Ask: "What are the main things users need to be able to do?"
624
+
625
+ For each capability mentioned:
626
+ - Ask clarifying questions to make it specific
627
+ - Probe for related capabilities
628
+ - Group into categories
629
+
630
+ **Scope each category:**
631
+
632
+ For each category, use AskUserQuestion:
633
+
634
+ - header: "[Category name]"
635
+ - question: "Which [category] features are in v1?"
636
+ - multiSelect: true
637
+ - options:
638
+ - "[Feature 1]" — [brief description]
639
+ - "[Feature 2]" — [brief description]
640
+ - "[Feature 3]" — [brief description]
641
+ - "None for v1" — Defer entire category
642
+
643
+ Track responses:
644
+ - Selected features → v1 requirements
645
+ - Unselected table stakes → v2 (users expect these)
646
+ - Unselected differentiators → out of scope
647
+
648
+ **Identify gaps:**
649
+
650
+ Use AskUserQuestion:
651
+ - header: "Additions"
652
+ - question: "Any requirements research missed? (Features specific to your vision)"
653
+ - options:
654
+ - "No, research covered it" — Proceed
655
+ - "Yes, let me add some" — Capture additions
656
+
657
+ **Validate core value:**
658
+
659
+ Cross-check requirements against Core Value from PROJECT.md. If gaps detected, surface them.
660
+
661
+ **Generate REQUIREMENTS.md:**
662
+
663
+ Create `.planning/REQUIREMENTS.md` with:
664
+ - v1 Requirements grouped by category (checkboxes, REQ-IDs)
665
+ - v2 Requirements (deferred)
666
+ - Out of Scope (explicit exclusions with reasoning)
667
+ - Traceability section (empty, filled by roadmap)
668
+
669
+ **REQ-ID format:** `[CATEGORY]-[NUMBER]` (AUTH-01, CONTENT-02)
670
+
671
+ **Requirement quality criteria:**
672
+
673
+ Good requirements are:
674
+ - **Specific and testable:** "User can reset password via email link" (not "Handle password reset")
675
+ - **User-centric:** "User can X" (not "System does Y")
676
+ - **Atomic:** One capability per requirement (not "User can login and manage profile")
677
+ - **Independent:** Minimal dependencies on other requirements
678
+
679
+ Reject vague requirements. Push for specificity:
680
+ - "Handle authentication" → "User can log in with email/password and stay logged in across sessions"
681
+ - "Support sharing" → "User can share post via link that opens in recipient's browser"
682
+
683
+ **Present full requirements list:**
684
+
685
+ Show every requirement (not counts) for user confirmation:
686
+
687
+ ```
688
+ ## v1 Requirements
689
+
690
+ ### Authentication
691
+ - [ ] **AUTH-01**: User can create account with email/password
692
+ - [ ] **AUTH-02**: User can log in and stay logged in across sessions
693
+ - [ ] **AUTH-03**: User can log out from any page
694
+
695
+ ### Content
696
+ - [ ] **CONT-01**: User can create posts with text
697
+ - [ ] **CONT-02**: User can edit their own posts
698
+
699
+ [... full list ...]
700
+
701
+ ---
702
+
703
+ Does this capture what you're building? (yes / adjust)
704
+ ```
705
+
706
+ If "adjust": Return to scoping.
707
+
708
+ **Commit requirements:**
709
+
710
+ ```bash
711
+ node /home/qualia/.claude/qualia-engine/bin/qualia-tools.js commit "docs: define v1 requirements" --files .planning/REQUIREMENTS.md
712
+ ```
713
+
714
+ ## 8. Create Roadmap
715
+
716
+ Display stage banner:
717
+ ```
718
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
719
+ Qualia ► CREATING ROADMAP
720
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
721
+
722
+ ◆ Spawning roadmapper...
723
+ ```
724
+
725
+ Spawn qualia-roadmapper agent with context:
726
+
727
+ ```
728
+ Task(prompt="
729
+ <planning_context>
730
+
731
+ **Project:**
732
+ @.planning/PROJECT.md
733
+
734
+ **Requirements:**
735
+ @.planning/REQUIREMENTS.md
736
+
737
+ **Research (if exists):**
738
+ @.planning/research/SUMMARY.md
739
+
740
+ **Config:**
741
+ @.planning/config.json
742
+
743
+ </planning_context>
744
+
745
+ <template_context>
746
+ Template type: {template_type or 'none'}
747
+ {If template_type is set, inline the full template file content from ~/.claude/qualia-engine/templates/projects/{template_type}.md}
748
+ </template_context>
749
+
750
+ <instructions>
751
+ Create roadmap:
752
+ 1. If template provided: use template phases as starting structure, merge with project-specific requirements. Mark template-sourced phases with `source: template`. Add skill references and team fields from template.
753
+ 2. If no template: derive phases from requirements (don't impose structure)
754
+ 3. Map every v1 requirement to exactly one phase
755
+ 4. Derive 2-5 success criteria per phase (observable user behaviors)
756
+ 5. Validate 100% coverage
757
+ 6. Write files immediately (ROADMAP.md, STATE.md, update REQUIREMENTS.md traceability)
758
+ 7. Return ROADMAP CREATED with summary
759
+
760
+ Write files first, then return. This ensures artifacts persist even if context is lost.
761
+ </instructions>
762
+ ", subagent_type="qualia-roadmapper", model="{roadmapper_model}", description="Create roadmap")
763
+ ```
764
+
765
+ **Handle roadmapper return:**
766
+
767
+ **If `## ROADMAP BLOCKED`:**
768
+ - Present blocker information
769
+ - Work with user to resolve
770
+ - Re-spawn when resolved
771
+
772
+ **If `## ROADMAP CREATED`:**
773
+
774
+ Read the created ROADMAP.md and present it nicely inline:
775
+
776
+ ```
777
+ ---
778
+
779
+ ## Proposed Roadmap
780
+
781
+ **[N] phases** | **[X] requirements mapped** | All v1 requirements covered ✓
782
+
783
+ | # | Phase | Goal | Requirements | Success Criteria |
784
+ |---|-------|------|--------------|------------------|
785
+ | 1 | [Name] | [Goal] | [REQ-IDs] | [count] |
786
+ | 2 | [Name] | [Goal] | [REQ-IDs] | [count] |
787
+ | 3 | [Name] | [Goal] | [REQ-IDs] | [count] |
788
+ ...
789
+
790
+ ### Phase Details
791
+
792
+ **Phase 1: [Name]**
793
+ Goal: [goal]
794
+ Requirements: [REQ-IDs]
795
+ Success criteria:
796
+ 1. [criterion]
797
+ 2. [criterion]
798
+ 3. [criterion]
799
+
800
+ **Phase 2: [Name]**
801
+ Goal: [goal]
802
+ Requirements: [REQ-IDs]
803
+ Success criteria:
804
+ 1. [criterion]
805
+ 2. [criterion]
806
+
807
+ [... continue for all phases ...]
808
+
809
+ ---
810
+ ```
811
+
812
+ **CRITICAL: Ask for approval before committing:**
813
+
814
+ Use AskUserQuestion:
815
+ - header: "Roadmap"
816
+ - question: "Does this roadmap structure work for you?"
817
+ - options:
818
+ - "Approve" — Commit and continue
819
+ - "Adjust phases" — Tell me what to change
820
+ - "Review full file" — Show raw ROADMAP.md
821
+
822
+ **If "Approve":** Continue to commit.
823
+
824
+ **If "Adjust phases":**
825
+ - Get user's adjustment notes
826
+ - Re-spawn roadmapper with revision context:
827
+ ```
828
+ Task(prompt="
829
+ <revision>
830
+ User feedback on roadmap:
831
+ [user's notes]
832
+
833
+ Current ROADMAP.md: @.planning/ROADMAP.md
834
+
835
+ Update the roadmap based on feedback. Edit files in place.
836
+ Return ROADMAP REVISED with changes made.
837
+ </revision>
838
+ ", subagent_type="qualia-roadmapper", model="{roadmapper_model}", description="Revise roadmap")
839
+ ```
840
+ - Present revised roadmap
841
+ - Loop until user approves
842
+
843
+ **If "Review full file":** Display raw `cat .planning/ROADMAP.md`, then re-ask.
844
+
845
+ **Commit roadmap (after approval):**
846
+
847
+ ```bash
848
+ node /home/qualia/.claude/qualia-engine/bin/qualia-tools.js commit "docs: create roadmap ([N] phases)" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md
849
+ ```
850
+
851
+ ## 9. Environment Setup
852
+
853
+ Display stage banner:
854
+ ```
855
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
856
+ Qualia ► ENVIRONMENT SETUP
857
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
858
+ ```
859
+
860
+ **Detect what's needed based on project type and stack:**
861
+
862
+ Check PROJECT.md and research/STACK.md for:
863
+ - Supabase → needs project creation or linking
864
+ - Vercel → needs project linking
865
+ - Environment variables → needs `.env.local`
866
+ - External services (Stripe, VAPI, etc.) → needs API keys
867
+
868
+ **Present setup checklist:**
869
+
870
+ Use AskUserQuestion:
871
+ - header: "Env Setup"
872
+ - question: "Let's set up the development environment. Which of these are ready?"
873
+ - multiSelect: true
874
+ - options (dynamically generated from detection):
875
+ - "Supabase project exists" — I have a Supabase project ready to link
876
+ - "Vercel project exists" — I have a Vercel project ready
877
+ - "I'll set these up now" — Walk me through creating them
878
+ - "Skip for now" — I'll handle environment setup myself later
879
+
880
+ **If "I'll set these up now":**
881
+
882
+ Walk through each needed service:
883
+
884
+ 1. **Supabase** (if detected):
885
+ ```bash
886
+ supabase init # If no supabase/ directory
887
+ supabase link --project-ref <ref> # User provides ref
888
+ ```
889
+
890
+ 2. **Vercel** (if detected):
891
+ ```bash
892
+ vercel link # Interactive linking
893
+ ```
894
+
895
+ 3. **Environment variables:**
896
+ Create `.env.local` with placeholders:
897
+ ```bash
898
+ cat > .env.local << 'EOF'
899
+ # Supabase
900
+ NEXT_PUBLIC_SUPABASE_URL=
901
+ NEXT_PUBLIC_SUPABASE_ANON_KEY=
902
+ SUPABASE_SERVICE_ROLE_KEY=
903
+
904
+ # Add other detected services...
905
+ EOF
906
+ ```
907
+
908
+ Tell user: "Fill in the values from your Supabase dashboard (Settings → API). I'll wait."
909
+
910
+ 4. **Verify setup:**
911
+ ```bash
912
+ # Check Supabase connection
913
+ supabase status 2>/dev/null
914
+
915
+ # Check env vars are populated (not empty)
916
+ grep -c "=$" .env.local # Should be 0 if all filled
917
+ ```
918
+
919
+ **If "Skip for now":**
920
+ Note in STATE.md: `env_setup: pending` so future commands can warn.
921
+
922
+ ## 9.5. Design Context (frontend projects)
923
+
924
+ **Check if project involves frontend work:**
925
+
926
+ ```bash
927
+ # Detect from roadmap, requirements, or project type
928
+ HAS_FRONTEND=$(grep -qiE 'website|landing|dashboard|ui|frontend|page|component|SaaS|web app' .planning/PROJECT.md .planning/ROADMAP.md 2>/dev/null && echo "true" || echo "false")
929
+ ```
930
+
931
+ **If `HAS_FRONTEND` is true:** Run `/critique` to gather design context.
932
+
933
+ Display banner:
934
+ ```
935
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
936
+ Qualia ► DESIGN CONTEXT
937
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
938
+ ```
939
+
940
+ Execute the critique skill:
941
+ 1. Read `/home/qualia/.claude/skills/critique/SKILL.md`
942
+ 2. Follow its process: scan codebase for existing design patterns, ask UX-focused questions, write Design Context section
943
+ 3. The skill persists design context to the project's CLAUDE.md (or `.claude/` config)
944
+
945
+ This runs ONCE per project. All subsequent `/qualia:execute-phase` runs will have the design context available for the frontend-master skill and the diagnostic design pass.
946
+
947
+ **If `HAS_FRONTEND` is false:** Skip silently.
948
+
949
+ **Commit setup:**
950
+ ```bash
951
+ node /home/qualia/.claude/qualia-engine/bin/qualia-tools.js commit "chore: environment setup" --files .env.local supabase/config.toml
952
+ ```
953
+
954
+ Ensure `.env.local` is in `.gitignore` (create/append if needed).
955
+
956
+ ## 10. Done
957
+
958
+ Present completion with next steps:
959
+
960
+ ```
961
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
962
+ Qualia ► PROJECT INITIALIZED ✓
963
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
964
+
965
+ **[Project Name]**
966
+
967
+ | Artifact | Location |
968
+ |----------------|-----------------------------|
969
+ | Project | `.planning/PROJECT.md` |
970
+ | Config | `.planning/config.json` |
971
+ | Research | `.planning/research/` |
972
+ | Requirements | `.planning/REQUIREMENTS.md` |
973
+ | Roadmap | `.planning/ROADMAP.md` |
974
+ | Environment | `.env.local` |
975
+
976
+ **[N] phases** | **[X] requirements** | Ready to build ✓
977
+
978
+ ───────────────────────────────────────────────────────────────
979
+
980
+ ## ▶ Next Up
981
+
982
+ **Phase 1: [Phase Name]** — [Goal from ROADMAP.md]
983
+
984
+ /qualia:discuss-phase 1 — gather context and clarify approach
985
+
986
+ <sub>/clear first → fresh context window</sub>
987
+
988
+ ---
989
+
990
+ **Also available:**
991
+ - /qualia:plan-phase 1 — skip discussion, plan directly
992
+
993
+ ───────────────────────────────────────────────────────────────
994
+ ```
995
+
996
+ </process>
997
+
998
+ <output>
999
+
1000
+ - `.planning/PROJECT.md`
1001
+ - `.planning/config.json`
1002
+ - `.planning/research/` (if research selected)
1003
+ - `STACK.md`
1004
+ - `FEATURES.md`
1005
+ - `ARCHITECTURE.md`
1006
+ - `PITFALLS.md`
1007
+ - `SUMMARY.md`
1008
+ - `.planning/REQUIREMENTS.md`
1009
+ - `.planning/ROADMAP.md`
1010
+ - `.planning/STATE.md`
1011
+
1012
+ </output>
1013
+
1014
+ <success_criteria>
1015
+
1016
+ - [ ] .planning/ directory created
1017
+ - [ ] Git repo initialized
1018
+ - [ ] Brownfield detection completed
1019
+ - [ ] Deep questioning completed (threads followed, not rushed)
1020
+ - [ ] PROJECT.md captures full context → **committed**
1021
+ - [ ] config.json has workflow mode, depth, parallelization → **committed**
1022
+ - [ ] Research completed (if selected) — 4 parallel agents spawned → **committed**
1023
+ - [ ] Requirements gathered (from research or conversation)
1024
+ - [ ] User scoped each category (v1/v2/out of scope)
1025
+ - [ ] REQUIREMENTS.md created with REQ-IDs → **committed**
1026
+ - [ ] qualia-roadmapper spawned with context
1027
+ - [ ] Roadmap files written immediately (not draft)
1028
+ - [ ] User feedback incorporated (if any)
1029
+ - [ ] ROADMAP.md created with phases, requirement mappings, success criteria
1030
+ - [ ] STATE.md initialized
1031
+ - [ ] REQUIREMENTS.md traceability updated
1032
+ - [ ] If frontend project: `/critique` run to set design context
1033
+ - [ ] User knows next step is `/qualia:discuss-phase 1`
1034
+
1035
+ **Atomic commits:** Each phase commits its artifacts immediately. If context is lost, artifacts persist.
1036
+
1037
+ </success_criteria>