# Story Approved Workflow Instructions (DEV Agent)
The workflow execution engine is governed by: {project-root}/bmad/core/tasks/workflow.xml
You MUST have already loaded and processed: {installed_path}/workflow.yaml
Communicate all responses in {communication_language}
This workflow is run by DEV agent AFTER user confirms a story is approved (Definition of Done is complete)
Workflow: Update story file status to Done
Use {story_path} directly
Read COMPLETE story file and parse sections
Extract story_key from filename or story metadata
Verify Status is "review" - if not, HALT with message: "Story status must be 'review' to mark as done"
MUST read COMPLETE sprint-status.yaml file from start to end to preserve order
Load the FULL file: {output_folder}/sprint-status.yaml
Read ALL lines from beginning to end - do not skip any content
Parse the development_status section completely
Find FIRST story (reading in order from top to bottom) where: - Key matches pattern: number-number-name (e.g., "1-2-user-auth") - NOT an epic key (epic-X) or retrospective (epic-X-retrospective) - Status value equals "review"
HALT
Use the first reviewed story found
Find matching story file in {story_dir} using story_key pattern
Read the COMPLETE story file
Extract story_id and story_title from the story file
Find the "Status:" line (usually at the top)
Update story file: Change Status to "done"
Add completion notes to Dev Agent Record section:
Find "## Dev Agent Record" section and add:
```
### Completion Notes
**Completed:** {date}
**Definition of Done:** All acceptance criteria met, code reviewed, tests passing
```
Save the story file
Load the FULL file: {output_folder}/sprint-status.yaml
Find development_status key matching {story_key}
Verify current status is "review" (expected previous state)
Update development_status[{story_key}] = "done"
Save file, preserving ALL comments and structure including STATUS DEFINITIONS
```