@howlil/ez-agents 3.4.1 → 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 (162) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +84 -20
  3. package/agents/ez-observer-agent.md +260 -0
  4. package/agents/ez-release-agent.md +333 -0
  5. package/agents/ez-requirements-agent.md +377 -0
  6. package/agents/ez-scrum-master-agent.md +242 -0
  7. package/agents/ez-tech-lead-agent.md +267 -0
  8. package/bin/install.js +3221 -3230
  9. package/commands/ez/arch-review.md +102 -0
  10. package/commands/ez/execute-phase.md +11 -0
  11. package/commands/ez/export-session.md +79 -0
  12. package/commands/ez/gather-requirements.md +117 -0
  13. package/commands/ez/git-workflow.md +72 -0
  14. package/commands/ez/hotfix.md +120 -0
  15. package/commands/ez/import-session.md +82 -0
  16. package/commands/ez/join-discord.md +18 -18
  17. package/commands/ez/list-sessions.md +96 -0
  18. package/commands/ez/package-manager.md +316 -0
  19. package/commands/ez/plan-phase.md +9 -1
  20. package/commands/ez/preflight.md +79 -0
  21. package/commands/ez/progress.md +13 -1
  22. package/commands/ez/release.md +153 -0
  23. package/commands/ez/resume.md +107 -0
  24. package/commands/ez/standup.md +85 -0
  25. package/ez-agents/bin/ez-tools.cjs +1095 -716
  26. package/ez-agents/bin/lib/assistant-adapter.cjs +264 -264
  27. package/ez-agents/bin/lib/audit-exec.cjs +7 -2
  28. package/ez-agents/bin/lib/bdd-validator.cjs +622 -0
  29. package/ez-agents/bin/lib/circuit-breaker.cjs +118 -118
  30. package/ez-agents/bin/lib/config.cjs +190 -190
  31. package/ez-agents/bin/lib/content-scanner.cjs +238 -0
  32. package/ez-agents/bin/lib/context-cache.cjs +154 -0
  33. package/ez-agents/bin/lib/context-errors.cjs +71 -0
  34. package/ez-agents/bin/lib/context-manager.cjs +220 -0
  35. package/ez-agents/bin/lib/discussion-synthesizer.cjs +458 -0
  36. package/ez-agents/bin/lib/file-access.cjs +207 -0
  37. package/ez-agents/bin/lib/file-lock.cjs +236 -236
  38. package/ez-agents/bin/lib/frontmatter.cjs +299 -299
  39. package/ez-agents/bin/lib/fs-utils.cjs +153 -153
  40. package/ez-agents/bin/lib/git-errors.cjs +83 -0
  41. package/ez-agents/bin/lib/git-utils.cjs +118 -0
  42. package/ez-agents/bin/lib/git-workflow-engine.cjs +1157 -0
  43. package/ez-agents/bin/lib/index.cjs +157 -113
  44. package/ez-agents/bin/lib/init.cjs +757 -757
  45. package/ez-agents/bin/lib/lockfile-validator.cjs +227 -0
  46. package/ez-agents/bin/lib/logger.cjs +124 -124
  47. package/ez-agents/bin/lib/memory-compression.cjs +256 -0
  48. package/ez-agents/bin/lib/metrics-tracker.cjs +406 -0
  49. package/ez-agents/bin/lib/milestone.cjs +241 -241
  50. package/ez-agents/bin/lib/model-provider.cjs +241 -241
  51. package/ez-agents/bin/lib/package-manager-detector.cjs +203 -0
  52. package/ez-agents/bin/lib/package-manager-executor.cjs +385 -0
  53. package/ez-agents/bin/lib/package-manager-service.cjs +216 -0
  54. package/ez-agents/bin/lib/phase.cjs +925 -925
  55. package/ez-agents/bin/lib/planning-write.cjs +107 -107
  56. package/ez-agents/bin/lib/release-validator.cjs +614 -0
  57. package/ez-agents/bin/lib/retry.cjs +119 -119
  58. package/ez-agents/bin/lib/roadmap.cjs +306 -306
  59. package/ez-agents/bin/lib/safe-exec.cjs +128 -128
  60. package/ez-agents/bin/lib/safe-path.cjs +130 -130
  61. package/ez-agents/bin/lib/session-chain.cjs +304 -0
  62. package/ez-agents/bin/lib/session-errors.cjs +81 -0
  63. package/ez-agents/bin/lib/session-export.cjs +251 -0
  64. package/ez-agents/bin/lib/session-import.cjs +262 -0
  65. package/ez-agents/bin/lib/session-manager.cjs +280 -0
  66. package/ez-agents/bin/lib/state.cjs +736 -736
  67. package/ez-agents/bin/lib/temp-file.cjs +239 -239
  68. package/ez-agents/bin/lib/template.cjs +223 -223
  69. package/ez-agents/bin/lib/test-file-lock.cjs +112 -112
  70. package/ez-agents/bin/lib/test-graceful.cjs +93 -93
  71. package/ez-agents/bin/lib/test-logger.cjs +60 -60
  72. package/ez-agents/bin/lib/test-safe-exec.cjs +38 -38
  73. package/ez-agents/bin/lib/test-safe-path.cjs +33 -33
  74. package/ez-agents/bin/lib/test-temp-file.cjs +125 -125
  75. package/ez-agents/bin/lib/tier-manager.cjs +428 -0
  76. package/ez-agents/bin/lib/timeout-exec.cjs +63 -63
  77. package/ez-agents/bin/lib/url-fetch.cjs +170 -0
  78. package/ez-agents/bin/lib/verify.cjs +15 -1
  79. package/ez-agents/references/checkpoints.md +776 -776
  80. package/ez-agents/references/continuation-format.md +249 -249
  81. package/ez-agents/references/metrics-schema.md +118 -0
  82. package/ez-agents/references/planning-config.md +140 -0
  83. package/ez-agents/references/questioning.md +162 -162
  84. package/ez-agents/references/tdd.md +263 -263
  85. package/ez-agents/references/tier-strategy.md +103 -0
  86. package/ez-agents/templates/bdd-feature.md +173 -0
  87. package/ez-agents/templates/codebase/concerns.md +310 -310
  88. package/ez-agents/templates/codebase/conventions.md +307 -307
  89. package/ez-agents/templates/codebase/integrations.md +280 -280
  90. package/ez-agents/templates/codebase/stack.md +186 -186
  91. package/ez-agents/templates/codebase/testing.md +480 -480
  92. package/ez-agents/templates/config.json +37 -37
  93. package/ez-agents/templates/continue-here.md +78 -78
  94. package/ez-agents/templates/discussion.md +68 -0
  95. package/ez-agents/templates/incident-runbook.md +205 -0
  96. package/ez-agents/templates/milestone-archive.md +123 -123
  97. package/ez-agents/templates/milestone.md +115 -115
  98. package/ez-agents/templates/release-checklist.md +133 -0
  99. package/ez-agents/templates/requirements.md +231 -231
  100. package/ez-agents/templates/research-project/ARCHITECTURE.md +204 -204
  101. package/ez-agents/templates/research-project/FEATURES.md +147 -147
  102. package/ez-agents/templates/research-project/PITFALLS.md +200 -200
  103. package/ez-agents/templates/research-project/STACK.md +120 -120
  104. package/ez-agents/templates/research-project/SUMMARY.md +170 -170
  105. package/ez-agents/templates/retrospective.md +54 -54
  106. package/ez-agents/templates/roadmap.md +202 -202
  107. package/ez-agents/templates/rollback-plan.md +201 -0
  108. package/ez-agents/templates/summary-minimal.md +41 -41
  109. package/ez-agents/templates/summary-standard.md +48 -48
  110. package/ez-agents/templates/summary.md +248 -248
  111. package/ez-agents/templates/user-setup.md +311 -311
  112. package/ez-agents/templates/verification-report.md +322 -322
  113. package/ez-agents/workflows/add-phase.md +112 -112
  114. package/ez-agents/workflows/add-tests.md +351 -351
  115. package/ez-agents/workflows/add-todo.md +158 -158
  116. package/ez-agents/workflows/arch-review.md +54 -0
  117. package/ez-agents/workflows/audit-milestone.md +332 -332
  118. package/ez-agents/workflows/autonomous.md +131 -30
  119. package/ez-agents/workflows/check-todos.md +177 -177
  120. package/ez-agents/workflows/cleanup.md +152 -152
  121. package/ez-agents/workflows/complete-milestone.md +766 -766
  122. package/ez-agents/workflows/diagnose-issues.md +219 -219
  123. package/ez-agents/workflows/discovery-phase.md +289 -289
  124. package/ez-agents/workflows/discuss-phase.md +762 -762
  125. package/ez-agents/workflows/execute-phase.md +513 -468
  126. package/ez-agents/workflows/execute-plan.md +483 -483
  127. package/ez-agents/workflows/export-session.md +255 -0
  128. package/ez-agents/workflows/gather-requirements.md +206 -0
  129. package/ez-agents/workflows/health.md +159 -159
  130. package/ez-agents/workflows/help.md +584 -492
  131. package/ez-agents/workflows/hotfix.md +291 -0
  132. package/ez-agents/workflows/import-session.md +303 -0
  133. package/ez-agents/workflows/insert-phase.md +130 -130
  134. package/ez-agents/workflows/list-phase-assumptions.md +178 -178
  135. package/ez-agents/workflows/map-codebase.md +316 -316
  136. package/ez-agents/workflows/new-milestone.md +339 -10
  137. package/ez-agents/workflows/new-project.md +293 -299
  138. package/ez-agents/workflows/node-repair.md +92 -92
  139. package/ez-agents/workflows/pause-work.md +122 -122
  140. package/ez-agents/workflows/plan-milestone-gaps.md +274 -274
  141. package/ez-agents/workflows/plan-phase.md +673 -651
  142. package/ez-agents/workflows/progress.md +372 -382
  143. package/ez-agents/workflows/quick.md +610 -610
  144. package/ez-agents/workflows/release.md +253 -0
  145. package/ez-agents/workflows/remove-phase.md +155 -155
  146. package/ez-agents/workflows/research-phase.md +74 -74
  147. package/ez-agents/workflows/resume-project.md +307 -307
  148. package/ez-agents/workflows/resume-session.md +215 -0
  149. package/ez-agents/workflows/set-profile.md +81 -81
  150. package/ez-agents/workflows/settings.md +242 -242
  151. package/ez-agents/workflows/standup.md +64 -0
  152. package/ez-agents/workflows/stats.md +57 -57
  153. package/ez-agents/workflows/transition.md +544 -544
  154. package/ez-agents/workflows/ui-phase.md +290 -290
  155. package/ez-agents/workflows/ui-review.md +157 -157
  156. package/ez-agents/workflows/update.md +320 -320
  157. package/ez-agents/workflows/validate-phase.md +167 -167
  158. package/ez-agents/workflows/verify-phase.md +243 -243
  159. package/ez-agents/workflows/verify-work.md +584 -584
  160. package/package.json +10 -4
  161. package/scripts/build-hooks.js +43 -43
  162. package/scripts/run-tests.cjs +29 -29
