@torka/claude-workflows 0.2.0 → 0.3.1
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.
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/completion-summary-implement-epic-with-subagents.md +103 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-01-init.md +250 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-01b-continue.md +305 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-01c-new.md +434 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-02-orchestrate.md +440 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-03-complete.md +476 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/templates/epic-completion-report.md +62 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/validation/checklist.md +121 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/workflow-plan-implement-epic-with-subagents.md +758 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/workflow.md +101 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/workflow.yaml +87 -0
- package/install.js +12 -5
- package/package.json +2 -1
- package/uninstall.js +57 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 'step-02-orchestrate'
|
|
3
|
+
description: 'Main orchestration loop - execute all stories autonomously with sub-agents'
|
|
4
|
+
|
|
5
|
+
# Path Definitions
|
|
6
|
+
workflow_path: '{project-root}/_bmad/bmm/workflows/4-implementation/implement-epic-with-subagents'
|
|
7
|
+
|
|
8
|
+
# File References
|
|
9
|
+
thisStepFile: '{workflow_path}/steps/step-02-orchestrate.md'
|
|
10
|
+
nextStepFile: '{workflow_path}/steps/step-03-complete.md'
|
|
11
|
+
workflowFile: '{workflow_path}/workflow.md'
|
|
12
|
+
|
|
13
|
+
# Template References
|
|
14
|
+
spawnStoryPrepTemplate: '{workflow_path}/templates/spawn-story-prep.md'
|
|
15
|
+
spawnDevAgentTemplate: '{workflow_path}/templates/spawn-dev-agent.md'
|
|
16
|
+
spawnCodeReviewTemplate: '{workflow_path}/templates/spawn-code-review.md'
|
|
17
|
+
|
|
18
|
+
# Task References
|
|
19
|
+
# (orchestration uses sub-agents, not BMAD tasks)
|
|
20
|
+
|
|
21
|
+
# State files
|
|
22
|
+
sidecarFolder: '{output_folder}/epic-executions'
|
|
23
|
+
sprintStatus: '{implementation_artifacts}/sprint-status.yaml'
|
|
24
|
+
|
|
25
|
+
# Agent references
|
|
26
|
+
storyPrepAgent: '.claude/agents/story-prep-master.md'
|
|
27
|
+
codeReviewAgent: '.claude/agents/principal-code-reviewer.md'
|
|
28
|
+
specialistAgentsFolder: '.claude/agents/vt-bmad-dev-agents/'
|
|
29
|
+
fallbackDevAgent: '_bmad/bmm/agents/dev.md'
|
|
30
|
+
|
|
31
|
+
# Configuration
|
|
32
|
+
coverageThreshold: 80
|
|
33
|
+
maxRetries: 3
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
# Step 2: Story Orchestration Loop
|
|
37
|
+
|
|
38
|
+
## STEP GOAL:
|
|
39
|
+
|
|
40
|
+
To autonomously execute all pending stories in the epic by orchestrating specialized sub-agents through the complete implementation pipeline: create → develop → visual-check (UI only) → review → commit → finalize.
|
|
41
|
+
|
|
42
|
+
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
43
|
+
|
|
44
|
+
### Universal Rules:
|
|
45
|
+
|
|
46
|
+
- 🛑 NEVER generate content without user input
|
|
47
|
+
- 📖 CRITICAL: Read the complete step file before taking any action
|
|
48
|
+
- 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
|
|
49
|
+
- 📋 YOU ARE A FACILITATOR, not a content generator
|
|
50
|
+
|
|
51
|
+
### Orchestrator-Specific Rules (Autonomous Execution):
|
|
52
|
+
|
|
53
|
+
- 🛑 PAUSE execution only on critical blockers or user-required decisions
|
|
54
|
+
- 📖 CRITICAL: Execute stories sequentially, one at a time
|
|
55
|
+
- 🔄 CRITICAL: Update sidecar state after EVERY phase completion
|
|
56
|
+
- 📋 YOU ARE THE ORCHESTRATOR - spawn agents, parse results, manage flow
|
|
57
|
+
|
|
58
|
+
### Role Reinforcement:
|
|
59
|
+
|
|
60
|
+
- ✅ You are an Epic Execution Orchestrator
|
|
61
|
+
- ✅ You spawn sub-agents with fresh context for each task
|
|
62
|
+
- ✅ You parse handoff messages to determine next actions
|
|
63
|
+
- ✅ You handle failures gracefully with retry or escalation
|
|
64
|
+
- ✅ You output brief progress after each story completion
|
|
65
|
+
|
|
66
|
+
### Step-Specific Rules:
|
|
67
|
+
|
|
68
|
+
- 🎯 Execute stories in linear order from pending list
|
|
69
|
+
- 🚫 FORBIDDEN to skip phases within a story
|
|
70
|
+
- 💬 Output brief status after each story completes
|
|
71
|
+
- 🚪 ESCALATE to user only when required (blockers, complex failures)
|
|
72
|
+
|
|
73
|
+
## EXECUTION PROTOCOLS:
|
|
74
|
+
|
|
75
|
+
- 🎯 Update sidecar before each phase starts
|
|
76
|
+
- 💾 Parse agent handoff messages for status
|
|
77
|
+
- 📖 Verify sprint-status matches sidecar state
|
|
78
|
+
- 🚫 NEVER proceed if code review rejected without retry/escalate
|
|
79
|
+
|
|
80
|
+
## CONTEXT BOUNDARIES:
|
|
81
|
+
|
|
82
|
+
- **Sidecar path:** Use `sidecar_path` from router context (step-01-init). In worktree mode, the sidecar is in the main repo's `_bmad-output/epic-executions/`, NOT the worktree's folder.
|
|
83
|
+
- Sidecar file tracks current story and phase
|
|
84
|
+
- Each agent gets fresh context with specific instructions
|
|
85
|
+
- Sprint-status.yaml is source of truth for story states
|
|
86
|
+
- Handoff messages provide phase completion status
|
|
87
|
+
|
|
88
|
+
**CRITICAL for worktree mode:** All sidecar updates must use the absolute `sidecar_path` passed from step-01-init. Do NOT use `{sidecarFolder}` directly as it resolves to the wrong location in worktrees.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## STORY EXECUTION LOOP
|
|
93
|
+
|
|
94
|
+
For each story in `stories_pending`:
|
|
95
|
+
|
|
96
|
+
### PHASE A: Create Story
|
|
97
|
+
|
|
98
|
+
**Update sidecar:**
|
|
99
|
+
```yaml
|
|
100
|
+
current_story: "N.M"
|
|
101
|
+
current_phase: "create"
|
|
102
|
+
last_updated: "[timestamp]"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Spawn agent:**
|
|
106
|
+
```
|
|
107
|
+
Task tool:
|
|
108
|
+
subagent_type: "general-purpose"
|
|
109
|
+
description: "Create story N.M"
|
|
110
|
+
prompt: |
|
|
111
|
+
You are the story-prep-master agent.
|
|
112
|
+
Load and embody: {storyPrepAgent}
|
|
113
|
+
|
|
114
|
+
Task: Create story N.M from the epic file.
|
|
115
|
+
Epic file: [epic_path]
|
|
116
|
+
Story location: {implementation_artifacts}/stories/
|
|
117
|
+
Sprint status: {sprintStatus}
|
|
118
|
+
|
|
119
|
+
Create a complete, developer-ready story file following BMAD story template.
|
|
120
|
+
|
|
121
|
+
When complete, output handoff in this format:
|
|
122
|
+
=== AGENT HANDOFF ===
|
|
123
|
+
agent: story-prep-master
|
|
124
|
+
story: N.M
|
|
125
|
+
status: completed | failed
|
|
126
|
+
story_file: [path to created story]
|
|
127
|
+
blockers: none | [list]
|
|
128
|
+
next_action: proceed | escalate
|
|
129
|
+
=== END HANDOFF ===
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Parse handoff:**
|
|
133
|
+
- If status=completed → update sprint-status to `ready-for-dev`, proceed to Phase B
|
|
134
|
+
- If status=failed → handle failure (retry or escalate)
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### PHASE B: Develop Story
|
|
139
|
+
|
|
140
|
+
**Update sidecar:**
|
|
141
|
+
```yaml
|
|
142
|
+
current_phase: "dev"
|
|
143
|
+
last_updated: "[timestamp]"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Select specialist agent:**
|
|
147
|
+
1. Read story file content (title, tasks, dev notes)
|
|
148
|
+
2. Scan `{specialistAgentsFolder}` for agents
|
|
149
|
+
3. For each agent, read `specialty` field and `Specialty Context`
|
|
150
|
+
4. Match story content against agent specializations
|
|
151
|
+
5. If match found → use specialist
|
|
152
|
+
6. If no match → use fallback `{fallbackDevAgent}`
|
|
153
|
+
|
|
154
|
+
**Spawn agent:**
|
|
155
|
+
```
|
|
156
|
+
Task tool:
|
|
157
|
+
subagent_type: "general-purpose"
|
|
158
|
+
description: "Develop story N.M"
|
|
159
|
+
prompt: |
|
|
160
|
+
You are a specialized developer agent.
|
|
161
|
+
Load and embody: [selected agent path]
|
|
162
|
+
|
|
163
|
+
Task: Implement story N.M completely.
|
|
164
|
+
Story file: [story_path]
|
|
165
|
+
Sprint status: {sprintStatus}
|
|
166
|
+
Project context: [project_context_path if exists]
|
|
167
|
+
|
|
168
|
+
Follow the story's tasks/subtasks exactly.
|
|
169
|
+
Write tests first (red-green-refactor).
|
|
170
|
+
Mark tasks complete as you finish them.
|
|
171
|
+
|
|
172
|
+
Available MCP Tools (use if available):
|
|
173
|
+
- Serena MCP: Code intelligence for navigation, refactoring
|
|
174
|
+
- Context7 MCP: Documentation lookup
|
|
175
|
+
|
|
176
|
+
When complete, output handoff in this format:
|
|
177
|
+
=== AGENT HANDOFF ===
|
|
178
|
+
agent: [agent_name]
|
|
179
|
+
story: N.M
|
|
180
|
+
status: completed | failed | blocked
|
|
181
|
+
files_changed:
|
|
182
|
+
- [list of files]
|
|
183
|
+
tests_passed: true | false
|
|
184
|
+
tests_run: [count]
|
|
185
|
+
tests_failed: [count]
|
|
186
|
+
coverage: [percentage]
|
|
187
|
+
has_ui_changes: true | false
|
|
188
|
+
ui_routes_affected: [list of routes or "none"]
|
|
189
|
+
blockers: none | [list]
|
|
190
|
+
next_action: proceed | escalate | retry
|
|
191
|
+
error_summary: null | [description]
|
|
192
|
+
=== END HANDOFF ===
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Parse handoff:**
|
|
196
|
+
- If status=completed, tests_passed=true → proceed to Phase B.5 (if has_ui_changes) or Phase C
|
|
197
|
+
- If status=failed, blockers contains critical → escalate to user
|
|
198
|
+
- If tests_passed=false → retry (up to maxRetries)
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### PHASE B.5: Visual Inspection (Conditional)
|
|
203
|
+
|
|
204
|
+
**Skip this phase if:**
|
|
205
|
+
- `has_ui_changes` is false AND no UI-related files in `files_changed`
|
|
206
|
+
- Chrome extension MCP tools are not available
|
|
207
|
+
|
|
208
|
+
**Update sidecar:**
|
|
209
|
+
```yaml
|
|
210
|
+
current_phase: "visual"
|
|
211
|
+
last_updated: "[timestamp]"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Execute visual inspection using Chrome extension MCP:**
|
|
215
|
+
|
|
216
|
+
1. Ensure dev server is running (`npm run dev` or equivalent)
|
|
217
|
+
2. For each route in `ui_routes_affected`:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
mcp__claude-in-chrome__navigate({ url: "http://localhost:3000{route}", tabId: [tab] })
|
|
221
|
+
mcp__claude-in-chrome__computer({ action: "wait", duration: 2, tabId: [tab] })
|
|
222
|
+
mcp__claude-in-chrome__computer({ action: "screenshot", tabId: [tab] })
|
|
223
|
+
mcp__claude-in-chrome__read_console_messages({ tabId: [tab], onlyErrors: true })
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
3. Check for:
|
|
227
|
+
- Visual rendering issues (obvious layout breaks)
|
|
228
|
+
- Console errors related to the changes
|
|
229
|
+
- Basic functionality working
|
|
230
|
+
|
|
231
|
+
**If issues found:**
|
|
232
|
+
- Log issues but don't block (visual issues are noted in code review)
|
|
233
|
+
- Add to handoff: `visual_issues: [list]`
|
|
234
|
+
|
|
235
|
+
**Proceed to Phase C** (Code Review)
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### PHASE C: Code Review
|
|
240
|
+
|
|
241
|
+
**Update sidecar:**
|
|
242
|
+
```yaml
|
|
243
|
+
current_phase: "review"
|
|
244
|
+
last_updated: "[timestamp]"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Spawn agent:**
|
|
248
|
+
```
|
|
249
|
+
Task tool:
|
|
250
|
+
subagent_type: "general-purpose"
|
|
251
|
+
description: "Review story N.M"
|
|
252
|
+
prompt: |
|
|
253
|
+
You are the principal-code-reviewer agent.
|
|
254
|
+
Load and embody: {codeReviewAgent}
|
|
255
|
+
|
|
256
|
+
Task: Perform thorough code review for story N.M.
|
|
257
|
+
Story file: [story_path]
|
|
258
|
+
Files changed: [from dev handoff]
|
|
259
|
+
|
|
260
|
+
Review for:
|
|
261
|
+
- Code quality and patterns
|
|
262
|
+
- Test coverage and quality
|
|
263
|
+
- Security considerations
|
|
264
|
+
- Performance implications
|
|
265
|
+
- Adherence to project standards
|
|
266
|
+
|
|
267
|
+
When complete, output handoff in this format:
|
|
268
|
+
=== CODE REVIEW HANDOFF ===
|
|
269
|
+
agent: principal-code-reviewer
|
|
270
|
+
story: N.M
|
|
271
|
+
review_status: approved | changes_requested | rejected
|
|
272
|
+
findings:
|
|
273
|
+
critical: [count]
|
|
274
|
+
major: [count]
|
|
275
|
+
minor: [count]
|
|
276
|
+
suggestions: [count]
|
|
277
|
+
summary: [brief summary]
|
|
278
|
+
next_action: proceed | fix_required | escalate
|
|
279
|
+
=== END HANDOFF ===
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Parse handoff:**
|
|
283
|
+
- If review_status=approved → proceed to Phase D
|
|
284
|
+
- If review_status=changes_requested → go back to Phase B (with review feedback)
|
|
285
|
+
- If review_status=rejected → escalate to user
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
### PHASE D: Git Commit
|
|
290
|
+
|
|
291
|
+
**Update sidecar:**
|
|
292
|
+
```yaml
|
|
293
|
+
current_phase: "commit"
|
|
294
|
+
last_updated: "[timestamp]"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Execute git commit:**
|
|
298
|
+
```bash
|
|
299
|
+
git add .
|
|
300
|
+
git commit -m "feat(story-N.M): [story title]
|
|
301
|
+
|
|
302
|
+
Implemented via implement-epic-with-subagents workflow.
|
|
303
|
+
Agent: [dev_agent_name]
|
|
304
|
+
Coverage: [coverage]%
|
|
305
|
+
Tests: [passed]/[total]
|
|
306
|
+
|
|
307
|
+
Co-Authored-By: [agent_name] <noreply@anthropic.com>"
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Verify commit success** - if fails, log error but continue.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
### PHASE E: Finalize Story
|
|
315
|
+
|
|
316
|
+
**Update sidecar:**
|
|
317
|
+
```yaml
|
|
318
|
+
current_story: null
|
|
319
|
+
current_phase: "between_stories"
|
|
320
|
+
stories_completed: [..., "N.M"]
|
|
321
|
+
stories_pending: [remaining stories]
|
|
322
|
+
last_updated: "[timestamp]"
|
|
323
|
+
execution_log:
|
|
324
|
+
- story: "N.M"
|
|
325
|
+
agent: "[dev_agent_used]"
|
|
326
|
+
coverage: [X]
|
|
327
|
+
tests: "[passed]/[total]"
|
|
328
|
+
duration: "[time]"
|
|
329
|
+
completed_at: "[timestamp]"
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Update sprint-status.yaml:**
|
|
333
|
+
- Set story N.M status to `done`
|
|
334
|
+
|
|
335
|
+
**Output progress to user:**
|
|
336
|
+
```
|
|
337
|
+
✅ Story N.M: [story title]
|
|
338
|
+
Agent: [agent-name] | Coverage: X% | Tests: P/T | Duration: Xm
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Continue to next story** - loop back to Phase A for next pending story.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## FAILURE HANDLING
|
|
346
|
+
|
|
347
|
+
### On Failure (After Retries Exhausted):
|
|
348
|
+
|
|
349
|
+
1. Determine failure type from handoff
|
|
350
|
+
2. Display failure context to user:
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
⚠️ Story N.M Failed
|
|
354
|
+
|
|
355
|
+
Phase: [phase where failure occurred]
|
|
356
|
+
Error: [error summary]
|
|
357
|
+
Attempts: [retry count]
|
|
358
|
+
|
|
359
|
+
Context:
|
|
360
|
+
[relevant details from handoff]
|
|
361
|
+
|
|
362
|
+
Options:
|
|
363
|
+
[S] Skip this story and continue
|
|
364
|
+
[X] Stop epic execution
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
3. Wait for user decision
|
|
368
|
+
4. If Skip:
|
|
369
|
+
- Add story to `stories_skipped` in sidecar
|
|
370
|
+
- Update sprint-status to `skipped`
|
|
371
|
+
- Continue to next story
|
|
372
|
+
5. If Stop:
|
|
373
|
+
- Update sidecar with current state
|
|
374
|
+
- Route to step-03-complete (partial completion)
|
|
375
|
+
|
|
376
|
+
### On Blocker (Human Decision Required):
|
|
377
|
+
|
|
378
|
+
1. Display blocker context:
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
🛑 Human Decision Required
|
|
382
|
+
|
|
383
|
+
Story: N.M
|
|
384
|
+
Blocker: [blocker description]
|
|
385
|
+
|
|
386
|
+
This requires your input:
|
|
387
|
+
[specific question or decision needed]
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
2. Wait for user response
|
|
391
|
+
3. Apply user's decision
|
|
392
|
+
4. Continue execution
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## LOOP COMPLETION
|
|
397
|
+
|
|
398
|
+
When `stories_pending` is empty:
|
|
399
|
+
|
|
400
|
+
1. Update sidecar:
|
|
401
|
+
```yaml
|
|
402
|
+
current_phase: "complete"
|
|
403
|
+
completed_at: "[timestamp]"
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
2. Output summary:
|
|
407
|
+
```
|
|
408
|
+
🎉 Epic Execution Complete!
|
|
409
|
+
|
|
410
|
+
Stories: [completed]/[total]
|
|
411
|
+
Skipped: [count]
|
|
412
|
+
Failed: [count]
|
|
413
|
+
|
|
414
|
+
Proceeding to generate completion report...
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
3. Load, read entire file, then execute `{nextStepFile}`
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
422
|
+
|
|
423
|
+
### ✅ SUCCESS:
|
|
424
|
+
|
|
425
|
+
- All stories processed (completed, skipped, or failed with user decision)
|
|
426
|
+
- Sidecar updated after every phase
|
|
427
|
+
- Sprint-status reflects actual story states
|
|
428
|
+
- Git commits created for completed stories
|
|
429
|
+
- Progress reported after each story
|
|
430
|
+
- Graceful handling of failures
|
|
431
|
+
|
|
432
|
+
### ❌ SYSTEM FAILURE:
|
|
433
|
+
|
|
434
|
+
- Skipping phases within a story
|
|
435
|
+
- Not updating sidecar state
|
|
436
|
+
- Proceeding after code review rejection without retry/escalate
|
|
437
|
+
- Not parsing handoff messages
|
|
438
|
+
- Silent failures without user notification
|
|
439
|
+
|
|
440
|
+
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
|