learnship 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.cursor-plugin/plugin.json +1 -1
  3. package/README.md +172 -155
  4. package/SKILL.md +23 -2
  5. package/bin/install.js +305 -3
  6. package/commands/learnship/diagnose-issues.md +1 -0
  7. package/commands/learnship/discuss-phase.md +1 -0
  8. package/commands/learnship/ideate.md +1 -0
  9. package/commands/learnship/list-phase-assumptions.md +1 -0
  10. package/commands/learnship/quick.md +1 -0
  11. package/commands/learnship/research-phase.md +1 -0
  12. package/commands/learnship/secure-phase.md +1 -0
  13. package/commands/learnship/validate-phase.md +2 -0
  14. package/commands/learnship/verify-work.md +1 -0
  15. package/cursor-rules/learnship.mdc +14 -4
  16. package/gemini-extension.json +1 -1
  17. package/hooks/learnship-context-monitor.js +120 -0
  18. package/hooks/learnship-prompt-guard.js +75 -0
  19. package/hooks/learnship-session-state.js +136 -0
  20. package/hooks/learnship-statusline.js +179 -0
  21. package/learnship/contexts/dev.md +21 -0
  22. package/learnship/contexts/research.md +22 -0
  23. package/learnship/contexts/review.md +22 -0
  24. package/learnship/templates/research-project/ARCHITECTURE.md +140 -0
  25. package/learnship/templates/research-project/FEATURES.md +130 -0
  26. package/learnship/templates/research-project/PITFALLS.md +102 -0
  27. package/learnship/templates/research-project/STACK.md +105 -0
  28. package/learnship/templates/research-project/SUMMARY.md +111 -0
  29. package/learnship/workflows/challenge.md +16 -4
  30. package/learnship/workflows/debug.md +30 -6
  31. package/learnship/workflows/diagnose-issues.md +14 -1
  32. package/learnship/workflows/discuss-milestone.md +15 -1
  33. package/learnship/workflows/discuss-phase.md +83 -10
  34. package/learnship/workflows/ideate.md +25 -5
  35. package/learnship/workflows/list-phase-assumptions.md +12 -5
  36. package/learnship/workflows/new-milestone.md +12 -6
  37. package/learnship/workflows/new-project.md +229 -85
  38. package/learnship/workflows/quick.md +18 -4
  39. package/learnship/workflows/research-phase.md +43 -8
  40. package/learnship/workflows/secure-phase.md +57 -15
  41. package/learnship/workflows/settings.md +142 -142
  42. package/learnship/workflows/validate-phase.md +39 -12
  43. package/learnship/workflows/verify-work.md +27 -0
  44. package/package.json +1 -1
  45. package/templates/config.json +1 -0
@@ -74,14 +74,34 @@ a problem you're trying to solve, or something you're not sure about yet.
74
74
  **Mid-conversation research offer (after 2-3 exchanges):**
75
75
 
76
76
  If the conversation surfaces factual questions, technology comparisons, or unknowns:
77
- ```
78
- This touches on [specific question]. Want me to do a quick research pass before we continue?
79
- This would take ~30 seconds and might surface useful context.
80
77
 
81
- [Yes, research this] / [No, let's keep exploring]
78
+ ```
79
+ AskUserQuestion([
80
+ {
81
+ header: "Research Opportunity",
82
+ question: "This touches on [specific question]. Want me to do a quick research pass before we continue?",
83
+ multiSelect: false,
84
+ options: [
85
+ { label: "Yes, research this", description: "~30 seconds — may surface useful context" },
86
+ { label: "No, keep exploring", description: "Continue the conversation without research" }
87
+ ]
88
+ }
89
+ ])
82
90
  ```
83
91
 
84
- If yes and parallelization is enabled, spawn a research agent. Otherwise do an inline research pass. Share findings and continue.
92
+ If yes: read `parallelization` from `.planning/config.json`. If `parallelization.enabled` is true, spawn a researcher agent:
93
+ ```
94
+ Task(
95
+ subagent_type="learnship-researcher",
96
+ prompt="
97
+ <objective>
98
+ Quick research pass on: [specific question].
99
+ Search web, scan codebase for relevant patterns, and return a concise summary of findings.
100
+ </objective>
101
+ "
102
+ )
103
+ ```
104
+ If parallelization is false, use `@./agents/researcher.md` as inline persona for a quick research pass. Share findings and continue.
85
105
 
86
106
  **Crystallize outputs (after 3-6 exchanges):**
87
107
 
@@ -105,11 +105,18 @@ Assumptions validated. Ready to plan.
105
105
  ## Step 5: Offer Next Steps
106
106
 
107
107
  ```
