@howlil/ez-agents 3.4.2 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +77 -2
  2. package/agents/ez-observer-agent.md +260 -0
  3. package/agents/ez-release-agent.md +333 -0
  4. package/agents/ez-requirements-agent.md +377 -0
  5. package/agents/ez-scrum-master-agent.md +242 -0
  6. package/agents/ez-tech-lead-agent.md +267 -0
  7. package/bin/install.js +3221 -3272
  8. package/commands/ez/arch-review.md +102 -0
  9. package/commands/ez/execute-phase.md +11 -0
  10. package/commands/ez/export-session.md +79 -0
  11. package/commands/ez/gather-requirements.md +117 -0
  12. package/commands/ez/git-workflow.md +72 -0
  13. package/commands/ez/hotfix.md +120 -0
  14. package/commands/ez/import-session.md +82 -0
  15. package/commands/ez/list-sessions.md +96 -0
  16. package/commands/ez/package-manager.md +316 -0
  17. package/commands/ez/plan-phase.md +9 -1
  18. package/commands/ez/preflight.md +79 -0
  19. package/commands/ez/progress.md +13 -1
  20. package/commands/ez/release.md +153 -0
  21. package/commands/ez/resume.md +107 -0
  22. package/commands/ez/standup.md +85 -0
  23. package/ez-agents/bin/ez-tools.cjs +1095 -716
  24. package/ez-agents/bin/lib/bdd-validator.cjs +622 -0
  25. package/ez-agents/bin/lib/content-scanner.cjs +238 -0
  26. package/ez-agents/bin/lib/context-cache.cjs +154 -0
  27. package/ez-agents/bin/lib/context-errors.cjs +71 -0
  28. package/ez-agents/bin/lib/context-manager.cjs +220 -0
  29. package/ez-agents/bin/lib/discussion-synthesizer.cjs +458 -0
  30. package/ez-agents/bin/lib/file-access.cjs +207 -0
  31. package/ez-agents/bin/lib/git-errors.cjs +83 -0
  32. package/ez-agents/bin/lib/git-utils.cjs +321 -203
  33. package/ez-agents/bin/lib/git-workflow-engine.cjs +1157 -0
  34. package/ez-agents/bin/lib/index.cjs +46 -2
  35. package/ez-agents/bin/lib/lockfile-validator.cjs +227 -0
  36. package/ez-agents/bin/lib/logger.cjs +124 -154
  37. package/ez-agents/bin/lib/memory-compression.cjs +256 -0
  38. package/ez-agents/bin/lib/metrics-tracker.cjs +406 -0
  39. package/ez-agents/bin/lib/package-manager-detector.cjs +203 -0
  40. package/ez-agents/bin/lib/package-manager-executor.cjs +385 -0
  41. package/ez-agents/bin/lib/package-manager-service.cjs +216 -0
  42. package/ez-agents/bin/lib/release-validator.cjs +614 -0
  43. package/ez-agents/bin/lib/safe-exec.cjs +128 -214
  44. package/ez-agents/bin/lib/session-chain.cjs +304 -0
  45. package/ez-agents/bin/lib/session-errors.cjs +81 -0
  46. package/ez-agents/bin/lib/session-export.cjs +251 -0
  47. package/ez-agents/bin/lib/session-import.cjs +262 -0
  48. package/ez-agents/bin/lib/session-manager.cjs +280 -0
  49. package/ez-agents/bin/lib/tier-manager.cjs +428 -0
  50. package/ez-agents/bin/lib/url-fetch.cjs +170 -0
  51. package/ez-agents/references/metrics-schema.md +118 -0
  52. package/ez-agents/references/planning-config.md +140 -0
  53. package/ez-agents/references/tier-strategy.md +103 -0
  54. package/ez-agents/templates/bdd-feature.md +173 -0
  55. package/ez-agents/templates/discussion.md +68 -0
  56. package/ez-agents/templates/incident-runbook.md +205 -0
  57. package/ez-agents/templates/release-checklist.md +133 -0
  58. package/ez-agents/templates/rollback-plan.md +201 -0
  59. package/ez-agents/workflows/arch-review.md +54 -0
  60. package/ez-agents/workflows/autonomous.md +844 -743
  61. package/ez-agents/workflows/execute-phase.md +45 -0
  62. package/ez-agents/workflows/export-session.md +255 -0
  63. package/ez-agents/workflows/gather-requirements.md +206 -0
  64. package/ez-agents/workflows/help.md +92 -0
  65. package/ez-agents/workflows/hotfix.md +291 -0
  66. package/ez-agents/workflows/import-session.md +303 -0
  67. package/ez-agents/workflows/new-milestone.md +713 -384
  68. package/ez-agents/workflows/new-project.md +1107 -1113
  69. package/ez-agents/workflows/plan-phase.md +22 -0
  70. package/ez-agents/workflows/progress.md +15 -25
  71. package/ez-agents/workflows/release.md +253 -0
  72. package/ez-agents/workflows/resume-session.md +215 -0
  73. package/ez-agents/workflows/standup.md +64 -0
  74. package/package.json +9 -2
