# Sprint Execution Monitoring Workflow

**Project**: {{ project.name }}
**Workflow**: Sprint Execution Monitoring
**Purpose**: Monitor sprint progress, identify blockers, and generate daily/weekly reports

## Output Formatting Requirements

**IMPORTANT**: Use actual Unicode emojis in reports, NOT GitHub-style shortcodes:
- ✅ On track | ⚠️ At risk | ❌ Blocked
- 🟢 Complete | 🟡 In progress | 🔴 Not started
- 📊 Metric | 🎯 Goal | ⏱️ Time remaining

## Overview

This workflow monitors active sprint execution, tracks progress against sprint goals, identifies blockers, and provides regular status reports to stakeholders.

## Prerequisites

- Active sprint in {{ work_tracking.platform }}
- Work items assigned to current sprint
- Sprint goals defined

## Initialize Work Tracking

```python
# Initialize work tracking adapter (auto-selects Azure DevOps or file-based)
import sys
sys.path.insert(0, ".claude/skills")
from work_tracking import get_adapter

adapter = get_adapter()
print(f"📋 Work Tracking: {adapter.platform}")

# Set current sprint name
current_sprint = "Sprint 1"  # Replace with actual sprint
```

## Workflow Steps

### Step 1: Collect Sprint Status Data

{% if work_tracking.platform == 'azure-devops' %}
1. **Query current sprint work items:**
   ```bash
   # Get all work items in current sprint
   az boards query --wiql "SELECT [System.Id], [System.Title], [System.State], [System.AssignedTo], [{{ work_tracking.custom_fields.story_points or 'Microsoft.VSTS.Scheduling.StoryPoints' }}] FROM WorkItems WHERE [System.TeamProject] = '{{ work_tracking.project }}' AND [System.IterationPath] UNDER '{{ work_tracking.iteration_format.format(project=work_tracking.project, sprint='CURRENT_SPRINT') }}'" --output json
   ```
{% else %}
1. **Query current sprint work items:**
   ```python
   # Get all work items in current sprint
   sprint_items = adapter.query_sprint_work_items(current_sprint)

   print(f"📋 Sprint Work Items ({len(sprint_items)}):")
   for item in sprint_items:
       points = item.get('story_points', '-')
       assignee = item.get('assigned_to', 'Unassigned')
       print(f"  WI-{item['id']}: {item['title']}")
       print(f"    State: {item['state']} | Points: {points} | Assigned: {assignee}")

   # Get sprint summary
   summary = adapter.get_sprint_summary(current_sprint)
   print(f"\n📊 Sprint Status:")
   print(f"  Total items: {summary['total_items']}")
   print(f"  Total points: {summary['total_points']}")
   print(f"  Completed points: {summary['completed_points']}")
   print(f"  Completion: {(summary['completed_points']/max(summary['total_points'],1))*100:.1f}%")
   ```
{% endif %}

2. **Calculate sprint metrics:**
   - **Total story points**: Planned vs. completed
   - **Burndown data**: Remaining work over time
   - **Work item status**: New / Active / Resolved / Closed
   - **Team capacity**: Available vs. allocated
   - **Velocity**: Story points per day
   - **Blockers**: Items tagged or flagged as blocked

3. **Identify issues:**
   - Work items not updated in 3+ days
   - Items without assignee
   - Items marked as blocked
   - Items exceeding estimated time
   - High-priority items not started

### Step 2: Daily Standup Report Generation

{% if config.is_agent_enabled('scrum-master') %}
1. **Read agent definition:** `.claude/agents/scrum-master.md`
2. **Task:** "Generate daily standup report for the sprint:
   - Summarize yesterday's progress (story points completed)
   - Identify work planned for today
   - List current blockers and impediments
   - Flag items at risk of not completing
   - Provide recommendations for team focus
   - Track toward sprint goal"
3. **Spawn agent** using Task tool with model `{{ config.get_agent_model('scrum-master') or 'haiku' }}`
4. **Input:** Sprint status data from Step 1
5. **Display output** to user
6. **Collect:**
   - Daily progress summary
   - Blockers list
   - Items at risk
   - Team focus recommendations

{% endif %}
### Step 3: Identify and Analyze Blockers

{% if config.is_agent_enabled('senior-engineer') %}
1. **Read agent definition:** `.claude/agents/senior-engineer.md`
2. **Task:** "Analyze blocked work items and suggest resolutions:
   - Review each blocked item's context
   - Identify root cause of blocker
   - Suggest technical solutions or workarounds
   - Recommend who should be involved
   - Estimate impact on sprint goal"
3. **Spawn agent** using Task tool with model `{{ config.get_agent_model('engineer') }}`
4. **Input:** List of blocked items
5. **Display output** to user
6. **Collect:**
   - Blocker analysis
   - Suggested resolutions
   - Impact assessment

{% endif %}
### Step 4: Quality Health Check

1. **Run automated quality checks:**
   ```bash
   # Test coverage check
   {{ 'pytest --cov=src --cov-report=term' if 'Python' in project.tech_stack.languages else 'dotnet test --collect:"XPlat Code Coverage"' }}

   # Security scan
   # (Run your security scanner here)

   # Code quality
   # (Run linters/analyzers here)
   ```