108
- What's next?
109
-
110
- 1. discuss-phase [N] — you answer my questions to build CONTEXT.md
111
- 2. plan-phase [N] create plans now (assumptions noted above apply)
112
- 3. Re-examine — I'll analyze again with your corrections
108
+ AskUserQuestion([
109
+ {
110
+ header: "Next Step",
111
+ question: "What would you like to do with these assumptions?",
112
+ multiSelect: false,
113
+ options: [
114
+ { label: "Discuss Phase", description: "Run discuss-phase [N] — you answer my questions to build CONTEXT.md" },
115
+ { label: "Plan Now", description: "Run plan-phase [N] — create plans now (assumptions noted above apply)" },
116
+ { label: "Re-examine", description: "Analyze again with your corrections" }
117
+ ]
118
+ }
119
+ ])
113
120
  ```
114
121
 
115
122
  Note: Any corrections discussed here are not automatically captured. Run `discuss-phase [N]` to write them to a CONTEXT.md that planners will read.
@@ -32,14 +32,20 @@ Pending todos carried forward:
32
32
  Ask openly: **"What do you want to build in this milestone?"**
33
33
 
34
34
  If a milestone scope was already discussed (look for `.planning/MILESTONE-CONTEXT.md`), load it and confirm:
35
- ```
36
- I found a milestone context file from a prior discussion:
37
- [summary of scope]
38
35
 
39
- Use this as the starting point?
40
36
  ```
41
- - **Yes** → proceed with it
42
- - **No / Start fresh** → ask from scratch
37
+ AskUserQuestion([
38
+ {
39
+ header: "Prior Context Found",
40
+ question: "I found a milestone context file from a prior discussion. Use it as the starting point?",
41
+ multiSelect: false,
42
+ options: [
43
+ { label: "Yes", description: "Proceed with the scope from the prior discussion" },
44
+ { label: "Start fresh", description: "Discard prior context and ask from scratch" }
45
+ ]
46
+ }
47
+ ])
48
+ ```
43
49
 
44
50
  Follow the thread. When you have enough to write clear goals, ask for confirmation before continuing.
45
51
 
@@ -6,6 +6,8 @@ description: Initialize a new project — questioning → research → requireme
6
6
 
7
7
  Initialize a new project with full context gathering, optional research, requirements scoping, and roadmap creation. This is the most leveraged moment in any project — deep questioning now means better plans, better execution, better outcomes.
8
8
 
9
+ > **Platform note:** When this workflow shows structured question blocks, use your platform's interactive question tool to present them (the tool that lets users pick from predefined options). If no such tool is available, present each question as a numbered text list with descriptions and ask the user to reply with their choice number or label.
10
+
9
11
  > **This workflow has 9 mandatory steps. You must complete every step in order. Do not skip, defer, or abbreviate any step. Check each one off as you complete it:**
10
12
  >
11
13
  > - [ ] Step 1 — Setup & codebase check
@@ -80,70 +82,151 @@ Note the tech stack, key directories, and any README content internally. Use thi
80
82
 
81
83
  ## Step 2: Configuration
82
84
 
83
- Ask the user the following questions to configure the project. Ask them in a conversational way not all at once, but grouped naturally.
84
-
85
- **Group A — Working style:**
86
-
87
- Ask: "How do you want to work?"
88
- - **YOLO** (recommended) — Auto-approve steps, just execute
89
- - **Interactive** — Confirm at each step
90
-
91
- Ask: "How finely should scope be sliced into phases?"
92
- - **Coarse** (recommended) — Fewer, broader phases (3-5 phases, 1-3 plans each)
93
- - **Standard** — Balanced phase size (5-8 phases, 3-5 plans each)
94
- - **Fine** — Many focused phases (8-12 phases, 5-10 plans each)
95
-
96
- **Group B — Learning mode:**
97
-
98
- Ask: "How should the learning partner (agentic-learning) work during this project?"
99
- - **Auto** (recommended) — I'll offer relevant learning actions at natural checkpoints (after planning, after execution, etc.)
100
- - **Manual** — I'll only activate when you explicitly invoke `@agentic-learning`
101
-
102
- **Group C — Model profile:**
85
+ Present configuration questions using structured question rounds. Use your platform's interactive question tool, or numbered text lists if unavailable.
103
86
 