@@ -1,5 +1,7 @@
1
1
  <purpose>
2
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.
3
5
  </purpose>
4
6
 
5
7
  <required_reading>
@@ -41,9 +43,78 @@ The document should describe what you want to build.
41
43
 
42
44
  <process>
43
45
 
44
- ## 1. Setup
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)
45
104
 
46
- **MANDATORY FIRST STEP Execute these checks before ANY user interaction:**
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:**
47
118
 
48
119
  ```bash
49
120
  INIT=$(node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" init new-project)
@@ -54,11 +125,35 @@ Parse JSON for: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `co
54
125
 
55
126
  **If `project_exists` is true:** Error — project already initialized. Use `/ez:progress`.
56
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
+
57
149
  **If `has_git` is false:** Initialize git:
58
150
  ```bash
59
151
  git init
152
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="git_initialized"
60
153
  ```
61
154
 
155
+ ---
156
+
62
157
  ## 2. Brownfield Offer
63
158
 
64
159
  **If auto mode:** Skip to Step 4 (assume greenfield, synthesize PROJECT.md from provided document).
@@ -80,6 +175,13 @@ Exit command.
80
175
 
81
176
  **If "Skip mapping" OR `needs_codebase_map` is false:** Continue to Step 3.
82
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
+
83
185
  ## 2a. Auto Mode Config (auto mode only)