2. **Compare against standards:**
   - Test coverage: Current vs. {{ quality_standards.test_coverage_min }}%
   - Critical vulnerabilities: Current vs. {{ quality_standards.critical_vulnerabilities_max }}
   - High vulnerabilities: Current vs. {{ quality_standards.high_vulnerabilities_max or 0 }}
   - Code complexity: Current vs. {{ quality_standards.code_complexity_max }}

3. **Flag quality regressions:**
   - Identify when metrics fall below standards
   - Link to specific work items causing regression
   - Recommend remediation actions

{% if config.is_agent_enabled('security-specialist') %}
### Step 5: Security Status Review (Weekly)

1. **Read agent definition:** `.claude/agents/security-specialist.md`
2. **Task:** "Review sprint security status:
   - Analyze security scan results
   - Review vulnerability trends
   - Assess impact of security issues on sprint
   - Recommend security-focused tasks
   - Check compliance with security standards"
3. **Spawn agent** using Task tool with model `{{ config.get_agent_model('security') or 'sonnet' }}`
4. **Input:** Security scan results and vulnerability data
5. **Display output** to user
6. **Collect:**
   - Security status summary
   - Critical issues requiring immediate attention
   - Recommended security tasks

{% endif %}
### Step 6: Generate Status Report

Report includes:
- Sprint progress (story points, velocity, trend)
- Work item status breakdown
- Quality metrics vs. standards
- Blockers and risks
- Items at risk
- Sprint goal progress
- Recommendations

### Step 7: Update Stakeholders

1. **Daily standup report** (automated):
   - Save to `.claude/reports/daily/sprint-[NUMBER]-day-[DAY].md`
   - Post to team chat (Slack/Teams via webhook)
   - Update Azure DevOps dashboard

2. **Weekly status report** (for stakeholders):
   - Save to `.claude/reports/weekly/sprint-[NUMBER]-week-[WEEK].md`
   - Email to stakeholders
   - Update project wiki

3. **Real-time blockers alert**:
   - Create {{ work_tracking.work_item_types.task or 'Task' }} for each new blocker
   - Assign to appropriate resolver
   - Tag with "blocker" and "urgent"

### Step 8: Automated Actions (Optional)

Create work items for:
- Stale items (no update in 3+ days)
- Blocked items requiring resolution
- Quality regressions

## Execution Schedule

### Daily (Automated)
- **Every morning at 9 AM**:
  - Run Steps 1-3 (status collection, standup report, blocker analysis)
  - Generate daily standup report
  - Send to team channel

### Weekly (Automated)
- **Every Friday at 4 PM**:
  - Run full workflow (all steps)
  - Generate comprehensive weekly report
  - Send to stakeholders
  - Update project dashboard

### Ad-hoc (Manual)
- Run whenever sprint health check is needed
- Before sprint review preparation
- When major blockers emerge

## Setup for Automated Execution

### GitHub Actions

{% raw %}
```yaml
# .github/workflows/sprint-monitoring.yml
name: Sprint Execution Monitoring

on:
  schedule:
    - cron: '0 9 * * 1-5'  # Weekdays at 9 AM
    - cron: '0 16 * * 5'   # Friday at 4 PM (weekly report)

jobs:
  monitor-sprint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.10'
      - run: pip install claude-workflow-framework
      - name: Generate Sprint Report
        env:
          AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
        run: |
          cwf workflow run sprint-execution --report-type daily
```
{% endraw %}

### Azure DevOps Pipeline

{% raw %}
```yaml
# azure-sprint-monitoring.yml
schedules:
  - cron: "0 9 * * 1-5"
    displayName: Daily Sprint Standup
    branches:
      include:
        - main
  - cron: "0 16 * * 5"
    displayName: Weekly Sprint Report
    branches:
      include:
        - main

steps:
  - script: |
      pip install claude-workflow-framework
      cwf workflow run sprint-execution
    env:
      AZURE_DEVOPS_PAT: $(AZURE_DEVOPS_PAT)
      ANTHROPIC_API_KEY: $(ANTHROPIC_API_KEY)
```
{% endraw %}

## Success Criteria

- ✅ Daily standup reports generated and shared
- ✅ Blockers identified and assigned for resolution
- ✅ Sprint progress visible to all stakeholders
- ✅ Quality metrics tracked against standards
- ✅ Risks flagged early for mitigation
- ✅ Team stays aligned on sprint goals

## Configuration

**Agents Used:**
{% if config.is_agent_enabled('scrum-master') %}- Scrum Master (daily reports){% endif %}
{% if config.is_agent_enabled('senior-engineer') %}- Senior Engineer (blocker analysis){% endif %}
{% if config.is_agent_enabled('security-specialist') %}- Security Specialist (weekly security review){% endif %}

**Quality Standards:**
- Test Coverage: ≥ {{ quality_standards.test_coverage_min }}%
- Critical Vulnerabilities: ≤ {{ quality_standards.critical_vulnerabilities_max }}
- High Vulnerabilities: ≤ {{ quality_standards.high_vulnerabilities_max or 0 }}
- Code Complexity: ≤ {{ quality_standards.code_complexity_max }}

**Report Frequency:**
- Daily: Standup reports
- Weekly: Comprehensive status
- Ad-hoc: On-demand health checks

---

*Generated by Claude Workflow Framework for {{ project.name }}*