104
- Ask: "Which model quality tier do you want?"
105
- - **Quality** — Large-tier models for all decision-making agents (highest cost, best results)
106
- - **Balanced** (recommended) — Large for planning, medium for execution
107
- - **Budget** — Medium for code, small for research/verification (lowest cost)
87
+ **Round 1 Core settings (4 questions):**
108
88
 
109
- **Group D — Development style:**
110
-
111
- Ask: "Test-first (TDD) mode?"
112
- - **No** (recommended) — Write tests alongside implementation
113
- - **Yes** — Enforce red-green-refactor: write failing test first, verify red, implement, verify green
114
-
115
- **Group E — Workflow agents (these add quality but cost tokens/time):**
116
-
117
- Ask: "Which workflow agents and quality steps should be enabled?"
118
- - **Research** (recommended) — Investigate domain before planning each phase
119
- - **Plan Check** (recommended) — Verify plans achieve their goals before execution
120
- - **Verifier** (recommended) — Confirm deliverables match phase goals after execution
121
- - **Review** (recommended) — Multi-persona code review after verification
122
- - **Solutions Search** (recommended) Search prior solutions for reusable patterns during planning
89
+ ```
90
+ AskUserQuestion([
91
+ {
92
+ header: "Working Style",
93
+ question: "How do you want to work?",
94
+ multiSelect: false,
95
+ options: [
96
+ { label: "YOLO (Recommended)", description: "Auto-approve steps, just execute" },
97
+ { label: "Interactive", description: "Confirm at each step" }
98
+ ]
99
+ },
100
+ {
101
+ header: "Granularity",
102
+ question: "How finely should scope be sliced into phases?",
103
+ multiSelect: false,
104
+ options: [
105
+ { label: "Coarse (Recommended)", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
106
+ { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
107
+ { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
108
+ ]
109
+ },
110
+ {
111
+ header: "Learning Partner",
112
+ question: "How should agentic-learning work during this project?",
113
+ multiSelect: false,
114
+ options: [
115
+ { label: "Auto (Recommended)", description: "Offer learning actions at natural checkpoints (after planning, execution, etc.)" },
116
+ { label: "Manual", description: "Only activate when you explicitly invoke @agentic-learning" }
117
+ ]
118
+ },
119
+ {
120
+ header: "AI Models",
121
+ question: "Which model quality tier for planning agents?",
122
+ multiSelect: false,
123
+ options: [
124
+ { label: "Balanced (Recommended)", description: "Large for planning, medium for execution — good quality/cost ratio" },
125
+ { label: "Quality", description: "Large-tier models for all agents (highest cost, best results)" },
126
+ { label: "Budget", description: "Medium for code, small for research/verification (lowest cost)" }
127
+ ]
128
+ }
129
+ ])
130
+ ```
123
131
 
124
- Ask: "Auto-trigger review after verify-work passes?"
125
- - **No** (recommended) — Run `/review` manually when ready
126
- - **Yes** — Automatically start review after verification succeeds
132
+ **Round 2 Workflow agents (5 questions):**
127
133
 
