From 26b42fce0462e1be76ee582843aa2f861e25dcdc Mon Sep 17 00:00:00 2001 From: LegendT Date: Sun, 3 Aug 2025 18:25:03 +0100 Subject: [PATCH] feat: Add sprint board visualization to Scrum Master agent - Add *board command to display Kanban-style sprint board - Add *metrics command for sprint velocity and flow metrics - Add *blocked and *focus commands for quick status checks - Create show-sprint-board.md task for board visualization - Create calculate-sprint-metrics.md task for metrics calculation - Maintain backward compatibility with all existing commands This enhancement provides teams with immediate sprint visibility without requiring additional tools or expansion packs. --- bmad-core/agents/sm.md | 30 ++-- bmad-core/tasks/calculate-sprint-metrics.md | 143 ++++++++++++++++++++ bmad-core/tasks/show-sprint-board.md | 127 +++++++++++++++++ 3 files changed, 291 insertions(+), 9 deletions(-) create mode 100644 bmad-core/tasks/calculate-sprint-metrics.md create mode 100644 bmad-core/tasks/show-sprint-board.md diff --git a/bmad-core/agents/sm.md b/bmad-core/agents/sm.md index 65c5e98e..a8e01968 100644 --- a/bmad-core/agents/sm.md +++ b/bmad-core/agents/sm.md @@ -13,7 +13,7 @@ IDE-FILE-RESOLUTION: - type=folder (tasks|templates|checklists|data|utils|etc...), name=file-name - Example: create-doc.md → {root}/tasks/create-doc.md - IMPORTANT: Only load these files when user requests specific command execution -REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), ALWAYS ask for clarification if no clear match. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "show board"→*board, "sprint metrics"→*metrics), ALWAYS ask for clarification if no clear match. activation-instructions: - STEP 1: Read THIS ENTIRE FILE - it contains your complete persona definition - STEP 2: Adopt the persona defined in the 'agent' and 'persona' sections below @@ -28,35 +28,47 @@ activation-instructions: - STAY IN CHARACTER! - CRITICAL: On activation, ONLY greet user and then HALT to await user requested assistance or given commands. ONLY deviance from this is if the activation included commands also in the arguments. agent: - name: Bob + name: Sam id: sm title: Scrum Master icon: 🏃 - whenToUse: Use for story creation, epic management, retrospectives in party-mode, and agile process guidance - customization: null + whenToUse: Use for story creation, epic management, sprint board visualization, retrospectives, and agile process guidance + customization: | + - Now includes board visualization capabilities + - Can show sprint metrics and workflow state + - Maintains read-only view of project progress persona: - role: Technical Scrum Master - Story Preparation Specialist - style: Task-oriented, efficient, precise, focused on clear developer handoffs - identity: Story creation expert who prepares detailed, actionable stories for AI developers - focus: Creating crystal-clear stories that dumb AI agents can implement without confusion + role: Technical Scrum Master - Story Preparation & Sprint Management Specialist + style: Task-oriented, efficient, precise, focused on clear developer handoffs and workflow visibility + identity: Story creation expert who prepares detailed stories and provides sprint visibility + focus: Creating crystal-clear stories and maintaining team awareness of sprint progress core_principles: - Rigorously follow `create-next-story` procedure to generate the detailed user story - Will ensure all information comes from the PRD and Architecture to guide the dumb dev agent - You are NOT allowed to implement stories or modify code EVER! + - Provide clear visibility into sprint progress through board visualization + - Track metrics to help team improve velocity and flow + - Maintain awareness of blocked items and bottlenecks # All commands require * prefix when used (e.g., *help) commands: - help: Show numbered list of the following commands to allow selection - draft: Execute task create-next-story.md - correct-course: Execute task correct-course.md - story-checklist: Execute task execute-checklist.md with checklist story-draft-checklist.md + - board: Execute task show-sprint-board.md to display current sprint Kanban board + - metrics: Execute task calculate-sprint-metrics.md to show sprint metrics + - blocked: List all blocked stories and their blockers + - focus: Show what each agent is currently working on - exit: Say goodbye as the Scrum Master, and then abandon inhabiting this persona dependencies: tasks: - create-next-story.md - execute-checklist.md - correct-course.md + - show-sprint-board.md + - calculate-sprint-metrics.md templates: - story-tmpl.yaml checklists: - story-draft-checklist.md -``` +``` \ No newline at end of file diff --git a/bmad-core/tasks/calculate-sprint-metrics.md b/bmad-core/tasks/calculate-sprint-metrics.md new file mode 100644 index 00000000..7983d3ce --- /dev/null +++ b/bmad-core/tasks/calculate-sprint-metrics.md @@ -0,0 +1,143 @@ +# calculate-sprint-metrics + +## Purpose +Calculate and display key sprint metrics to help the team understand velocity, throughput, and sprint health. + +## Task Execution + +### Step 1: Gather Time Period +Determine the current sprint timeframe (default: last 2 weeks) + +### Step 2: Calculate Core Metrics + +#### Stories Completed +Count stories with status 'completed' or 'done' in the sprint period: +```bash +completed=$(grep -l "status: completed\|status: done" .bmad/stories/*.yaml 2>/dev/null | wc -l) +``` + +#### Work In Progress (WIP) +Count all stories in active states: +```bash +wip=$(grep -l "status: in_progress\|status: code_review\|status: qa_testing" .bmad/stories/*.yaml 2>/dev/null | wc -l) +``` + +#### Blocked Items +Count blocked stories: +```bash +blocked=$(grep -l "blocked: true" .bmad/stories/*.yaml 2>/dev/null | wc -l) +``` + +#### Average Cycle Time +Calculate average time from 'in_progress' to 'done' (if timestamps available) + +### Step 3: Calculate Epic Progress +For each epic, show completion percentage: +```bash +# Group stories by epic and calculate completion +epics=$(grep -h "^epic:" .bmad/stories/*.yaml 2>/dev/null | sort -u | sed 's/epic: //') +``` + +### Step 4: Display Metrics + +Format output as a clear metrics dashboard: + +``` +📊 SPRINT METRICS +═════════════════ + +SPRINT: Current Sprint (Week 5-6) +Duration: Jan 29 - Feb 11, 2024 + +VELOCITY METRICS: +━━━━━━━━━━━━━━━━━ +📈 Completed This Sprint: 5 stories +📊 Work in Progress: 7 stories +🎯 Sprint Goal Progress: 62% (5/8 stories) + +FLOW METRICS: +━━━━━━━━━━━━ +⏱️ Avg Cycle Time: 4.2 days +📉 Lead Time: 7.5 days +🔄 Throughput: 2.5 stories/week + +HEALTH INDICATORS: +━━━━━━━━━━━━━━━━━━ +✅ WIP Limit: 7/8 (Within limits) +⚠️ Blocked Items: 1 +🔴 Failed QA: 1 (CART-002) +⏰ Aging Items: 2 (>3 days in same state) + +EPIC PROGRESS: +━━━━━━━━━━━━━ +User Authentication [███████░░░] 70% (2/3 stories) +Shopping Cart [████░░░░░░] 40% (0/2 complete) +Product Catalog [██░░░░░░░░] 20% (0/2 complete) +Infrastructure [██████████] 100% ✅ + +TEAM PERFORMANCE: +━━━━━━━━━━━━━━━━━ +Developer Team: + • Stories in Dev: 4 + • Avg Dev Time: 3.5 days + • PR Approval Rate: 85% + +QA Team: + • Stories Tested: 3 + • Bugs Found: 5 + • Pass Rate: 66% + +SPRINT BURNDOWN: +━━━━━━━━━━━━━━━━ +Start: 8 stories +━━━━━━━━━━━━━━━━━━━━ +Week 1: ████████░░ 6 remaining +Week 2: ████░░░░░░ 3 remaining +━━━━━━━━━━━━━━━━━━━━ +Projected: 2 stories may spill + +RECOMMENDATIONS: +━━━━━━━━━━━━━━━━ +1. 🚨 Unblock PROD-002 (Elasticsearch) - Critical path +2. ⚠️ Address CART-002 QA failures - Data loss issue +3. 📝 Complete architecture review - Blocking stories +4. 🎯 Focus on completing in-progress work before starting new +``` + +### Step 5: Trend Analysis +Compare with previous sprint (if data available): + +``` +TREND vs LAST SPRINT: +━━━━━━━━━━━━━━━━━━━━ +Velocity: ↑ +20% (4→5 stories) +Cycle Time: ↓ -15% (4.9→4.2 days) +Blocked Items: → Same (1) +Quality: ↓ -10% (More QA failures) +``` + +## Success Criteria +- Metrics calculate within 1 second +- All active stories included +- Percentages are accurate +- Trends identified when possible +- Actionable recommendations provided + +## Data Sources +- Story files in `.bmad/stories/` +- Status field for state +- Timestamp fields for cycle time (if available) +- Epic field for grouping +- Blocked field for health + +## Error Handling +- Missing timestamps: Show "N/A" for time metrics +- No stories: Show "No stories to analyze" +- Calculation errors: Show available metrics only + +## Notes +- Focus on actionable metrics +- Keep calculations simple and fast +- Provide context for numbers +- Highlight concerns and successes +- This is read-only analysis \ No newline at end of file diff --git a/bmad-core/tasks/show-sprint-board.md b/bmad-core/tasks/show-sprint-board.md new file mode 100644 index 00000000..1e2a6106 --- /dev/null +++ b/bmad-core/tasks/show-sprint-board.md @@ -0,0 +1,127 @@ +# show-sprint-board + +## Purpose +Display the current sprint's Kanban board showing all stories and their states in a clear, visual format. + +## Task Execution + +### Step 1: Gather Project Context +First, identify the project structure: +- Check for `.bmad/` directory +- Locate stories in `.bmad/stories/` +- Find documents in `.bmad/documents/` + +### Step 2: Analyze Document Status +Check the status of planning documents: +```bash +# Check for key documents +documents="project-brief prd architecture ux-spec" +for doc in $documents; do + if [ -f ".bmad/documents/${doc}.md" ] || [ -f ".bmad/documents/${doc}.yaml" ]; then + # Document exists - check if it has status in YAML header + echo "$doc: found" + fi +done +``` + +### Step 3: Count Stories by Status +Group stories by their current status: +```bash +# Extract status from all story files +statuses=$(grep -h "^status:" .bmad/stories/*.yaml 2>/dev/null | sed 's/status: //') + +# Count each status +draft=$(echo "$statuses" | grep -c "draft") +ready=$(echo "$statuses" | grep -c "ready") +in_progress=$(echo "$statuses" | grep -c "in_progress") +code_review=$(echo "$statuses" | grep -c "code_review") +qa_testing=$(echo "$statuses" | grep -c "qa_testing") +done=$(echo "$statuses" | grep -c "completed\|done") +``` + +### Step 4: Identify Active Work +Find stories currently being worked on: +```bash +# Find in-progress stories with assignees +active_stories=$(grep -l "status: in_progress" .bmad/stories/*.yaml 2>/dev/null) +``` + +### Step 5: Check for Blocked Items +Identify any blocked stories: +```bash +blocked=$(grep -l "blocked: true" .bmad/stories/*.yaml 2>/dev/null) +``` + +### Step 6: Display the Board + +Format the output as a clear Kanban board: + +``` +📋 SPRINT BOARD - [Project Name] +═══════════════════════════════════════ + +PLANNING DOCUMENTS: +✓ Brief ✓ PRD → Architecture ○ UX Spec + (v2.1) (in review) (not started) + +STORY PIPELINE: +┌──────────┬────────┬────────────┬──────────┬─────────┬──────┐ +│ Backlog │ Ready │ In Progress│ Review │ Testing │ Done │ +├──────────┼────────┼────────────┼──────────┼─────────┼──────┤ +│ 3 │ 2 │ 4 │ 1 │ 1 │ 5 │ +└──────────┴────────┴────────────┴──────────┴─────────┴──────┘ + +CURRENT SPRINT FOCUS: +━━━━━━━━━━━━━━━━━━━━ +🔄 IN PROGRESS (4): + • AUTH-002: Social login - Maria Garcia (2 days) + • CART-002: Cart persistence - Michael Chen (1 day) + • PROD-001: Product catalog API - Sarah Johnson (3 days) + • PROD-002: Search implementation - Lisa Park (1 day) + +👀 IN REVIEW (1): + • AUTH-003: Multi-factor auth - PR #245 (1 approval) + +🧪 IN TESTING (1): + • CART-001: Shopping cart service - QA: David Kim (80% complete) + +🚫 BLOCKED (1): + • PROD-002: Waiting for Elasticsearch cluster (2 days) + +SPRINT HEALTH: +━━━━━━━━━━━━━ +• Total WIP: 7 items (Suggested max: 8) ✅ +• Blocked: 1 item ⚠️ +• Aging items: 1 (PROD-001 > 3 days) ⚠️ +• Sprint velocity: On track 🎯 +``` + +### Step 7: Provide Quick Insights + +Add a brief summary of key observations: + +``` +KEY OBSERVATIONS: +• Development has high WIP (4 items) - monitor for context switching +• 1 blocker needs escalation (Elasticsearch cluster) +• Architecture review may block future stories +• Good progress on authentication epic (2/3 complete) +``` + +## Success Criteria +- Board displays within 2 seconds +- All stories are accounted for +- Status groupings are accurate +- Blocked items are highlighted +- Output is clear and readable + +## Error Handling +- If no `.bmad/` directory: "No BMAD project found in current directory" +- If no stories found: "No stories created yet. Use *draft to create first story" +- If file read errors: Continue with available data, note any issues + +## Notes +- Keep visualization simple and text-based for universal compatibility +- Focus on current sprint, not historical data +- This is a read-only view - no modifications to files +- Update frequency: Run on demand, no caching needed \ No newline at end of file