Files
BMAD-METHOD/src/modules/bmm/workflows/4-implementation/story-approved/instructions.md
2025-10-13 22:32:35 -05:00

9.0 KiB

Story Approved Workflow Instructions (DEV Agent)

This workflow is run by DEV agent AFTER user confirms a story is approved (Definition of Done is complete) NO SEARCHING - DEV agent reads status file IN PROGRESS section to know which story was being worked on Workflow: Update story file status, move story IN PROGRESS → DONE, move TODO → IN PROGRESS, move BACKLOG → TODO

Read {output_folder}/bmm-workflow-status.md Navigate to "### Implementation Progress (Phase 4 Only)" section Find "#### IN PROGRESS (Approved for Development)" section

Extract current story information:

  • current_story_id: The story ID (e.g., "1.1", "auth-feature-1", "login-fix")
  • current_story_title: The story title
  • current_story_file: The exact story file path
  • current_story_points: Story points (if tracked)

Read the TODO section to know what's next:

  • todo_story_id: Next story to move to IN PROGRESS (if exists)
  • todo_story_title: Next story title
  • todo_story_file: Next story file path

Read the BACKLOG section to know what comes after:

  • next_backlog_story_id: Story to move to TODO (if exists)
  • next_backlog_story_title
  • next_backlog_story_file

DO NOT SEARCH for stories - the status file tells you exactly which story is in each state

Read the story file: {story_dir}/{current_story_file}

Find the "Status:" line (usually at the top)

Update story file:

  • Change: Status: Ready or Status: In Review
  • To: Status: Done

Add completion notes if Dev Agent Record section exists:

Find "## Dev Agent Record" section and add:

### Completion Notes
**Completed:** {{date}}
**Definition of Done:** All acceptance criteria met, code reviewed, tests passing, deployed

Save the story file

Open {output_folder}/bmm-workflow-status.md

Update "#### DONE (Completed Stories)" section:

Add the completed story to the table:

Story ID File Completed Date Points
{{current_story_id}} {{current_story_file}} {{date}} {{current_story_points}}

... (existing done stories)

Total completed: {{done_count + 1}} stories Total points completed: {{done_points + current_story_points}} points

Update "#### IN PROGRESS (Approved for Development)" section:

Move the TODO story to IN PROGRESS:

IN PROGRESS (Approved for Development)

  • Story ID: {{todo_story_id}}
  • Story Title: {{todo_story_title}}
  • Story File: {{todo_story_file}}
  • Story Status: Ready (OR Draft if not yet reviewed)
  • Context File: {{context_file_path}} (if exists, otherwise note "Context not yet generated")
  • Action: DEV should run dev-story workflow to implement this story
Mark IN PROGRESS as empty:

IN PROGRESS (Approved for Development)

(No story currently in progress - all stories complete!)

Update "#### TODO (Needs Drafting)" section:

Move the first BACKLOG story to TODO:

TODO (Needs Drafting)

  • Story ID: {{next_backlog_story_id}}
  • Story Title: {{next_backlog_story_title}}
  • Story File: {{next_backlog_story_file}}
  • Status: Not created OR Draft (needs review)
  • Action: SM should run create-story workflow to draft this story
Mark TODO as empty:

TODO (Needs Drafting)

(No more stories to draft - all stories are drafted or complete)

Update "#### BACKLOG (Not Yet Drafted)" section:

Remove the first story from the BACKLOG table (the one we just moved to TODO).

If BACKLOG had 1 story and is now empty:

Epic Story ID Title File
(empty - all stories drafted)

Total in backlog: 0 stories

Update story counts in "#### Epic/Story Summary" section:

  • Increment done_count by 1
  • Increment done_points by {{current_story_points}}
  • Decrement backlog_count by 1 (if story was moved from BACKLOG → TODO)
  • Update epic breakdown:
    • Increment epic_done_stories for the current story's epic
Check "4-Implementation" checkbox in "### Phase Completion Status" Set progress_percentage = 100%

Add to "## Decision Log" section:

- **{{date}}**: Story {{current_story_id}} ({{current_story_title}}) approved and marked done by DEV agent. Moved from IN PROGRESS → DONE. {{#if todo_story}}Story {{todo_story_id}} moved from TODO → IN PROGRESS.{{/if}} {{#if next_backlog_story}}Story {{next_backlog_story_id}} moved from BACKLOG → TODO.{{/if}}

current_step Set to: "story-approved (Story {{current_story_id}})"

current_workflow Set to: "story-approved (Story {{current_story_id}}) - Complete"

progress_percentage Calculate per-story weight: remaining_40_percent / total_stories / 5 Increment by: {{per_story_weight}} * 1 (story-approved weight is ~1% per story) Set progress_percentage = 100%

Update "### Next Action Required" section:

``` **What to do next:** {{#if todo_story_status == 'Draft'}}Review drafted story {{todo_story_id}}, then mark it ready{{else}}Implement story {{todo_story_id}}{{/if}}

Command to run: {{#if todo_story_status == 'Draft'}}Load SM agent and run 'story-ready' workflow{{else}}Run 'dev-story' workflow to implement{{/if}}

Agent to load: {{#if todo_story_status == 'Draft'}}bmad/bmm/agents/sm.md{{else}}bmad/bmm/agents/dev.md{{/if}}

</check>

<check if="todo_story does NOT exist AND backlog not empty">

What to do next: Draft the next story ({{next_backlog_story_id}})

Command to run: Load SM agent and run 'create-story' workflow

Agent to load: bmad/bmm/agents/sm.md

</check>

<check if="all stories complete">

What to do next: All stories complete! Run retrospective workflow or close project.

Command to run: Load PM agent and run 'retrospective' workflow

Agent to load: bmad/bmm/agents/pm.md

</check>

<action>Save bmm-workflow-status.md</action>

</step>

<step n="5" goal="Confirm completion to user">

<action>Display summary</action>

**Story Approved and Marked Done!**

✅ Story file updated: `{{current_story_file}}` → Status: Done
✅ Status file updated: Story moved IN PROGRESS → DONE
{{#if todo_story}}✅ Next story moved: TODO → IN PROGRESS ({{todo_story_id}}: {{todo_story_title}}){{/if}}
{{#if next_backlog_story}}✅ Next story moved: BACKLOG → TODO ({{next_backlog_story_id}}: {{next_backlog_story_title}}){{/if}}

**Completed Story:**
- **ID:** {{current_story_id}}
- **Title:** {{current_story_title}}
- **File:** `{{current_story_file}}`
- **Points:** {{current_story_points}}
- **Completed:** {{date}}

**Progress Summary:**
- **Stories Completed:** {{done_count}} / {{total_stories}}
- **Points Completed:** {{done_points}} / {{total_points}}
- **Progress:** {{progress_percentage}}%

{{#if all_stories_complete}}
**🎉 ALL STORIES COMPLETE!**

Congratulations! You have completed all stories for this project.

**Next Steps:**
1. Run `retrospective` workflow with PM agent to review the project
2. Close out the project
3. Celebrate! 🎊
{{/if}}

{{#if todo_story}}
**Next Story (IN PROGRESS):**
- **ID:** {{todo_story_id}}
- **Title:** {{todo_story_title}}
- **File:** `{{todo_story_file}}`
- **Status:** {{todo_story_status}}

**Next Steps:**
{{#if todo_story_status == 'Draft'}}
1. Review the drafted story {{todo_story_file}}
2. Load SM agent and run `story-ready` workflow to approve it
3. Then return to DEV agent to implement
{{else}}
1. Stay with DEV agent and run `dev-story` workflow
2. Implement story {{todo_story_id}}
{{/if}}
{{/if}}

{{#if backlog_not_empty AND todo_empty}}
**Next Story (TODO):**
- **ID:** {{next_backlog_story_id}}
- **Title:** {{next_backlog_story_title}}

**Next Steps:**
1. Load SM agent
2. Run `create-story` workflow to draft story {{next_backlog_story_id}}
{{/if}}

</step>

</workflow>