128
- **Group F — Ship pipeline defaults:**
134
+ ```
135
+ AskUserQuestion([
136
+ {
137
+ header: "Research",
138
+ question: "Research domain before planning each phase? (adds tokens/time)",
139
+ multiSelect: false,
140
+ options: [
141
+ { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
142
+ { label: "No", description: "Plan directly from requirements" }
143
+ ]
144
+ },
145
+ {
146
+ header: "Plan Check",
147
+ question: "Verify plans will achieve their goals? (adds tokens/time)",
148
+ multiSelect: false,
149
+ options: [
150
+ { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
151
+ { label: "No", description: "Execute plans without verification" }
152
+ ]
153
+ },
154
+ {
155
+ header: "Verifier",
156
+ question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
157
+ multiSelect: false,
158
+ options: [
159
+ { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
160
+ { label: "No", description: "Trust execution, skip verification" }
161
+ ]
162
+ },
163
+ {
164
+ header: "Review",
165
+ question: "Multi-persona code review after verification?",
166
+ multiSelect: false,
167
+ options: [
168
+ { label: "Yes (Recommended)", description: "Correctness, security, performance, maintainability review" },
169
+ { label: "No", description: "Skip code review" }
170
+ ]
171
+ },
172
+ {
173
+ header: "Solutions Search",
174
+ question: "Search prior solutions for reusable patterns during planning?",
175
+ multiSelect: false,
176
+ options: [
177
+ { label: "Yes (Recommended)", description: "Check .planning/solutions/ for relevant past fixes" },
178
+ { label: "No", description: "Plan without searching prior solutions" }
179
+ ]
180
+ }
181
+ ])
182
+ ```
129
183
 
130
- Ask: "Ship pipeline preferences?"
131
- - **Auto-test before shipping** (recommended: yes) — Run tests before every ship
132
- - **Conventional commits** (recommended: yes) — Use `feat:`, `fix:`, `docs:` commit prefixes
133
- - **Auto-generate PR description** (recommended: yes) — Create PR body from commit messages
184
+ **Round 3 Pipeline & git (4 questions):**
134
185
 
135
- **Group G — Parallel execution:**
186
+ ```
187
+ AskUserQuestion([
188
+ {
189
+ header: "TDD",
190
+ question: "Test-first (TDD) mode?",
191
+ multiSelect: false,
192
+ options: [
193
+ { label: "No (Recommended)", description: "Write tests alongside implementation" },
194
+ { label: "Yes", description: "Red-green-refactor: write failing test first, implement, verify green" }
195
+ ]
196
+ },
197
+ {
198
+ header: "Ship Pipeline",
199
+ question: "Ship pipeline preferences?",
200
+ multiSelect: true,
201
+ options: [
202
+ { label: "Auto-test before shipping (Recommended)", description: "Run tests before every ship" },
203
+ { label: "Conventional commits (Recommended)", description: "Use feat:, fix:, docs: commit prefixes" },
204
+ { label: "Auto-generate PR description (Recommended)", description: "Create PR body from commit messages" }
205
+ ]
206
+ },
207
+ {
208
+ header: "Git Tracking",
209
+ question: "Commit planning docs to git?",
210
+ multiSelect: false,
211
+ options: [
212
+ { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
213
+ { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
214
+ ]
215
+ },
216
+ {
217
+ header: "Commit Mode",
218
+ question: "When should learnship commit files to git?",
219
+ multiSelect: false,
220
+ options: [
221
+ { label: "Automatically (Recommended)", description: "Commit after each workflow step completes" },
222
+ { label: "Manually", description: "You commit when ready; skip all git commit steps" }
223
+ ]
224
+ }
225
+ ])
226
+ ```
136
227
 
137
228
  <!-- LEARNSHIP_PARALLEL_BLOCK -->
138
229
 
139
- Ask: "Commit planning docs to git?"
140
- - **Yes** (recommended) — Planning docs tracked in version control
141
- - **No** — Keep `.planning/` local-only
142
-
143
- Ask: "When should learnship commit files to git?"
144
- - **Automatically** (recommended) — Commit after each workflow step completes (config, requirements, roadmap, AGENTS.md)
145
- - **Manually** — I'll commit when I say so; skip all git commit steps
146
-
147
230
  Create `.planning/config.json` with all settings:
148
231
 
149
232
  ```json
@@ -311,24 +394,26 @@ git add .planning/PROJECT.md && git commit -m "docs: initialize project"
311
394
 
312
395
  > **🔴 MANDATORY USER CHOICE — You must ask this question and wait for a reply. You are NOT allowed to decide this yourself.**
313
396
 
314
- Display this question to the user exactly as written:
397
+ Display the research decision banner, then present the choice using a structured question:
315
398
 
316
399
  ```
317
400
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
318
401
  learnship ► RESEARCH DECISION
