Skip to content

Commit 8edf231

Browse files
committed
refactor(bmad-workflow): streamline story creation process and validation
- Move checklist from main agents config to templates directory - Add phase separators to workflow steps for better visibility - Simplify story checklist by removing redundant sections - Update instructions.xml to include checklist as required input - Consolidate story status update logic in workflow
1 parent d512103 commit 8edf231

File tree

5 files changed

+50
-204
lines changed

5 files changed

+50
-204
lines changed

config/main.agents.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ module.exports = [
228228
path.join(promptsDir, 'bmad', 'shared', 'system-files-protection.md'),
229229
path.join(promptsDir, 'bmad', '06-sm', 'bob.md'),
230230
path.join(promptsDir, 'bmad', '06-sm', '02-create-story', 'instructions.xml'),
231-
path.join(promptsDir, 'bmad', '06-sm', '02-create-story', 'checklist.md'),
232231
],
233232
},
234233
{

config/placeholders.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = {
4242
// BMAD SM workflow shared files
4343
sprint_status_template: path.join('prompts', 'templates', 'bmad', '06-sm', '01-sprint-planning', 'sprint-status-template.yaml'),
4444
story_template: path.join('prompts', 'templates', 'bmad', '06-sm', '02-create-story', 'template.md'),
45+
story_checklist: path.join('prompts', 'templates', 'bmad', '06-sm', '02-create-story', 'checklist.md'),
4546

4647
// BMAD shared step rules
4748
step_completion: path.join('prompts', 'templates', 'bmad', 'shared', 'step-completion.md'),

prompts/templates/bmad/06-sm/02-create-story/checklist.md

Lines changed: 7 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
11
# 🎯 Story Context Quality Competition Prompt
22

3-
## Source Documents
4-
5-
### Epics
6-
7-
{epics}
8-
9-
### PRD
10-
11-
{prd}
12-
13-
### Architecture
14-
15-
{architecture}
16-
17-
### UX Design Specification
18-
19-
{!ux_design_spec}
20-
21-
### Story Template
22-
23-
{story_template}
24-
25-
---
26-
273
## **🔥 CRITICAL MISSION: Outperform and Fix the Original Create-Story LLM**
284

295
You are an independent quality validator in a **FRESH CONTEXT**. Your mission is to **thoroughly review** a story file that was generated by the create-story workflow and **systematically identify any mistakes, omissions, or disasters** that the original LLM missed.
@@ -53,45 +29,17 @@ Use research subagents, subprocesses, or parallel processing if available to tho
5329

5430
This is a COMPETITION to create the **ULTIMATE story context** that makes LLM developer mistakes **IMPOSSIBLE**!
5531

56-
## **🚀 HOW TO USE THIS CHECKLIST**
57-
58-
### **When Running from Create-Story Workflow:**
59-
60-
- The `{project_root}/_bmad/core/tasks/validate-workflow.xml` framework will automatically:
61-
- Load this checklist file
62-
- Load the newly created story file (`{story_file_path}`)
63-
- Load workflow variables from `{installed_path}/workflow.yaml`
64-
- Execute the validation process
65-
66-
### **When Running in Fresh Context:**
67-
68-
- User should provide the story file path being reviewed
69-
- Load the story file directly
70-
- Load the corresponding workflow.yaml for variable context
71-
- Proceed with systematic analysis
72-
73-
### **Required Inputs:**
74-
75-
- **Story file**: The story file to review and improve
76-
- **Source documents**: Epics, PRD, Architecture (required), UX Design Spec (optional)
77-
- **Validation framework**: `validate-workflow.xml` (handles checklist execution)
78-
7932
---
8033

8134
## **🔬 SYSTEMATIC RE-ANALYSIS APPROACH**
8235

8336
You will systematically re-do the entire story creation process, but with a critical eye for what the original LLM might have missed:
8437

85-
### **Step 1: Load and Understand the Target**
86-
87-
1. **Load the workflow configuration**: `{installed_path}/workflow.yaml` for variable inclusion
88-
2. **Load the story file**: `{story_file_path}` (provided by user or discovered)
89-
3. **Load validation framework**: `{project_root}/_bmad/core/tasks/validate-workflow.xml`
90-
4. **Extract metadata**: epic_num, story_num, story_key, story_title from story file
91-
5. **Resolve all workflow variables**: story_dir, output_folder, epics_file, architecture_file, etc.
92-
6. **Understand current status**: What story implementation guidance is currently provided?
38+
### **Step 1: Understand the Target Story**
9339

94-
**Note:** If running in fresh context, user should provide the story file path being reviewed. If running from create-story workflow, the validation framework will automatically discover the checklist and story file.
40+
1. **Extract metadata** from the story file: epic_num, story_num, story_key, story_title
41+
2. **Understand current status**: What story implementation guidance is currently provided?
42+
3. **Identify gaps**: What critical context might be missing for the developer?
9543

9644
### **Step 2: Exhaustive Source Document Analysis**
9745

@@ -122,7 +70,7 @@ You will systematically re-do the entire story creation process, but with a crit
12270

12371
#### **2.3 Previous Story Intelligence (if applicable)**
12472

125-
- If `story_num > 1`, load the previous story file
73+
- If `story_num > 1`, load previous story from `.codemachine/artifacts/stories/`
12674
- Extract **actionable intelligence**:
12775
- Dev notes and learnings
12876
- Review feedback and corrections needed
@@ -323,7 +271,7 @@ Your choice:
323271

324272
When user accepts improvements:
325273

326-
- **Load the story file**
274+
- **Update the story file** at `.codemachine/artifacts/stories/{{story_key}}.md`
327275
- **Apply accepted changes** (make them look natural, as if they were always there)
328276
- **DO NOT reference** the review process, original LLM, or that changes were "added" or "enhanced"
329277
- **Ensure clean, coherent final story** that reads as if it was created perfectly the first time
@@ -335,7 +283,7 @@ After applying changes:
335283
```
336284
✅ **STORY IMPROVEMENTS APPLIED**
337285
338-
Updated {{count}} sections in the story file.
286+
Updated {{count}} sections in `.codemachine/artifacts/stories/{{story_key}}.md`
339287
340288
The story now includes comprehensive developer guidance to prevent common implementation issues and ensure flawless execution.
341289

prompts/templates/bmad/06-sm/02-create-story/instructions.xml

Lines changed: 37 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,34 @@
1010
<input name="architecture" required="true">Architecture document</input>
1111
<input name="ux_design_spec" required="false">UX design specification</input>
1212
<input name="story_template" required="true">Story file template</input>
13+
<input name="story_checklist" required="true">Story validation checklist</input>
1314
</inputs>
1415

15-
<critical>Communicate all responses in {communication_language} and generate all documents in {document_output_language}</critical>
16+
<source_documents>
17+
## Epics
18+
19+
{epics}
20+
21+
## PRD
22+
23+
{prd}
24+
25+
## Architecture
26+
27+
{architecture}
28+
29+
## UX Design Specification
30+
31+
{!ux_design_spec}
32+
33+
## Story Template
34+
35+
{story_template}
36+
37+
## Story Checklist
38+
39+
{story_checklist}
40+
</source_documents>
1641

1742
<critical>🔥 CRITICAL MISSION: You are creating the ULTIMATE story context engine that prevents LLM developer mistakes, omissions or
1843
disasters! 🔥</critical>
@@ -26,127 +51,17 @@
2651
analyze different artifacts simultaneously and thoroughly</critical>
2752
<critical>❓ SAVE QUESTIONS: If you think of questions or clarifications during analysis, save them for the end after the complete story is
2853
written</critical>
29-
<critical>🎯 ZERO USER INTERVENTION: Process should be fully automated except for initial epic/story selection or missing documents</critical>
30-
31-
<step n="1" goal="Determine target story">
32-
<check if="{{story_path}} is provided by user or user provided the epic and story number such as 2-4 or 1.6 or epic 1 story 5">
33-
<action>Parse user-provided story path: extract epic_num, story_num, story_title from format like "1-2-user-auth"</action>
34-
<action>Set {{epic_num}}, {{story_num}}, {{story_key}} from user input</action>
35-
<action>GOTO step 2a</action>
36-
</check>
37-
38-
<action>Check if .codemachine/artifacts/sprint-status.yaml file exists for auto discover</action>
39-
<check if="sprint status file does NOT exist">
40-
<output>🚫 No sprint status file found and no story specified</output>
41-
<output>
42-
**Required Options:**
43-
1. Run `sprint-planning` to initialize sprint tracking (recommended)
44-
2. Provide specific epic-story number to create (e.g., "1-2-user-auth")
45-
3. Provide path to story documents if sprint status doesn't exist yet
46-
</output>
47-
<ask>Choose option [1], provide epic-story number, path to story docs, or [q] to quit:</ask>
48-
49-
<check if="user chooses 'q'">
50-
<action>HALT - No work needed</action>
51-
</check>
52-
53-
<check if="user chooses '1'">
54-
<output>Run sprint-planning workflow first to create sprint-status.yaml</output>
55-
<action>HALT - User needs to run sprint-planning</action>
56-
</check>
57-
58-
<check if="user provides epic-story number">
59-
<action>Parse user input: extract epic_num, story_num, story_title</action>
60-
<action>Set {{epic_num}}, {{story_num}}, {{story_key}} from user input</action>
61-
<action>GOTO step 2a</action>
62-
</check>
63-
64-
<check if="user provides story docs path">
65-
<action>Use user-provided path for story documents</action>
66-
<action>GOTO step 2a</action>
67-
</check>
68-
</check>
69-
70-
<!-- Auto-discover from sprint status only if no user input -->
71-
<check if="no user input provided">
72-
<critical>MUST read COMPLETE .codemachine/artifacts/sprint-status.yaml file from start to end to preserve order</critical>
73-
<action>Load the FULL file: .codemachine/artifacts/sprint-status.yaml</action>
74-
<action>Read ALL lines from beginning to end - do not skip any content</action>
75-
<action>Parse the development_status section completely</action>
76-
77-
<action>Find the FIRST story (by reading in order from top to bottom) where:
78-
- Key matches pattern: number-number-name (e.g., "1-2-user-auth")
79-
- NOT an epic key (epic-X) or retrospective (epic-X-retrospective)
80-
- Status value equals "backlog"
81-
</action>
82-
83-
<check if="no backlog story found">
84-
<output>📋 No backlog stories found in sprint-status.yaml
85-
86-
All stories are either already created, in progress, or done.
87-
88-
**Options:**
89-
1. Run sprint-planning to refresh story tracking
90-
2. Load PM agent and run correct-course to add more stories
91-
3. Check if current sprint is complete and run retrospective
92-
</output>
93-
<action>HALT</action>
94-
</check>
95-
96-
<action>Extract from found story key (e.g., "1-2-user-authentication"):
97-
- epic_num: first number before dash (e.g., "1")
98-
- story_num: second number after first dash (e.g., "2")
99-
- story_title: remainder after second dash (e.g., "user-authentication")
100-
</action>
101-
<action>Set {{story_id}} = "{{epic_num}}.{{story_num}}"</action>
102-
<action>Store story_key for later use (e.g., "1-2-user-authentication")</action>
103-
104-
<!-- Mark epic as in-progress if this is first story -->
105-
<action>Check if this is the first story in epic {{epic_num}} by looking for {{epic_num}}-1-* pattern</action>
106-
<check if="this is first story in epic {{epic_num}}">
107-
<action>Load .codemachine/artifacts/sprint-status.yaml and check epic-{{epic_num}} status</action>
108-
<action>If epic status is "backlog" → update to "in-progress"</action>
109-
<action>If epic status is "contexted" (legacy status) → update to "in-progress" (backward compatibility)</action>
110-
<action>If epic status is "in-progress" → no change needed</action>
111-
<check if="epic status is 'done'">
112-
<output>🚫 ERROR: Cannot create story in completed epic</output>
113-
<output>Epic {{epic_num}} is marked as 'done'. All stories are complete.</output>
114-
<output>If you need to add more work, either:</output>
115-
<output>1. Manually change epic status back to 'in-progress' in sprint-status.yaml</output>
116-
<output>2. Create a new epic for additional work</output>
117-
<action>HALT - Cannot proceed</action>
118-
</check>
119-
<check if="epic status is not one of: backlog, contexted, in-progress, done">
120-
<output>🚫 ERROR: Invalid epic status '{{epic_status}}'</output>
121-
<output>Epic {{epic_num}} has invalid status. Expected: backlog, in-progress, or done</output>
122-
<output>Please fix sprint-status.yaml manually or run sprint-planning to regenerate</output>
123-
<action>HALT - Cannot proceed</action>
124-
</check>
125-
<output>📊 Epic {{epic_num}} status updated to in-progress</output>
126-
</check>
54+
<critical>🎯 ZERO USER INTERVENTION: Process is fully automated - all data is pre-injected</critical>
12755

128-
<action>GOTO step 2a</action>
129-
</check>
130-
<action>Load the FULL file: .codemachine/artifacts/sprint-status.yaml</action>
131-
<action>Read ALL lines from beginning to end - do not skip any content</action>
132-
<action>Parse the development_status section completely</action>
133-
134-
<action>Find the FIRST story (by reading in order from top to bottom) where:
56+
<step n="1" goal="Determine target story from sprint status">
57+
<action>From {sprint_status}, find the FIRST story (in order) where:
13558
- Key matches pattern: number-number-name (e.g., "1-2-user-auth")
13659
- NOT an epic key (epic-X) or retrospective (epic-X-retrospective)
13760
- Status value equals "backlog"
13861
</action>
13962

14063
<check if="no backlog story found">
141-
<output>📋 No backlog stories found in sprint-status.yaml
142-
143-
All stories are either already created, in progress, or done.
144-
145-
**Options:**
146-
1. Run sprint-planning to refresh story tracking
147-
2. Load PM agent and run correct-course to add more stories
148-
3. Check if current sprint is complete and run retrospective
149-
</output>
64+
<output>📋 No backlog stories found - All stories are either already created, in progress, or done.</output>
15065
<action>HALT</action>
15166
</check>
15267

@@ -159,30 +74,14 @@
15974
<action>Store story_key for later use (e.g., "1-2-user-authentication")</action>
16075

16176
<!-- Mark epic as in-progress if this is first story -->
162-
<action>Check if this is the first story in epic {{epic_num}} by looking for {{epic_num}}-1-* pattern</action>
163-
<check if="this is first story in epic {{epic_num}}">
164-
<action>Load .codemachine/artifacts/sprint-status.yaml and check epic-{{epic_num}} status</action>
165-
<action>If epic status is "backlog" → update to "in-progress"</action>
166-
<action>If epic status is "contexted" (legacy status) → update to "in-progress" (backward compatibility)</action>
167-
<action>If epic status is "in-progress" → no change needed</action>
77+
<check if="this is first story in epic ({{epic_num}}-1-*)">
78+
<action>If epic-{{epic_num}} status is "backlog" or "contexted" → update to "in-progress"</action>
16879
<check if="epic status is 'done'">
169-
<output>🚫 ERROR: Cannot create story in completed epic</output>
170-
<output>Epic {{epic_num}} is marked as 'done'. All stories are complete.</output>
171-
<output>If you need to add more work, either:</output>
172-
<output>1. Manually change epic status back to 'in-progress' in sprint-status.yaml</output>
173-
<output>2. Create a new epic for additional work</output>
174-
<action>HALT - Cannot proceed</action>
175-
</check>
176-
<check if="epic status is not one of: backlog, contexted, in-progress, done">
177-
<output>🚫 ERROR: Invalid epic status '{{epic_status}}'</output>
178-
<output>Epic {{epic_num}} has invalid status. Expected: backlog, in-progress, or done</output>
179-
<output>Please fix sprint-status.yaml manually or run sprint-planning to regenerate</output>
180-
<action>HALT - Cannot proceed</action>
80+
<output>🚫 ERROR: Cannot create story in completed epic - Epic {{epic_num}} is marked as 'done'</output>
81+
<action>HALT</action>
18182
</check>
18283
<output>📊 Epic {{epic_num}} status updated to in-progress</output>
18384
</check>
184-
185-
<action>GOTO step 2a</action>
18685
</step>
18786

18887
<step n="2" goal="Load and analyze core artifacts">
@@ -320,18 +219,12 @@
320219
</step>
321220

322221
<step n="6" goal="Update sprint status and finalize">
323-
<invoke-task>Validate against checklist at {installed_path}/checklist.md using _bmad/core/tasks/validate-workflow.xml</invoke-task>
222+
<action>Validate story against the Story Checklist criteria in source documents above</action>
324223
<action>Save story document unconditionally</action>
325224

326225
<!-- Update sprint status -->
327-
<check if="sprint status file exists">
328-
<action>Update .codemachine/artifacts/sprint-status.yaml</action>
329-
<action>Load the FULL file and read all development_status entries</action>
330-
<action>Find development_status key matching {{story_key}}</action>
331-
<action>Verify current status is "backlog" (expected previous state)</action>
332-
<action>Update development_status[{{story_key}}] = "ready-for-dev"</action>
333-
<action>Save file, preserving ALL comments and structure including STATUS DEFINITIONS</action>
334-
</check>
226+
<action>In .codemachine/artifacts/sprint-status.yaml, update development_status[{{story_key}}] from "backlog" to "ready-for-dev"</action>
227+
<action>Save .codemachine/artifacts/sprint-status.yaml preserving all comments and structure</action>
335228

336229
<action>Report completion</action>
337230
<output>**🎯 ULTIMATE BMad Method STORY CONTEXT CREATED, {user_name}!**

templates/workflows/bmad.workflow.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ export default {
5252

5353
steps: [
5454
resolveStep('bmad-analyst', {conditions: ['use_analyst']}),
55+
resolveUI("∴ Planning Phase ∴"),
5556
resolveStep('bmad-pm', {}),
5657
resolveStep('bmad-ux', {conditions: ['has_ui']}),
58+
resolveUI("∴ Solutioning Phase ∴"),
5759
resolveStep('bmad-architect', {}),
5860
resolveStep('bmad-epics', {}),
61+
resolveUI("∴ Implementation Phase ∴"),
5962
resolveStep('bmad-sprints', {}),
63+
resolveUI("⟲ Story Loop ⟲"),
64+
6065
],
6166
};

0 commit comments

Comments
 (0)