84
186
 
85
187
  **If auto mode:** Collect config settings upfront before processing the idea document.
@@ -199,8 +301,15 @@ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "chore: add project confi
199
301
  node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" config-set workflow._auto_chain_active true
200
302
  ```
201
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
+
202
309
  Proceed to Step 4 (skip Steps 3 and 5).
203
310
 
311
+ ---
312
+
204
313
  ## 3. Deep Questioning
205
314
 
206
315
  **If auto mode:** Skip (already handled in Step 2a). Extract project context from provided document instead and proceed to Step 4.
@@ -257,6 +366,13 @@ If "Keep exploring" — ask what they want to add, or identify gaps and probe na
257
366
 
258
367
  Loop until "Create PROJECT.md" selected.
259
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
+
260
376
  ## 4. Write PROJECT.md
261
377
 
262
378
  **If auto mode:** Synthesize from provided document. No "Ready?" gate was shown — proceed directly to commit.
@@ -343,6 +459,13 @@ mkdir -p .planning
343
459
  node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs: initialize project" --files .planning/PROJECT.md
344
460
  ```
345
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
+
346
469
  ## 5. Workflow Preferences
347
470
 
348
471
  **If auto mode:** Skip — config was collected in Step 2a. Proceed to Step 5.5.
@@ -415,13 +538,7 @@ questions: [
415
538
 
416
539
  **Round 2 — Workflow agents:**
417
540
 
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 |
541
+ These spawn additional agents during planning/execution. They add tokens and time but improve quality. They add tokens and time but improve quality.
425
542
 
426
543
  All recommended for important projects. Skip for quick experiments.
427
544
 
@@ -500,11 +617,18 @@ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "chore: add project confi
500
617
 
501
618
  **Note:** Run `/ez:settings` anytime to update these preferences.
502
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
+
503
625
  ## 5.5. Resolve Model Profile
504
626
 
505
627
  Use models from init: `researcher_model`, `synthesizer_model`, `roadmapper_model`.
506
628
 
507
- ## 6. Research Decision
629
+ ---
630
+
631
+ ## 6. Research Decision (with Fresh Context - GSD-2 Pattern)
508
632
 
509
633
  **If auto mode:** Default to "Research first" without asking.
510
634
 
@@ -512,7 +636,7 @@ Use AskUserQuestion:
512
636
  - header: "Research"
513
637
  - question: "Research the domain ecosystem before defining requirements?"
514
638
  - options:
515
- - "Research first (Recommended)" — Discover standard stacks, expected features, architecture patterns
639
+ - "Research first (Recommended)" — Discover standard stack, expected features, architecture patterns
516
640
  - "Skip research" — I know this domain well, go straight to requirements
517
641
 
518
642
  **If "Research first":**
@@ -546,22 +670,34 @@ Display spawning indicator:
546
670
  → Pitfalls research
547
671
  ```
548
672
 
549
- Spawn 4 parallel ez-project-researcher agents with path references:
673
+ **Spawn 4 parallel ez-project-researcher agents with FRESH CONTEXT (GSD-2 Pattern):**
674
+
675
+ Each uses this template with dimension-specific fields:
550
676
 
551
677
  ```
552
- Task(prompt="<research_type>
553
- Project Research — Stack dimension for [domain].
554
- </research_type>
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>
555
691
 
556
692
  <milestone_context>
557
- [greenfield OR subsequent]
693
+ {greenfield_or_subsequent}
558
694
 
559
695
  Greenfield: Research the standard stack for building [domain] from scratch.
560
696
  Subsequent: Research what's needed to add [target features] to an existing [domain] app. Don't re-research the existing system.
561
697
  </milestone_context>
562
698
 
563
699
  <question>
564
- What's the standard 2025 stack for [domain]?
700
+ {QUESTION}
565
701
  </question>
566
702
 
567
703
  <files_to_read>
@@ -569,146 +705,34 @@ What's the standard 2025 stack for [domain]?
569
705
  </files_to_read>
570
706
 
571
707
  <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)
708
+ {CONSUMER}
652
709
  </downstream_consumer>
653
710
 
654
711
  <quality_gate>
655
- - [ ] Components clearly defined with boundaries
656
- - [ ] Data flow direction explicit
657
- - [ ] Build order implications noted
712
+ {GATES}
658
713
  </quality_gate>
659
714
 
660
715
  <output>
661
- Write to: .planning/research/ARCHITECTURE.md
662
- Use template: ~/.claude/ez-agents/templates/research-project/ARCHITECTURE.md
716
+ Write to: .planning/research/{FILE}
717
+ Use template: ~/.claude/ez-agents/templates/research-project/{FILE}
663
718
  </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>
719
+ ", subagent_type="ez-project-researcher", model="{researcher_model}", description="{DIMENSION} research")
720
+ ```
691
721
 
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>
722
+ **Dimension-specific fields:**
697
723
 
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
- ```
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 |
704
730
 
705
- After all 4 agents complete, spawn synthesizer to create SUMMARY.md:
731
+ After all 4 complete, spawn synthesizer to create SUMMARY.md:
706
732
 
707
733
  ```
708
734
  Task(prompt="
709
- <task>
710
735
  Synthesize research outputs into SUMMARY.md.
711
- </task>
712
736
 
713
737
  <files_to_read>
714
738
  - .planning/research/STACK.md
@@ -717,11 +741,9 @@ Synthesize research outputs into SUMMARY.md.
717
741
  - .planning/research/PITFALLS.md
718
742
  </files_to_read>
719
743
 
720
- <output>
721
744
  Write to: .planning/research/SUMMARY.md
722
745
  Use template: ~/.claude/ez-agents/templates/research-project/SUMMARY.md
723
746
  Commit after writing.
724
- </output>
725
747
  ", subagent_type="ez-research-synthesizer", model="{synthesizer_model}", description="Synthesize research")
726
748
  ```
727
749
 
@@ -740,8 +762,15 @@ Display research complete banner and key findings:
740
762
  Files: `.planning/research/`
741
763
  ```
742
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
+
743
770
  **If "Skip research":** Continue to Step 7.
744
771
 
772
+ ---
773
+
745
774
  ## 7. Define Requirements
746
775
 
747
776
  Display stage banner:
@@ -852,29 +881,19 @@ Good requirements are:
852
881
  - **Atomic:** One capability per requirement (not "User can login and manage profile")
853
882
  - **Independent:** Minimal dependencies on other requirements
854
883
 
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):**
884
+ Reject vague requirements. Push for specificity.
860
885
 
861
- Show every requirement (not counts) for user confirmation:
886
+ Present FULL requirements list for confirmation:
862
887
 
863
888
  ```
864
- ## v1 Requirements
889
+ ## Project Requirements
865
890
 
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
891
+ ### [Category 1]
892
+ - [ ] **CAT1-01**: User can do X
893
+ - [ ] **CAT1-02**: User can do Y
870
894
 
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
- ---
895
+ ### [Category 2]
896
+ - [ ] **CAT2-01**: User can do Z
878
897
 
879
898
  Does this capture what you're building? (yes / adjust)
880
899
  ```
@@ -882,12 +901,18 @@ Does this capture what you're building? (yes / adjust)
882
901
  If "adjust": Return to scoping.
883
902
 
884
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
+ ```
885
907
 
908
+ **Update lock file state:**
886
909
  ```bash
887
- node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" commit "docs: define v1 requirements" --files .planning/REQUIREMENTS.md
910
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="requirements_defined"
888
911
  ```
889
912
 
890
- ## 8. Create Roadmap
913
+ ---
914
+
915
+ ## 8. Create Roadmap (with Stuck Detection - GSD-2 Pattern)
891
916
 
892
917
  Display stage banner:
893
918
  ```
@@ -898,59 +923,90 @@ Display stage banner:
898
923
  ◆ Spawning roadmapper...
899
924
  ```
900
925
 
901
- Spawn ez-roadmapper agent with path references:
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
+ ```
902
935
 
903
936
  ```
904
937
  Task(prompt="
905
938
  <planning_context>
906
-
907
939
  <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)
940
+ - .planning/PROJECT.md
941
+ - .planning/REQUIREMENTS.md
942
+ - .planning/research/SUMMARY.md (if exists)
943
+ - .planning/config.json
912
944
  </files_to_read>
913
-
914
945
  </planning_context>
915
946
 
916
947
  <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.
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.
926
958
  </instructions>
927
959
  ", subagent_type="ez-roadmapper", model="{roadmapper_model}", description="Create roadmap")
928
960
  ```
929
961
 
930
- **Handle roadmapper return:**
962
+ **Handle return:**
931
963
 
932
964
  **If `## ROADMAP BLOCKED`:**
933
- - Present blocker information
934
- - Work with user to resolve
935
- - Re-spawn when resolved
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
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
936
987
 
937
- **If `## ROADMAP CREATED`:**
988
+ Error Type: [type]
989
+ Error Location: [file:line]
990
+ Suggested Fix: [action]
938
991
 
939
- Read the created ROADMAP.md and present it nicely inline:
992
+ Context Snapshot: .planning/logs/stuck-snapshot-[timestamp].json
940
993
 
994
+ Next Steps:
995
+ 1. Review context snapshot
996
+ 2. Fix [specific issue]
997
+ 3. Run: /ez:new-project --retry
941
998
  ```
942
- ---
943
999
 
1000
+ **If `## ROADMAP CREATED`:** Read ROADMAP.md, present inline:
1001
+
1002
+ ```
944
1003
  ## Proposed Roadmap
945
1004
 
946
- **[N] phases** | **[X] requirements mapped** | All v1 requirements covered ✓
1005
+ **[N] phases** | **[X] requirements mapped** | All covered ✓
947
1006
 
948
1007
  | # | Phase | Goal | Requirements | Success Criteria |
949
1008
  |---|-------|------|--------------|------------------|
950
1009
  | 1 | [Name] | [Goal] | [REQ-IDs] | [count] |
951
- | 2 | [Name] | [Goal] | [REQ-IDs] | [count] |
952
- | 3 | [Name] | [Goal] | [REQ-IDs] | [count] |
953
- ...
954
1010
 
955
1011
  ### Phase Details
956
1012
 
@@ -960,154 +1016,92 @@ Requirements: [REQ-IDs]
960
1016
  Success criteria:
961
1017
  1. [criterion]
962
1018
  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
1019
  ```
976
1020
 
977
- **If auto mode:** Skip approval gate — auto-approve and commit directly.
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
978
1025
 
979
- **CRITICAL: Ask for approval before committing (interactive mode only):**
1026
+ **If "Adjust":** Get notes, re-spawn roadmapper with revision context, loop until approved.
1027
+ **If "Review":** Display raw ROADMAP.md, re-ask.
980
1028
 
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]
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
+ ```
999
1033
 
1000
- <files_to_read>
1001
- - .planning/ROADMAP.md (Current roadmap to revise)
1002
- </files_to_read>
1034
+ **Update lock file state:**
1035
+ ```bash
1036
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-update --state="roadmap_created"
1037
+ ```
1003
1038
 
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
1039
+ ---
1011
1040
 
1012
- **If "Review full file":** Display raw `cat .planning/ROADMAP.md`, then re-ask.
1041
+ ## 9. Release Lock File
1013
1042
 
1014
- **Commit roadmap (after approval or auto mode):**
1043
+ **Project initialization complete:**
1015
1044
 
1016
1045
  ```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