319
402
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
403
+ ```
320
404
 
321
- Before I write the requirements — do you want me to
322
- research the domain ecosystem first?
323
-
324
- 1. Research first (recommended)
325
- Discover standard stacks, expected features,
326
- architecture patterns, common pitfalls
327
-
328
- 2. Skip research
329
- Go straight to requirements
330
-
331
- Reply 1 or 2.
405
+ ```
406
+ AskUserQuestion([
407
+ {
408
+ header: "Research",
409
+ question: "Before I write the requirements — do you want me to research the domain ecosystem first?",
410
+ multiSelect: false,
411
+ options: [
412
+ { label: "Research first (Recommended)", description: "Discover standard stacks, expected features, architecture patterns, common pitfalls — writes 5 research files" },
413
+ { label: "Skip research", description: "Go straight to requirements" }
414
+ ]
415
+ }
416
+ ])
332
417
  ```
333
418
 
334
419
  > � **HARD GATE — This is a user decision. You MUST wait for the user to reply.**
@@ -355,62 +440,121 @@ Reply 1 or 2.
355
440
 
356
441
  ```
357
442
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
358
- learnship ► RESEARCHING
443
+ learnship ► WRITING RESEARCH FILES
359
444
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
360
445
  ```
361
446
 
362
- **You MUST create exactly 5 separate markdown files.** Do NOT write a single monolithic research file. Do NOT combine multiple files into one. Each file is a separate write operation.
447
+ > 🔴 **CRITICAL "Research" in this step means WRITING 5 FILES to disk. It does NOT mean thinking, browsing the web, or analyzing in your head. The deliverable is 5 markdown files on the filesystem. You are not done with research until all 5 files exist and pass verification.**
448
+ >
449
+ > **Forbidden behaviors (if you do any of these, the research step has FAILED):**
450
+ > - Doing web searches or thinking about the domain and then saying "I have enough research data" WITHOUT writing the 5 files
451
+ > - Writing research findings only in your response text instead of to files
452
+ > - Writing fewer than 5 files (e.g., one combined file)
453
+ > - Moving to Step 6 or writing REQUIREMENTS.md before the verification command below prints `RESEARCH VERIFIED OK`
454
+ > - Saying "Let me proceed to requirements" or "Moving to requirements" before verification passes
455
+ >
456
+ > **The ONLY acceptable sequence is:** mkdir → write file 1 → write file 2 → write file 3 → write file 4 → write file 5 → run verification → see `RESEARCH VERIFIED OK` → present findings → get user confirmation.
363
457
 
364
- Create the research directory first:
458
+ **Step 5a — Create the research directory.** Run this command now:
365
459
 
366
460
  ```bash
367
461
  node -e "require('fs').mkdirSync('.planning/research',{recursive:true})"
