@luanpdd/kit-mcp 1.29.0 → 1.30.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 (330) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +168 -168
  3. package/gates/agent-no-recursive-dispatch.md +82 -82
  4. package/kit/COMANDOS.md +138 -138
  5. package/kit/README.md +76 -76
  6. package/kit/agents/advisor-researcher.md +106 -106
  7. package/kit/agents/assumptions-analyzer.md +107 -107
  8. package/kit/agents/audit-log-implementer.md +313 -313
  9. package/kit/agents/auditor-consistencia-isolamento.md +413 -413
  10. package/kit/agents/b2b-saas-architect.md +156 -156
  11. package/kit/agents/cascading-failures-auditor.md +298 -298
  12. package/kit/agents/codebase-mapper.md +768 -768
  13. package/kit/agents/crm-pipeline-implementer.md +256 -256
  14. package/kit/agents/debugger.md +813 -813
  15. package/kit/agents/detector-tenant-quente.md +337 -337
  16. package/kit/agents/evolution-go-integrator.md +200 -200
  17. package/kit/agents/example-reviewer.md +21 -21
  18. package/kit/agents/executor.md +564 -564
  19. package/kit/agents/integration-checker.md +200 -200
  20. package/kit/agents/invite-flow-implementer.md +189 -189
  21. package/kit/agents/legacy-characterizer.md +368 -368
  22. package/kit/agents/lgpd-compliance-auditor.md +295 -295
  23. package/kit/agents/multi-tenant-isolation-auditor.md +253 -253
  24. package/kit/agents/multi-tenant-rls-writer.md +340 -340
  25. package/kit/agents/nyquist-auditor.md +178 -178
  26. package/kit/agents/observability-coverage-auditor.md +315 -315
  27. package/kit/agents/org-onboarding-implementer.md +223 -223
  28. package/kit/agents/payload-capture-instrumenter.md +273 -273
  29. package/kit/agents/phase-researcher.md +696 -696
  30. package/kit/agents/plan-checker.md +272 -272
  31. package/kit/agents/planner.md +922 -922
  32. package/kit/agents/project-researcher.md +652 -652
  33. package/kit/agents/refactor-safety-auditor.md +404 -404
  34. package/kit/agents/research-synthesizer.md +245 -245
  35. package/kit/agents/roadmapper.md +677 -677
  36. package/kit/agents/seam-finder.md +359 -359
  37. package/kit/agents/shotgun-surgery-detector.md +349 -349
  38. package/kit/agents/supabase-branching-architect.md +562 -562
  39. package/kit/agents/supabase-cicd-pipeline-implementer.md +777 -777
  40. package/kit/agents/supabase-column-privileges-writer.md +399 -399
  41. package/kit/agents/supabase-edge-fn-tester.md +287 -0
  42. package/kit/agents/supabase-edge-fn-writer.md +239 -210
  43. package/kit/agents/supabase-migration-writer.md +385 -385
  44. package/kit/agents/supabase-rbac-implementer.md +392 -392
  45. package/kit/agents/supabase-realtime-implementer.md +363 -267
  46. package/kit/agents/supabase-rls-hardener.md +521 -521
  47. package/kit/agents/supabase-rls-writer.md +323 -323
  48. package/kit/agents/supabase-roles-implementer.md +355 -355
  49. package/kit/agents/super-admin-implementer.md +281 -281
  50. package/kit/agents/ui-auditor.md +437 -437
  51. package/kit/agents/ui-checker.md +302 -302
  52. package/kit/agents/ui-researcher.md +355 -355
  53. package/kit/agents/user-profiler.md +175 -175
  54. package/kit/agents/validador-evolucao-schema.md +335 -335
  55. package/kit/agents/verifier.md +728 -728
  56. package/kit/commands/adicionar-backlog.md +75 -75
  57. package/kit/commands/adicionar-fase.md +42 -42
  58. package/kit/commands/adicionar-tarefa.md +45 -45
  59. package/kit/commands/adicionar-testes.md +41 -41
  60. package/kit/commands/ajuda.md +21 -21
  61. package/kit/commands/atualizar.md +37 -37
  62. package/kit/commands/auditar-cascading.md +111 -111
  63. package/kit/commands/auditar-marco.md +179 -179
  64. package/kit/commands/auditar-observabilidade-cobertura.md +183 -183
  65. package/kit/commands/auditar-refactor.md +219 -219
  66. package/kit/commands/auditar-release.md +109 -109
  67. package/kit/commands/auditar-uat.md +23 -23
  68. package/kit/commands/autonomo.md +40 -40
  69. package/kit/commands/branch-pr.md +24 -24
  70. package/kit/commands/burn-rate-status.md +408 -408
  71. package/kit/commands/capturar-payloads.md +193 -193
  72. package/kit/commands/caracterizar.md +212 -212
  73. package/kit/commands/concluir-marco.md +247 -247
  74. package/kit/commands/configuracoes.md +36 -36
  75. package/kit/commands/dados-distribuidos.md +188 -188
  76. package/kit/commands/definir-perfil.md +10 -10
  77. package/kit/commands/depurar.md +190 -190
  78. package/kit/commands/detectar-duplicacao.md +197 -197
  79. package/kit/commands/discutir-fase.md +131 -131
  80. package/kit/commands/encontrar-seams.md +136 -136
  81. package/kit/commands/entrar-discord.md +17 -17
  82. package/kit/commands/estatisticas.md +18 -18
  83. package/kit/commands/example-greeting.md +33 -33
  84. package/kit/commands/executar-fase.md +58 -58
  85. package/kit/commands/expresso.md +56 -56
  86. package/kit/commands/fase-ui.md +34 -34
  87. package/kit/commands/fazer.md +57 -57
  88. package/kit/commands/fio.md +125 -125
  89. package/kit/commands/fluxos-trabalho.md +64 -64
  90. package/kit/commands/forense.md +176 -176
  91. package/kit/commands/gerenciador.md +38 -38
  92. package/kit/commands/inserir-fase.md +31 -31
  93. package/kit/commands/legacy.md +263 -263
  94. package/kit/commands/limpeza.md +17 -17
  95. package/kit/commands/listar-hipoteses-fase.md +45 -45
  96. package/kit/commands/listar-workspaces.md +18 -18
  97. package/kit/commands/load-shedding.md +117 -117
  98. package/kit/commands/mapear-codebase.md +70 -70
  99. package/kit/commands/multi-tenant.md +163 -163
  100. package/kit/commands/nota.md +33 -33
  101. package/kit/commands/novo-marco.md +43 -43
  102. package/kit/commands/novo-projeto.md +41 -41
  103. package/kit/commands/novo-workspace.md +43 -43
  104. package/kit/commands/pausar-trabalho.md +37 -37
  105. package/kit/commands/perfil-usuario.md +45 -45
  106. package/kit/commands/pesquisar-fase.md +195 -195
  107. package/kit/commands/planejar-fase.md +67 -67
  108. package/kit/commands/planejar-lacunas.md +33 -33
  109. package/kit/commands/plantar-ideia.md +25 -25
  110. package/kit/commands/progresso.md +24 -24
  111. package/kit/commands/proximo.md +30 -30
  112. package/kit/commands/publicar.md +490 -490
  113. package/kit/commands/rapido.md +35 -35
  114. package/kit/commands/reaplicar-patches.md +124 -124
  115. package/kit/commands/refactor-seguro.md +321 -321
  116. package/kit/commands/relatorio-sessao.md +19 -19
  117. package/kit/commands/remover-fase.md +31 -31
  118. package/kit/commands/remover-workspace.md +26 -26
  119. package/kit/commands/resumo-marco.md +50 -50
  120. package/kit/commands/retomar-trabalho.md +40 -40
  121. package/kit/commands/revisar-backlog.md +60 -60
  122. package/kit/commands/revisar-ui.md +32 -32
  123. package/kit/commands/revisar.md +37 -37
  124. package/kit/commands/saude.md +21 -21
  125. package/kit/commands/setup-notion.md +93 -93
  126. package/kit/commands/storytelling.md +179 -179
  127. package/kit/commands/supabase.md +30 -7
  128. package/kit/commands/sync-main.md +68 -68
  129. package/kit/commands/validar-fase.md +35 -35
  130. package/kit/commands/verificar-tarefas.md +44 -44
  131. package/kit/commands/verificar-trabalho.md +64 -64
  132. package/kit/file-manifest.json +14 -8
  133. package/kit/framework/bin/lib/commands.cjs +959 -959
  134. package/kit/framework/bin/lib/config.cjs +442 -442
  135. package/kit/framework/bin/lib/core.cjs +1230 -1230
  136. package/kit/framework/bin/lib/frontmatter.cjs +336 -336
  137. package/kit/framework/bin/lib/init.cjs +1442 -1442
  138. package/kit/framework/bin/lib/milestone.cjs +252 -252
  139. package/kit/framework/bin/lib/model-profiles.cjs +68 -68
  140. package/kit/framework/bin/lib/phase.cjs +888 -888
  141. package/kit/framework/bin/lib/profile-output.cjs +952 -952
  142. package/kit/framework/bin/lib/profile-pipeline.cjs +539 -539
  143. package/kit/framework/bin/lib/roadmap.cjs +329 -329
  144. package/kit/framework/bin/lib/security.cjs +382 -382
  145. package/kit/framework/bin/lib/state.cjs +1031 -1031
  146. package/kit/framework/bin/lib/template.cjs +222 -222
  147. package/kit/framework/bin/lib/uat.cjs +282 -282
  148. package/kit/framework/bin/lib/verify.cjs +888 -888
  149. package/kit/framework/bin/lib/workstream.cjs +491 -491
  150. package/kit/framework/bin/tools.cjs +918 -918
  151. package/kit/framework/commands/workstreams.md +63 -63
  152. package/kit/framework/references/checkpoints.md +778 -778
  153. package/kit/framework/references/continuation-format.md +249 -249
  154. package/kit/framework/references/decimal-phase-calculation.md +64 -64
  155. package/kit/framework/references/git-integration.md +295 -295
  156. package/kit/framework/references/git-planning-commit.md +38 -38
  157. package/kit/framework/references/model-profile-resolution.md +36 -36
  158. package/kit/framework/references/model-profiles.md +139 -139
  159. package/kit/framework/references/phase-argument-parsing.md +61 -61
  160. package/kit/framework/references/planning-config.md +202 -202
  161. package/kit/framework/references/questioning.md +162 -162
  162. package/kit/framework/references/tdd.md +263 -263
  163. package/kit/framework/references/ui-brand.md +160 -160
  164. package/kit/framework/references/user-profiling.md +657 -657
  165. package/kit/framework/references/verification-patterns.md +612 -612
  166. package/kit/framework/references/workstream-flag.md +58 -58
  167. package/kit/framework/templates/DEBUG.md +164 -164
  168. package/kit/framework/templates/UAT.md +265 -265
  169. package/kit/framework/templates/UI-SPEC.md +100 -100
  170. package/kit/framework/templates/VALIDATION.md +76 -76
  171. package/kit/framework/templates/claude-md.md +122 -122
  172. package/kit/framework/templates/codebase/architecture.md +185 -185
  173. package/kit/framework/templates/codebase/concerns.md +205 -205
  174. package/kit/framework/templates/codebase/conventions.md +204 -204
  175. package/kit/framework/templates/codebase/integrations.md +192 -192
  176. package/kit/framework/templates/codebase/stack.md +158 -158
  177. package/kit/framework/templates/codebase/structure.md +199 -199
  178. package/kit/framework/templates/codebase/testing.md +301 -301
  179. package/kit/framework/templates/config.json +44 -44
  180. package/kit/framework/templates/context.md +352 -352
  181. package/kit/framework/templates/continue-here.md +78 -78
  182. package/kit/framework/templates/copilot-instructions.md +7 -7
  183. package/kit/framework/templates/debug-subagent-prompt.md +91 -91
  184. package/kit/framework/templates/dev-preferences.md +20 -20
  185. package/kit/framework/templates/discovery.md +146 -146
  186. package/kit/framework/templates/discussion-log.md +63 -63
  187. package/kit/framework/templates/milestone-archive.md +123 -123
  188. package/kit/framework/templates/milestone.md +115 -115
  189. package/kit/framework/templates/phase-prompt.md +610 -610
  190. package/kit/framework/templates/planner-subagent-prompt.md +117 -117
  191. package/kit/framework/templates/project.md +186 -186
  192. package/kit/framework/templates/requirements.md +231 -231
  193. package/kit/framework/templates/research-project/ARCHITECTURE.md +204 -204
  194. package/kit/framework/templates/research-project/FEATURES.md +147 -147
  195. package/kit/framework/templates/research-project/PITFALLS.md +200 -200
  196. package/kit/framework/templates/research-project/STACK.md +120 -120
  197. package/kit/framework/templates/research-project/SUMMARY.md +170 -170
  198. package/kit/framework/templates/research.md +419 -419
  199. package/kit/framework/templates/retrospective.md +54 -54
  200. package/kit/framework/templates/roadmap.md +202 -202
  201. package/kit/framework/templates/state.md +176 -176
  202. package/kit/framework/templates/summary-complex.md +59 -59
  203. package/kit/framework/templates/summary-minimal.md +41 -41
  204. package/kit/framework/templates/summary-standard.md +48 -48
  205. package/kit/framework/templates/summary.md +209 -209
  206. package/kit/framework/templates/user-profile.md +146 -146
  207. package/kit/framework/templates/user-setup.md +256 -256
  208. package/kit/framework/templates/verification-report.md +258 -258
  209. package/kit/framework/workflows/add-phase.md +112 -112
  210. package/kit/framework/workflows/add-tests.md +351 -351
  211. package/kit/framework/workflows/add-todo.md +158 -158
  212. package/kit/framework/workflows/audit-milestone.md +340 -340
  213. package/kit/framework/workflows/audit-uat.md +109 -109
  214. package/kit/framework/workflows/autonomous.md +891 -891
  215. package/kit/framework/workflows/check-todos.md +177 -177
  216. package/kit/framework/workflows/cleanup.md +152 -152
  217. package/kit/framework/workflows/complete-milestone.md +696 -696
  218. package/kit/framework/workflows/diagnose-issues.md +231 -231
  219. package/kit/framework/workflows/discovery-phase.md +289 -289
  220. package/kit/framework/workflows/discuss-phase-assumptions.md +653 -653
  221. package/kit/framework/workflows/discuss-phase.md +784 -784
  222. package/kit/framework/workflows/do.md +104 -104
  223. package/kit/framework/workflows/execute-phase.md +838 -838
  224. package/kit/framework/workflows/execute-plan.md +510 -510
  225. package/kit/framework/workflows/fast.md +102 -102
  226. package/kit/framework/workflows/forensics.md +265 -265
  227. package/kit/framework/workflows/health.md +181 -181
  228. package/kit/framework/workflows/help.md +619 -619
  229. package/kit/framework/workflows/insert-phase.md +130 -130
  230. package/kit/framework/workflows/list-phase-assumptions.md +178 -178
  231. package/kit/framework/workflows/list-workspaces.md +56 -56
  232. package/kit/framework/workflows/manager.md +362 -362
  233. package/kit/framework/workflows/map-codebase.md +377 -377
  234. package/kit/framework/workflows/milestone-summary.md +223 -223
  235. package/kit/framework/workflows/new-milestone.md +486 -486
  236. package/kit/framework/workflows/new-project.md +1159 -1159
  237. package/kit/framework/workflows/new-workspace.md +237 -237
  238. package/kit/framework/workflows/next.md +97 -97
  239. package/kit/framework/workflows/node-repair.md +92 -92
  240. package/kit/framework/workflows/note.md +156 -156
  241. package/kit/framework/workflows/pause-work.md +176 -176
  242. package/kit/framework/workflows/plan-milestone-gaps.md +273 -273
  243. package/kit/framework/workflows/plan-phase.md +765 -765
  244. package/kit/framework/workflows/plant-seed.md +169 -169
  245. package/kit/framework/workflows/pr-branch.md +129 -129
  246. package/kit/framework/workflows/profile-user.md +450 -450
  247. package/kit/framework/workflows/progress.md +507 -507
  248. package/kit/framework/workflows/quick.md +757 -757
  249. package/kit/framework/workflows/remove-phase.md +155 -155
  250. package/kit/framework/workflows/remove-workspace.md +90 -90
  251. package/kit/framework/workflows/research-phase.md +82 -82
  252. package/kit/framework/workflows/resume-project.md +326 -326
  253. package/kit/framework/workflows/review.md +228 -228
  254. package/kit/framework/workflows/session-report.md +146 -146
  255. package/kit/framework/workflows/settings.md +283 -283
  256. package/kit/framework/workflows/ship.md +228 -228
  257. package/kit/framework/workflows/stats.md +60 -60
  258. package/kit/framework/workflows/transition.md +671 -671
  259. package/kit/framework/workflows/ui-phase.md +302 -302
  260. package/kit/framework/workflows/ui-review.md +165 -165
  261. package/kit/framework/workflows/update.md +323 -323
  262. package/kit/framework/workflows/validate-phase.md +174 -174
  263. package/kit/framework/workflows/verify-phase.md +252 -252
  264. package/kit/framework/workflows/verify-work.md +637 -637
  265. package/kit/hooks/check-update.js +118 -118
  266. package/kit/hooks/context-monitor.js +163 -163
  267. package/kit/hooks/prompt-guard.js +103 -103
  268. package/kit/hooks/statusline.js +125 -125
  269. package/kit/hooks/workflow-guard.js +101 -101
  270. package/kit/settings.json +45 -45
  271. package/kit/skills/_shared-supabase/glossary.md +17 -0
  272. package/kit/skills/ai-prompt-characterization/SKILL.md +335 -335
  273. package/kit/skills/armadilhas-sistemas-distribuidos/SKILL.md +447 -447
  274. package/kit/skills/audit-log-multi-tenant/SKILL.md +340 -340
  275. package/kit/skills/b2b-saas-architecture/SKILL.md +300 -300
  276. package/kit/skills/consistencia-leitura-replica/SKILL.md +385 -385
  277. package/kit/skills/crm-lead-pipeline-patterns/SKILL.md +343 -343
  278. package/kit/skills/escolha-modelo-consistencia/SKILL.md +494 -494
  279. package/kit/skills/evolucao-schema-compativel/SKILL.md +448 -448
  280. package/kit/skills/evolution-go-whatsapp-integration/SKILL.md +322 -322
  281. package/kit/skills/example-skill/SKILL.md +42 -42
  282. package/kit/skills/legacy-api-only-applications/SKILL.md +358 -358
  283. package/kit/skills/legacy-characterization-tests/SKILL.md +330 -330
  284. package/kit/skills/legacy-effect-analysis/SKILL.md +331 -331
  285. package/kit/skills/legacy-extract-class/SKILL.md +203 -203
  286. package/kit/skills/legacy-programming-by-difference/SKILL.md +252 -252
  287. package/kit/skills/legacy-seams-and-test-harness/SKILL.md +460 -460
  288. package/kit/skills/legacy-shotgun-surgery/SKILL.md +286 -286
  289. package/kit/skills/legacy-sprout-wrap-techniques/SKILL.md +434 -434
  290. package/kit/skills/legacy-storytelling-naked-crc/SKILL.md +270 -270
  291. package/kit/skills/lgpd-multi-tenant-compliance/SKILL.md +340 -340
  292. package/kit/skills/member-invite-flow/SKILL.md +305 -305
  293. package/kit/skills/member-management-react-shadcn/SKILL.md +328 -328
  294. package/kit/skills/multi-tenant-performance-scaling/SKILL.md +316 -316
  295. package/kit/skills/multi-tenant-rls-hierarchy/SKILL.md +342 -342
  296. package/kit/skills/org-onboarding-flow/SKILL.md +257 -257
  297. package/kit/skills/org-switcher-react-pattern/SKILL.md +349 -349
  298. package/kit/skills/permission-gate-react-pattern/SKILL.md +271 -271
  299. package/kit/skills/postgres-isolamento-concorrencia/SKILL.md +552 -552
  300. package/kit/skills/pre-refactor-characterization/SKILL.md +421 -421
  301. package/kit/skills/rbac-permissions-matrix-supabase/SKILL.md +338 -338
  302. package/kit/skills/streams-eventos-cdc/SKILL.md +711 -711
  303. package/kit/skills/supabase-branching-workflow/SKILL.md +544 -544
  304. package/kit/skills/supabase-ci-cd-github-actions/SKILL.md +880 -880
  305. package/kit/skills/supabase-column-level-security/SKILL.md +426 -426
  306. package/kit/skills/supabase-config-toml-remotes/SKILL.md +807 -807
  307. package/kit/skills/supabase-custom-claims-rbac/SKILL.md +472 -472
  308. package/kit/skills/supabase-edge-functions/SKILL.md +229 -141
  309. package/kit/skills/supabase-edge-functions-auth/SKILL.md +309 -0
  310. package/kit/skills/supabase-edge-functions-limits/SKILL.md +302 -0
  311. package/kit/skills/supabase-edge-functions-mcp-server/SKILL.md +279 -0
  312. package/kit/skills/supabase-edge-functions-testing/SKILL.md +277 -0
  313. package/kit/skills/supabase-edge-runtime-builtins/SKILL.md +357 -0
  314. package/kit/skills/supabase-migration-repair/SKILL.md +823 -823
  315. package/kit/skills/supabase-migrations/SKILL.md +297 -297
  316. package/kit/skills/supabase-pgtap-testing/SKILL.md +1053 -1053
  317. package/kit/skills/supabase-postgres-roles/SKILL.md +392 -392
  318. package/kit/skills/supabase-realtime/SKILL.md +460 -236
  319. package/kit/skills/supabase-rls-defense-in-depth/SKILL.md +418 -418
  320. package/kit/skills/supabase-rls-policies/SKILL.md +635 -635
  321. package/kit/skills/super-admin-platform-pattern/SKILL.md +326 -326
  322. package/kit/skills/tenant-quente-mitigacao/SKILL.md +605 -605
  323. package/kit/skills/whatsapp-conversation-state-machine/SKILL.md +287 -287
  324. package/package.json +1 -1
  325. package/src/core/kit.js +216 -216
  326. package/src/core/reflect.js +247 -247
  327. package/src/core/reverse-sync.js +372 -372
  328. package/src/core/sync.js +418 -418
  329. package/src/core/watch.js +121 -121
  330. package/src/mcp-server/index.js +693 -693