@@ -1,1113 +1,1107 @@
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
- <auto_mode>
10
- ## Auto Mode Detection
11
-
12
- Check if `--auto` flag is present in $ARGUMENTS.
13
-
14
- **If auto mode:**
15
- - Skip brownfield mapping offer (assume greenfield)
16
- - Skip deep questioning (extract context from provided document)
17
- - Config: YOLO mode is implicit (skip that question), but ask granularity/git/agents FIRST (Step 2a)
18
- - After config: run Steps 6-9 automatically with smart defaults:
19
- - Research: Always yes
20
- - Requirements: Include all table stakes + features from provided document
21
- - Requirements approval: Auto-approve
22
- - Roadmap approval: Auto-approve
23
-
24
- **Document requirement:**
25
- Auto mode requires an idea document — either:
26
- - File reference: `/ez:new-project --auto @prd.md`
27
- - Pasted/written text in the prompt
28
-
29
- If no document content provided, error:
30
-
31
- ```
32
- Error: --auto requires an idea document.
33
-
34
- Usage:
35
- /ez:new-project --auto @your-idea.md
36
- /ez:new-project --auto [paste or write your idea here]
37
-
38
- The document should describe what you want to build.
39
- ```
40
- </auto_mode>
41
-
42
- <process>
43
-
44
- ## 1. Setup
45
-
46
- **MANDATORY FIRST STEP Execute these checks before ANY user interaction:**
47
-
48
- ```bash
49
- INIT=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" init new-project)
50
- if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
51
- ```
52
-
53
- 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`.
54
-
55
- **If `project_exists` is true:** Error — project already initialized. Use `/ez:progress`.
56
-
57
- **If `has_git` is false:** Initialize git:
58
- ```bash
59
- git init
60
- ```
61
-
62
- ## 2. Brownfield Offer
63
-
64
- **If auto mode:** Skip to Step 4 (assume greenfield, synthesize PROJECT.md from provided document).
65
-
66
- **If `needs_codebase_map` is true** (from init — existing code detected but no codebase map):
67
-
68
- Use AskUserQuestion:
69
- - header: "Codebase"
70
- - question: "I detected existing code in this directory. Would you like to map the codebase first?"
71
- - options:
72
- - "Map codebase first" — Run /ez:map-codebase to understand existing architecture (Recommended)
73
- - "Skip mapping" — Proceed with project initialization
74
-
75
- **If "Map codebase first":**
76
- ```
77
- Run `/ez:map-codebase` first, then return to `/ez:new-project`
78
- ```
79
- Exit command.
80
-
81
- **If "Skip mapping" OR `needs_codebase_map` is false:** Continue to Step 3.
82
-
83
- ## 2a. Auto Mode Config (auto mode only)
84
-
85
- **If auto mode:** Collect config settings upfront before processing the idea document.
86
-
87
- YOLO mode is implicit (auto = YOLO). Ask remaining config questions:
88
-
89
- **Round 1 Core settings (3 questions, no Mode question):**
90
-
91
- ```
92
- AskUserQuestion([
93
- {
94
- header: "Granularity",
95
- question: "How finely should scope be sliced into phases?",
96
- multiSelect: false,
97
- options: [
98
- { label: "Coarse (Recommended)", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
99
- { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
100
- { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
101
- ]
102
- },
103
- {
104
- header: "Execution",
105
- question: "Run plans in parallel?",
106
- multiSelect: false,
107
- options: [
108
- { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
109
- { label: "Sequential", description: "One plan at a time" }
110
- ]
111
- },
112
- {
113
- header: "Git Tracking",
114
- question: "Commit planning docs to git?",
115
- multiSelect: false,
116
- options: [
117
- { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
118
- { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
119
- ]
120
- }
121
- ])
122
- ```
123
-
124
- **Round 2 Workflow agents (same as Step 5):**
125
-
126
- ```
127
- AskUserQuestion([
128
- {
129
- header: "Research",
130
- question: "Research before planning each phase? (adds tokens/time)",
131
- multiSelect: false,
132
- options: [
133
- { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
134
- { label: "No", description: "Plan directly from requirements" }
135
- ]
136
- },
137
- {
138
- header: "Plan Check",
139
- question: "Verify plans will achieve their goals? (adds tokens/time)",
140
- multiSelect: false,
141
- options: [
142
- { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
143
- { label: "No", description: "Execute plans without verification" }
144
- ]
145
- },
146
- {
147
- header: "Verifier",
148
- question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
149
- multiSelect: false,
150
- options: [
151
- { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
152
- { label: "No", description: "Trust execution, skip verification" }
153
- ]
154
- },
155
- {
156
- header: "AI Models",
157
- question: "Which AI models for planning agents?",
158
- multiSelect: false,
159
- options: [
160
- { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
161
- { label: "Quality", description: "Opus for research/roadmap higher cost, deeper analysis" },
162
- { label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
163
- ]
164
- }
165
- ])
166
- ```
167
-
168
- Create `.planning/config.json` with mode set to "yolo":
169
-
170
- ```json
171
- {
172
- "mode": "yolo",
173
- "granularity": "[selected]",
174
- "parallelization": true|false,
175
- "commit_docs": true|false,
176
- "model_profile": "quality|balanced|budget",
177
- "workflow": {
178
- "research": true|false,
179
- "plan_check": true|false,
180
- "verifier": true|false,
181
- "nyquist_validation": depth !== "quick",
182
- "auto_advance": true
183
- }
184
- }
185
- ```
186
-
187
- **If commit_docs = No:** Add `.planning/` to `.gitignore`.
188
-
189
- **Commit config.json:**
190
-
191
- ```bash
192
- mkdir -p .planning
193
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "chore: add project config" --files .planning/config.json
194
- ```
195
-
196
- **Persist auto-advance chain flag to config (survives context compaction):**
197
-
198
- ```bash
199
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-set workflow._auto_chain_active true
200
- ```
201
-
202
- Proceed to Step 4 (skip Steps 3 and 5).
203
-
204
- ## 3. Deep Questioning
205
-
206
- **If auto mode:** Skip (already handled in Step 2a). Extract project context from provided document instead and proceed to Step 4.
207
-
208
- **Display stage banner:**
209
-
210
- ```
211
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
212
- EZ ► QUESTIONING
213
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
214
- ```
215
-
216
- **Open the conversation:**
217
-
218
- Ask inline (freeform, NOT AskUserQuestion):
219
-
220
- "What do you want to build?"
221
-
222
- Wait for their response. This gives you the context needed to ask intelligent follow-up questions.
223
-
224
- **Follow the thread:**
225
-
226
- Based on what they said, ask follow-up questions that dig into their response. Use AskUserQuestion with options that probe what they mentioned — interpretations, clarifications, concrete examples.
227
-
228
- Keep following threads. Each answer opens new threads to explore. Ask about:
229
- - What excited them
230
- - What problem sparked this
231
- - What they mean by vague terms
232
- - What it would actually look like
233
- - What's already decided
234
-
235
- Consult `questioning.md` for techniques:
236
- - Challenge vagueness
237
- - Make abstract concrete
238
- - Surface assumptions
239
- - Find edges
240
- - Reveal motivation
241
-
242
- **Check context (background, not out loud):**
243
-
244
- As you go, mentally check the context checklist from `questioning.md`. If gaps remain, weave questions naturally. Don't suddenly switch to checklist mode.
245
-
246
- **Decision gate:**
247
-
248
- When you could write a clear PROJECT.md, use AskUserQuestion:
249
-
250
- - header: "Ready?"
251
- - question: "I think I understand what you're after. Ready to create PROJECT.md?"
252
- - options:
253
- - "Create PROJECT.md" Let's move forward
254
- - "Keep exploring" I want to share more / ask me more
255
-
256
- If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
257
-
258
- Loop until "Create PROJECT.md" selected.
259
-
260
- ## 4. Write PROJECT.md
261
-
262
- **If auto mode:** Synthesize from provided document. No "Ready?" gate was shownproceed directly to commit.
263
-
264
- Synthesize all context into `.planning/PROJECT.md` using the template from `templates/project.md`.
265
-
266
- **For greenfield projects:**
267
-
268
- Initialize requirements as hypotheses:
269
-
270
- ```markdown
271
- ## Requirements
272
-
273
- ### Validated
274
-
275
- (None yet — ship to validate)
276
-
277
- ### Active
278
-
279
- - [ ] [Requirement 1]
280
- - [ ] [Requirement 2]
281
- - [ ] [Requirement 3]
282
-
283
- ### Out of Scope
284
-
285
- - [Exclusion 1] — [why]
286
- - [Exclusion 2] — [why]
287
- ```
288
-
289
- All Active requirements are hypotheses until shipped and validated.
290
-
291
- **For brownfield projects (codebase map exists):**
292
-
293
- Infer Validated requirements from existing code:
294
-
295
- 1. Read `.planning/codebase/ARCHITECTURE.md` and `STACK.md`
296
- 2. Identify what the codebase already does
297
- 3. These become the initial Validated set
298
-
299
- ```markdown
300
- ## Requirements
301
-
302
- ### Validated
303
-
304
- - [Existing capability 1] — existing
305
- - ✓ [Existing capability 2] — existing
306
- - [Existing capability 3] — existing
307
-
308
- ### Active
309
-
310
- - [ ] [New requirement 1]
311
- - [ ] [New requirement 2]
312
-
313
- ### Out of Scope
314
-
315
- - [Exclusion 1] [why]
316
- ```
317
-
318
- **Key Decisions:**
319
-
320
- Initialize with any decisions made during questioning:
321
-
322
- ```markdown
323
- ## Key Decisions
324
-
325
- | Decision | Rationale | Outcome |
326
- |----------|-----------|---------|
327
- | [Choice from questioning] | [Why] | — Pending |
328
- ```
329
-
330
- **Last updated footer:**
331
-
332
- ```markdown
333
- ---
334
- *Last updated: [date] after initialization*
335
- ```
336
-
337
- Do not compress. Capture everything gathered.
338
-
339
- **Commit PROJECT.md:**
340
-
341
- ```bash
342
- mkdir -p .planning
343
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs: initialize project" --files .planning/PROJECT.md
344
- ```
345
-
346
- ## 5. Workflow Preferences
347
-
348
- **If auto mode:** Skip — config was collected in Step 2a. Proceed to Step 5.5.
349
-
350
- **Check for global defaults** at `~/.ez/defaults.json` using direct path existence checks only.
351
- Do **not** glob or recursively search home directories for this file.
352
- If it exists, offer to use saved defaults:
353
-
354
- ```
355
- AskUserQuestion([
356
- {
357
- question: "Use your saved default settings? (from ~/.ez/defaults.json)",
358
- header: "Defaults",
359
- multiSelect: false,
360
- options: [
361
- { label: "Yes (Recommended)", description: "Use saved defaults, skip settings questions" },
362
- { label: "No", description: "Configure settings manually" }
363
- ]
364
- }
365
- ])
366
- ```
367
-
368
- If "Yes": read `~/.ez/defaults.json`, use those values for config.json, and skip directly to **Commit config.json** below.
369
-
370
- If "No" or it doesn't exist: proceed with the questions below.
371
-
372
- **Round 1 — Core workflow settings (4 questions):**
373
-
374
- ```
375
- questions: [
376
- {
377
- header: "Mode",
378
- question: "How do you want to work?",
379
- multiSelect: false,
380
- options: [
381
- { label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
382
- { label: "Interactive", description: "Confirm at each step" }
383
- ]
384
- },
385
- {
386
- header: "Granularity",
387
- question: "How finely should scope be sliced into phases?",
388
- multiSelect: false,
389
- options: [
390
- { label: "Coarse", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
391
- { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
392
- { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
393
- ]
394
- },
395
- {
396
- header: "Execution",
397
- question: "Run plans in parallel?",
398
- multiSelect: false,
399
- options: [
400
- { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
401
- { label: "Sequential", description: "One plan at a time" }
402
- ]
403
- },
404
- {
405
- header: "Git Tracking",
406
- question: "Commit planning docs to git?",
407
- multiSelect: false,
408
- options: [
409
- { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
410
- { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
411
- ]
412
- }
413
- ]
414
- ```
415
-
416
- **Round 2 — Workflow agents:**
417
-
418
- These spawn additional agents during planning/execution. They add tokens and time but improve quality.
419
-
420
- | Agent | When it runs | What it does |
421
- |-------|--------------|--------------|
422
- | **Researcher** | Before planning each phase | Investigates domain, finds patterns, surfaces gotchas |
423
- | **Plan Checker** | After plan is created | Verifies plan actually achieves the phase goal |
424
- | **Verifier** | After phase execution | Confirms must-haves were delivered |
425
-
426
- All recommended for important projects. Skip for quick experiments.
427
-
428
- ```
429
- questions: [
430
- {
431
- header: "Research",
432
- question: "Research before planning each phase? (adds tokens/time)",
433
- multiSelect: false,
434
- options: [
435
- { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
436
- { label: "No", description: "Plan directly from requirements" }
437
- ]
438
- },
439
- {
440
- header: "Plan Check",
441
- question: "Verify plans will achieve their goals? (adds tokens/time)",
442
- multiSelect: false,
443
- options: [
444
- { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
445
- { label: "No", description: "Execute plans without verification" }
446
- ]
447
- },
448
- {
449
- header: "Verifier",
450
- question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
451
- multiSelect: false,
452
- options: [
453
- { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
454
- { label: "No", description: "Trust execution, skip verification" }
455
- ]
456
- },
457
- {
458
- header: "AI Models",
459
- question: "Which AI models for planning agents?",
460
- multiSelect: false,
461
- options: [
462
- { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
463
- { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
464
- { label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
465
- ]
466
- }
467
- ]
468
- ```
469
-
470
- Create `.planning/config.json` with all settings:
471
-
472
- ```json
473
- {
474
- "mode": "yolo|interactive",
475
- "granularity": "coarse|standard|fine",
476
- "parallelization": true|false,
477
- "commit_docs": true|false,
478
- "model_profile": "quality|balanced|budget",
479
- "workflow": {
480
- "research": true|false,
481
- "plan_check": true|false,
482
- "verifier": true|false,
483
- "nyquist_validation": depth !== "quick"
484
- }
485
- }
486
- ```
487
-
488
- **If commit_docs = No:**
489
- - Set `commit_docs: false` in config.json
490
- - Add `.planning/` to `.gitignore` (create if needed)
491
-
492
- **If commit_docs = Yes:**
493
- - No additional gitignore entries needed
494
-
495
- **Commit config.json:**
496
-
497
- ```bash
498
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "chore: add project config" --files .planning/config.json
499
- ```
500
-
501
- **Note:** Run `/ez:settings` anytime to update these preferences.
502
-
503
- ## 5.5. Resolve Model Profile
504
-
505
- Use models from init: `researcher_model`, `synthesizer_model`, `roadmapper_model`.
506
-
507
- ## 6. Research Decision
508
-
509
- **If auto mode:** Default to "Research first" without asking.
510
-
511
- Use AskUserQuestion:
512
- - header: "Research"
513
- - question: "Research the domain ecosystem before defining requirements?"
514
- - options:
515
- - "Research first (Recommended)" Discover standard stacks, expected features, architecture patterns
516
- - "Skip research" — I know this domain well, go straight to requirements
517
-
518
- **If "Research first":**
519
-
520
- Display stage banner:
521
- ```
522
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
523
- EZ RESEARCHING
524
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
525
-
526
- Researching [domain] ecosystem...
527
- ```
528
-
529
- Create research directory:
530
- ```bash
531
- mkdir -p .planning/research
532
- ```
533
-
534
- **Determine milestone context:**
535
-
536
- Check if this is greenfield or subsequent milestone:
537
- - If no "Validated" requirements in PROJECT.md → Greenfield (building from scratch)
538
- - If "Validated" requirements exist → Subsequent milestone (adding to existing app)
539
-
540
- Display spawning indicator:
541
- ```
542
- ◆ Spawning 4 researchers in parallel...
543
- Stack research
544
- → Features research
545
- → Architecture research
546
- Pitfalls research
547
- ```
548
-
549
- Spawn 4 parallel ez-project-researcher agents with path references:
550
-
551
- ```
552
- Task(prompt="<research_type>
553
- Project Research Stack dimension for [domain].
554
- </research_type>
555
-
556
- <milestone_context>
557
- [greenfield OR subsequent]
558
-
559
- Greenfield: Research the standard stack for building [domain] from scratch.
560
- Subsequent: Research what's needed to add [target features] to an existing [domain] app. Don't re-research the existing system.
561
- </milestone_context>
562
-
563
- <question>
564
- What's the standard 2025 stack for [domain]?
565
- </question>
566
-
567
- <files_to_read>
568
- - {project_path} (Project context and goals)
569
- </files_to_read>
570
-
571
- <downstream_consumer>
572
- Your STACK.md feeds into roadmap creation. Be prescriptive:
573
- - Specific libraries with versions
574
- - Clear rationale for each choice
575
- - What NOT to use and why
576
- </downstream_consumer>
577
-
578
- <quality_gate>
579
- - [ ] Versions are current (verify with Context7/official docs, not training data)
580
- - [ ] Rationale explains WHY, not just WHAT
581
- - [ ] Confidence levels assigned to each recommendation
582
- </quality_gate>
583
-
584
- <output>
585
- Write to: .planning/research/STACK.md
586
- Use template: ~/.claude/ez-agents/templates/research-project/STACK.md
587
- </output>
588
- ", subagent_type="ez-project-researcher", model="{researcher_model}", description="Stack research")
589
-
590
- Task(prompt="<research_type>
591
- Project Research — Features dimension for [domain].
592
- </research_type>
593
-
594
- <milestone_context>
595
- [greenfield OR subsequent]
596
-
597
- Greenfield: What features do [domain] products have? What's table stakes vs differentiating?
598
- Subsequent: How do [target features] typically work? What's expected behavior?
599
- </milestone_context>
600
-
601
- <question>
602
- What features do [domain] products have? What's table stakes vs differentiating?
603
- </question>
604
-
605
- <files_to_read>
606
- - {project_path} (Project context)
607
- </files_to_read>
608
-
609
- <downstream_consumer>
610
- Your FEATURES.md feeds into requirements definition. Categorize clearly:
611
- - Table stakes (must have or users leave)
612
- - Differentiators (competitive advantage)
613
- - Anti-features (things to deliberately NOT build)
614
- </downstream_consumer>
615
-
616
- <quality_gate>
617
- - [ ] Categories are clear (table stakes vs differentiators vs anti-features)
618
- - [ ] Complexity noted for each feature
619
- - [ ] Dependencies between features identified
620
- </quality_gate>
621
-
622
- <output>
623
- Write to: .planning/research/FEATURES.md
624
- Use template: ~/.claude/ez-agents/templates/research-project/FEATURES.md
625
- </output>
626
- ", subagent_type="ez-project-researcher", model="{researcher_model}", description="Features research")
627
-
628
- Task(prompt="<research_type>
629
- Project Research — Architecture dimension for [domain].
630
- </research_type>
631
-
632
- <milestone_context>
633
- [greenfield OR subsequent]
634
-
635
- Greenfield: How are [domain] systems typically structured? What are major components?
636
- Subsequent: How do [target features] integrate with existing [domain] architecture?
637
- </milestone_context>
638
-
639
- <question>
640
- How are [domain] systems typically structured? What are major components?
641
- </question>
642
-
643
- <files_to_read>
644
- - {project_path} (Project context)
645
- </files_to_read>
646
-
647
- <downstream_consumer>
648
- Your ARCHITECTURE.md informs phase structure in roadmap. Include:
649
- - Component boundaries (what talks to what)
650
- - Data flow (how information moves)
651
- - Suggested build order (dependencies between components)
652
- </downstream_consumer>
653
-
654
- <quality_gate>
655
- - [ ] Components clearly defined with boundaries
656
- - [ ] Data flow direction explicit
657
- - [ ] Build order implications noted
658
- </quality_gate>
659
-
660
- <output>
661
- Write to: .planning/research/ARCHITECTURE.md
662
- Use template: ~/.claude/ez-agents/templates/research-project/ARCHITECTURE.md
663
- </output>
664
- ", subagent_type="ez-project-researcher", model="{researcher_model}", description="Architecture research")
665
-
666
- Task(prompt="<research_type>
667
- Project Research — Pitfalls dimension for [domain].
668
- </research_type>
669
-
670
- <milestone_context>
671
- [greenfield OR subsequent]
672
-
673
- Greenfield: What do [domain] projects commonly get wrong? Critical mistakes?
674
- Subsequent: What are common mistakes when adding [target features] to [domain]?
675
- </milestone_context>
676
-
677
- <question>
678
- What do [domain] projects commonly get wrong? Critical mistakes?
679
- </question>
680
-
681
- <files_to_read>
682
- - {project_path} (Project context)
683
- </files_to_read>
684
-
685
- <downstream_consumer>
686
- Your PITFALLS.md prevents mistakes in roadmap/planning. For each pitfall:
687
- - Warning signs (how to detect early)
688
- - Prevention strategy (how to avoid)
689
- - Which phase should address it
690
- </downstream_consumer>
691
-
692
- <quality_gate>
693
- - [ ] Pitfalls are specific to this domain (not generic advice)
694
- - [ ] Prevention strategies are actionable
695
- - [ ] Phase mapping included where relevant
696
- </quality_gate>
697
-
698
- <output>
699
- Write to: .planning/research/PITFALLS.md
700
- Use template: ~/.claude/ez-agents/templates/research-project/PITFALLS.md
701
- </output>
702
- ", subagent_type="ez-project-researcher", model="{researcher_model}", description="Pitfalls research")
703
- ```
704
-
705
- After all 4 agents complete, spawn synthesizer to create SUMMARY.md:
706
-
707
- ```
708
- Task(prompt="
709
- <task>
710
- Synthesize research outputs into SUMMARY.md.
711
- </task>
712
-
713
- <files_to_read>
714
- - .planning/research/STACK.md
715
- - .planning/research/FEATURES.md
716
- - .planning/research/ARCHITECTURE.md
717
- - .planning/research/PITFALLS.md
718
- </files_to_read>
719
-
720
- <output>
721
- Write to: .planning/research/SUMMARY.md
722
- Use template: ~/.claude/ez-agents/templates/research-project/SUMMARY.md
723
- Commit after writing.
724
- </output>
725
- ", subagent_type="ez-research-synthesizer", model="{synthesizer_model}", description="Synthesize research")
726
- ```
727
-
728
- Display research complete banner and key findings:
729
- ```
730
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
731
- EZ RESEARCH COMPLETE
732
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
733
-
734
- ## Key Findings
735
-
736
- **Stack:** [from SUMMARY.md]
737
- **Table Stakes:** [from SUMMARY.md]
738
- **Watch Out For:** [from SUMMARY.md]
739
-
740
- Files: `.planning/research/`
741
- ```
742
-
743
- **If "Skip research":** Continue to Step 7.
744
-
745
- ## 7. Define Requirements
746
-
747
- Display stage banner:
748
- ```
749
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
750
- EZ DEFINING REQUIREMENTS
751
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
752
- ```
753
-
754
- **Load context:**
755
-
756
- Read PROJECT.md and extract:
757
- - Core value (the ONE thing that must work)
758
- - Stated constraints (budget, timeline, tech limitations)
759
- - Any explicit scope boundaries
760
-
761
- **If research exists:** Read research/FEATURES.md and extract feature categories.
762
-
763
- **If auto mode:**
764
- - Auto-include all table stakes features (users expect these)
765
- - Include features explicitly mentioned in provided document
766
- - Auto-defer differentiators not mentioned in document
767
- - Skip per-category AskUserQuestion loops
768
- - Skip "Any additions?" question
769
- - Skip requirements approval gate
770
- - Generate REQUIREMENTS.md and commit directly
771
-
772
- **Present features by category (interactive mode only):**
773
-
774
- ```
775
- Here are the features for [domain]:
776
-
777
- ## Authentication
778
- **Table stakes:**
779
- - Sign up with email/password
780
- - Email verification
781
- - Password reset
782
- - Session management
783
-
784
- **Differentiators:**
785
- - Magic link login
786
- - OAuth (Google, GitHub)
787
- - 2FA
788
-
789
- **Research notes:** [any relevant notes]
790
-
791
- ---
792
-
793
- ## [Next Category]
794
- ...
795
- ```
796
-
797
- **If no research:** Gather requirements through conversation instead.
798
-
799
- Ask: "What are the main things users need to be able to do?"
800
-
801
- For each capability mentioned:
802
- - Ask clarifying questions to make it specific
803
- - Probe for related capabilities
804
- - Group into categories
805
-
806
- **Scope each category:**
807
-
808
- For each category, use AskUserQuestion:
809
-
810
- - header: "[Category]" (max 12 chars)
811
- - question: "Which [category] features are in v1?"
812
- - multiSelect: true
813
- - options:
814
- - "[Feature 1]" — [brief description]
815
- - "[Feature 2]" — [brief description]
816
- - "[Feature 3]" — [brief description]
817
- - "None for v1" — Defer entire category
818
-
819
- Track responses:
820
- - Selected features → v1 requirements
821
- - Unselected table stakes → v2 (users expect these)
822
- - Unselected differentiators → out of scope
823
-
824
- **Identify gaps:**
825
-
826
- Use AskUserQuestion:
827
- - header: "Additions"
828
- - question: "Any requirements research missed? (Features specific to your vision)"
829
- - options:
830
- - "No, research covered it" — Proceed
831
- - "Yes, let me add some" Capture additions
832
-
833
- **Validate core value:**
834
-
835
- Cross-check requirements against Core Value from PROJECT.md. If gaps detected, surface them.
836
-
837
- **Generate REQUIREMENTS.md:**
838
-
839
- Create `.planning/REQUIREMENTS.md` with:
840
- - v1 Requirements grouped by category (checkboxes, REQ-IDs)
841
- - v2 Requirements (deferred)
842
- - Out of Scope (explicit exclusions with reasoning)
843
- - Traceability section (empty, filled by roadmap)
844
-
845
- **REQ-ID format:** `[CATEGORY]-[NUMBER]` (AUTH-01, CONTENT-02)
846
-
847
- **Requirement quality criteria:**
848
-
849
- Good requirements are:
850
- - **Specific and testable:** "User can reset password via email link" (not "Handle password reset")
851
- - **User-centric:** "User can X" (not "System does Y")
852
- - **Atomic:** One capability per requirement (not "User can login and manage profile")
853
- - **Independent:** Minimal dependencies on other requirements
854
-
855
- Reject vague requirements. Push for specificity:
856
- - "Handle authentication""User can log in with email/password and stay logged in across sessions"
857
- - "Support sharing" "User can share post via link that opens in recipient's browser"
858
-
859
- **Present full requirements list (interactive mode only):**
860
-
861
- Show every requirement (not counts) for user confirmation:
862
-
863
- ```
864
- ## v1 Requirements
865
-
866
- ### Authentication
867
- - [ ] **AUTH-01**: User can create account with email/password
868
- - [ ] **AUTH-02**: User can log in and stay logged in across sessions
869
- - [ ] **AUTH-03**: User can log out from any page
870
-
871
- ### Content
872
- - [ ] **CONT-01**: User can create posts with text
873
- - [ ] **CONT-02**: User can edit their own posts
874
-
875
- [... full list ...]
876
-
877
- ---
878
-
879
- Does this capture what you're building? (yes / adjust)
880
- ```
881
-
882
- If "adjust": Return to scoping.
883
-
884
- **Commit requirements:**
885
-
886
- ```bash
887
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs: define v1 requirements" --files .planning/REQUIREMENTS.md
888
- ```
889
-
890
- ## 8. Create Roadmap
891
-
892
- Display stage banner:
893
- ```
894
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
895
- EZ ► CREATING ROADMAP
896
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
897
-
898
- Spawning roadmapper...
899
- ```
900
-
901
- Spawn ez-roadmapper agent with path references:
902
-
903
- ```
904
- Task(prompt="
905
- <planning_context>
906
-
907
- <files_to_read>
908
- - .planning/PROJECT.md (Project context)
909
- - .planning/REQUIREMENTS.md (v1 Requirements)
910
- - .planning/research/SUMMARY.md (Research findings - if exists)
911
- - .planning/config.json (Granularity and mode settings)
912
- </files_to_read>
913
-
914
- </planning_context>
915
-
916
- <instructions>
917
- Create roadmap:
918
- 1. Derive phases from requirements (don't impose structure)
919
- 2. Map every v1 requirement to exactly one phase
920
- 3. Derive 2-5 success criteria per phase (observable user behaviors)
921
- 4. Validate 100% coverage
922
- 5. Write files immediately (ROADMAP.md, STATE.md, update REQUIREMENTS.md traceability)
923
- 6. Return ROADMAP CREATED with summary
924
-
925
- Write files first, then return. This ensures artifacts persist even if context is lost.
926
- </instructions>
927
- ", subagent_type="ez-roadmapper", model="{roadmapper_model}", description="Create roadmap")
928
- ```
929
-
930
- **Handle roadmapper return:**
931
-
932
- **If `## ROADMAP BLOCKED`:**
933
- - Present blocker information
934
- - Work with user to resolve
935
- - Re-spawn when resolved
936
-
937
- **If `## ROADMAP CREATED`:**
938
-
939
- Read the created ROADMAP.md and present it nicely inline:
940
-
941
- ```
942
- ---
943
-
944
- ## Proposed Roadmap
945
-
946
- **[N] phases** | **[X] requirements mapped** | All v1 requirements covered ✓
947
-
948
- | # | Phase | Goal | Requirements | Success Criteria |
949
- |---|-------|------|--------------|------------------|
950
- | 1 | [Name] | [Goal] | [REQ-IDs] | [count] |
951
- | 2 | [Name] | [Goal] | [REQ-IDs] | [count] |
952
- | 3 | [Name] | [Goal] | [REQ-IDs] | [count] |
953
- ...
954
-
955
- ### Phase Details
956
-
957
- **Phase 1: [Name]**
958
- Goal: [goal]
959
- Requirements: [REQ-IDs]
960
- Success criteria:
961
- 1. [criterion]
962
- 2. [criterion]
963
- 3. [criterion]
964
-
965
- **Phase 2: [Name]**
966
- Goal: [goal]
967
- Requirements: [REQ-IDs]
968
- Success criteria:
969
- 1. [criterion]
970
- 2. [criterion]
971
-
972
- [... continue for all phases ...]
973
-
974
- ---
975
- ```
976
-
977
- **If auto mode:** Skip approval gate — auto-approve and commit directly.
978
-
979
- **CRITICAL: Ask for approval before committing (interactive mode only):**
980
-
981
- Use AskUserQuestion:
982
- - header: "Roadmap"
983
- - question: "Does this roadmap structure work for you?"
984
- - options:
985
- - "Approve" Commit and continue
986
- - "Adjust phases" — Tell me what to change
987
- - "Review full file" — Show raw ROADMAP.md
988
-
989
- **If "Approve":** Continue to commit.
990
-
991
- **If "Adjust phases":**
992
- - Get user's adjustment notes
993
- - Re-spawn roadmapper with revision context:
994
- ```
995
- Task(prompt="
996
- <revision>
997
- User feedback on roadmap:
998
- [user's notes]
999
-
1000
- <files_to_read>
1001
- - .planning/ROADMAP.md (Current roadmap to revise)
1002
- </files_to_read>
1003
-
1004
- Update the roadmap based on feedback. Edit files in place.
1005
- Return ROADMAP REVISED with changes made.
1006
- </revision>
1007
- ", subagent_type="ez-roadmapper", model="{roadmapper_model}", description="Revise roadmap")
1008
- ```
1009
- - Present revised roadmap
1010
- - Loop until user approves
1011
-
1012
- **If "Review full file":** Display raw `cat .planning/ROADMAP.md`, then re-ask.
1013
-
1014
- **Commit roadmap (after approval or auto mode):**
1015
-
1016
- ```bash
1017
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs: create roadmap ([N] phases)" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md
1018
- ```
1019
-
1020
- ## 9. Done
1021
-
1022
- Present completion summary:
1023
-
1024
- ```
1025
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1026
- EZ PROJECT INITIALIZED
1027
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1028
-
1029
- **[Project Name]**
1030
-
1031
- | Artifact | Location |
1032
- |----------------|-----------------------------|
1033
- | Project | `.planning/PROJECT.md` |
1034
- | Config | `.planning/config.json` |
1035
- | Research | `.planning/research/` |
1036
- | Requirements | `.planning/REQUIREMENTS.md` |
1037
- | Roadmap | `.planning/ROADMAP.md` |
1038
-
1039
- **[N] phases** | **[X] requirements** | Ready to build ✓
1040
- ```
1041
-
1042
- **If auto mode:**
1043
-
1044
- ```
1045
- ╔══════════════════════════════════════════╗
1046
- ║ AUTO-ADVANCING → DISCUSS PHASE 1 ║
1047
- ╚══════════════════════════════════════════╝
1048
- ```
1049
-
1050
- Exit skill and invoke SlashCommand("/ez:discuss-phase 1 --auto")
1051
-
1052
- **If interactive mode:**
1053
-
1054
- ```
1055
- ───────────────────────────────────────────────────────────────
1056
-
1057
- ## ▶ Next Up
1058
-
1059
- **Phase 1: [Phase Name]** — [Goal from ROADMAP.md]
1060
-
1061
- /ez:discuss-phase 1 — gather context and clarify approach
1062
-
1063
- <sub>/clear first → fresh context window</sub>
1064
-
1065
- ---
1066
-
1067
- **Also available:**
1068
- - /ez:plan-phase 1 skip discussion, plan directly
1069
-
1070
- ───────────────────────────────────────────────────────────────
1071
- ```
1072
-
1073
- </process>
1074
-
1075
- <output>
1076
-
1077
- - `.planning/PROJECT.md`
1078
- - `.planning/config.json`
1079
- - `.planning/research/` (if research selected)
1080
- - `STACK.md`
1081
- - `FEATURES.md`
1082
- - `ARCHITECTURE.md`
1083
- - `PITFALLS.md`
1084
- - `SUMMARY.md`
1085
- - `.planning/REQUIREMENTS.md`
1086
- - `.planning/ROADMAP.md`
1087
- - `.planning/STATE.md`
1088
-
1089
- </output>
1090
-
1091
- <success_criteria>
1092
-
1093
- - [ ] .planning/ directory created
1094
- - [ ] Git repo initialized
1095
- - [ ] Brownfield detection completed
1096
- - [ ] Deep questioning completed (threads followed, not rushed)
1097
- - [ ] PROJECT.md captures full context → **committed**
1098
- - [ ] config.json has workflow mode, granularity, parallelization → **committed**
1099
- - [ ] Research completed (if selected) — 4 parallel agents spawned → **committed**
1100
- - [ ] Requirements gathered (from research or conversation)
1101
- - [ ] User scoped each category (v1/v2/out of scope)
1102
- - [ ] REQUIREMENTS.md created with REQ-IDs → **committed**
1103
- - [ ] ez-roadmapper spawned with context
1104
- - [ ] Roadmap files written immediately (not draft)
1105
- - [ ] User feedback incorporated (if any)
1106
- - [ ] ROADMAP.md created with phases, requirement mappings, success criteria
1107
- - [ ] STATE.md initialized
1108
- - [ ] REQUIREMENTS.md traceability updated
1109
- - [ ] User knows next step is `/ez:discuss-phase 1`
1110
-
1111
- **Atomic commits:** Each phase commits its artifacts immediately. If context is lost, artifacts persist.
1112
-
1113
- </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
+
4
+ **GSD-2 Enhanced:** Includes health check, cost tracking, crash recovery, fresh context, and stuck detection for production-grade reliability.
5
+ </purpose>
6
+
7
+ <required_reading>
8
+ Read all files referenced by the invoking prompt's execution_context before starting.
9
+ </required_reading>
10
+
11
+ <auto_mode>
12
+ ## Auto Mode Detection
13
+
14
+ Check if `--auto` flag is present in $ARGUMENTS.
15
+
16
+ **If auto mode:**
17
+ - Skip brownfield mapping offer (assume greenfield)
18
+ - Skip deep questioning (extract context from provided document)
19
+ - Config: YOLO mode is implicit (skip that question), but ask granularity/git/agents FIRST (Step 2a)
20
+ - After config: run Steps 6-9 automatically with smart defaults:
21
+ - Research: Always yes
22
+ - Requirements: Include all table stakes + features from provided document
23
+ - Requirements approval: Auto-approve
24
+ - Roadmap approval: Auto-approve
25
+
26
+ **Document requirement:**
27
+ Auto mode requires an idea document — either:
28
+ - File reference: `/ez:new-project --auto @prd.md`
29
+ - Pasted/written text in the prompt
30
+
31
+ If no document content provided, error:
32
+
33
+ ```
34
+ Error: --auto requires an idea document.
35
+
36
+ Usage:
37
+ /ez:new-project --auto @your-idea.md
38
+ /ez:new-project --auto [paste or write your idea here]
39
+
40
+ The document should describe what you want to build.
41
+ ```
42
+ </auto_mode>
43
+
44
+ <process>
45
+
46
+ ## 0. Pre-Flight Health Check (GSD-2 Pattern)
47
+
48
+ **MANDATORY FIRST STEP — Validate environment before ANY operation:**
49
+
50
+ ```bash
51
+ # Run health check
52
+ HEALTH=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" doctor --json)
53
+ ```
54
+
55
+ **Check:**
56
+ - ✅ Node.js version >= 16.7.0
57
+ - AI tools available (Claude, OpenCode, etc.)
58
+ - ✅ Config valid (`.planning/config.json` or create default)
59
+ - ✅ Git repo initialized (or auto-init)
60
+ - ✅ API keys configured
61
+
62
+ **If any check fails:**
63
+ ```
64
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
65
+ EZ ► HEALTH CHECK FAILED
66
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
67
+
68
+ [Failed check description]
69
+
70
+ Fix:
71
+ [suggested command]
72
+
73
+ Example:
74
+ $ [example command]
75
+
76
+ Resolve before continuing with project initialization.
77
+ ```
78
+
79
+ **Abort project init until resolved.**
80
+
81
+ ---
82
+
83
+ ## 0a. Gather Initial Context (CONTEXT-01, CONTEXT-02)
84
+
85
+ **Initialize ContextManager for context gathering:**
86
+
87
+ ```javascript
88
+ const ContextManager = require('../bin/lib/context-manager.cjs');
89
+ const contextManager = new ContextManager(process.cwd());
90
+ ```
91
+
92
+ **Request initial project context:**
93
+
94
+ ```javascript
95
+ const context = await contextManager.requestContext({
96
+ files: ['README.md', 'package.json'],
97
+ urls: []
98
+ });
99
+ ```
100
+
101
+ **Agent can request additional context using:**
102
+ - `ez-tools context read <pattern>` — Read local files
103
+ - `ez-tools context fetch <url>` — Fetch URL content (requires user confirmation)
104
+
105
+ **Update STATE.md with context sources:**
106
+
107
+ ```javascript
108
+ await contextManager.updateStateMd();
109
+ ```
110
+
111
+ **Continue to Setup (Step 1) with gathered context.**
112
+
113
+ ---
114
+
115
+ ## 1. Setup with Lock File (GSD-2 Pattern)
116
+
117
+ **Execute initialization with crash recovery:**
118
+
119
+ ```bash
120
+ INIT=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" init new-project)
121
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
122
+ ```
123
+
124
+ 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`.
125
+
126
+ **If `project_exists` is true:** Error — project already initialized. Use `/ez:progress`.
127
+
128
+ **Create lock file for crash recovery:**
129
+
130
+ ```bash
131
+ # Create auto.lock
132
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-create \
133
+ --operation="new-project" \
134
+ --project-path="$project_path"
135
+ ```
136
+
137
+ **Create `.planning/auto.lock`:**
138
+ ```json
139
+ {
140
+ "pid": 12345,
141
+ "operation": "new-project",
142
+ "project_path": "/path/to/project",
143
+ "started_at": "2026-03-18T12:00:00.000Z",
144
+ "last_heartbeat": "2026-03-18T12:00:00.000Z",
145
+ "state": "setup"
146
+ }
147
+ ```
148
+
149
+ **If `has_git` is false:** Initialize git:
150
+ ```bash
151
+ git init
152
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="git_initialized"
153
+ ```
154
+
155
+ ---
156
+
157
+ ## 2. Brownfield Offer
158
+
159
+ **If auto mode:** Skip to Step 4 (assume greenfield, synthesize PROJECT.md from provided document).
160
+
161
+ **If `needs_codebase_map` is true** (from initexisting code detected but no codebase map):
162
+
163
+ Use AskUserQuestion:
164
+ - header: "Codebase"
165
+ - question: "I detected existing code in this directory. Would you like to map the codebase first?"
166
+ - options:
167
+ - "Map codebase first" — Run /ez:map-codebase to understand existing architecture (Recommended)
168
+ - "Skip mapping" Proceed with project initialization
169
+
170
+ **If "Map codebase first":**
171
+ ```
172
+ Run `/ez:map-codebase` first, then return to `/ez:new-project`
173
+ ```
174
+ Exit command.
175
+
176
+ **If "Skip mapping" OR `needs_codebase_map` is false:** Continue to Step 3.
177
+
178
+ **Update lock file state:**
179
+ ```bash
180
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="brownfield_check_complete"
181
+ ```
182
+
183
+ ---
184
+
185
+ ## 2a. Auto Mode Config (auto mode only)
186
+
187
+ **If auto mode:** Collect config settings upfront before processing the idea document.
188
+
189
+ YOLO mode is implicit (auto = YOLO). Ask remaining config questions:
190
+
191
+ **Round 1 — Core settings (3 questions, no Mode question):**
192
+
193
+ ```
194
+ AskUserQuestion([
195
+ {
196
+ header: "Granularity",
197
+ question: "How finely should scope be sliced into phases?",
198
+ multiSelect: false,
199
+ options: [
200
+ { label: "Coarse (Recommended)", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
201
+ { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
202
+ { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
203
+ ]
204
+ },
205
+ {
206
+ header: "Execution",
207
+ question: "Run plans in parallel?",
208
+ multiSelect: false,
209
+ options: [
210
+ { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
211
+ { label: "Sequential", description: "One plan at a time" }
212
+ ]
213
+ },
214
+ {
215
+ header: "Git Tracking",
216
+ question: "Commit planning docs to git?",
217
+ multiSelect: false,
218
+ options: [
219
+ { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
220
+ { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
221
+ ]
222
+ }
223
+ ])
224
+ ```
225
+
226
+ **Round 2 Workflow agents (same as Step 5):**
227
+
228
+ ```
229
+ AskUserQuestion([
230
+ {
231
+ header: "Research",
232
+ question: "Research before planning each phase? (adds tokens/time)",
233
+ multiSelect: false,
234
+ options: [
235
+ { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
236
+ { label: "No", description: "Plan directly from requirements" }
237
+ ]
238
+ },
239
+ {
240
+ header: "Plan Check",
241
+ question: "Verify plans will achieve their goals? (adds tokens/time)",
242
+ multiSelect: false,
243
+ options: [
244
+ { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
245
+ { label: "No", description: "Execute plans without verification" }
246
+ ]
247
+ },
248
+ {
249
+ header: "Verifier",
250
+ question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
251
+ multiSelect: false,
252
+ options: [
253
+ { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
254
+ { label: "No", description: "Trust execution, skip verification" }
255
+ ]
256
+ },
257
+ {
258
+ header: "AI Models",
259
+ question: "Which AI models for planning agents?",
260
+ multiSelect: false,
261
+ options: [
262
+ { label: "Balanced (Recommended)", description: "Sonnet for most agentsgood quality/cost ratio" },
263
+ { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
264
+ { label: "Budget", description: "Haiku where possible fastest, lowest cost" }
265
+ ]
266
+ }
267
+ ])
268
+ ```
269
+
270
+ Create `.planning/config.json` with mode set to "yolo":
271
+
272
+ ```json
273
+ {
274
+ "mode": "yolo",
275
+ "granularity": "[selected]",
276
+ "parallelization": true|false,
277
+ "commit_docs": true|false,
278
+ "model_profile": "quality|balanced|budget",
279
+ "workflow": {
280
+ "research": true|false,
281
+ "plan_check": true|false,
282
+ "verifier": true|false,
283
+ "nyquist_validation": depth !== "quick",
284
+ "auto_advance": true
285
+ }
286
+ }
287
+ ```
288
+
289
+ **If commit_docs = No:** Add `.planning/` to `.gitignore`.
290
+
291
+ **Commit config.json:**
292
+
293
+ ```bash
294
+ mkdir -p .planning
295
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "chore: add project config" --files .planning/config.json
296
+ ```
297
+
298
+ **Persist auto-advance chain flag to config (survives context compaction):**
299
+
300
+ ```bash
301
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-set workflow._auto_chain_active true
302
+ ```
303
+
304
+ **Update lock file state:**
305
+ ```bash
306
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="config_complete"
307
+ ```
308
+
309
+ Proceed to Step 4 (skip Steps 3 and 5).
310
+
311
+ ---
312
+
313
+ ## 3. Deep Questioning
314
+
315
+ **If auto mode:** Skip (already handled in Step 2a). Extract project context from provided document instead and proceed to Step 4.
316
+
317
+ **Display stage banner:**
318
+
319
+ ```
320
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
321
+ EZ ► QUESTIONING
322
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
323
+ ```
324
+
325
+ **Open the conversation:**
326
+
327
+ Ask inline (freeform, NOT AskUserQuestion):
328
+
329
+ "What do you want to build?"
330
+
331
+ Wait for their response. This gives you the context needed to ask intelligent follow-up questions.
332
+
333
+ **Follow the thread:**
334
+
335
+ Based on what they said, ask follow-up questions that dig into their response. Use AskUserQuestion with options that probe what they mentioned — interpretations, clarifications, concrete examples.
336
+
337
+ Keep following threads. Each answer opens new threads to explore. Ask about:
338
+ - What excited them
339
+ - What problem sparked this
340
+ - What they mean by vague terms
341
+ - What it would actually look like
342
+ - What's already decided
343
+
344
+ Consult `questioning.md` for techniques:
345
+ - Challenge vagueness
346
+ - Make abstract concrete
347
+ - Surface assumptions
348
+ - Find edges
349
+ - Reveal motivation
350
+
351
+ **Check context (background, not out loud):**
352
+
353
+ As you go, mentally check the context checklist from `questioning.md`. If gaps remain, weave questions naturally. Don't suddenly switch to checklist mode.
354
+
355
+ **Decision gate:**
356
+
357
+ When you could write a clear PROJECT.md, use AskUserQuestion:
358
+
359
+ - header: "Ready?"
360
+ - question: "I think I understand what you're after. Ready to create PROJECT.md?"
361
+ - options:
362
+ - "Create PROJECT.md" Let's move forward
363
+ - "Keep exploring" — I want to share more / ask me more
364
+
365
+ If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
366
+
367
+ Loop until "Create PROJECT.md" selected.
368
+
369
+ **Update lock file state:**
370
+ ```bash
371
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="questioning_complete"
372
+ ```
373
+
374
+ ---
375
+
376
+ ## 4. Write PROJECT.md
377
+
378
+ **If auto mode:** Synthesize from provided document. No "Ready?" gate was shown — proceed directly to commit.
379
+
380
+ Synthesize all context into `.planning/PROJECT.md` using the template from `templates/project.md`.
381
+
382
+ **For greenfield projects:**
383
+
384
+ Initialize requirements as hypotheses:
385
+
386
+ ```markdown
387
+ ## Requirements
388
+
389
+ ### Validated
390
+
391
+ (None yet ship to validate)
392
+
393
+ ### Active
394
+
395
+ - [ ] [Requirement 1]
396
+ - [ ] [Requirement 2]
397
+ - [ ] [Requirement 3]
398
+
399
+ ### Out of Scope
400
+
401
+ - [Exclusion 1] [why]
402
+ - [Exclusion 2] — [why]
403
+ ```
404
+
405
+ All Active requirements are hypotheses until shipped and validated.
406
+
407
+ **For brownfield projects (codebase map exists):**
408
+
409
+ Infer Validated requirements from existing code:
410
+
411
+ 1. Read `.planning/codebase/ARCHITECTURE.md` and `STACK.md`
412
+ 2. Identify what the codebase already does
413
+ 3. These become the initial Validated set
414
+
415
+ ```markdown
416
+ ## Requirements
417
+
418
+ ### Validated
419
+
420
+ - [Existing capability 1] existing
421
+ - ✓ [Existing capability 2] — existing
422
+ - [Existing capability 3] existing
423
+
424
+ ### Active
425
+
426
+ - [ ] [New requirement 1]
427
+ - [ ] [New requirement 2]
428
+
429
+ ### Out of Scope
430
+
431
+ - [Exclusion 1] — [why]
432
+ ```
433
+
434
+ **Key Decisions:**
435
+
436
+ Initialize with any decisions made during questioning:
437
+
438
+ ```markdown
439
+ ## Key Decisions
440
+
441
+ | Decision | Rationale | Outcome |
442
+ |----------|-----------|---------|
443
+ | [Choice from questioning] | [Why] | — Pending |
444
+ ```
445
+
446
+ **Last updated footer:**
447
+
448
+ ```markdown
449
+ ---
450
+ *Last updated: [date] after initialization*
451
+ ```
452
+
453
+ Do not compress. Capture everything gathered.
454
+
455
+ **Commit PROJECT.md:**
456
+
457
+ ```bash
458
+ mkdir -p .planning
459
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs: initialize project" --files .planning/PROJECT.md
460
+ ```
461
+
462
+ **Update lock file state:**
463
+ ```bash
464
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="project_defined"
465
+ ```
466
+
467
+ ---
468
+
469
+ ## 5. Workflow Preferences
470
+
471
+ **If auto mode:** Skip — config was collected in Step 2a. Proceed to Step 5.5.
472
+
473
+ **Check for global defaults** at `~/.ez/defaults.json` using direct path existence checks only.
474
+ Do **not** glob or recursively search home directories for this file.
475
+ If it exists, offer to use saved defaults:
476
+
477
+ ```
478
+ AskUserQuestion([
479
+ {
480
+ question: "Use your saved default settings? (from ~/.ez/defaults.json)",
481
+ header: "Defaults",
482
+ multiSelect: false,
483
+ options: [
484
+ { label: "Yes (Recommended)", description: "Use saved defaults, skip settings questions" },
485
+ { label: "No", description: "Configure settings manually" }
486
+ ]
487
+ }
488
+ ])
489
+ ```
490
+
491
+ If "Yes": read `~/.ez/defaults.json`, use those values for config.json, and skip directly to **Commit config.json** below.
492
+
493
+ If "No" or it doesn't exist: proceed with the questions below.
494
+
495
+ **Round 1 — Core workflow settings (4 questions):**
496
+
497
+ ```
498
+ questions: [
499
+ {
500
+ header: "Mode",
501
+ question: "How do you want to work?",
502
+ multiSelect: false,
503
+ options: [
504
+ { label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
505
+ { label: "Interactive", description: "Confirm at each step" }
506
+ ]
507
+ },
508
+ {
509
+ header: "Granularity",
510
+ question: "How finely should scope be sliced into phases?",
511
+ multiSelect: false,
512
+ options: [
513
+ { label: "Coarse", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
514
+ { label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
515
+ { label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
516
+ ]
517
+ },
518
+ {
519
+ header: "Execution",
520
+ question: "Run plans in parallel?",
521
+ multiSelect: false,
522
+ options: [
523
+ { label: "Parallel (Recommended)", description: "Independent plans run simultaneously" },
524
+ { label: "Sequential", description: "One plan at a time" }
525
+ ]
526
+ },
527
+ {
528
+ header: "Git Tracking",
529
+ question: "Commit planning docs to git?",
530
+ multiSelect: false,
531
+ options: [
532
+ { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
533
+ { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
534
+ ]
535
+ }
536
+ ]
537
+ ```
538
+
539
+ **Round 2 — Workflow agents:**
540
+
541
+ These spawn additional agents during planning/execution. They add tokens and time but improve quality. They add tokens and time but improve quality.
542
+
543
+ All recommended for important projects. Skip for quick experiments.
544
+
545
+ ```
546
+ questions: [
547
+ {
548
+ header: "Research",
549
+ question: "Research before planning each phase? (adds tokens/time)",
550
+ multiSelect: false,
551
+ options: [
552
+ { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
553
+ { label: "No", description: "Plan directly from requirements" }
554
+ ]
555
+ },
556
+ {
557
+ header: "Plan Check",
558
+ question: "Verify plans will achieve their goals? (adds tokens/time)",
559
+ multiSelect: false,
560
+ options: [
561
+ { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
562
+ { label: "No", description: "Execute plans without verification" }
563
+ ]
564
+ },
565
+ {
566
+ header: "Verifier",
567
+ question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
568
+ multiSelect: false,
569
+ options: [
570
+ { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
571
+ { label: "No", description: "Trust execution, skip verification" }
572
+ ]
573
+ },
574
+ {
575
+ header: "AI Models",
576
+ question: "Which AI models for planning agents?",
577
+ multiSelect: false,
578
+ options: [
579
+ { label: "Balanced (Recommended)", description: "Sonnet for most agents good quality/cost ratio" },
580
+ { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
581
+ { label: "Budget", description: "Haiku where possible fastest, lowest cost" }
582
+ ]
583
+ }
584
+ ]
585
+ ```
586
+
587
+ Create `.planning/config.json` with all settings:
588
+
589
+ ```json
590
+ {
591
+ "mode": "yolo|interactive",
592
+ "granularity": "coarse|standard|fine",
593
+ "parallelization": true|false,
594
+ "commit_docs": true|false,
595
+ "model_profile": "quality|balanced|budget",
596
+ "workflow": {
597
+ "research": true|false,
598
+ "plan_check": true|false,
599
+ "verifier": true|false,
600
+ "nyquist_validation": depth !== "quick"
601
+ }
602
+ }
603
+ ```
604
+
605
+ **If commit_docs = No:**
606
+ - Set `commit_docs: false` in config.json
607
+ - Add `.planning/` to `.gitignore` (create if needed)
608
+
609
+ **If commit_docs = Yes:**
610
+ - No additional gitignore entries needed
611
+
612
+ **Commit config.json:**
613
+
614
+ ```bash
615
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "chore: add project config" --files .planning/config.json
616
+ ```
617
+
618
+ **Note:** Run `/ez:settings` anytime to update these preferences.
619
+
620
+ **Update lock file state:**
621
+ ```bash
622
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="config_complete"
623
+ ```
624
+
625
+ ## 5.5. Resolve Model Profile
626
+
627
+ Use models from init: `researcher_model`, `synthesizer_model`, `roadmapper_model`.
628
+
629
+ ---
630
+
631
+ ## 6. Research Decision (with Fresh Context - GSD-2 Pattern)
632
+
633
+ **If auto mode:** Default to "Research first" without asking.
634
+
635
+ Use AskUserQuestion:
636
+ - header: "Research"
637
+ - question: "Research the domain ecosystem before defining requirements?"
638
+ - options:
639
+ - "Research first (Recommended)" — Discover standard stack, expected features, architecture patterns
640
+ - "Skip research" I know this domain well, go straight to requirements
641
+
642
+ **If "Research first":**
643
+
644
+ Display stage banner:
645
+ ```
646
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
647
+ EZ ► RESEARCHING
648
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
649
+
650
+ Researching [domain] ecosystem...
651
+ ```
652
+
653
+ Create research directory:
654
+ ```bash
655
+ mkdir -p .planning/research
656
+ ```
657
+
658
+ **Determine milestone context:**
659
+
660
+ Check if this is greenfield or subsequent milestone:
661
+ - If no "Validated" requirements in PROJECT.md → Greenfield (building from scratch)
662
+ - If "Validated" requirements exist → Subsequent milestone (adding to existing app)
663
+
664
+ Display spawning indicator:
665
+ ```
666
+ ◆ Spawning 4 researchers in parallel...
667
+ Stack research
668
+ → Features research
669
+ → Architecture research
670
+ → Pitfalls research
671
+ ```
672
+
673
+ **Spawn 4 parallel ez-project-researcher agents with FRESH CONTEXT (GSD-2 Pattern):**
674
+
675
+ Each uses this template with dimension-specific fields:
676
+
677
+ ```
678
+ Task(prompt="
679
+ <research_type>Project Research — {DIMENSION} for [domain].</research_type>
680
+
681
+ <fresh_context>
682
+ CONTEXT RESET: This is a fresh 200K session.
683
+ No accumulated garbage from prior tasks.
684
+ Only relevant context pre-loaded below.
685
+ </fresh_context>
686
+
687
+ <pre_loaded_context>
688
+ - .planning/PROJECT.md excerpt (core value, goals)
689
+ - .planning/config.json (workflow settings)
690
+ </pre_loaded_context>
691
+
692
+ <milestone_context>
693
+ {greenfield_or_subsequent}
694
+
695
+ Greenfield: Research the standard stack for building [domain] from scratch.
696
+ Subsequent: Research what's needed to add [target features] to an existing [domain] app. Don't re-research the existing system.
697
+ </milestone_context>
698
+
699
+ <question>
700
+ {QUESTION}
701
+ </question>
702
+
703
+ <files_to_read>
704
+ - {project_path} (Project context and goals)
705
+ </files_to_read>
706
+
707
+ <downstream_consumer>
708
+ {CONSUMER}
709
+ </downstream_consumer>
710
+
711
+ <quality_gate>
712
+ {GATES}
713
+ </quality_gate>
714
+
715
+ <output>
716
+ Write to: .planning/research/{FILE}
717
+ Use template: ~/.claude/ez-agents/templates/research-project/{FILE}
718
+ </output>
719
+ ", subagent_type="ez-project-researcher", model="{researcher_model}", description="{DIMENSION} research")
720
+ ```
721
+
722
+ **Dimension-specific fields:**
723
+
724
+ | Field | Stack | Features | Architecture | Pitfalls |
725
+ |-------|-------|----------|-------------|----------|
726
+ | QUESTION | What's the standard 2025 stack for [domain]? | What features do [domain] products have? | How are [domain] systems typically structured? | What do [domain] projects commonly get wrong? |
727
+ | CONSUMER | Specific libraries with versions, clear rationale, what NOT to use | Table stakes vs differentiators vs anti-features | Component boundaries, data flow, build order | Warning signs, prevention strategy, phase mapping |
728
+ | GATES | Versions current (verify with Context7), rationale explains WHY | Categories clear, complexity noted, dependencies identified | Components clearly defined, data flow explicit | Pitfalls specific to domain, prevention actionable |
729
+ | FILE | STACK.md | FEATURES.md | ARCHITECTURE.md | PITFALLS.md |
730
+
731
+ After all 4 complete, spawn synthesizer to create SUMMARY.md:
732
+
733
+ ```
734
+ Task(prompt="
735
+ Synthesize research outputs into SUMMARY.md.
736
+
737
+ <files_to_read>
738
+ - .planning/research/STACK.md
739
+ - .planning/research/FEATURES.md
740
+ - .planning/research/ARCHITECTURE.md
741
+ - .planning/research/PITFALLS.md
742
+ </files_to_read>
743
+
744
+ Write to: .planning/research/SUMMARY.md
745
+ Use template: ~/.claude/ez-agents/templates/research-project/SUMMARY.md
746
+ Commit after writing.
747
+ ", subagent_type="ez-research-synthesizer", model="{synthesizer_model}", description="Synthesize research")
748
+ ```
749
+
750
+ Display research complete banner and key findings:
751
+ ```
752
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
753
+ EZ ► RESEARCH COMPLETE ✓
754
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
755
+
756
+ ## Key Findings
757
+
758
+ **Stack:** [from SUMMARY.md]
759
+ **Table Stakes:** [from SUMMARY.md]
760
+ **Watch Out For:** [from SUMMARY.md]
761
+
762
+ Files: `.planning/research/`
763
+ ```
764
+
765
+ **Update lock file state:**
766
+ ```bash
767
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="research_complete"
768
+ ```
769
+
770
+ **If "Skip research":** Continue to Step 7.
771
+
772
+ ---
773
+
774
+ ## 7. Define Requirements
775
+
776
+ Display stage banner:
777
+ ```
778
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
779
+ EZ DEFINING REQUIREMENTS
780
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
781
+ ```
782
+
783
+ **Load context:**
784
+
785
+ Read PROJECT.md and extract:
786
+ - Core value (the ONE thing that must work)
787
+ - Stated constraints (budget, timeline, tech limitations)
788
+ - Any explicit scope boundaries
789
+
790
+ **If research exists:** Read research/FEATURES.md and extract feature categories.
791
+
792
+ **If auto mode:**
793
+ - Auto-include all table stakes features (users expect these)
794
+ - Include features explicitly mentioned in provided document
795
+ - Auto-defer differentiators not mentioned in document
796
+ - Skip per-category AskUserQuestion loops
797
+ - Skip "Any additions?" question
798
+ - Skip requirements approval gate
799
+ - Generate REQUIREMENTS.md and commit directly
800
+
801
+ **Present features by category (interactive mode only):**
802
+
803
+ ```
804
+ Here are the features for [domain]:
805
+
806
+ ## Authentication
807
+ **Table stakes:**
808
+ - Sign up with email/password
809
+ - Email verification
810
+ - Password reset
811
+ - Session management
812
+
813
+ **Differentiators:**
814
+ - Magic link login
815
+ - OAuth (Google, GitHub)
816
+ - 2FA
817
+
818
+ **Research notes:** [any relevant notes]
819
+
820
+ ---
821
+
822
+ ## [Next Category]
823
+ ...
824
+ ```
825
+
826
+ **If no research:** Gather requirements through conversation instead.
827
+
828
+ Ask: "What are the main things users need to be able to do?"
829
+
830
+ For each capability mentioned:
831
+ - Ask clarifying questions to make it specific
832
+ - Probe for related capabilities
833
+ - Group into categories
834
+
835
+ **Scope each category:**
836
+
837
+ For each category, use AskUserQuestion:
838
+
839
+ - header: "[Category]" (max 12 chars)
840
+ - question: "Which [category] features are in v1?"
841
+ - multiSelect: true
842
+ - options:
843
+ - "[Feature 1]" [brief description]
844
+ - "[Feature 2]" — [brief description]
845
+ - "[Feature 3]" — [brief description]
846
+ - "None for v1" — Defer entire category
847
+
848
+ Track responses:
849
+ - Selected features → v1 requirements
850
+ - Unselected table stakes v2 (users expect these)
851
+ - Unselected differentiators out of scope
852
+
853
+ **Identify gaps:**
854
+
855
+ Use AskUserQuestion:
856
+ - header: "Additions"
857
+ - question: "Any requirements research missed? (Features specific to your vision)"
858
+ - options:
859
+ - "No, research covered it" Proceed
860
+ - "Yes, let me add some" — Capture additions
861
+
862
+ **Validate core value:**
863
+
864
+ Cross-check requirements against Core Value from PROJECT.md. If gaps detected, surface them.
865
+
866
+ **Generate REQUIREMENTS.md:**
867
+
868
+ Create `.planning/REQUIREMENTS.md` with:
869
+ - v1 Requirements grouped by category (checkboxes, REQ-IDs)
870
+ - v2 Requirements (deferred)
871
+ - Out of Scope (explicit exclusions with reasoning)
872
+ - Traceability section (empty, filled by roadmap)
873
+
874
+ **REQ-ID format:** `[CATEGORY]-[NUMBER]` (AUTH-01, CONTENT-02)
875
+
876
+ **Requirement quality criteria:**
877
+
878
+ Good requirements are:
879
+ - **Specific and testable:** "User can reset password via email link" (not "Handle password reset")
880
+ - **User-centric:** "User can X" (not "System does Y")
881
+ - **Atomic:** One capability per requirement (not "User can login and manage profile")
882
+ - **Independent:** Minimal dependencies on other requirements
883
+
884
+ Reject vague requirements. Push for specificity.
885
+
886
+ Present FULL requirements list for confirmation:
887
+
888
+ ```
889
+ ## Project Requirements
890
+
891
+ ### [Category 1]
892
+ - [ ] **CAT1-01**: User can do X
893
+ - [ ] **CAT1-02**: User can do Y
894
+
895
+ ### [Category 2]
896
+ - [ ] **CAT2-01**: User can do Z
897
+
898
+ Does this capture what you're building? (yes / adjust)
899
+ ```
900
+
901
+ If "adjust": Return to scoping.
902
+
903
+ **Commit requirements:**
904
+ ```bash
905
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs: define project requirements" --files .planning/REQUIREMENTS.md
906
+ ```
907
+
908
+ **Update lock file state:**
909
+ ```bash
910
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="requirements_defined"
911
+ ```
912
+
913
+ ---
914
+
915
+ ## 8. Create Roadmap (with Stuck Detection - GSD-2 Pattern)
916
+
917
+ Display stage banner:
918
+ ```
919
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
920
+ EZ CREATING ROADMAP
921
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
922
+
923
+ Spawning roadmapper...
924
+ ```
925
+
926
+ **Initialize stuck detection:**
927
+
928
+ ```bash
929
+ # Start stuck watcher
930
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" stuck-watch start \
931
+ --operation="roadmap-creation" \
932
+ --max-retries=1 \
933
+ --timeout=300
934
+ ```
935
+
936
+ ```
937
+ Task(prompt="
938
+ <planning_context>
939
+ <files_to_read>
940
+ - .planning/PROJECT.md
941
+ - .planning/REQUIREMENTS.md
942
+ - .planning/research/SUMMARY.md (if exists)
943
+ - .planning/config.json
944
+ </files_to_read>
945
+ </planning_context>
946
+
947
+ <instructions>
948
+ Create roadmap for new project:
949
+ 1. Start phase numbering from 1
950
+ 2. Derive phases from requirements
951
+ 3. Map every requirement to exactly one phase
952
+ 4. Derive 2-5 success criteria per phase (observable user behaviors)
953
+ 5. Validate 100% coverage
954
+ 6. Write files immediately (ROADMAP.md, STATE.md, update REQUIREMENTS.md traceability)
955
+ 7. Return ROADMAP CREATED with summary
956
+
957
+ Write files first, then return.
958
+ </instructions>
959
+ ", subagent_type="ez-roadmapper", model="{roadmapper_model}", description="Create roadmap")
960
+ ```
961
+
962
+ **Handle return:**
963
+
964
+ **If `## ROADMAP BLOCKED`:**
965
+ 1. Log error type and location
966
+ 2. Retry ONCE with diagnostic context:
967
+ ```
968
+ Task(prompt="
969
+ <retry_context>
970
+ PREVIOUS ATTEMPT FAILED
971
+ Error Type: [error_type]
972
+ Error Location: [location]
973
+ Suggested Fix: [fix]
974
+
975
+ CONTEXT SNAPSHOT FOR DEBUGGING:
976
+ [snapshot of files read]
977
+
978
+ Please try again with this diagnostic information.
979
+ </retry_context>
980
+ ", subagent_type="ez-roadmapper", model="{roadmapper_model}", description="Create roadmap (retry)")
981
+ ```
982
+ 3. If fails again → STOP with exact failure report:
983
+ ```
984
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
985
+ EZ ROADMAP CREATION FAILED
986
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
987
+
988
+ Error Type: [type]
989
+ Error Location: [file:line]
990
+ Suggested Fix: [action]
991
+
992
+ Context Snapshot: .planning/logs/stuck-snapshot-[timestamp].json
993
+
994
+ Next Steps:
995
+ 1. Review context snapshot
996
+ 2. Fix [specific issue]
997
+ 3. Run: /ez:new-project --retry
998
+ ```
999
+
1000
+ **If `## ROADMAP CREATED`:** Read ROADMAP.md, present inline:
1001
+
1002
+ ```
1003
+ ## Proposed Roadmap
1004
+
1005
+ **[N] phases** | **[X] requirements mapped** | All covered ✓
1006
+
1007
+ | # | Phase | Goal | Requirements | Success Criteria |
1008
+ |---|-------|------|--------------|------------------|
1009
+ | 1 | [Name] | [Goal] | [REQ-IDs] | [count] |
1010
+
1011
+ ### Phase Details
1012
+
1013
+ **Phase 1: [Name]**
1014
+ Goal: [goal]
1015
+ Requirements: [REQ-IDs]
1016
+ Success criteria:
1017
+ 1. [criterion]
1018
+ 2. [criterion]
1019
+ ```
1020
+
1021
+ **Ask for approval** via AskUserQuestion:
1022
+ - "Approve" — Commit and continue
1023
+ - "Adjust phases" — Tell me what to change
1024
+ - "Review full file" — Show raw ROADMAP.md
1025
+
1026
+ **If "Adjust":** Get notes, re-spawn roadmapper with revision context, loop until approved.
1027
+ **If "Review":** Display raw ROADMAP.md, re-ask.
1028
+
1029
+ **Commit roadmap** (after approval):
1030
+ ```bash
1031
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs: create project roadmap ([N] phases)" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md
1032
+ ```
1033
+
1034
+ **Update lock file state:**
1035
+ ```bash
1036
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="roadmap_created"
1037
+ ```
1038
+
1039
+ ---
1040
+
1041
+ ## 9. Release Lock File
1042
+
1043
+ **Project initialization complete:**
1044
+
1045
+ ```bash
1046
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-release
1047
+ ```
1048
+
1049
+ ---
1050
+
1051
+ ## 10. Done
1052
+
1053
+ ```
1054
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1055
+ EZ ► PROJECT INITIALIZED ✓
1056
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1057
+
1058
+ **Project: [Project Name]**
1059
+
1060
+ | Artifact | Location |
1061
+ |----------------|-----------------------------|
1062
+ | Project | `.planning/PROJECT.md` |
1063
+ | Research | `.planning/research/` |
1064
+ | Requirements | `.planning/REQUIREMENTS.md` |
1065
+ | Roadmap | `.planning/ROADMAP.md` |
1066
+ | Config | `.planning/config.json` |
1067
+
1068
+ **[N] phases** | **[X] requirements** | Ready to build ✓
1069
+
1070
+ ## ▶ Next Up
1071
+
1072
+ **Phase 1: [Phase Name]** — [Goal]
1073
+
1074
+ `/ez:discuss-phase 1` — gather context and clarify approach
1075
+
1076
+ <sub>`/clear` first → fresh context window</sub>
1077
+
1078
+ Also: `/ez:plan-phase 1` — skip discussion, plan directly
1079
+ ```
1080
+
1081
+ </process>
1082
+
1083
+ <success_criteria>
1084
+ - [ ] Pre-flight health check passed (all systems go)
1085
+ - [ ] Lock file created and maintained throughout
1086
+ - [ ] PROJECT.md created with clear core value
1087
+ - [ ] REQUIREMENTS.md created with REQ-IDs
1088
+ - [ ] ROADMAP.md created with phased execution plan
1089
+ - [ ] STATE.md initialized
1090
+ - [ ] Config.json created with workflow preferences
1091
+ - [ ] Research completed (if selected) — 4 parallel agents with fresh context
1092
+ - [ ] Requirements gathered and scoped per category
1093
+ - [ ] ez-roadmapper spawned with stuck detection
1094
+ - [ ] Roadmap files written immediately (not draft)
1095
+ - [ ] User feedback incorporated (if any)
1096
+ - [ ] All commits made (if planning docs committed)
1097
+ - [ ] Lock file released on completion
1098
+ - [ ] User knows next step: `/ez:discuss-phase 1`
1099
+
1100
+ **Atomic commits:** Each artifact committed immediately after creation.
1101
+
1102
+ **GSD-2 Reliability:**
1103
+ - Health check pre-flight validation
1104
+ - Crash recovery via lock files
1105
+ - Fresh context per researcher/agent
1106
+ - Stuck detection with diagnostics during roadmap creation
1107
+ </success_criteria>