368
462
  ```
369
463
 
370
- Now create each file one at a time. After writing each file, move to the next.
464
+ > 🛑 Did the mkdir command run? If not, run it now before continuing.
371
465
 
372
- **File 1 of 5 — Write `.planning/research/STACK.md` now:**
373
- Research the standard tech stack for this domain. The file MUST contain these exact `##` headers:
466
+ Read `parallelization` from `.planning/config.json` (defaults to `false`).
467
+
468
+ **If `parallelization.enabled` is `true` (subagent mode — Claude Code, OpenCode, Codex):**
469
+
470
+ Spawn a dedicated researcher agent with the project context:
471
+ ```
472
+ Task(
473
+ subagent_type="learnship-researcher",
474
+ prompt="
475
+ <objective>
476
+ Write 5 research files for a new project into .planning/research/.
477
+ Before writing each file, read the corresponding template from @./templates/research-project/ for the expected structure.
478
+
479
+ Files to write:
480
+ 1. STACK.md — Must have: ## Recommended Stack, ## Alternatives Considered, ## What NOT to Use, ## Versions
481
+ 2. FEATURES.md — Must have: ## Table Stakes, ## Differentiators, ## Anti-Features
482
+ 3. ARCHITECTURE.md — Must have: ## Component Boundaries, ## Data Flow, ## Build Order, ## Integration Points
483
+ 4. PITFALLS.md — Must have: ## Common Mistakes, ## Warning Signs, ## Prevention Strategies
484
+ 5. SUMMARY.md — Must have: ## Recommended Stack, ## Table Stakes Features, ## Key Architecture Decisions, ## Top Pitfalls
485
+
486
+ After writing all 5 files, run the verification command to confirm all files exist with required sections.
487
+ Return: confirmation that all 5 files pass verification.
488
+ </objective>
489
+
490
+ <files_to_read>
491
+ - .planning/PROJECT.md (project description and goals)
492
+ - @./templates/research-project/STACK.md (template for STACK.md)
493
+ - @./templates/research-project/FEATURES.md (template for FEATURES.md)
494
+ - @./templates/research-project/ARCHITECTURE.md (template for ARCHITECTURE.md)
495
+ - @./templates/research-project/PITFALLS.md (template for PITFALLS.md)
496
+ - @./templates/research-project/SUMMARY.md (template for SUMMARY.md)
497
+ </files_to_read>
498
+ "
499
+ )
500
+ ```
501
+
502
+ Wait for the agent to complete, then proceed to Step 5c (verification) to confirm files were written correctly.
503
+
504
+ **If `parallelization.enabled` is `false` (sequential mode):**
505
+
506
+ Using `@./agents/researcher.md` as your research persona:
507
+
508
+ **Step 5b — Write all 5 files.** Create each file one at a time using your file write tool. Each file is a separate write operation. Do NOT combine files. Do NOT skip files. **Before writing each file, read the corresponding template** from `@./templates/research-project/` to understand the expected structure.
509
+
510
+ **File 1 of 5 — Write `.planning/research/STACK.md` to disk now.**
511
+ First, read the template at `@./templates/research-project/STACK.md` for the expected structure. Then research the standard tech stack for this domain and write the results to this file. Use the template as your structural guide. The file MUST contain these exact `##` headers:
374
512
  - `## Recommended Stack`
375
513
  - `## Alternatives Considered`
376
514
  - `## What NOT to Use` (with reasons)
377
515
  - `## Versions`
378
516
 
379
- **File 2 of 5 Write `.planning/research/FEATURES.md` now:**
380
- Research what features exist in this domain. The file MUST contain these exact `##` headers:
517
+ > 🛑 STOP. Confirm: did you write `.planning/research/STACK.md` to the filesystem? If you only thought about the stack but did not create the file, go back and create it now.
518
+
519
+ **File 2 of 5 — Write `.planning/research/FEATURES.md` to disk now.**
520
+ First, read the template at `@./templates/research-project/FEATURES.md` for the expected structure. Then research what features users expect in this domain. Write the results to this file. Use the template as your structural guide. The file MUST contain these exact `##` headers:
381
521
  - `## Table Stakes` (must-haves)
382
522
  - `## Differentiators` (nice-to-haves)
383
523
  - `## Anti-Features` (what to avoid)
384
524
 
385
- **File 3 of 5 — Write `.planning/research/ARCHITECTURE.md` now:**
386
- Research how systems in this domain are typically structured. The file MUST contain these exact `##` headers:
525
+ **File 3 of 5 — Write `.planning/research/ARCHITECTURE.md` to disk now.**
526
+ First, read the template at `@./templates/research-project/ARCHITECTURE.md` for the expected structure. Then research how systems in this domain are typically structured. Write the results to this file. Use the template as your structural guide. The file MUST contain these exact `##` headers:
387
527
  - `## Component Boundaries`
388
528
  - `## Data Flow`
389
529
  - `## Build Order` (suggested sequence)
390
530
  - `## Integration Points`
391
531
 
392
- **File 4 of 5 — Write `.planning/research/PITFALLS.md` now:**
393
- Research common mistakes and prevention strategies. The file MUST contain these exact `##` headers:
532
+ **File 4 of 5 — Write `.planning/research/PITFALLS.md` to disk now.**
533
+ First, read the template at `@./templates/research-project/PITFALLS.md` for the expected structure. Then research common mistakes and prevention strategies. Write the results to this file. Use the template as your structural guide. The file MUST contain these exact `##` headers:
394
534
  - `## Common Mistakes`
395
535
  - `## Warning Signs`
396
536
  - `## Prevention Strategies`
397
537
 