@@ -1,1159 +1,1159 @@
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
- <available_agent_types>
10
- Valid framework subagent types (use exact names — do not fall back to 'general-purpose'):
11
- - project-researcher — Researches project-level technical decisions
12
- - research-synthesizer — Synthesizes findings from parallel research agents
13
- - roadmapper — Creates phased execution roadmaps
14
- </available_agent_types>
15
-
16
- <auto_mode>
17
-
18
- ## Auto Mode Detection
19
-
20
- Check if `--auto` flag is present in $ARGUMENTS.
21
-
22
- **If auto mode:**
23
-
24
- - Skip brownfield mapping offer (assume greenfield)
25
- - Skip deep questioning (extract context from provided document)
26
- - Config: YOLO mode is implicit (skip that question), but ask granularity/git/agents FIRST (Step 2a)
27
- - After config: run Steps 6-9 automatically with smart defaults:
28
- - Research: Always yes
29
- - Requirements: Include all table stakes + features from provided document
30
- - Requirements approval: Auto-approve
31
- - Roadmap approval: Auto-approve
32
-
33
- **Document requirement:**
34
- Auto mode requires an idea document — either:
35
-
36
- - File reference: `/new-project --auto @prd.md`
37
- - Pasted/written text in the prompt
38
-
39
- If no document content provided, error:
40
-
41
- ```
42
- Error: --auto requires an idea document.
43
-
44
- Usage:
45
- /new-project --auto @your-idea.md
46
- /new-project --auto [paste or write your idea here]
47
-
48
- The document should describe what you want to build.
49
- ```
50
-
51
- </auto_mode>
52
-
53
- <process>
54
-
55
- ## 1. Setup
56
-
57
- **MANDATORY FIRST STEP — Execute these checks before ANY user interaction:**
58
-
59
- ```bash
60
- INIT=$(node "./.claude/framework/bin/tools.cjs" init new-project)
61
- if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
62
- AGENT_SKILLS_RESEARCHER=$(node "./.claude/framework/bin/tools.cjs" agent-skills project-researcher 2>/dev/null)
63
- AGENT_SKILLS_SYNTHESIZER=$(node "./.claude/framework/bin/tools.cjs" agent-skills synthesizer 2>/dev/null)
64
- AGENT_SKILLS_ROADMAPPER=$(node "./.claude/framework/bin/tools.cjs" agent-skills roadmapper 2>/dev/null)
65
- ```
66
-
67
- 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`, `project_path`.
68
-
69
- **If `project_exists` is true:** Error — project already initialized. Use `/progress`.
70
-
71
- **If `has_git` is false:** Initialize git:
72
-
73
- ```bash
74
- git init
75
- ```
76
-
77
- ## 2. Brownfield Offer
78
-
79
- **If auto mode:** Skip to Step 4 (assume greenfield, synthesize PROJECT.md from provided document).
80
-
81
- **If `needs_codebase_map` is true** (from init — existing code detected but no codebase map):
82
-
83
- Use AskUserQuestion:
84
-
85
- - header: "Codebase"
86
- - question: "I detected existing code in this directory. Would you like to map the codebase first?"
87
- - options:
88
- - "Map codebase first" — Run /map-codebase to understand existing architecture (Recommended)
89
- - "Skip mapping" — Proceed with project initialization
90
-
91
- **If "Map codebase first":**
92
-
93
- ```
94
- Run `/map-codebase` first, then return to `/new-project`
95
- ```
96
-
97
- Exit command.
98
-
99
- **If "Skip mapping" OR `needs_codebase_map` is false:** Continue to Step 3.
100
-
101
- ## 2a. Auto Mode Config (auto mode only)
102
-
103
- **If auto mode:** Collect config settings upfront before processing the idea document.
104
-
105
- YOLO mode is implicit (auto = YOLO). Ask remaining config questions:
106
-
107
- **Round 1 — Core settings (3 questions, no Mode question):**
108
-
109
- ```
110
- AskUserQuestion([
111
- {
112
- header: "Granularity",
113
- question: "How finely should scope be sliced into phases?",
114
- multiSelect: false,
115
- options: [
116
- { label: "Coarse (Recommended)", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
117
- { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
118
- { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
119
- ]
120
- },
121
- {
122
- header: "Execution",
123
- question: "Run plans in parallel?",
124
- multiSelect: false,
125
- options: [
126
- { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
127
- { label: "Sequential", description: "One plan at a time" }
128
- ]
129
- },
130
- {
131
- header: "Git Tracking",
132
- question: "Commit planning docs to git?",
133
- multiSelect: false,
134
- options: [
135
- { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
136
- { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
137
- ]
138
- }
139
- ])
140
- ```
141
-
142
- **Round 2 — Workflow agents (same as Step 5):**
143
-
144
- ```
145
- AskUserQuestion([
146
- {
147
- header: "Research",
148
- question: "Research before planning each phase? (adds tokens/time)",
149
- multiSelect: false,
150
- options: [
151
- { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
152
- { label: "No", description: "Plan directly from requirements" }
153
- ]
154
- },
155
- {
156
- header: "Plan Check",
157
- question: "Verify plans will achieve their goals? (adds tokens/time)",
158
- multiSelect: false,
159
- options: [
160
- { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
161
- { label: "No", description: "Execute plans without verification" }
162
- ]
163
- },
164
- {
165
- header: "Verifier",
166
- question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
167
- multiSelect: false,
168
- options: [
169
- { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
170
- { label: "No", description: "Trust execution, skip verification" }
171
- ]
172
- },
173
- {
174
- header: "AI Models",
175
- question: "Which AI models for planning agents?",
176
- multiSelect: false,
177
- options: [
178
- { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
179
- { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
180
- { label: "Budget", description: "Haiku where possible — fastest, lowest cost" },
181
- { label: "Inherit", description: "Use the current session model for all agents (OpenCode /model)" }
182
- ]
183
- }
184
- ])
185
- ```
186
-
187
- Create `.planning/config.json` with all settings (CLI fills in remaining defaults automatically):
188
-
189
- ```bash
190
- mkdir -p .planning
191
- node "./.claude/framework/bin/tools.cjs" config-new-project '{"mode":"yolo","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":true|false,"auto_advance":true}}'
192
- ```
193
-
194
- **If commit_docs = No:** Add `.planning/` to `.gitignore`.
195
-
196
- **Commit config.json:**
197
-
198
- ```bash
199
- mkdir -p .planning
200
- node "./.claude/framework/bin/tools.cjs" commit "chore: add project config" --files .planning/config.json
201
- ```
202
-
203
- **Persist auto-advance chain flag to config (survives context compaction):**
204
-
205
- ```bash
206
- node "./.claude/framework/bin/tools.cjs" config-set workflow._auto_chain_active true
207
- ```
208
-
209
- Proceed to Step 4 (skip Steps 3 and 5).
210
-
211
- ## 3. Deep Questioning
212
-
213
- **Auto mode:** pular (handled em 2a) — extrair contexto do documento e ir pra passo 4.
214
-
215
- **Banner:** `framework ► QUESTIONING`.
216
-
217
- **Abrir:** pergunta inline freeform (NÃO AskUserQuestion): "What do you want to build?". Aguardar resposta.
218
-
219
- **Modo `workflow.research_before_questions`:** se enabled, antes de follow-ups numa área, fazer breve web search por melhores práticas e mencionar findings naturalmente ("Most projects like this use X — is that what you're thinking?"). Default off, perguntar direto.
220
-
221
- **Follow the thread:** AskUserQuestion com options que provocam interpretações/clarificações/exemplos. Cada resposta abre novos threads. Cobrir: o que empolgou, problema que sparkou, termos vagos, como seria na prática, o que já está decidido.
222
-
223
- **Técnicas de `questioning.md`:** challenge vagueness, concretize abstract, surface assumptions, find edges, reveal motivation.
224
-
225
- Mentalmente validar checklist do `questioning.md`; se gaps, tecer perguntas naturalmente (não modo checklist).
226
-
227
- **Decision gate:** quando puder escrever PROJECT.md claro, AskUserQuestion `Ready?` — "Create PROJECT.md" ou "Keep exploring". Loop até "Create".
228
-
229
- ## 4. Write PROJECT.md
230
-
231
- **If auto mode:** Synthesize from provided document. No "Ready?" gate was shown — proceed directly to commit.
232
-
233
- Synthesize all context into `.planning/PROJECT.md` using the template from `templates/project.md`.
234
-
235
- **For greenfield projects:**
236
-
237
- Initialize requirements as hypotheses:
238
-
239
- ```markdown
240
- ## Requirements
241
-
242
- ### Validated
243
-
244
- (None yet — ship to validate)
245
-
246
- ### Active
247
-
248
- - [ ] [Requirement 1]
249
- - [ ] [Requirement 2]
250
- - [ ] [Requirement 3]
251
-
252
- ### Out of Scope
253
-
254
- - [Exclusion 1] — [why]
255
- - [Exclusion 2] — [why]
256
- ```
257
-
258
- All Active requirements are hypotheses until shipped and validated.
259
-
260
- **For brownfield projects (codebase map exists):**
261
-
262
- Infer Validated requirements from existing code:
263
-
264
- 1. Read `.planning/codebase/ARCHITECTURE.md` and `STACK.md`
265
- 2. Identify what the codebase already does
266
- 3. These become the initial Validated set
267
-
268
- ```markdown
269
- ## Requirements
270
-
271
- ### Validated
272
-
273
- - ✓ [Existing capability 1] — existing
274
- - ✓ [Existing capability 2] — existing
275
- - ✓ [Existing capability 3] — existing
276
-
277
- ### Active
278
-
279
- - [ ] [New requirement 1]
280
- - [ ] [New requirement 2]
281
-
282
- ### Out of Scope
283
-
284
- - [Exclusion 1] — [why]
285
- ```
286
-
287
- **Key Decisions:**
288
-
289
- Initialize with any decisions made during questioning:
290
-
291
- ```markdown
292
- ## Key Decisions
293
-
294
- | Decision | Rationale | Outcome |
295
- |----------|-----------|---------|
296
- | [Choice from questioning] | [Why] | — Pending |
297
- ```
298
-
299
- **Last updated footer:**
300
-
301
- ```markdown
302
- ---
303
- *Last updated: [date] after initialization*
304
- ```
305
-
306
- **Evolution section** (include at the end of PROJECT.md, before the footer):
307
-
308
- ```markdown
309
- ## Evolution
310
-
311
- This document evolves at phase transitions and milestone boundaries.
312
-
313
- **After each phase transition** (via `/transition`):
314
- 1. Requirements invalidated? → Move to Out of Scope with reason
315
- 2. Requirements validated? → Move to Validated with phase reference
316
- 3. New requirements emerged? → Add to Active
317
- 4. Decisions to log? → Add to Key Decisions
318
- 5. "What This Is" still accurate? → Update if drifted
319
-
320
- **After each milestone** (via `/complete-milestone`):
321
- 1. Full review of all sections
322
- 2. Core Value check — still the right priority?
323
- 3. Audit Out of Scope — reasons still valid?
324
- 4. Update Context with current state
325
- ```
326
-
327
- Do not compress. Capture everything gathered.
328
-
329
- **Commit PROJECT.md:**
330
-
331
- ```bash
332
- mkdir -p .planning
333
- node "./.claude/framework/bin/tools.cjs" commit "docs: initialize project" --files .planning/PROJECT.md
334
- ```
335
-
336
- ## 5. Workflow Preferences
337
-
338
- **If auto mode:** Skip — config was collected in Step 2a. Proceed to Step 5.5.
339
-
340
- **Check for global defaults** at `~/.framework/defaults.json`. If the file exists, offer to use saved defaults:
341
-
342
- ```
343
- AskUserQuestion([
344
- {
345
- question: "Use your saved default settings? (from ~/.framework/defaults.json)",
346
- header: "Defaults",
347
- multiSelect: false,
348
- options: [
349
- { label: "Yes (Recommended)", description: "Use saved defaults, skip settings questions" },
350
- { label: "No", description: "Configure settings manually" }
351
- ]
352
- }
353
- ])
354
- ```
355
-
356
- If "Yes": read `~/.framework/defaults.json`, use those values for config.json, and skip directly to **Commit config.json** below.
357
-
358
- If "No" or `~/.framework/defaults.json` doesn't exist: proceed with the questions below.
359
-
360
- **Round 1 — Core workflow settings (4 questions):**
361
-
362
- ```
363
- questions: [
364
- {
365
- header: "Mode",
366
- question: "How do you want to work?",
367
- multiSelect: false,
368
- options: [
369
- { label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
370
- { label: "Interactive", description: "Confirm at each step" }
371
- ]
372
- },
373
- {
374
- header: "Granularity",
375
- question: "How finely should scope be sliced into phases?",
376
- multiSelect: false,
377
- options: [
378
- { label: "Coarse", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
379
- { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
380
- { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
381
- ]
382
- },
383
- {
384
- header: "Execution",
385
- question: "Run plans in parallel?",
386
- multiSelect: false,
387
- options: [
388
- { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
389
- { label: "Sequential", description: "One plan at a time" }
390
- ]
391
- },
392
- {
393
- header: "Git Tracking",
394
- question: "Commit planning docs to git?",
395
- multiSelect: false,
396
- options: [
397
- { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
398
- { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
399
- ]
400
- }
401
- ]
402
- ```
403
-
404
- **Round 2 — Workflow agents (opt-in, adicionam tokens/tempo, melhoram qualidade):**
405
-
406
- | Agent | Quando | O que faz |
407
- |---|---|---|
408
- | Researcher | Antes de cada plan-phase | Investiga domínio, padrões, pitfalls |
409
- | Plan Checker | Após plano criado | Verifica se plano atinge o goal |
410
- | Verifier | Após execução | Confirma must-haves entregues |
411
-
412
- Todos recomendados pra projetos sérios; pular pra experimentos rápidos.
413
-
414
- AskUserQuestion: 4 perguntas — `Research` (yes/no), `Plan Check` (yes/no), `Verifier` (yes/no), `AI Models` (Balanced=Sonnet recomendado / Quality=Opus / Budget=Haiku / Inherit=session model).
415
-
416
- Create `.planning/config.json` with all settings (CLI fills in remaining defaults automatically):
417
-
418
- ```bash
419
- mkdir -p .planning
420
- node "./.claude/framework/bin/tools.cjs" config-new-project '{"mode":"[yolo|interactive]","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":[false if granularity=coarse, true otherwise]}}'
421
- ```
422
-
423
- **Note:** Run `/settings` anytime to update model profile, workflow agents, branching strategy, and other preferences.
424
-
425
- **If commit_docs = No:**
426
-
427
- - Set `commit_docs: false` in config.json
428
- - Add `.planning/` to `.gitignore` (create if needed)
429
-
430
- **If commit_docs = Yes:**
431
-
432
- - No additional gitignore entries needed
433
-
434
- **Commit config.json:**
435
-
436
- ```bash
437
- node "./.claude/framework/bin/tools.cjs" commit "chore: add project config" --files .planning/config.json
438
- ```
439
-
440
- ## 5.1. Sub-Repo Detection
441
-
442
- **Detect multi-repo workspace:**
443
-
444
- Check for directories with their own `.git` folders (separate repos within the workspace):
445
-
446
- ```bash
447
- find . -maxdepth 1 -type d -not -name ".*" -not -name "node_modules" -exec test -d "{}/.git" \; -print
448
- ```
449
-
450
- **If sub-repos found:**
451
-
452
- Strip the `./` prefix to get directory names (e.g., `./backend` → `backend`).
453
-
454
- Use AskUserQuestion:
455
-
456
- - header: "Multi-Repo Workspace"
457
- - question: "I detected separate git repos in this workspace. Which directories contain code that framework should commit to?"
458
- - multiSelect: true
459
- - options: one option per detected directory
460
- - "[directory name]" — Separate git repo
461
-
462
- **If user selects one or more directories:**
463
-
464
- - Set `planning.sub_repos` in config.json to the selected directory names array (e.g., `["backend", "frontend"]`)
465
- - Auto-set `planning.commit_docs` to `false` (planning docs stay local in multi-repo workspaces)
466
- - Add `.planning/` to `.gitignore` if not already present
467
-
468
- Config changes are saved locally — no commit needed since `commit_docs` is `false` in multi-repo mode.
469
-
470
- **If no sub-repos found or user selects none:** Continue with no changes to config.
471
-
472
- ## 5.5. Resolve Model Profile
473
-
474
- Use models from init: `researcher_model`, `synthesizer_model`, `roadmapper_model`.
475
-
476
- ## 6. Research Decision
477
-
478
- **If auto mode:** Default to "Research first" without asking.
479
-
480
- Use AskUserQuestion:
481
-
482
- - header: "Research"
483
- - question: "Research the domain ecosystem before defining requirements?"
484
- - options:
485
- - "Research first (Recommended)" — Discover standard stacks, expected features, architecture patterns
486
- - "Skip research" — I know this domain well, go straight to requirements
487
-
488
- **If "Research first":**
489
-
490
- Display stage banner:
491
-
492
- ```
493
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
494
- framework ► RESEARCHING
495
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
496
-
497
- Researching [domain] ecosystem...
498
- ```
499
-
500
- Create research directory:
501
-
502
- ```bash
503
- mkdir -p .planning/research
504
- ```
505
-
506
- **Determine milestone context:**
507
-
508
- Check if this is greenfield or subsequent milestone:
509
-
510
- - If no "Validated" requirements in PROJECT.md → Greenfield (building from scratch)
511
- - If "Validated" requirements exist → Subsequent milestone (adding to existing app)
512
-
513
- Display spawning indicator:
514
-
515
- ```
516
- ◆ Spawning 4 researchers in parallel...
517
- → Stack research
518
- → Features research
519
- → Architecture research
520
- → Pitfalls research
521
- ```
522
-
523
- Spawn 4 parallel project-researcher agents with path references:
524
-
525
- ```
526
- Task(prompt="<research_type>
527
- Project Research — Stack dimension for [domain].
528
- </research_type>
529
-
530
- <milestone_context>
531
- [greenfield OR subsequent]
532
-
533
- Greenfield: Research the standard stack for building [domain] from scratch.
534
- Subsequent: Research what's needed to add [target features] to an existing [domain] app. Don't re-research the existing system.
535
- </milestone_context>
536
-
537
- <question>
538
- What's the standard 2025 stack for [domain]?
539
- </question>
540
-
541
- <files_to_read>
542
- - {project_path} (Project context and goals)
543
- </files_to_read>
544
-
545
- ${AGENT_SKILLS_RESEARCHER}
546
-
547
- <downstream_consumer>
548
- Your STACK.md feeds into roadmap creation. Be prescriptive:
549
- - Specific libraries with versions
550
- - Clear rationale for each choice
551
- - What NOT to use and why
552
- </downstream_consumer>
553
-
554
- <quality_gate>
555
- - [ ] Versions are current (verify with Context7/official docs, not training data)
556
- - [ ] Rationale explains WHY, not just WHAT
557
- - [ ] Confidence levels assigned to each recommendation
558
- </quality_gate>
559
-
560
- <output>
561
- Write to: .planning/research/STACK.md
562
- Use template: ./.claude/framework/templates/research-project/STACK.md
563
- </output>
564
- ", subagent_type="project-researcher", model="{researcher_model}", description="Stack research")
565
-
566
- Task(prompt="<research_type>
567
- Project Research — Features dimension for [domain].
568
- </research_type>
569
-
570
- <milestone_context>
571
- [greenfield OR subsequent]
572
-
573
- Greenfield: What features do [domain] products have? What's table stakes vs differentiating?
574
- Subsequent: How do [target features] typically work? What's expected behavior?
575
- </milestone_context>
576
-
577
- <question>
578
- What features do [domain] products have? What's table stakes vs differentiating?
579
- </question>
580
-
581
- <files_to_read>
582
- - {project_path} (Project context)
583
- </files_to_read>
584
-
585
- ${AGENT_SKILLS_RESEARCHER}
586
-
587
- <downstream_consumer>
588
- Your FEATURES.md feeds into requirements definition. Categorize clearly:
589
- - Table stakes (must have or users leave)
590
- - Differentiators (competitive advantage)
591
- - Anti-features (things to deliberately NOT build)
592
- </downstream_consumer>
593
-
594
- <quality_gate>
595
- - [ ] Categories are clear (table stakes vs differentiators vs anti-features)
596
- - [ ] Complexity noted for each feature
597
- - [ ] Dependencies between features identified
598
- </quality_gate>
599
-
600
- <output>
601
- Write to: .planning/research/FEATURES.md
602
- Use template: ./.claude/framework/templates/research-project/FEATURES.md
603
- </output>
604
- ", subagent_type="project-researcher", model="{researcher_model}", description="Features research")
605
-
606
- Task(prompt="<research_type>
607
- Project Research — Architecture dimension for [domain].
608
- </research_type>
609
-
610
- <milestone_context>
611
- [greenfield OR subsequent]
612
-
613
- Greenfield: How are [domain] systems typically structured? What are major components?
614
- Subsequent: How do [target features] integrate with existing [domain] architecture?
615
- </milestone_context>
616
-
617
- <question>
618
- How are [domain] systems typically structured? What are major components?
619
- </question>
620
-
621
- <files_to_read>
622
- - {project_path} (Project context)
623
- </files_to_read>
624
-
625
- ${AGENT_SKILLS_RESEARCHER}
626
-
627
- <downstream_consumer>
628
- Your ARCHITECTURE.md informs phase structure in roadmap. Include:
629
- - Component boundaries (what talks to what)
630
- - Data flow (how information moves)
631
- - Suggested build order (dependencies between components)
632
- </downstream_consumer>
633
-
634
- <quality_gate>
635
- - [ ] Components clearly defined with boundaries
636
- - [ ] Data flow direction explicit
637
- - [ ] Build order implications noted
638
- </quality_gate>
639
-
640
- <output>
641
- Write to: .planning/research/ARCHITECTURE.md
642
- Use template: ./.claude/framework/templates/research-project/ARCHITECTURE.md
643
- </output>
644
- ", subagent_type="project-researcher", model="{researcher_model}", description="Architecture research")
645
-
646
- Task(prompt="<research_type>
647
- Project Research — Pitfalls dimension for [domain].
648
- </research_type>
649
-
650
- <milestone_context>
651
- [greenfield OR subsequent]
652
-
653
- Greenfield: What do [domain] projects commonly get wrong? Critical mistakes?
654
- Subsequent: What are common mistakes when adding [target features] to [domain]?
655
- </milestone_context>
656
-
657
- <question>
658
- What do [domain] projects commonly get wrong? Critical mistakes?
659
- </question>
660
-
661
- <files_to_read>
662
- - {project_path} (Project context)
663
- </files_to_read>
664
-
665
- ${AGENT_SKILLS_RESEARCHER}
666
-
667
- <downstream_consumer>
668
- Your PITFALLS.md prevents mistakes in roadmap/planning. For each pitfall:
669
- - Warning signs (how to detect early)
670
- - Prevention strategy (how to avoid)
671
- - Which phase should address it
672
- </downstream_consumer>
673
-
674
- <quality_gate>
675
- - [ ] Pitfalls are specific to this domain (not generic advice)
676
- - [ ] Prevention strategies are actionable
677
- - [ ] Phase mapping included where relevant
678
- </quality_gate>
679
-
680
- <output>
681
- Write to: .planning/research/PITFALLS.md
682
- Use template: ./.claude/framework/templates/research-project/PITFALLS.md
683
- </output>
684
- ", subagent_type="project-researcher", model="{researcher_model}", description="Pitfalls research")
685
- ```
686
-
687
- After all 4 agents complete, spawn synthesizer to create SUMMARY.md:
688
-
689
- ```
690
- Task(prompt="
691
- <task>
692
- Synthesize research outputs into SUMMARY.md.
693
- </task>
694
-
695
- <files_to_read>
696
- - .planning/research/STACK.md
697
- - .planning/research/FEATURES.md
698
- - .planning/research/ARCHITECTURE.md
699
- - .planning/research/PITFALLS.md
700
- </files_to_read>
701
-
702
- ${AGENT_SKILLS_SYNTHESIZER}
703
-
704
- <output>
705
- Write to: .planning/research/SUMMARY.md
706
- Use template: ./.claude/framework/templates/research-project/SUMMARY.md
707
- Commit after writing.
708
- </output>
709
- ", subagent_type="research-synthesizer", model="{synthesizer_model}", description="Synthesize research")
710
- ```
711
-
712
- Display research complete banner and key findings:
713
-
714
- ```
715
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
716
- framework ► RESEARCH COMPLETE ✓
717
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
718
-
719
- ## Key Findings
720
-
721
- **Stack:** [from SUMMARY.md]
722
- **Table Stakes:** [from SUMMARY.md]
723
- **Watch Out For:** [from SUMMARY.md]
724
-
725
- Files: `.planning/research/`
726
- ```
727
-
728
- **If "Skip research":** Continue to Step 7.
729
-
730
- ## 7. Define Requirements
731
-
732
- Display stage banner:
733
-
734
- ```
735
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
736
- framework ► DEFINING REQUIREMENTS
737
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
738
- ```
739
-
740
- **Load context:**
741
-
742
- Read PROJECT.md and extract:
743
-
744
- - Core value (the ONE thing that must work)
745
- - Stated constraints (budget, timeline, tech limitations)
746
- - Any explicit scope boundaries
747
-
748
- **If research exists:** Read research/FEATURES.md and extract feature categories.
749
-
750
- **If auto mode:**
751
-
752
- - Auto-include all table stakes features (users expect these)
753
- - Include features explicitly mentioned in provided document
754
- - Auto-defer differentiators not mentioned in document
755
- - Skip per-category AskUserQuestion loops
756
- - Skip "Any additions?" question
757
- - Skip requirements approval gate
758
- - Generate REQUIREMENTS.md and commit directly
759
-
760
- **Present features by category (interactive mode only):**
761
-
762
- ```
763
- Here are the features for [domain]:
764
-
765
- ## Authentication
766
- **Table stakes:**
767
- - Sign up with email/password
768
- - Email verification
769
- - Password reset
770
- - Session management
771
-
772
- **Differentiators:**
773
- - Magic link login
774
- - OAuth (Google, GitHub)
775
- - 2FA
776
-
777
- **Research notes:** [any relevant notes]
778
-
779
- ---
780
-
781
- ## [Next Category]
782
- ...
783
- ```
784
-
785
- **If no research:** Gather requirements through conversation instead.
786
-
787
- Ask: "What are the main things users need to be able to do?"
788
-
789
- For each capability mentioned:
790
-
791
- - Ask clarifying questions to make it specific
792
- - Probe for related capabilities
793
- - Group into categories
794
-
795
- **Scope each category:**
796
-
797
- For each category, use AskUserQuestion:
798
-
799
- - header: "[Category]" (max 12 chars)
800
- - question: "Which [category] features are in v1?"
801
- - multiSelect: true
802
- - options:
803
- - "[Feature 1]" — [brief description]
804
- - "[Feature 2]" — [brief description]
805
- - "[Feature 3]" — [brief description]
806
- - "None for v1" — Defer entire category
807
-
808
- Track responses:
809
-
810
- - Selected features → v1 requirements
811
- - Unselected table stakes → v2 (users expect these)
812
- - Unselected differentiators → out of scope
813
-
814
- **Identify gaps:**
815
-
816
- Use AskUserQuestion:
817
-
818
- - header: "Additions"
819
- - question: "Any requirements research missed? (Features specific to your vision)"
820
- - options:
821
- - "No, research covered it" — Proceed
822
- - "Yes, let me add some" — Capture additions
823
-
824
- **Validate core value:**
825
-
826
- Cross-check requirements against Core Value from PROJECT.md. If gaps detected, surface them.
827
-
828
- **Generate REQUIREMENTS.md:**
829
-
830
- Create `.planning/REQUIREMENTS.md` with:
831
-
832
- - v1 Requirements grouped by category (checkboxes, REQ-IDs)
833
- - v2 Requirements (deferred)
834
- - Out of Scope (explicit exclusions with reasoning)
835
- - Traceability section (empty, filled by roadmap)
836
-
837
- **REQ-ID format:** `[CATEGORY]-[NUMBER]` (AUTH-01, CONTENT-02)
838
-
839
- **Requirement quality criteria:**
840
-
841
- Good requirements are:
842
-
843
- - **Specific and testable:** "User can reset password via email link" (not "Handle password reset")
844
- - **User-centric:** "User can X" (not "System does Y")
845
- - **Atomic:** One capability per requirement (not "User can login and manage profile")
846
- - **Independent:** Minimal dependencies on other requirements
847
-
848
- Reject vague requirements. Push for specificity:
849
-
850
- - "Handle authentication" → "User can log in with email/password and stay logged in across sessions"
851
- - "Support sharing" → "User can share post via link that opens in recipient's browser"
852
-
853
- **Present full requirements list (interactive mode only):**
854
-
855
- Show every requirement (not counts) for user confirmation:
856
-
857
- ```
858
- ## v1 Requirements
859
-
860
- ### Authentication
861
- - [ ] **AUTH-01**: User can create account with email/password
862
- - [ ] **AUTH-02**: User can log in and stay logged in across sessions
863
- - [ ] **AUTH-03**: User can log out from any page
864
-
865
- ### Content
866
- - [ ] **CONT-01**: User can create posts with text
867
- - [ ] **CONT-02**: User can edit their own posts
868
-
869
- [... full list ...]
870
-
871
- ---
872
-
873
- Does this capture what you're building? (yes / adjust)
874
- ```
875
-
876
- If "adjust": Return to scoping.
877
-
878
- **Commit requirements:**
879
-
880
- ```bash
881
- node "./.claude/framework/bin/tools.cjs" commit "docs: define v1 requirements" --files .planning/REQUIREMENTS.md
882
- ```
883
-
884
- ## 8. Create Roadmap
885
-
886
- Display stage banner:
887
-
888
- ```
889
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
890
- framework ► CREATING ROADMAP
891
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
892
-
893
- ◆ Spawning roadmapper...
894
- ```
895
-
896
- Spawn roadmapper agent with path references:
897
-
898
- ```
899
- Task(prompt="
900
- <planning_context>
901
-
902
- <files_to_read>
903
- - .planning/PROJECT.md (Project context)
904
- - .planning/REQUIREMENTS.md (v1 Requirements)
905
- - .planning/research/SUMMARY.md (Research findings - if exists)
906
- - .planning/config.json (Granularity and mode settings)
907
- </files_to_read>
908
-
909
- ${AGENT_SKILLS_ROADMAPPER}
910
-
911
- </planning_context>
912
-
913
- <instructions>
914
- Create roadmap:
915
- 1. Derive phases from requirements (don't impose structure)
916
- 2. Map every v1 requirement to exactly one phase
917
- 3. Derive 2-5 success criteria per phase (observable user behaviors)
918
- 4. Validate 100% coverage
919
- 5. Write files immediately (ROADMAP.md, STATE.md, update REQUIREMENTS.md traceability)
920
- 6. Return ROADMAP CREATED with summary
921
-
922
- Write files first, then return. This ensures artifacts persist even if context is lost.
923
- </instructions>
924
- ", subagent_type="roadmapper", model="{roadmapper_model}", description="Create roadmap")
925
- ```
926
-
927
- **Handle roadmapper return:**
928
-
929
- **If `## ROADMAP BLOCKED`:**
930
-
931
- - Present blocker information
932
- - Work with user to resolve
933
- - Re-spawn when resolved
934
-
935
- **If `## ROADMAP CREATED`:**
936
-
937
- Read the created ROADMAP.md and present it nicely inline:
938
-
939
- ```
940
- ---
941
-
942
- ## Proposed Roadmap
943
-
944
- **[N] phases** | **[X] requirements mapped** | All v1 requirements covered ✓
945
-
946
- | # | Phase | Goal | Requirements | Success Criteria |
947
- |---|-------|------|--------------|------------------|
948
- | 1 | [Name] | [Goal] | [REQ-IDs] | [count] |
949
- | 2 | [Name] | [Goal] | [REQ-IDs] | [count] |
950
- | 3 | [Name] | [Goal] | [REQ-IDs] | [count] |
951
- ...
952
-
953
- ### Phase Details
954
-
955
- **Phase 1: [Name]**
956
- Goal: [goal]
957
- Requirements: [REQ-IDs]
958
- Success criteria:
959
- 1. [criterion]
960
- 2. [criterion]
961
- 3. [criterion]
962
-
963
- **Phase 2: [Name]**
964
- Goal: [goal]
965
- Requirements: [REQ-IDs]
966
- Success criteria:
967
- 1. [criterion]
968
- 2. [criterion]
969
-
970
- [... continue for all phases ...]
971
-
972
- ---
973
- ```
974
-
975
- **If auto mode:** Skip approval gate — auto-approve and commit directly.
976
-
977
- **CRITICAL: Ask for approval before committing (interactive mode only):**
978
-
979
- Use AskUserQuestion:
980
-
981
- - header: "Roadmap"
982
- - question: "Does this roadmap structure work for you?"
983
- - options:
984
- - "Approve" — Commit and continue
985
- - "Adjust phases" — Tell me what to change
986
- - "Review full file" — Show raw ROADMAP.md
987
-
988
- **If "Approve":** Continue to commit.
989
-
990
- **If "Adjust phases":**
991
-
992
- - Get user's adjustment notes
993
- - Re-spawn roadmapper with revision context:
994
-
995
- ```
996
- Task(prompt="
997
- <revision>
998
- User feedback on roadmap:
999
- [user's notes]
1000
-
1001
- <files_to_read>
1002
- - .planning/ROADMAP.md (Current roadmap to revise)
1003
- </files_to_read>
1004
-
1005
- ${AGENT_SKILLS_ROADMAPPER}
1006
-
1007
- Update the roadmap based on feedback. Edit files in place.
1008
- Return ROADMAP REVISED with changes made.
1009
- </revision>
1010
- ", subagent_type="roadmapper", model="{roadmapper_model}", description="Revise roadmap")
1011
- ```
1012
-
1013
- - Present revised roadmap
1014
- - Loop until user approves
1015
-
1016
- **If "Review full file":** Display raw `cat .planning/ROADMAP.md`, then re-ask.
1017
-
1018
- **Generate or refresh project CLAUDE.md before final commit:**
1019
-
1020
- ```bash
1021
- node "./.claude/framework/bin/tools.cjs" generate-claude-md
1022
- ```
1023
-
1024
- This ensures new projects get the default framework workflow-enforcement guidance and current project context in `CLAUDE.md`.
1025
-
1026
- **Commit roadmap (after approval or auto mode):**
1027
-
1028
- ```bash
1029
- node "./.claude/framework/bin/tools.cjs" commit "docs: create roadmap ([N] phases)" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md CLAUDE.md
1030
- ```
1031
-
1032
- ## 9. Done
1033
-
1034
- Present completion summary:
1035
-
1036
- ```
1037
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1038
- framework ► PROJECT INITIALIZED ✓
1039
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1040
-
1041
- **[Project Name]**
1042
-
1043
- | Artifact | Location |
1044
- |----------------|-----------------------------|
1045
- | Project | `.planning/PROJECT.md` |
1046
- | Config | `.planning/config.json` |
1047
- | Research | `.planning/research/` |
1048
- | Requirements | `.planning/REQUIREMENTS.md` |
1049
- | Roadmap | `.planning/ROADMAP.md` |
1050
- | Project guide | `CLAUDE.md` |
1051
-
1052
- **[N] phases** | **[X] requirements** | Ready to build ✓
1053
- ```
1054
-
1055
- **If auto mode:**
1056
-
1057
- ```
1058
- ╔══════════════════════════════════════════╗
1059
- ║ AUTO-ADVANCING → DISCUSS PHASE 1 ║
1060
- ╚══════════════════════════════════════════╝
1061
- ```
1062
-
1063
- Exit skill and invoke SlashCommand("/discuss-phase 1 --auto")
1064
-
1065
- **If interactive mode:**
1066
-
1067
- Check if Phase 1 has UI indicators (look for `**UI hint**: yes` in Phase 1 detail section of ROADMAP.md):
1068
-
1069
- ```bash
1070
- PHASE1_SECTION=$(node "./.claude/framework/bin/tools.cjs" roadmap get-phase 1 2>/dev/null)
1071
- PHASE1_HAS_UI=$(echo "$PHASE1_SECTION" | grep -qi "UI hint.*yes" && echo "true" || echo "false")
1072
- ```
1073
-
1074
- **If Phase 1 has UI (`PHASE1_HAS_UI` is `true`):**
1075
-
1076
- ```
1077
- ───────────────────────────────────────────────────────────────
1078
-
1079
- ## ▶ Next Up
1080
-
1081
- **Phase 1: [Phase Name]** — [Goal from ROADMAP.md]
1082
-
1083
- /discuss-phase 1 — gather context and clarify approach
1084
-
1085
- <sub>/clear first → fresh context window</sub>
1086
-
1087
- ---
1088
-
1089
- **Also available:**
1090
- - /ui-phase 1 — generate UI design contract (recommended for frontend phases)
1091
- - /plan-phase 1 — skip discussion, plan directly
1092
-
1093
- ───────────────────────────────────────────────────────────────
1094
- ```
1095
-
1096
- **If Phase 1 has no UI:**
1097
-
1098
- ```
1099
- ───────────────────────────────────────────────────────────────
1100
-
1101
- ## ▶ Next Up
1102
-
1103
- **Phase 1: [Phase Name]** — [Goal from ROADMAP.md]
1104
-
1105
- /discuss-phase 1 — gather context and clarify approach
1106
-
1107
- <sub>/clear first → fresh context window</sub>
1108
-
1109
- ---
1110
-
1111
- **Also available:**
1112
- - /plan-phase 1 — skip discussion, plan directly
1113
-
1114
- ───────────────────────────────────────────────────────────────
1115
- ```
1116
-
1117
- </process>
1118
-
1119
- <output>
1120
-
1121
- - `.planning/PROJECT.md`
1122
- - `.planning/config.json`
1123
- - `.planning/research/` (if research selected)
1124
- - `STACK.md`
1125
- - `FEATURES.md`
1126
- - `ARCHITECTURE.md`
1127
- - `PITFALLS.md`
1128
- - `SUMMARY.md`
1129
- - `.planning/REQUIREMENTS.md`
1130
- - `.planning/ROADMAP.md`
1131
- - `.planning/STATE.md`
1132
- - `CLAUDE.md`
1133
-
1134
- </output>
1135
-
1136
- <success_criteria>
1137
-
1138
- - [ ] .planning/ directory created
1139
- - [ ] Git repo initialized
1140
- - [ ] Brownfield detection completed
1141
- - [ ] Deep questioning completed (threads followed, not rushed)
1142
- - [ ] PROJECT.md captures full context → **committed**
1143
- - [ ] config.json has workflow mode, granularity, parallelization → **committed**
1144
- - [ ] Research completed (if selected) — 4 parallel agents spawned → **committed**
1145
- - [ ] Requirements gathered (from research or conversation)
1146
- - [ ] User scoped each category (v1/v2/out of scope)
1147
- - [ ] REQUIREMENTS.md created with REQ-IDs → **committed**
1148
- - [ ] roadmapper spawned with context
1149
- - [ ] Roadmap files written immediately (not draft)
1150
- - [ ] User feedback incorporated (if any)
1151
- - [ ] ROADMAP.md created with phases, requirement mappings, success criteria
1152
- - [ ] STATE.md initialized
1153
- - [ ] REQUIREMENTS.md traceability updated
1154
- - [ ] CLAUDE.md generated with framework workflow guidance
1155
- - [ ] User knows next step is `/discuss-phase 1`
1156
-
1157
- **Atomic commits:** Each phase commits its artifacts immediately. If context is lost, artifacts persist.
1158
-
1159
- </success_criteria>
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
+ <available_agent_types>
10
+ Valid framework subagent types (use exact names — do not fall back to 'general-purpose'):
11
+ - project-researcher — Researches project-level technical decisions
12
+ - research-synthesizer — Synthesizes findings from parallel research agents
13
+ - roadmapper — Creates phased execution roadmaps
14
+ </available_agent_types>
15
+
16
+ <auto_mode>
17
+
18
+ ## Auto Mode Detection
19
+
20
+ Check if `--auto` flag is present in $ARGUMENTS.
21
+
22
+ **If auto mode:**
23
+
24
+ - Skip brownfield mapping offer (assume greenfield)
25
+ - Skip deep questioning (extract context from provided document)
26
+ - Config: YOLO mode is implicit (skip that question), but ask granularity/git/agents FIRST (Step 2a)
27
+ - After config: run Steps 6-9 automatically with smart defaults:
28
+ - Research: Always yes
29
+ - Requirements: Include all table stakes + features from provided document
30
+ - Requirements approval: Auto-approve
31
+ - Roadmap approval: Auto-approve
32
+
33
+ **Document requirement:**
34
+ Auto mode requires an idea document — either:
35
+
36
+ - File reference: `/new-project --auto @prd.md`
37
+ - Pasted/written text in the prompt
38
+
39
+ If no document content provided, error:
40
+
41
+ ```
42
+ Error: --auto requires an idea document.
43
+
44
+ Usage:
45
+ /new-project --auto @your-idea.md
46
+ /new-project --auto [paste or write your idea here]
47
+
48
+ The document should describe what you want to build.
49
+ ```
50
+
51
+ </auto_mode>
52
+
53
+ <process>
54
+
55
+ ## 1. Setup
56
+
57
+ **MANDATORY FIRST STEP — Execute these checks before ANY user interaction:**
58
+
59
+ ```bash
60
+ INIT=$(node "./.claude/framework/bin/tools.cjs" init new-project)
61
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
62
+ AGENT_SKILLS_RESEARCHER=$(node "./.claude/framework/bin/tools.cjs" agent-skills project-researcher 2>/dev/null)
63
+ AGENT_SKILLS_SYNTHESIZER=$(node "./.claude/framework/bin/tools.cjs" agent-skills synthesizer 2>/dev/null)
64
+ AGENT_SKILLS_ROADMAPPER=$(node "./.claude/framework/bin/tools.cjs" agent-skills roadmapper 2>/dev/null)
65
+ ```
66
+
67
+ 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`, `project_path`.
68
+
69
+ **If `project_exists` is true:** Error — project already initialized. Use `/progress`.
70
+
71
+ **If `has_git` is false:** Initialize git:
72
+
73
+ ```bash
74
+ git init
75
+ ```
76
+
77
+ ## 2. Brownfield Offer
78
+
79
+ **If auto mode:** Skip to Step 4 (assume greenfield, synthesize PROJECT.md from provided document).
80
+
81
+ **If `needs_codebase_map` is true** (from init — existing code detected but no codebase map):
82
+
83
+ Use AskUserQuestion:
84
+
85
+ - header: "Codebase"
86
+ - question: "I detected existing code in this directory. Would you like to map the codebase first?"
87
+ - options:
88
+ - "Map codebase first" — Run /map-codebase to understand existing architecture (Recommended)
89
+ - "Skip mapping" — Proceed with project initialization
90
+
91
+ **If "Map codebase first":**
92
+
93
+ ```
94
+ Run `/map-codebase` first, then return to `/new-project`
95
+ ```
96
+
97
+ Exit command.
98
+
99
+ **If "Skip mapping" OR `needs_codebase_map` is false:** Continue to Step 3.
100
+
101
+ ## 2a. Auto Mode Config (auto mode only)
102
+
103
+ **If auto mode:** Collect config settings upfront before processing the idea document.
104
+
105
+ YOLO mode is implicit (auto = YOLO). Ask remaining config questions:
106
+
107
+ **Round 1 — Core settings (3 questions, no Mode question):**
108
+
109
+ ```
110
+ AskUserQuestion([
111
+ {
112
+ header: "Granularity",
113
+ question: "How finely should scope be sliced into phases?",
114
+ multiSelect: false,
115
+ options: [
116
+ { label: "Coarse (Recommended)", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
117
+ { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
118
+ { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
119
+ ]
120
+ },
121
+ {
122
+ header: "Execution",
123
+ question: "Run plans in parallel?",
124
+ multiSelect: false,
125
+ options: [
126
+ { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
127
+ { label: "Sequential", description: "One plan at a time" }
128
+ ]
129
+ },
130
+ {
131
+ header: "Git Tracking",
132
+ question: "Commit planning docs to git?",
133
+ multiSelect: false,
134
+ options: [
135
+ { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
136
+ { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
137
+ ]
138
+ }
139
+ ])
140
+ ```
141
+
142
+ **Round 2 — Workflow agents (same as Step 5):**
143
+
144
+ ```
145
+ AskUserQuestion([
146
+ {
147
+ header: "Research",
148
+ question: "Research before planning each phase? (adds tokens/time)",
149
+ multiSelect: false,
150
+ options: [
151
+ { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
152
+ { label: "No", description: "Plan directly from requirements" }
153
+ ]
154
+ },
155
+ {
156
+ header: "Plan Check",
157
+ question: "Verify plans will achieve their goals? (adds tokens/time)",
158
+ multiSelect: false,
159
+ options: [
160
+ { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
161
+ { label: "No", description: "Execute plans without verification" }
162
+ ]
163
+ },
164
+ {
165
+ header: "Verifier",
166
+ question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
167
+ multiSelect: false,
168
+ options: [
169
+ { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
170
+ { label: "No", description: "Trust execution, skip verification" }
171
+ ]
172
+ },
173
+ {
174
+ header: "AI Models",
175
+ question: "Which AI models for planning agents?",
176
+ multiSelect: false,
177
+ options: [
178
+ { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
179
+ { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
180
+ { label: "Budget", description: "Haiku where possible — fastest, lowest cost" },
181
+ { label: "Inherit", description: "Use the current session model for all agents (OpenCode /model)" }
182
+ ]
183
+ }
184
+ ])
185
+ ```
186
+
187
+ Create `.planning/config.json` with all settings (CLI fills in remaining defaults automatically):
188
+
189
+ ```bash
190
+ mkdir -p .planning
191
+ node "./.claude/framework/bin/tools.cjs" config-new-project '{"mode":"yolo","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":true|false,"auto_advance":true}}'
192
+ ```
193
+
194
+ **If commit_docs = No:** Add `.planning/` to `.gitignore`.
195
+
196
+ **Commit config.json:**
197
+
198
+ ```bash
199
+ mkdir -p .planning
200
+ node "./.claude/framework/bin/tools.cjs" commit "chore: add project config" --files .planning/config.json
201
+ ```
202
+
203
+ **Persist auto-advance chain flag to config (survives context compaction):**
204
+
205
+ ```bash
206
+ node "./.claude/framework/bin/tools.cjs" config-set workflow._auto_chain_active true
207
+ ```
208
+
209
+ Proceed to Step 4 (skip Steps 3 and 5).
210
+
211
+ ## 3. Deep Questioning
212
+
213
+ **Auto mode:** pular (handled em 2a) — extrair contexto do documento e ir pra passo 4.
214
+
215
+ **Banner:** `framework ► QUESTIONING`.
216
+
217
+ **Abrir:** pergunta inline freeform (NÃO AskUserQuestion): "What do you want to build?". Aguardar resposta.
218
+
219
+ **Modo `workflow.research_before_questions`:** se enabled, antes de follow-ups numa área, fazer breve web search por melhores práticas e mencionar findings naturalmente ("Most projects like this use X — is that what you're thinking?"). Default off, perguntar direto.
220
+
221
+ **Follow the thread:** AskUserQuestion com options que provocam interpretações/clarificações/exemplos. Cada resposta abre novos threads. Cobrir: o que empolgou, problema que sparkou, termos vagos, como seria na prática, o que já está decidido.
222
+
223
+ **Técnicas de `questioning.md`:** challenge vagueness, concretize abstract, surface assumptions, find edges, reveal motivation.
224
+
225
+ Mentalmente validar checklist do `questioning.md`; se gaps, tecer perguntas naturalmente (não modo checklist).
226
+
227
+ **Decision gate:** quando puder escrever PROJECT.md claro, AskUserQuestion `Ready?` — "Create PROJECT.md" ou "Keep exploring". Loop até "Create".
228
+
229
+ ## 4. Write PROJECT.md
230
+
231
+ **If auto mode:** Synthesize from provided document. No "Ready?" gate was shown — proceed directly to commit.
232
+
233
+ Synthesize all context into `.planning/PROJECT.md` using the template from `templates/project.md`.
234
+
235
+ **For greenfield projects:**
236
+
237
+ Initialize requirements as hypotheses:
238
+
239
+ ```markdown
240
+ ## Requirements
241
+
242
+ ### Validated
243
+
244
+ (None yet — ship to validate)
245
+
246
+ ### Active
247
+
248
+ - [ ] [Requirement 1]
249
+ - [ ] [Requirement 2]
250
+ - [ ] [Requirement 3]
251
+
252
+ ### Out of Scope
253
+
254
+ - [Exclusion 1] — [why]
255
+ - [Exclusion 2] — [why]
256
+ ```
257
+
258
+ All Active requirements are hypotheses until shipped and validated.
259
+
260
+ **For brownfield projects (codebase map exists):**
261
+
262
+ Infer Validated requirements from existing code:
263
+
264
+ 1. Read `.planning/codebase/ARCHITECTURE.md` and `STACK.md`
265
+ 2. Identify what the codebase already does
266
+ 3. These become the initial Validated set
267
+
268
+ ```markdown
269
+ ## Requirements
270
+
271
+ ### Validated
272
+
273
+ - ✓ [Existing capability 1] — existing
274
+ - ✓ [Existing capability 2] — existing
275
+ - ✓ [Existing capability 3] — existing
276
+
277
+ ### Active
278
+
279
+ - [ ] [New requirement 1]
280
+ - [ ] [New requirement 2]
281
+
282
+ ### Out of Scope
283
+
284
+ - [Exclusion 1] — [why]
285
+ ```
286
+
287
+ **Key Decisions:**
288
+
289
+ Initialize with any decisions made during questioning:
290
+
291
+ ```markdown
292
+ ## Key Decisions
293
+
294
+ | Decision | Rationale | Outcome |
295
+ |----------|-----------|---------|
296
+ | [Choice from questioning] | [Why] | — Pending |
297
+ ```
298
+
299
+ **Last updated footer:**
300
+
301
+ ```markdown
302
+ ---
303
+ *Last updated: [date] after initialization*
304
+ ```
305
+
306
+ **Evolution section** (include at the end of PROJECT.md, before the footer):
307
+
308
+ ```markdown
309
+ ## Evolution
310
+
311
+ This document evolves at phase transitions and milestone boundaries.
312
+
313
+ **After each phase transition** (via `/transition`):
314
+ 1. Requirements invalidated? → Move to Out of Scope with reason
315
+ 2. Requirements validated? → Move to Validated with phase reference
316
+ 3. New requirements emerged? → Add to Active
317
+ 4. Decisions to log? → Add to Key Decisions
318
+ 5. "What This Is" still accurate? → Update if drifted
319
+
320
+ **After each milestone** (via `/complete-milestone`):
321
+ 1. Full review of all sections
322
+ 2. Core Value check — still the right priority?
323
+ 3. Audit Out of Scope — reasons still valid?
324
+ 4. Update Context with current state
325
+ ```
326
+
327
+ Do not compress. Capture everything gathered.
328
+
329
+ **Commit PROJECT.md:**
330
+
331
+ ```bash
332
+ mkdir -p .planning
333
+ node "./.claude/framework/bin/tools.cjs" commit "docs: initialize project" --files .planning/PROJECT.md
334
+ ```
335
+
336
+ ## 5. Workflow Preferences
337
+
338
+ **If auto mode:** Skip — config was collected in Step 2a. Proceed to Step 5.5.
339
+
340
+ **Check for global defaults** at `~/.framework/defaults.json`. If the file exists, offer to use saved defaults:
341
+
342
+ ```
343
+ AskUserQuestion([
344
+ {
345
+ question: "Use your saved default settings? (from ~/.framework/defaults.json)",
346
+ header: "Defaults",
347
+ multiSelect: false,
348
+ options: [
349
+ { label: "Yes (Recommended)", description: "Use saved defaults, skip settings questions" },
350
+ { label: "No", description: "Configure settings manually" }
351
+ ]
352
+ }
353
+ ])
354
+ ```
355
+
356
+ If "Yes": read `~/.framework/defaults.json`, use those values for config.json, and skip directly to **Commit config.json** below.
357
+
358
+ If "No" or `~/.framework/defaults.json` doesn't exist: proceed with the questions below.
359
+
360
+ **Round 1 — Core workflow settings (4 questions):**
361
+
362
+ ```
363
+ questions: [
364
+ {
365
+ header: "Mode",
366
+ question: "How do you want to work?",
367
+ multiSelect: false,
368
+ options: [
369
+ { label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
370
+ { label: "Interactive", description: "Confirm at each step" }
371
+ ]
372
+ },
373
+ {
374
+ header: "Granularity",
375
+ question: "How finely should scope be sliced into phases?",
376
+ multiSelect: false,
377
+ options: [
378
+ { label: "Coarse", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
379
+ { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
380
+ { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
381
+ ]
382
+ },
383
+ {
384
+ header: "Execution",
385
+ question: "Run plans in parallel?",
386
+ multiSelect: false,
387
+ options: [
388
+ { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
389
+ { label: "Sequential", description: "One plan at a time" }
390
+ ]
391
+ },
392
+ {
393
+ header: "Git Tracking",
394
+ question: "Commit planning docs to git?",
395
+ multiSelect: false,
396
+ options: [
397
+ { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
398
+ { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
399
+ ]
400
+ }
401
+ ]
402
+ ```
403
+
404
+ **Round 2 — Workflow agents (opt-in, adicionam tokens/tempo, melhoram qualidade):**
405
+
406
+ | Agent | Quando | O que faz |
407
+ |---|---|---|
408
+ | Researcher | Antes de cada plan-phase | Investiga domínio, padrões, pitfalls |
409
+ | Plan Checker | Após plano criado | Verifica se plano atinge o goal |
410
+ | Verifier | Após execução | Confirma must-haves entregues |
411
+
412
+ Todos recomendados pra projetos sérios; pular pra experimentos rápidos.
413
+
414
+ AskUserQuestion: 4 perguntas — `Research` (yes/no), `Plan Check` (yes/no), `Verifier` (yes/no), `AI Models` (Balanced=Sonnet recomendado / Quality=Opus / Budget=Haiku / Inherit=session model).
415
+
416
+ Create `.planning/config.json` with all settings (CLI fills in remaining defaults automatically):
417
+
418
+ ```bash
419
+ mkdir -p .planning
420
+ node "./.claude/framework/bin/tools.cjs" config-new-project '{"mode":"[yolo|interactive]","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":[false if granularity=coarse, true otherwise]}}'
421
+ ```
422
+
423
+ **Note:** Run `/settings` anytime to update model profile, workflow agents, branching strategy, and other preferences.
424
+
425
+ **If commit_docs = No:**
426
+
427
+ - Set `commit_docs: false` in config.json
428
+ - Add `.planning/` to `.gitignore` (create if needed)
429
+
430
+ **If commit_docs = Yes:**
431
+
432
+ - No additional gitignore entries needed
433
+
434
+ **Commit config.json:**
435
+
436
+ ```bash
437
+ node "./.claude/framework/bin/tools.cjs" commit "chore: add project config" --files .planning/config.json
438
+ ```
439
+
440
+ ## 5.1. Sub-Repo Detection
441
+
442
+ **Detect multi-repo workspace:**
443
+
444
+ Check for directories with their own `.git` folders (separate repos within the workspace):
445
+
446
+ ```bash
447
+ find . -maxdepth 1 -type d -not -name ".*" -not -name "node_modules" -exec test -d "{}/.git" \; -print
448
+ ```
449
+
450
+ **If sub-repos found:**
451
+
452
+ Strip the `./` prefix to get directory names (e.g., `./backend` → `backend`).
453
+
454
+ Use AskUserQuestion:
455
+
456
+ - header: "Multi-Repo Workspace"
457
+ - question: "I detected separate git repos in this workspace. Which directories contain code that framework should commit to?"
458
+ - multiSelect: true
459
+ - options: one option per detected directory
460
+ - "[directory name]" — Separate git repo
461
+
462
+ **If user selects one or more directories:**
463
+
464
+ - Set `planning.sub_repos` in config.json to the selected directory names array (e.g., `["backend", "frontend"]`)
465
+ - Auto-set `planning.commit_docs` to `false` (planning docs stay local in multi-repo workspaces)
466
+ - Add `.planning/` to `.gitignore` if not already present
467
+
468
+ Config changes are saved locally — no commit needed since `commit_docs` is `false` in multi-repo mode.
469
+
470
+ **If no sub-repos found or user selects none:** Continue with no changes to config.
471
+
472
+ ## 5.5. Resolve Model Profile
473
+
474
+ Use models from init: `researcher_model`, `synthesizer_model`, `roadmapper_model`.
475
+
476
+ ## 6. Research Decision
477
+
478
+ **If auto mode:** Default to "Research first" without asking.
479
+
480
+ Use AskUserQuestion:
481
+
482
+ - header: "Research"
483
+ - question: "Research the domain ecosystem before defining requirements?"
484
+ - options:
485
+ - "Research first (Recommended)" — Discover standard stacks, expected features, architecture patterns
486
+ - "Skip research" — I know this domain well, go straight to requirements
487
+
488
+ **If "Research first":**
489
+
490
+ Display stage banner:
491
+
492
+ ```
493
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
494
+ framework ► RESEARCHING
495
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
496
+
497
+ Researching [domain] ecosystem...
498
+ ```
499
+
500
+ Create research directory:
501
+
502
+ ```bash
503
+ mkdir -p .planning/research
504
+ ```
505
+
506
+ **Determine milestone context:**
507
+
508
+ Check if this is greenfield or subsequent milestone:
509
+
510
+ - If no "Validated" requirements in PROJECT.md → Greenfield (building from scratch)
511
+ - If "Validated" requirements exist → Subsequent milestone (adding to existing app)
512
+
513
+ Display spawning indicator:
514
+
515
+ ```
516
+ ◆ Spawning 4 researchers in parallel...
517
+ → Stack research
518
+ → Features research
519
+ → Architecture research
520
+ → Pitfalls research
521
+ ```
522
+
523
+ Spawn 4 parallel project-researcher agents with path references:
524
+
525
+ ```
526
+ Task(prompt="<research_type>
527
+ Project Research — Stack dimension for [domain].
528
+ </research_type>
529
+
530
+ <milestone_context>
531
+ [greenfield OR subsequent]
532
+
533
+ Greenfield: Research the standard stack for building [domain] from scratch.
534
+ Subsequent: Research what's needed to add [target features] to an existing [domain] app. Don't re-research the existing system.
535
+ </milestone_context>
536
+
537
+ <question>
538
+ What's the standard 2025 stack for [domain]?
539
+ </question>
540
+
541
+ <files_to_read>
542
+ - {project_path} (Project context and goals)
543
+ </files_to_read>
544
+
545
+ ${AGENT_SKILLS_RESEARCHER}
546
+
547
+ <downstream_consumer>
548
+ Your STACK.md feeds into roadmap creation. Be prescriptive:
549
+ - Specific libraries with versions
550
+ - Clear rationale for each choice
551
+ - What NOT to use and why
552
+ </downstream_consumer>
553
+
554
+ <quality_gate>
555
+ - [ ] Versions are current (verify with Context7/official docs, not training data)
556
+ - [ ] Rationale explains WHY, not just WHAT
557
+ - [ ] Confidence levels assigned to each recommendation
558
+ </quality_gate>
559
+
560
+ <output>
561
+ Write to: .planning/research/STACK.md
562
+ Use template: ./.claude/framework/templates/research-project/STACK.md
563
+ </output>
564
+ ", subagent_type="project-researcher", model="{researcher_model}", description="Stack research")
565
+
566
+ Task(prompt="<research_type>
567
+ Project Research — Features dimension for [domain].
568
+ </research_type>
569
+
570
+ <milestone_context>
571
+ [greenfield OR subsequent]
572
+
573
+ Greenfield: What features do [domain] products have? What's table stakes vs differentiating?
574
+ Subsequent: How do [target features] typically work? What's expected behavior?
575
+ </milestone_context>
576
+
577
+ <question>
578
+ What features do [domain] products have? What's table stakes vs differentiating?
579
+ </question>
580
+
581
+ <files_to_read>
582
+ - {project_path} (Project context)
583
+ </files_to_read>
584
+
585
+ ${AGENT_SKILLS_RESEARCHER}
586
+
587
+ <downstream_consumer>
588
+ Your FEATURES.md feeds into requirements definition. Categorize clearly:
589
+ - Table stakes (must have or users leave)
590
+ - Differentiators (competitive advantage)
591
+ - Anti-features (things to deliberately NOT build)
592
+ </downstream_consumer>
593
+
594
+ <quality_gate>
595
+ - [ ] Categories are clear (table stakes vs differentiators vs anti-features)
596
+ - [ ] Complexity noted for each feature
597
+ - [ ] Dependencies between features identified
598
+ </quality_gate>
599
+
600
+ <output>
601
+ Write to: .planning/research/FEATURES.md
602
+ Use template: ./.claude/framework/templates/research-project/FEATURES.md
603
+ </output>
604
+ ", subagent_type="project-researcher", model="{researcher_model}", description="Features research")
605
+
606
+ Task(prompt="<research_type>
607
+ Project Research — Architecture dimension for [domain].
608
+ </research_type>
609
+
610
+ <milestone_context>
611
+ [greenfield OR subsequent]
612
+
613
+ Greenfield: How are [domain] systems typically structured? What are major components?
614
+ Subsequent: How do [target features] integrate with existing [domain] architecture?
615
+ </milestone_context>
616
+
617
+ <question>
618
+ How are [domain] systems typically structured? What are major components?
619
+ </question>
620
+
621
+ <files_to_read>
622
+ - {project_path} (Project context)
623
+ </files_to_read>
624
+
625
+ ${AGENT_SKILLS_RESEARCHER}
626
+
627
+ <downstream_consumer>
628
+ Your ARCHITECTURE.md informs phase structure in roadmap. Include:
629
+ - Component boundaries (what talks to what)
630
+ - Data flow (how information moves)
631
+ - Suggested build order (dependencies between components)
632
+ </downstream_consumer>
633
+
634
+ <quality_gate>
635
+ - [ ] Components clearly defined with boundaries
636
+ - [ ] Data flow direction explicit
637
+ - [ ] Build order implications noted
638
+ </quality_gate>
639
+
640
+ <output>
641
+ Write to: .planning/research/ARCHITECTURE.md
642
+ Use template: ./.claude/framework/templates/research-project/ARCHITECTURE.md
643
+ </output>
644
+ ", subagent_type="project-researcher", model="{researcher_model}", description="Architecture research")
645
+
646
+ Task(prompt="<research_type>
647
+ Project Research — Pitfalls dimension for [domain].
648
+ </research_type>
649
+
650
+ <milestone_context>
651
+ [greenfield OR subsequent]
652
+
653
+ Greenfield: What do [domain] projects commonly get wrong? Critical mistakes?
654
+ Subsequent: What are common mistakes when adding [target features] to [domain]?
655
+ </milestone_context>
656
+
657
+ <question>
658
+ What do [domain] projects commonly get wrong? Critical mistakes?
659
+ </question>
660
+
661
+ <files_to_read>
662
+ - {project_path} (Project context)
663
+ </files_to_read>
664
+
665
+ ${AGENT_SKILLS_RESEARCHER}
666
+
667
+ <downstream_consumer>
668
+ Your PITFALLS.md prevents mistakes in roadmap/planning. For each pitfall:
669
+ - Warning signs (how to detect early)
670
+ - Prevention strategy (how to avoid)
671
+ - Which phase should address it
672
+ </downstream_consumer>
673
+
674
+ <quality_gate>
675
+ - [ ] Pitfalls are specific to this domain (not generic advice)
676
+ - [ ] Prevention strategies are actionable
677
+ - [ ] Phase mapping included where relevant
678
+ </quality_gate>
679
+
680
+ <output>
681
+ Write to: .planning/research/PITFALLS.md
682
+ Use template: ./.claude/framework/templates/research-project/PITFALLS.md
683
+ </output>
684
+ ", subagent_type="project-researcher", model="{researcher_model}", description="Pitfalls research")
685
+ ```
686
+
687
+ After all 4 agents complete, spawn synthesizer to create SUMMARY.md:
688
+
689
+ ```
690
+ Task(prompt="
691
+ <task>
692
+ Synthesize research outputs into SUMMARY.md.
693
+ </task>
694
+
695
+ <files_to_read>
696
+ - .planning/research/STACK.md
697
+ - .planning/research/FEATURES.md
698
+ - .planning/research/ARCHITECTURE.md
699
+ - .planning/research/PITFALLS.md
700
+ </files_to_read>
701
+
702
+ ${AGENT_SKILLS_SYNTHESIZER}
703
+
704
+ <output>
705
+ Write to: .planning/research/SUMMARY.md
706
+ Use template: ./.claude/framework/templates/research-project/SUMMARY.md
707
+ Commit after writing.
708
+ </output>
709
+ ", subagent_type="research-synthesizer", model="{synthesizer_model}", description="Synthesize research")
710
+ ```
711
+
712
+ Display research complete banner and key findings:
713
+
714
+ ```
715
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
716
+ framework ► RESEARCH COMPLETE ✓
717
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
718
+
719
+ ## Key Findings
720
+
721
+ **Stack:** [from SUMMARY.md]
722
+ **Table Stakes:** [from SUMMARY.md]
723
+ **Watch Out For:** [from SUMMARY.md]
724
+
725
+ Files: `.planning/research/`
726
+ ```
727
+
728
+ **If "Skip research":** Continue to Step 7.
729
+
730
+ ## 7. Define Requirements
731
+
732
+ Display stage banner:
733
+
734
+ ```
735
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
736
+ framework ► DEFINING REQUIREMENTS
737
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
738
+ ```
739
+
740
+ **Load context:**
741
+
742
+ Read PROJECT.md and extract:
743
+
744
+ - Core value (the ONE thing that must work)
745
+ - Stated constraints (budget, timeline, tech limitations)
746
+ - Any explicit scope boundaries
747
+
748
+ **If research exists:** Read research/FEATURES.md and extract feature categories.
749
+
750
+ **If auto mode:**
751
+
752
+ - Auto-include all table stakes features (users expect these)
753
+ - Include features explicitly mentioned in provided document
754
+ - Auto-defer differentiators not mentioned in document
755
+ - Skip per-category AskUserQuestion loops
756
+ - Skip "Any additions?" question
757
+ - Skip requirements approval gate
758
+ - Generate REQUIREMENTS.md and commit directly
759
+
760
+ **Present features by category (interactive mode only):**
761
+
762
+ ```
763
+ Here are the features for [domain]:
764
+
765
+ ## Authentication
766
+ **Table stakes:**
767
+ - Sign up with email/password
768
+ - Email verification
769
+ - Password reset
770
+ - Session management
771
+
772
+ **Differentiators:**
773
+ - Magic link login
774
+ - OAuth (Google, GitHub)
775
+ - 2FA
776
+
777
+ **Research notes:** [any relevant notes]
778
+
779
+ ---
780
+
781
+ ## [Next Category]
782
+ ...
783
+ ```
784
+
785
+ **If no research:** Gather requirements through conversation instead.
786
+
787
+ Ask: "What are the main things users need to be able to do?"
788
+
789
+ For each capability mentioned:
790
+
791
+ - Ask clarifying questions to make it specific
792
+ - Probe for related capabilities
793
+ - Group into categories
794
+
795
+ **Scope each category:**
796
+
797
+ For each category, use AskUserQuestion:
798
+
799
+ - header: "[Category]" (max 12 chars)
800
+ - question: "Which [category] features are in v1?"
801
+ - multiSelect: true
802
+ - options:
803
+ - "[Feature 1]" — [brief description]
804
+ - "[Feature 2]" — [brief description]
805
+ - "[Feature 3]" — [brief description]
806
+ - "None for v1" — Defer entire category
807
+
808
+ Track responses:
809
+
810
+ - Selected features → v1 requirements
811
+ - Unselected table stakes → v2 (users expect these)
812
+ - Unselected differentiators → out of scope
813
+
814
+ **Identify gaps:**
815
+
816
+ Use AskUserQuestion:
817
+
818
+ - header: "Additions"
819
+ - question: "Any requirements research missed? (Features specific to your vision)"
820
+ - options:
821
+ - "No, research covered it" — Proceed
822
+ - "Yes, let me add some" — Capture additions
823
+
824
+ **Validate core value:**
825
+
826
+ Cross-check requirements against Core Value from PROJECT.md. If gaps detected, surface them.
827
+
828
+ **Generate REQUIREMENTS.md:**
829
+
830
+ Create `.planning/REQUIREMENTS.md` with:
831
+
832
+ - v1 Requirements grouped by category (checkboxes, REQ-IDs)
833
+ - v2 Requirements (deferred)
834
+ - Out of Scope (explicit exclusions with reasoning)
835
+ - Traceability section (empty, filled by roadmap)
836
+
837
+ **REQ-ID format:** `[CATEGORY]-[NUMBER]` (AUTH-01, CONTENT-02)
838
+
839
+ **Requirement quality criteria:**
840
+
841
+ Good requirements are:
842
+
843
+ - **Specific and testable:** "User can reset password via email link" (not "Handle password reset")
844
+ - **User-centric:** "User can X" (not "System does Y")
845
+ - **Atomic:** One capability per requirement (not "User can login and manage profile")
846
+ - **Independent:** Minimal dependencies on other requirements
847
+
848
+ Reject vague requirements. Push for specificity:
849
+
850
+ - "Handle authentication" → "User can log in with email/password and stay logged in across sessions"
851
+ - "Support sharing" → "User can share post via link that opens in recipient's browser"
852
+
853
+ **Present full requirements list (interactive mode only):**
854
+
855
+ Show every requirement (not counts) for user confirmation:
856
+
857
+ ```
858
+ ## v1 Requirements
859
+
860
+ ### Authentication
861
+ - [ ] **AUTH-01**: User can create account with email/password
862
+ - [ ] **AUTH-02**: User can log in and stay logged in across sessions
863
+ - [ ] **AUTH-03**: User can log out from any page
864
+
865
+ ### Content
866
+ - [ ] **CONT-01**: User can create posts with text
867
+ - [ ] **CONT-02**: User can edit their own posts
868
+
869
+ [... full list ...]
870
+
871
+ ---
872
+
873
+ Does this capture what you're building? (yes / adjust)
874
+ ```
875
+
876
+ If "adjust": Return to scoping.
877
+
878
+ **Commit requirements:**
879
+
880
+ ```bash
881
+ node "./.claude/framework/bin/tools.cjs" commit "docs: define v1 requirements" --files .planning/REQUIREMENTS.md
882
+ ```
883
+
884
+ ## 8. Create Roadmap
885
+
886
+ Display stage banner:
887
+
888
+ ```
889
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
890
+ framework ► CREATING ROADMAP
891
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
892
+
893
+ ◆ Spawning roadmapper...
894
+ ```
895
+
896
+ Spawn roadmapper agent with path references:
897
+
898
+ ```
899
+ Task(prompt="
900
+ <planning_context>
901
+
902
+ <files_to_read>
903
+ - .planning/PROJECT.md (Project context)
904
+ - .planning/REQUIREMENTS.md (v1 Requirements)
905
+ - .planning/research/SUMMARY.md (Research findings - if exists)
906
+ - .planning/config.json (Granularity and mode settings)
907
+ </files_to_read>
908
+
909
+ ${AGENT_SKILLS_ROADMAPPER}
910
+
911
+ </planning_context>
912
+
913
+ <instructions>
914
+ Create roadmap:
915
+ 1. Derive phases from requirements (don't impose structure)
916
+ 2. Map every v1 requirement to exactly one phase
917
+ 3. Derive 2-5 success criteria per phase (observable user behaviors)
918
+ 4. Validate 100% coverage
919
+ 5. Write files immediately (ROADMAP.md, STATE.md, update REQUIREMENTS.md traceability)
920
+ 6. Return ROADMAP CREATED with summary
921
+
922
+ Write files first, then return. This ensures artifacts persist even if context is lost.
923
+ </instructions>
924
+ ", subagent_type="roadmapper", model="{roadmapper_model}", description="Create roadmap")
925
+ ```
926
+
927
+ **Handle roadmapper return:**
928
+
929
+ **If `## ROADMAP BLOCKED`:**
930
+
931
+ - Present blocker information
932
+ - Work with user to resolve
933
+ - Re-spawn when resolved
934
+
935
+ **If `## ROADMAP CREATED`:**
936
+
937
+ Read the created ROADMAP.md and present it nicely inline:
938
+
939
+ ```
940
+ ---
941
+
942
+ ## Proposed Roadmap
943
+
944
+ **[N] phases** | **[X] requirements mapped** | All v1 requirements covered ✓
945
+
946
+ | # | Phase | Goal | Requirements | Success Criteria |
947
+ |---|-------|------|--------------|------------------|
948
+ | 1 | [Name] | [Goal] | [REQ-IDs] | [count] |
949
+ | 2 | [Name] | [Goal] | [REQ-IDs] | [count] |
950
+ | 3 | [Name] | [Goal] | [REQ-IDs] | [count] |
951
+ ...
952
+
953
+ ### Phase Details
954
+
955
+ **Phase 1: [Name]**
956
+ Goal: [goal]
957
+ Requirements: [REQ-IDs]
958
+ Success criteria:
959
+ 1. [criterion]
960
+ 2. [criterion]
961
+ 3. [criterion]
962
+
963
+ **Phase 2: [Name]**
964
+ Goal: [goal]
965
+ Requirements: [REQ-IDs]
966
+ Success criteria:
967
+ 1. [criterion]
968
+ 2. [criterion]
969
+
970
+ [... continue for all phases ...]
971
+
972
+ ---
973
+ ```
974
+
975
+ **If auto mode:** Skip approval gate — auto-approve and commit directly.
976
+
977
+ **CRITICAL: Ask for approval before committing (interactive mode only):**
978
+
979
+ Use AskUserQuestion:
980
+
981
+ - header: "Roadmap"
982
+ - question: "Does this roadmap structure work for you?"
983
+ - options:
984
+ - "Approve" — Commit and continue
985
+ - "Adjust phases" — Tell me what to change
986
+ - "Review full file" — Show raw ROADMAP.md
987
+
988
+ **If "Approve":** Continue to commit.
989
+
990
+ **If "Adjust phases":**
991
+
992
+ - Get user's adjustment notes
993
+ - Re-spawn roadmapper with revision context:
994
+
995
+ ```
996
+ Task(prompt="
997
+ <revision>
998
+ User feedback on roadmap:
999
+ [user's notes]
1000
+
1001
+ <files_to_read>
1002
+ - .planning/ROADMAP.md (Current roadmap to revise)
1003
+ </files_to_read>
1004
+
1005
+ ${AGENT_SKILLS_ROADMAPPER}
1006
+
1007
+ Update the roadmap based on feedback. Edit files in place.
1008
+ Return ROADMAP REVISED with changes made.
1009
+ </revision>
1010
+ ", subagent_type="roadmapper", model="{roadmapper_model}", description="Revise roadmap")
1011
+ ```
1012
+
1013
+ - Present revised roadmap
1014
+ - Loop until user approves
1015
+
1016
+ **If "Review full file":** Display raw `cat .planning/ROADMAP.md`, then re-ask.
1017
+
1018
+ **Generate or refresh project CLAUDE.md before final commit:**
1019
+
1020
+ ```bash
1021
+ node "./.claude/framework/bin/tools.cjs" generate-claude-md
1022
+ ```
1023
+
1024
+ This ensures new projects get the default framework workflow-enforcement guidance and current project context in `CLAUDE.md`.
1025
+
1026
+ **Commit roadmap (after approval or auto mode):**
1027
+
1028
+ ```bash
1029
+ node "./.claude/framework/bin/tools.cjs" commit "docs: create roadmap ([N] phases)" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md CLAUDE.md
1030
+ ```
1031
+
1032
+ ## 9. Done
1033
+
1034
+ Present completion summary:
1035
+
1036
+ ```
1037
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1038
+ framework ► PROJECT INITIALIZED ✓
1039
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1040
+
1041
+ **[Project Name]**
1042
+
1043
+ | Artifact | Location |
1044
+ |----------------|-----------------------------|
1045
+ | Project | `.planning/PROJECT.md` |
1046
+ | Config | `.planning/config.json` |
1047
+ | Research | `.planning/research/` |
1048
+ | Requirements | `.planning/REQUIREMENTS.md` |
1049
+ | Roadmap | `.planning/ROADMAP.md` |
1050
+ | Project guide | `CLAUDE.md` |
1051
+
1052
+ **[N] phases** | **[X] requirements** | Ready to build ✓
1053
+ ```
1054
+
1055
+ **If auto mode:**
1056
+
1057
+ ```
1058
+ ╔══════════════════════════════════════════╗
1059
+ ║ AUTO-ADVANCING → DISCUSS PHASE 1 ║
1060
+ ╚══════════════════════════════════════════╝
1061
+ ```
1062
+
1063
+ Exit skill and invoke SlashCommand("/discuss-phase 1 --auto")
1064
+
1065
+ **If interactive mode:**
1066
+
1067
+ Check if Phase 1 has UI indicators (look for `**UI hint**: yes` in Phase 1 detail section of ROADMAP.md):
1068
+
1069
+ ```bash
1070
+ PHASE1_SECTION=$(node "./.claude/framework/bin/tools.cjs" roadmap get-phase 1 2>/dev/null)
1071
+ PHASE1_HAS_UI=$(echo "$PHASE1_SECTION" | grep -qi "UI hint.*yes" && echo "true" || echo "false")
1072
+ ```
1073
+
1074
+ **If Phase 1 has UI (`PHASE1_HAS_UI` is `true`):**
1075
+
1076
+ ```
1077
+ ───────────────────────────────────────────────────────────────
1078
+
1079
+ ## ▶ Next Up
1080
+
1081
+ **Phase 1: [Phase Name]** — [Goal from ROADMAP.md]
1082
+
1083
+ /discuss-phase 1 — gather context and clarify approach
1084
+
1085
+ <sub>/clear first → fresh context window</sub>
1086
+
1087
+ ---
1088
+
1089
+ **Also available:**
1090
+ - /ui-phase 1 — generate UI design contract (recommended for frontend phases)
1091
+ - /plan-phase 1 — skip discussion, plan directly
1092
+
1093
+ ───────────────────────────────────────────────────────────────
1094
+ ```
1095
+
1096
+ **If Phase 1 has no UI:**
1097
+
1098
+ ```
1099
+ ───────────────────────────────────────────────────────────────
1100
+
1101
+ ## ▶ Next Up
1102
+
1103
+ **Phase 1: [Phase Name]** — [Goal from ROADMAP.md]
1104
+
1105
+ /discuss-phase 1 — gather context and clarify approach
1106
+
1107
+ <sub>/clear first → fresh context window</sub>
1108
+
1109
+ ---
1110
+
1111
+ **Also available:**
1112
+ - /plan-phase 1 — skip discussion, plan directly
1113
+
1114
+ ───────────────────────────────────────────────────────────────
1115
+ ```
1116
+
1117
+ </process>
1118
+
1119
+ <output>
1120
+
1121
+ - `.planning/PROJECT.md`
1122
+ - `.planning/config.json`
1123
+ - `.planning/research/` (if research selected)
1124
+ - `STACK.md`
1125
+ - `FEATURES.md`
1126
+ - `ARCHITECTURE.md`
1127
+ - `PITFALLS.md`
1128
+ - `SUMMARY.md`
1129
+ - `.planning/REQUIREMENTS.md`
1130
+ - `.planning/ROADMAP.md`
1131
+ - `.planning/STATE.md`
1132
+ - `CLAUDE.md`
1133
+
1134
+ </output>
1135
+
1136
+ <success_criteria>
1137
+
1138
+ - [ ] .planning/ directory created
1139
+ - [ ] Git repo initialized
1140
+ - [ ] Brownfield detection completed
1141
+ - [ ] Deep questioning completed (threads followed, not rushed)
1142
+ - [ ] PROJECT.md captures full context → **committed**
1143
+ - [ ] config.json has workflow mode, granularity, parallelization → **committed**
1144
+ - [ ] Research completed (if selected) — 4 parallel agents spawned → **committed**
1145
+ - [ ] Requirements gathered (from research or conversation)
1146
+ - [ ] User scoped each category (v1/v2/out of scope)
1147
+ - [ ] REQUIREMENTS.md created with REQ-IDs → **committed**
1148
+ - [ ] roadmapper spawned with context
1149
+ - [ ] Roadmap files written immediately (not draft)
1150
+ - [ ] User feedback incorporated (if any)
1151
+ - [ ] ROADMAP.md created with phases, requirement mappings, success criteria
1152
+ - [ ] STATE.md initialized
1153
+ - [ ] REQUIREMENTS.md traceability updated
1154
+ - [ ] CLAUDE.md generated with framework workflow guidance
1155
+ - [ ] User knows next step is `/discuss-phase 1`
1156
+
1157
+ **Atomic commits:** Each phase commits its artifacts immediately. If context is lost, artifacts persist.
1158
+
1159
+ </success_criteria>