1046
+ node "$HOME/.claude/ez-agents/bin/ez-tools.cjs" lock-release
1018
1047
  ```
1019
1048
 
1020
- ## 9. Done
1049
+ ---
1021
1050
 
1022
- Present completion summary:
1051
+ ## 10. Done
1023
1052
 
1024
1053
  ```
1025
1054
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1026
1055
  EZ ► PROJECT INITIALIZED ✓
1027
1056
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1028
1057
 
1029
- **[Project Name]**
1058
+ **Project: [Project Name]**
1030
1059
 
1031
1060
  | Artifact | Location |
1032
1061
  |----------------|-----------------------------|
1033
1062
  | Project | `.planning/PROJECT.md` |
1034
- | Config | `.planning/config.json` |
1035
1063
  | Research | `.planning/research/` |
1036
1064
  | Requirements | `.planning/REQUIREMENTS.md` |
1037
1065
  | Roadmap | `.planning/ROADMAP.md` |
1066
+ | Config | `.planning/config.json` |
1038
1067
 
1039
1068
  **[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
1069
 
1057
1070
  ## ▶ Next Up
1058
1071
 
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>
1072
+ **Phase 1: [Phase Name]** — [Goal]
1064
1073
 
1065
- ---
1074
+ `/ez:discuss-phase 1` — gather context and clarify approach
1066
1075
 
1067
- **Also available:**
1068
- - /ez:plan-phase 1 — skip discussion, plan directly
1076
+ <sub>`/clear` first → fresh context window</sub>
1069
1077
 
1070
- ───────────────────────────────────────────────────────────────
1078
+ Also: `/ez:plan-phase 1` — skip discussion, plan directly
1071
1079
  ```
1072
1080
 
1073
1081
  </process>
1074
1082
 
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
1083
  <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
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
1104
1094
  - [ ] Roadmap files written immediately (not draft)
1105
1095
  - [ ] 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`
1096
+ - [ ] All commits made (if planning docs committed)
1097
+ - [ ] Lock file released on completion
1098
+ - [ ] User knows next step: `/ez:discuss-phase 1`
1110
1099
 
1111
- **Atomic commits:** Each phase commits its artifacts immediately. If context is lost, artifacts persist.
1100
+ **Atomic commits:** Each artifact committed immediately after creation.
1112
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
1113
1107
  </success_criteria>