398
- **File 5 of 5 — Write `.planning/research/SUMMARY.md` now:**
399
- Synthesize the 4 files above into a summary. The file MUST contain these exact `##` headers:
538
+ **File 5 of 5 — Write `.planning/research/SUMMARY.md` to disk now.**
539
+ First, read the template at `@./templates/research-project/SUMMARY.md` for the expected structure. Then synthesize the 4 files above into a summary. Write the results to this file. Use the template as your structural guide. The file MUST contain these exact `##` headers:
400
540
  - `## Recommended Stack`
401
541
  - `## Table Stakes Features`
402
542
  - `## Key Architecture Decisions`
403
543
  - `## Top Pitfalls`
404
544
 
405
- > 🔴 **HARD GATE — Run this verification command now. Do not skip it. Do not proceed without running it.**
545
+ **Step 5cVerify all 5 files exist on disk.** Run this verification command now. Do not skip it.
546
+
547
+ > 🔴 **HARD GATE — You MUST run this command. If you skip it and proceed to Step 6, the workflow has FAILED.**
406
548
 
407
549
  ```bash
408
- node -e "const fs=require('fs'),path=require('path');const dir='.planning/research/';const checks={'STACK.md':['Recommended Stack','What NOT to Use'],'FEATURES.md':['Table Stakes','Differentiators'],'ARCHITECTURE.md':['Component Boundaries','Data Flow'],'PITFALLS.md':['Common Mistakes','Prevention Strategies'],'SUMMARY.md':['Recommended Stack','Top Pitfalls']};const missing=[];for(const[file,sections]of Object.entries(checks)){const fp=path.join(dir,file);if(!fs.existsSync(fp)){missing.push(file+' MISSING');continue;}const c=fs.readFileSync(fp,'utf8');for(const s of sections){if(!c.includes('## '+s))missing.push(file+': missing ## '+s);}}if(missing.length){console.log('RESEARCH INCOMPLETE:\\n'+missing.join('\\n'));process.exit(1);}console.log('RESEARCH VERIFIED OK — all 5 files present with required sections');"
550
+ node -e "const fs=require('fs'),path=require('path');const dir='.planning/research/';const checks={'STACK.md':['Recommended Stack','What NOT to Use'],'FEATURES.md':['Table Stakes','Differentiators'],'ARCHITECTURE.md':['Component Boundaries','Data Flow'],'PITFALLS.md':['Common Mistakes','Prevention Strategies'],'SUMMARY.md':['Recommended Stack','Top Pitfalls']};const missing=[];for(const[file,sections]of Object.entries(checks)){const fp=path.join(dir,file);if(!fs.existsSync(fp)){missing.push(file+' MISSING');continue;}const c=fs.readFileSync(fp,'utf8');for(const s of sections){if(!c.includes('## '+s))missing.push(file+': missing ## '+s);}}if(missing.length){console.log('RESEARCH FAILED — files missing or incomplete:\\n'+missing.join('\\n'));console.log('\\nGo back and create the missing files. Do NOT proceed to requirements.');process.exit(1);}console.log('RESEARCH VERIFIED OK — all 5 files present with required sections');"
409
551
  ```
410
552
 
411
- > 🛑 **If the command prints `RESEARCH INCOMPLETE` or exits with code 1:** Go back and create or fix the missing files. Then run the verification again. You MUST see `RESEARCH VERIFIED OK` before continuing. Do NOT proceed to Step 6 without a passing verification.
553
+ > 🛑 **If the command prints `RESEARCH FAILED` or exits with code 1:** Go back and create or fix the missing files. Run the verification again. You MUST see `RESEARCH VERIFIED OK` before continuing.
554
+ >
555
+ > **If you did not run the command at all:** You have skipped verification. Go back and run it now. You cannot proceed to Step 5d without a passing verification.
412
556
 
413
- **Read all 5 research files now** and present their findings in full. Do NOT summarize into 3 bullets. Display this exact structure, populated from the actual file contents:
557
+ **Step 5d — Present findings.** Read all 5 research files from disk now and present their findings in full. Do NOT summarize into 3 bullets — display the actual content from the files you wrote. Display this exact structure, populated from the actual file contents:
414
558
 
