226 lines
7.8 KiB
Markdown
Raw Normal View History

2025-10-21 08:24:02 -05:00
# Sprint Planning - Sprint Status Generator
2025-12-10 20:50:24 +09:00
<critical>The workflow execution engine is governed by: {project-root}/.bmad/core/tasks/workflow.xml</critical>
<critical>You MUST have already loaded and processed: {project-root}/.bmad/bmm/workflows/4-implementation/sprint-planning/workflow.yaml</critical>
2025-10-21 08:24:02 -05:00
feat: add universal document sharding support with dual-strategy loading Implement comprehensive document sharding system across all BMM workflows enabling 90%+ token savings for large multi-epic projects through selective loading optimization. ## Document Sharding System ### Core Features - **Universal Support**: All 12 BMM workflows (Phase 1-4) handle both whole and sharded documents - **Dual Loading Strategy**: Full Load (Phase 1-3) vs Selective Load (Phase 4) - **Automatic Discovery**: Workflows detect format transparently (whole → sharded priority) - **Efficiency Optimization**: 90%+ token reduction for 10+ epic projects in Phase 4 ### Implementation Details **Phase 1-3 Workflows (7 workflows) - Full Load Strategy:** - product-brief, prd, gdd, create-ux-design, tech-spec, architecture, solutioning-gate-check - Load entire sharded documents when present - Transparent to user experience - Better organization for large projects **Phase 4 Workflows (5 workflows) - Selective Load Strategy:** - sprint-planning (Full Load exception - needs all epics) - epic-tech-context, create-story, story-context, code-review (Selective Load) - Load ONLY the specific epic needed (e.g., epic-3.md for Epic 3 stories) - Massive efficiency: Skip loading 9 other epics in 10-epic project ### Workflow Enhancements **Added to all workflows:** - `input_file_patterns` in workflow.yaml with wildcard discovery - Document Discovery section in instructions.md - Support for sharded index + section files - Brownfield `docs/index.md` support **Pattern standardization:** ```yaml input_file_patterns: document: whole: "{output_folder}/*doc*.md" sharded: "{output_folder}/*doc*/index.md" sharded_single: "{output_folder}/*doc*/section-{{id}}.md" # Selective load ``` ### Retrospective Workflow Major Overhaul Transformed retrospective into immersive, interactive team experience: **Epic Discovery Priority (Fixed):** - Priority 1: Check sprint-status.yaml for last completed epic - Priority 2: Ask user directly - Priority 3: Scan stories folder (last resort) **New Capabilities:** - Deep story analysis: Extract dev notes, mistakes, review feedback, lessons learned - Previous retro integration: Track action items, verify lessons applied - Significant change detection: Alert when discoveries require epic updates - Intent-based facilitation: Natural conversation vs scripted phrases - Party mode protocol: Clear speaker identification (Name (Role): dialogue) - Team dynamics: Drama, disagreements, diverse perspectives, authentic conflict **Structure:** - 12 whole-number steps (no decimals) - Highly interactive with constant user engagement - Cross-references previous retro for accountability - Synthesizes patterns across all stories - Detects architectural assumption changes ## Documentation **Created:** - `docs/document-sharding-guide.md` - Comprehensive 300+ line guide - What is sharding, when to use it (token thresholds) - How sharding works (discovery system, loading strategies) - Using shard-doc tool - Full Load vs Selective Load patterns - Complete examples and troubleshooting - Custom workflow integration patterns **Updated:** - `README.md` - Added Document Sharding feature section - `docs/index.md` - Added under Advanced Topics → Optimization - `src/modules/bmm/workflows/README.md` - Added sharding section with usage - `src/modules/bmb/workflows/create-workflow/workflow-creation-guide.md` - Added complete implementation patterns for workflow builders **Documentation levels:** 1. Overview (README.md) - Quick feature highlight 2. User guide (BMM workflows README) - Practical usage 3. Reference (document-sharding-guide.md) - Complete details 4. Builder guide (workflow-creation-guide.md) - Implementation patterns ## Efficiency Gains **Example: 10-Epic Project** Before sharding: - epic-tech-context for Epic 3: Load all 10 epics (~50k tokens) - create-story for Epic 3: Load all 10 epics (~50k tokens) - story-context for Epic 3: Load all 10 epics (~50k tokens) After sharding with selective load: - epic-tech-context for Epic 3: Load Epic 3 only (~5k tokens) = 90% reduction - create-story for Epic 3: Load Epic 3 only (~5k tokens) = 90% reduction - story-context for Epic 3: Load Epic 3 only (~5k tokens) = 90% reduction ## Breaking Changes None - fully backward compatible. Workflows work with existing whole documents. ## Files Changed **Workflows Updated (25 files):** - 7 Phase 1-3 workflows: Added full load sharding support - 5 Phase 4 workflows: Added selective load sharding support - 1 retrospective workflow: Complete overhaul with sharding support **Documentation (5 files):** - Created: document-sharding-guide.md - Updated: README.md, docs/index.md, BMM workflows README, BMB workflow-creation-guide - Removed: Old conversion report (obsolete) ## Future Extensibility - BMB workflows now aware of sharding patterns - Custom modules can easily implement sharding support - Standard patterns documented for consistency - No need to explain concept in future development
2025-11-02 00:13:33 -05:00
## 📚 Document Discovery - Full Epic Loading
**Strategy**: Sprint planning needs ALL epics and stories to build complete status tracking.
**Epic Discovery Process:**
1. **Search for whole document first** - Look for `epics.md`, `bmm-epics.md`, or any `*epic*.md` file
2. **Check for sharded version** - If whole document not found, look for `epics/index.md`
3. **If sharded version found**:
- Read `index.md` to understand the document structure
- Read ALL epic section files listed in the index (e.g., `epic-1.md`, `epic-2.md`, etc.)
- Process all epics and their stories from the combined content
- This ensures complete sprint status coverage
4. **Priority**: If both whole and sharded versions exist, use the whole document
**Fuzzy matching**: Be flexible with document names - users may use variations like `epics.md`, `bmm-epics.md`, `user-stories.md`, etc.
2025-10-21 08:24:02 -05:00
<workflow>
<step n="1" goal="Parse epic files and extract all work items">
<action>Communicate in {communication_language} with {user_name}</action>
<action>Look for all files matching `{epics_pattern}` in {epics_location}</action>
<action>Could be a single `epics.md` file or multiple `epic-1.md`, `epic-2.md` files</action>
<action>For each epic file found, extract:</action>
- Epic numbers from headers like `## Epic 1:` or `## Epic 2:`
- Story IDs and titles from patterns like `### Story 1.1: User Authentication`
- Convert story format from `Epic.Story: Title` to kebab-case key: `epic-story-title`
**Story ID Conversion Rules:**
- Original: `### Story 1.1: User Authentication`
- Replace period with dash: `1-1`
- Convert title to kebab-case: `user-authentication`
- Final key: `1-1-user-authentication`
<action>Build complete inventory of all epics and stories from all epic files</action>
</step>
feat(workflows): Implement intelligent file discovery protocol and Phase 4 BMGD workflows ## Core Workflow Engine Enhancements ### discover_inputs Protocol (MAJOR) - Added reusable `discover_inputs` protocol to workflow.xml for intelligent file loading - Supports three loading strategies: - FULL_LOAD: Load all shards for PRD, Architecture, UX (changed pattern from /index.md to /*/*.md) - SELECTIVE_LOAD: Load specific shard via template variable (e.g., epic-{{epic_num}}.md) - INDEX_GUIDED: Load index, analyze TOC, intelligently load relevant docs (with "DO NOT BE LAZY" mandate) - Auto-discovers whole vs sharded documents with proper fallback - Provides transparent reporting of loaded content with file counts - Invoked via <invoke-protocol name="discover_inputs" /> tag in workflow instructions ### Advanced Elicitation Improvements - Renamed adv-elicit.xml to advanced-elicitation.xml for clarity - Updated all references across agents and commands ### Shard Document Tool Enhancement - Added Step 6: Handle Original Document with three options: - [d] Delete - Remove original (recommended, prevents confusion) - [m] Move to archive - Backup original to archive folder - [k] Keep - Warning about defeating sharding purpose - Prevents issue where both whole and sharded versions exist, confusing discover_inputs protocol ## BMM Module - Input File Pattern Standardization ### Phase 1 - Analysis (1 workflow) - product-brief: Added load_strategy (FULL_LOAD for research/brainstorming, INDEX_GUIDED for document_project) - Updated instructions.md to use invoke-protocol, replaced manual fuzzy matching ### Phase 2 - Planning (4 workflows) - prd: Added load_strategy, updated instructions to reference {product_brief_content}, {research_content} - create-ux-design: Added load_strategy, removed fuzzy matching from instructions - tech-spec: Added load_strategy for brownfield context discovery - All epics patterns updated to support SELECTIVE_LOAD for specific epic shards ### Phase 3 - Solutioning (2 workflows) - architecture: Added load_strategy, updated instructions to use pre-loaded {prd_content}, {epics_content}, {ux_design_content} - solutioning-gate-check: Added load_strategy, replaced manual discovery with protocol invocation ### Phase 4 - Implementation (8 workflows) - code-review: Added load_strategy, fixed sharded patterns to /*/*.md, added step 1.5 for protocol - correct-course: Added complete input_file_patterns section (was missing), added step 0.5 - create-story: Added load_strategy, updated to SELECTIVE_LOAD for epics, added step 1.5 - dev-story: Added complete input_file_patterns section (was missing), added step 0.5 - epic-tech-context: Added load_strategy, updated PRD extraction to use {prd_content}, added step 1.5 - retrospective: Added load_strategy for architecture/prd (FULL_LOAD), epics (SELECTIVE_LOAD), added step 0.5 - sprint-planning: Fixed sharded pattern to load ALL epics (/*/*.md), added step 0.5 - story-context: Added load_strategy, updated doc collection to reference pre-loaded content, added step 1.5 ### Sprint Artifacts Path Corrections - story-done: Added missing sprint_artifacts variable, fixed sprint_status path from {context_dir} to {sprint_artifacts} - story-ready: Added missing sprint_artifacts variable - story-context: Fixed undefined {context_dir} -> {sprint_artifacts} - correct-course: Added sprint_artifacts and sprint_status variables ## BMGD Module - Phase 4 Production Workflows (NEW) Added complete Phase 4 implementation workflows for game development: - code-review: Senior developer review for completed game features - correct-course: Sprint change management for game projects - create-story: Story generation for game mechanics/features - dev-story: Feature implementation workflow - epic-tech-context: Technical spec generation per game epic - retrospective: Epic completion review and lessons learned - sprint-planning: Game development sprint status tracking - story-context: Dynamic context assembly for game stories - story-done: Story completion workflow - story-ready: Story readiness workflow All BMGD workflows follow BMM patterns with game-specific adaptations. ## Agent Updates ### BMM Agents - Updated all 7 BMM agents (analyst, architect, dev, pm, sm, tea, tech-writer, ux-designer) - Standardized web bundle configurations ### BMGD Agents - Updated 4 game development agents (game-architect, game-designer, game-dev, game-scrum-master) - Aligned with BMM agent structure ### CIS Agents - Updated 5 creative intelligence agents for consistency ## Documentation & Configuration - Updated CHANGELOG.md with Phase 4 workflow additions - Updated files-manifest.csv and task-manifest.csv - Updated .claude commands for all agents - Fixed formatting issues from previous commits ## Breaking Changes NONE - All changes are backward compatible. Workflows without input_file_patterns continue to work. Workflows with input_file_patterns now benefit from intelligent auto-loading. ## Migration Notes Existing workflows can gradually adopt discover_inputs protocol by: 1. Adding load_strategy to existing input_file_patterns in workflow.yaml 2. Adding <invoke-protocol name="discover_inputs" /> step in instructions.md 3. Replacing manual file loading with references to {pattern_name_content} variables
2025-11-12 19:18:38 -06:00
<step n="0.5" goal="Discover and load project documents">
<invoke-protocol name="discover_inputs" />
<note>After discovery, these content variables are available: {epics_content} (all epics loaded - uses FULL_LOAD strategy)</note>
</step>
2025-10-21 08:24:02 -05:00
<step n="2" goal="Build sprint status structure">
<action>For each epic found, create entries in this order:</action>
1. **Epic entry** - Key: `epic-{num}`, Default status: `backlog`
2. **Story entries** - Key: `{epic}-{story}-{title}`, Default status: `backlog`
3. **Retrospective entry** - Key: `epic-{num}-retrospective`, Default status: `optional`
**Example structure:**
```yaml
development_status:
epic-1: backlog
1-1-user-authentication: backlog
1-2-account-management: backlog
epic-1-retrospective: optional
```
</step>
<step n="3" goal="Apply intelligent status detection">
<action>For each story, detect current status by checking files:</action>
**Story file detection:**
2025-10-21 18:41:40 -05:00
- Check: `{story_location_absolute}/{story-key}.md` (e.g., `stories/1-1-user-authentication.md`)
2025-10-21 08:24:02 -05:00
- If exists → upgrade status to at least `ready-for-dev`
**Preservation rule:**
- If existing `{status_file}` exists and has more advanced status, preserve it
- Never downgrade status (e.g., don't change `done` to `ready-for-dev`)
2025-10-21 08:24:02 -05:00
**Status Flow Reference:**
- Epic: `backlog``in-progress``done`
- Story: `backlog``ready-for-dev``in-progress``review``done`
2025-10-21 08:24:02 -05:00
- Retrospective: `optional``completed`
</step>
<step n="4" goal="Generate sprint status file">
<action>Create or update {status_file} with:</action>
2025-10-21 18:41:40 -05:00
**File Structure:**
2025-10-21 08:24:02 -05:00
```yaml
2025-10-21 18:41:40 -05:00
# generated: {date}
# project: {project_name}
# project_key: {project_key}
# tracking_system: {tracking_system}
# story_location: {story_location}
# STATUS DEFINITIONS:
# ==================
# Epic Status:
# - backlog: Epic not yet started
# - in-progress: Epic actively being worked on
# - done: All stories in epic completed
#
# Epic Status Transitions:
# - backlog → in-progress: Automatically when first story is created (via create-story)
# - in-progress → done: Manually when all stories reach 'done' status
2025-10-21 18:41:40 -05:00
#
# Story Status:
2025-10-21 18:41:40 -05:00
# - backlog: Story only exists in epic file
# - ready-for-dev: Story file created in stories folder
2025-10-21 18:41:40 -05:00
# - in-progress: Developer actively working on implementation
# - review: Ready for code review (via Dev's code-review workflow)
2025-10-21 18:41:40 -05:00
# - done: Story completed
#
# Retrospective Status:
2025-10-21 18:41:40 -05:00
# - optional: Can be completed but not required
# - completed: Retrospective has been done
#
# WORKFLOW NOTES:
# ===============
# - Epic transitions to 'in-progress' automatically when first story is created
2025-10-21 18:41:40 -05:00
# - Stories can be worked in parallel if team capacity allows
# - SM typically creates next story after previous one is 'done' to incorporate learnings
# - Dev moves story to 'review', then runs code-review (fresh context, different LLM recommended)
2025-10-21 18:41:40 -05:00
generated: { date }
project: { project_name }
project_key: { project_key }
tracking_system: { tracking_system }
story_location: { story_location }
2025-10-21 08:24:02 -05:00
development_status:
# All epics, stories, and retrospectives in order
```
<action>Write the complete sprint status YAML to {status_file}</action>
2025-10-21 18:41:40 -05:00
<action>CRITICAL: Metadata appears TWICE - once as comments (#) for documentation, once as YAML key:value fields for parsing</action>
2025-10-21 08:24:02 -05:00
<action>Ensure all items are ordered: epic, its stories, its retrospective, next epic...</action>
</step>
<step n="5" goal="Validate and report">
<action>Perform validation checks:</action>
- [ ] Every epic in epic files appears in {status_file}
- [ ] Every story in epic files appears in {status_file}
2025-10-21 08:24:02 -05:00
- [ ] Every epic has a corresponding retrospective entry
- [ ] No items in {status_file} that don't exist in epic files
2025-10-21 08:24:02 -05:00
- [ ] All status values are legal (match state machine definitions)
- [ ] File is valid YAML syntax
<action>Count totals:</action>
- Total epics: {{epic_count}}
- Total stories: {{story_count}}
- Epics in-progress: {{in_progress_count}}
2025-10-21 08:24:02 -05:00
- Stories done: {{done_count}}
<action>Display completion summary to {user_name} in {communication_language}:</action>
**Sprint Status Generated Successfully**
- **File Location:** {status_file}
- **Total Epics:** {{epic_count}}
- **Total Stories:** {{story_count}}
- **Epics In Progress:** {{epics_in_progress_count}}
2025-10-21 08:24:02 -05:00
- **Stories Completed:** {{done_count}}
**Next Steps:**
1. Review the generated {status_file}
2025-10-21 08:24:02 -05:00
2. Use this file to track development progress
3. Agents will update statuses as they work
4. Re-run this workflow to refresh auto-detected statuses
</step>
</workflow>
## Additional Documentation
### Status State Machine
**Epic Status Flow:**
```
backlog → in-progress → done
2025-10-21 08:24:02 -05:00
```
- **backlog**: Epic not yet started
- **in-progress**: Epic actively being worked on (stories being created/implemented)
- **done**: All stories in epic completed
2025-10-21 08:24:02 -05:00
**Story Status Flow:**
```
backlog → ready-for-dev → in-progress → review → done
2025-10-21 08:24:02 -05:00
```
- **backlog**: Story only exists in epic file
- **ready-for-dev**: Story file created (e.g., `stories/1-3-plant-naming.md`)
2025-10-21 08:24:02 -05:00
- **in-progress**: Developer actively working
- **review**: Ready for code review (via Dev's code-review workflow)
2025-10-21 08:24:02 -05:00
- **done**: Completed
**Retrospective Status:**
```
optional ↔ completed
```
- **optional**: Can be done but not required
- **completed**: Retrospective has been completed
### Guidelines
1. **Epic Activation**: Mark epic as `in-progress` when starting work on its first story
2025-10-21 08:24:02 -05:00
2. **Sequential Default**: Stories are typically worked in order, but parallel work is supported
3. **Parallel Work Supported**: Multiple stories can be `in-progress` if team capacity allows
4. **Review Before Done**: Stories should pass through `review` before `done`
5. **Learning Transfer**: SM typically creates next story after previous one is `done` to incorporate learnings