415
559
  ```
416
560
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -73,13 +73,27 @@ Report: "Creating quick task ${NEXT_NUM}: ${DESCRIPTION}"
73
73
 
74
74
  Analyze `DESCRIPTION` to identify 2-4 gray areas — implementation decisions that would change the outcome.
75
75
 
76
- Present them for selection (multi-select):
77
- - Each area is a concrete decision point (not generic)
78
- - Include an "All clear — skip discussion" option
76
+ Present them for selection using a structured multi-select question:
77
+
78
+ ```
79
+ AskUserQuestion([
80
+ {
81
+ header: "Gray Areas",
82
+ question: "Which areas need clarification? (select all that apply)",
83
+ multiSelect: true,
84
+ options: [
85
+ { label: "[Area 1]", description: "[Concrete decision point]" },
86
+ { label: "[Area 2]", description: "[Concrete decision point]" },
87
+ { label: "[Area 3]", description: "[Concrete decision point]" },
88
+ { label: "All clear — skip discussion", description: "No gray areas need clarification" }
89
+ ]
90
+ }
91
+ ])
92
+ ```
79
93
 
80
94
  If "All clear" → skip to Step 4.
81
95
 
82
- For each selected area, ask 1-2 focused questions with concrete options. Max 2 questions per area — keep it lightweight.
96
+ For each selected area, ask 1-2 focused questions with concrete options using structured questions. Max 2 questions per area — keep it lightweight.
83
97
 
84
98
  Write `CONTEXT.md` to the task directory:
85
99
 
@@ -30,16 +30,21 @@ ls ".planning/phases/"*"/"*"-RESEARCH.md" 2>/dev/null | grep "^[N]-\|/[N][^0-9]"
30
30
  ```
31
31
 
32
32
  If RESEARCH.md already exists for this phase:
33
- ```
34
- Research already exists: .planning/phases/[phase-dir]/[N]-RESEARCH.md
35
33
 
36
- Options:
37
- 1. View existing research
38
- 2. Re-run and overwrite
39
- 3. Skip — use existing
40
34
  ```
41
-
42
- Wait for choice.
35
+ AskUserQuestion([
36
+ {
37
+ header: "Existing Research",
38
+ question: "Research already exists for this phase. What do you want to do?",
39
+ multiSelect: false,
40
+ options: [
41
+ { label: "View existing", description: "Show current research, then decide" },
42
+ { label: "Re-run and overwrite", description: "Discard existing research and re-run" },
43
+ { label: "Skip", description: "Use existing research as-is" }
44
+ ]
45
+ }
46
+ ])
47
+ ```
43
48
 
44
49
  ## Step 3: Load Context
45
50
 
@@ -65,6 +70,36 @@ If CONTEXT.md exists, read it — user decisions shape what to research.
65
70
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
66
71
  ```
67
72
 
73
+ Read `parallelization` from `.planning/config.json` (defaults to `false`).
74
+
75
+ **If `parallelization.enabled` is `true` (subagent mode — Claude Code, OpenCode, Codex):**
76
+
77
+ Spawn a dedicated researcher agent:
78
+ ```
79
+ Task(
80
+ subagent_type="learnship-researcher",
81
+ prompt="
82
+ <objective>
83
+ Research phase [N] for this project. Read the phase goal from ROADMAP.md,
84
+ requirements from REQUIREMENTS.md, and any CONTEXT.md decisions.
85
+ Write [padded_phase]-RESEARCH.md with Don't Hand-Roll, Common Pitfalls,
86
+ Existing Patterns, and Recommended Approach sections.
87
+ Follow the researcher persona at @./agents/researcher.md.
88
+ </objective>
89
+
90
+ <files_to_read>
91
+ - .planning/ROADMAP.md
92
+ - .planning/REQUIREMENTS.md
93
+ - .planning/STATE.md
94
+ - .planning/phases/[padded_phase]-[slug]/[padded_phase]-CONTEXT.md (if exists)
95
+ - @./agents/researcher.md (persona)
96
+ </files_to_read>
97
+ "
98
+ )
99
+ ```
100
+
101
+ **If `parallelization.enabled` is `false` (sequential mode):**
102
+
68
103
  Using `@./agents/researcher.md` as your research persona in **phase research mode**:
69
104
 
70
105
  Read all loaded context, then investigate how to implement this phase. Write `.planning/phases/[padded_phase]-[slug]/[padded_phase]-RESEARCH.md` with two sections: