# Batch Super-Dev - Interactive Story Selector ## AKA: "Mend the Gap" πŸš‡ **Primary Use Case:** Gap analysis and reconciliation workflow This workflow helps you "mind the gap" between story requirements and codebase reality, then "mend the gap" by building only what's truly missing. ### What This Workflow Does 1. **Scans codebase** to verify what's actually implemented vs what stories claim 2. **Finds the gap** between story requirements and reality 3. **Mends the gap** by building ONLY what's truly missing (no duplicate work) 4. **Updates tracking** to reflect actual completion status (check boxes, sprint-status) ### Common Use Cases **Reconciliation Mode (Most Common):** - Work was done but not properly tracked - Stories say "build X" but X is 60-80% already done - Need second set of eyes to find real gaps - Update story checkboxes to match reality **Greenfield Mode:** - Story says "build X", nothing exists - Build 100% from scratch with full quality gates **Brownfield Mode:** - Story says "modify X", X exists - Refactor carefully, add only new requirements ### Execution Modes **Sequential (Recommended for Gap Analysis):** - Process stories ONE-BY-ONE in THIS SESSION - After each story: verify existing code β†’ build only gaps β†’ check boxes β†’ move to next - Easier to monitor, can intervene if issues found - Best for reconciliation work **Parallel (For Greenfield Batch Implementation):** - Spawn autonomous Task agents to process stories concurrently - Faster completion but harder to monitor - Best when stories are independent and greenfield The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml You MUST have already loaded and processed: {project-root}/_bmad/bmm/workflows/4-implementation/batch-super-dev/workflow.yaml βš•οΈ HOSPITAL-GRADE CODE STANDARDS βš•οΈ This code may be used in healthcare settings where LIVES ARE AT STAKE. Every line of code must meet hospital-grade reliability standards. QUALITY >> SPEED. Take 5 hours to do it right, not 1 hour to do it poorly. Read {sprint_status} file Parse metadata: project, project_key, tracking_system Parse development_status map Filter stories with status = "ready-for-dev" OR "backlog" Exclude entries that are epics (keys starting with "epic-") or retrospectives (keys ending with "-retrospective") Group by status: ready_for_dev_stories, backlog_stories Further filter stories to only include those starting with "{filter_by_epic}-" If filter_by_epic = "3", only include stories like "3-1-...", "3-2-...", etc. Sort filtered stories by epic number, then story number (e.g., 1-1, 1-2, 2-1, 3-1) Store as: ready_for_dev_stories (list of story keys) βœ… No available stories found (ready-for-dev or backlog). All stories are either in-progress, review, or done! Run `/bmad_bmm_sprint-status` to see current status. Exit workflow Combine both lists: available_stories = ready_for_dev_stories + backlog_stories Read comment field for each story from sprint-status.yaml (text after # on the same line) For each story, verify story file exists using COMPREHENSIVE naming pattern detection: Parse story_key (e.g., "20-9-megamenu-navigation" or "20-9") to extract: - epic_num: first number (e.g., "20") - story_num: second number (e.g., "9") - optional_suffix: everything after second number (e.g., "-megamenu-navigation" or empty) Input: "20-9-megamenu-navigation" β†’ epic=20, story=9, suffix="-megamenu-navigation" Input: "20-11" β†’ epic=20, story=11, suffix="" 🚨 ONE CANONICAL FORMAT - NO VARIATIONS CANONICAL FORMAT: {story_key}.md 20-9-megamenu-navigation.md (epic-story-slug, NO prefix) 18-1-charge-model-state-machine.md (epic-story-slug, NO prefix) Check if file exists: {sprint_artifacts}/{story_key}.md Set file_status = βœ… EXISTS Store file_path = {sprint_artifacts}/{story_key}.md Set file_status = ❌ MISSING Check for legacy wrong-named files: Search for: story-{story_key}.md (wrong - has "story-" prefix) ⚠️ Found legacy file: story-{story_key}.md πŸ”§ AUTO-RENAMING to canonical: {story_key}.md Rename: mv story-{story_key}.md {story_key}.md Verify rename worked Set file_status = βœ… EXISTS (after rename) Store file_path = {sprint_artifacts}/{story_key}.md file_status = ❌ MISSING (genuinely missing) Mark stories as: βœ… (file exists), ❌ (file missing), πŸ”„ (already implemented but not marked done) ## πŸ“¦ Available Stories ({{count}}) {{#if filter_by_epic}} **Filtered by Epic {{filter_by_epic}}** {{/if}} {{#if ready_for_dev_stories.length > 0}} ### Ready for Dev ({{ready_for_dev_stories.length}}) {{#each ready_for_dev_stories}} {{@index}}. **{{key}}** {{file_status_icon}} {{sprint_status}} {{#if comment}}β†’ {{comment}}{{/if}} {{#if file_path}} File: {{file_path}}{{/if}} {{/each}} {{/if}} {{#if backlog_stories.length > 0}} ### Backlog ({{backlog_stories.length}}) {{#each backlog_stories}} {{@index}}. **{{key}}** {{file_status_icon}} [BACKLOG] {{#if comment}}β†’ {{comment}}{{/if}} {{#if file_path}} File: {{file_path}}{{else}} Needs story creation{{/if}} {{/each}} {{/if}} --- **Legend:** - βœ… Story file exists, ready to implement - πŸ”„ Already implemented, just needs status update - ❌ Story file missing, needs creation first - [BACKLOG] Story needs gap analysis before implementation **Total:** {{count}} stories available **Max batch size:** {{max_stories}} stories ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ” VALIDATING STORY FILES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ For each story in available_stories (ready_for_dev + backlog): Check if story file exists (already done in Step 2) πŸ“ Story {{story_key}}: BACKLOG - will create basic story file Mark story as needs_story_creation = true Mark story.creation_workflow = "/create-story" (lightweight, no gap analysis) Mark story as validated (will create in next step) ❌ Story {{story_key}}: File MISSING but status is ready-for-dev Mark story for removal from selection Add to skipped_stories list with reason: "Story file missing (status ready-for-dev but no file)" Read story file: {{file_path}} Parse sections and validate BMAD format Check for all 12 required sections: 1. Business Context 2. Current State 3. Acceptance Criteria 4. Tasks and Subtasks 5. Technical Requirements 6. Architecture Compliance 7. Testing Requirements 8. Dev Agent Guardrails 9. Definition of Done 10. References 11. Dev Agent Record 12. Change Log Count sections present: sections_found Check Current State content length (word count) Check Acceptance Criteria item count: ac_count Count unchecked tasks ([ ]) in Tasks/Subtasks: task_count Look for gap analysis markers (βœ…/❌) in Current State ❌ Story {{story_key}}: INVALID - Insufficient tasks ({{task_count}}/3 minimum) This story has TOO FEW TASKS to be a valid story (found {{task_count}}, need β‰₯3). Analysis: - 0 tasks: Story is a stub or empty - 1-2 tasks: Too small to represent meaningful feature work - β‰₯3 tasks: Minimum valid (MICRO threshold) Possible causes: - Story file is incomplete/stub - Tasks section is empty or malformed - Story needs proper task breakdown - Story is too small and should be combined with another Required action: - Run /validate-create-story to regenerate with proper task breakdown - Or manually add tasks to reach minimum of 3 tasks - Or combine this story with a related story This story will be SKIPPED. Mark story for removal from selection Add to skipped_stories list with reason: "INVALID - Only {{task_count}} tasks (need β‰₯3)" ⚠️ Story {{story_key}}: File incomplete or invalid - Sections: {{sections_found}}/12 {{#if Current State < 100 words}}- Current State: stub ({{word_count}} words, expected β‰₯100){{/if}} {{#if no gap analysis}}- Gap analysis: missing{{/if}} {{#if ac_count < 3}}- Acceptance Criteria: {{ac_count}} items (expected β‰₯3){{/if}} {{#if task_count < 3}}- Tasks: {{task_count}} items (expected β‰₯3){{/if}} Regenerate story with codebase scan? (yes/no): ⚠️ STORY REGENERATION REQUIRES MANUAL WORKFLOW EXECUTION **Story:** {{story_key}} **Status:** File incomplete or invalid ({{sections_found}}/12 sections) **Problem:** Agents cannot invoke /create-story-with-gap-analysis workflow autonomously. Story regeneration requires: - Interactive user prompts - Context-heavy codebase scanning - Gap analysis decision-making **Required Action:** 1. **Exit this batch execution:** - This story will be skipped - Batch will continue with valid stories only 2. **Backup existing file (optional):** ``` cp {{file_path}} {{file_path}}.backup ``` 3. **Regenerate story manually:** ``` /create-story-with-gap-analysis ``` When prompted, provide: - Story key: {{story_key}} 4. **Validate story format:** ``` ./scripts/validate-all-stories.sh ``` 5. **Re-run batch-super-dev:** - Story will now be properly formatted **Skipping story {{story_key}} from current batch execution.** Mark story for removal from selection Add to skipped_stories list with reason: "Story regeneration requires manual workflow (agents cannot invoke /create-story)" Add to manual_actions_required list: "Regenerate {{story_key}} with /create-story-with-gap-analysis" ⏭️ Skipping story {{story_key}} (file incomplete) Mark story for removal from selection Add to skipped_stories list with reason: "User declined regeneration" βœ… Story {{story_key}}: Valid (12/12 sections, gap analysis present) Mark story as validated βœ… Story {{story_key}}: Already implemented (will skip or reconcile only) Mark story as validated (already done) Remove skipped stories from ready_for_dev_stories Update count of available stories ⏭️ Skipped Stories ({{skipped_count}}): {{#each skipped_stories}} - {{story_key}}: {{reason}} {{/each}} ❌ No valid stories remaining after validation. All stories were either: - Missing files (user declined creation) - Invalid/incomplete (user declined regeneration) - Already implemented Run `/bmad:bmm:workflows:sprint-status` to see status. Exit workflow ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ βœ… Story Validation Complete ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Validated:** {{validated_count}} stories ready to process {{#if skipped_count > 0}}**Skipped:** {{skipped_count}} stories{{/if}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“Š SCORING STORY COMPLEXITY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ For each validated story: Read story file: {{file_path}} Count unchecked tasks ([ ]) at top level only in Tasks/Subtasks section β†’ task_count (See workflow.yaml complexity.task_counting.method = "top_level_only") ⚠️ Story {{story_key}}: Cannot score complexity - INSUFFICIENT TASKS ({{task_count}}/3 minimum) This story was not caught in Step 2.5 validation but has too few tasks. It should have been rejected during validation. Skipping complexity scoring for this story - marking as INVALID. Set {{story_key}}.complexity = {level: "INVALID", score: 0, task_count: {{task_count}}, reason: "Insufficient tasks ({{task_count}}/3 minimum)"} Continue to next story Extract file paths mentioned in tasks β†’ file_count Scan story title and task descriptions for risk keywords using rules from workflow.yaml: - Case insensitive matching (require_word_boundaries: true) - Include keyword variants (e.g., "authentication" matches "auth") - Scan: story_title, task_descriptions, subtask_descriptions Calculate complexity score: - Base score = task_count - Add 5 for each HIGH risk keyword match (auth, security, payment, migration, database, schema, encryption) - Add 2 for each MEDIUM risk keyword match (api, integration, external, third-party, cache) - Add 0 for LOW risk keywords (ui, style, config, docs, test) - Count each keyword only once (no duplicates) Assign complexity level using mutually exclusive decision tree (priority order): 1. Check COMPLEX first (highest priority): IF (task_count β‰₯ 16 OR complexity_score β‰₯ 20 OR has ANY HIGH risk keyword) THEN level = COMPLEX 2. Else check MICRO (lowest complexity): ELSE IF (task_count ≀ 3 AND complexity_score ≀ 5 AND file_count ≀ 5) THEN level = MICRO 3. Else default to STANDARD: ELSE level = STANDARD This ensures no overlaps: - Story with HIGH keyword β†’ COMPLEX (never MICRO or STANDARD) - Story with 4-15 tasks or >5 files β†’ STANDARD (not MICRO or COMPLEX) - Story with ≀3 tasks, ≀5 files, no HIGH keywords β†’ MICRO Store complexity_level for story: {{story_key}}.complexity = {level, score, task_count, risk_keywords} Group stories by complexity level Filter out INVALID stories (those with level="INVALID"): For each INVALID story, add to skipped_stories with reason from complexity object Remove INVALID stories from complexity_groups and ready_for_dev_stories ❌ **Invalid Stories Skipped ({{invalid_count}}):** {{#each invalid_stories}} - {{story_key}}: {{reason}} {{/each}} These stories need to be regenerated with /create-story or /validate-create-story before processing. πŸ“Š **Complexity Analysis Complete** {{#each complexity_groups}} **{{level}} Stories ({{count}}):** {{#each stories}} - {{story_key}}: {{task_count}} tasks, score {{score}}{{#if risk_keywords}}, risk: {{risk_keywords}}{{/if}} {{/each}} {{/each}} --- **Pipeline Routing:** - πŸš€ **MICRO** ({{micro_count}}): Lightweight path - skip gap analysis + code review - βš™οΈ **STANDARD** ({{standard_count}}): Full pipeline with all quality gates - πŸ”’ **COMPLEX** ({{complex_count}}): Enhanced validation + consider splitting {{#if complex_count > 0}} ⚠️ **Warning:** {{complex_count}} complex stories detected. Consider: - Breaking into smaller stories before processing - Running these separately with extra attention {{/if}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ❌ No valid stories remaining after complexity analysis. All stories were either: - Missing story files (Step 2.5) - Invalid/incomplete (Step 2.5) - Zero tasks (Step 2.6) Run /create-story or /validate-create-story to create proper story files, then rerun /batch-super-dev. Exit workflow **Select stories to process:** Enter story numbers to process (examples): - Single: `1` - Multiple: `1,3,5` - Range: `1-5` (processes 1,2,3,4,5) - Mixed: `1,3-5,8` (processes 1,3,4,5,8) - All: `all` (processes all {{count}} stories) Or: - `cancel` - Exit without processing **Your selection:** Parse user input ❌ Batch processing cancelled. Exit workflow Set selected_stories = all ready_for_dev_stories Parse selection (handle commas, ranges) Input "1,3-5,8" β†’ indexes [1,3,4,5,8] β†’ map to story keys Map selected indexes to story keys from ready_for_dev_stories Store as: selected_stories ⚠️ You selected {{count}} stories, but max_stories is {{max_stories}}. Only the first {{max_stories}} will be processed. Truncate selected_stories to first max_stories entries Display confirmation ## πŸ“‹ Selected Stories ({{count}}) {{#each selected_stories}} {{@index}}. {{key}} {{#if is_backlog}}[BACKLOG - needs story creation]{{/if}} {{/each}} **Estimated time:** {{count}} stories Γ— 30-60 min/story = {{estimated_hours}} hours ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ” IMPLEMENTATION READINESS CHECK ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Validating selected stories for quality and completeness... For each selected story: Read story file: {{story_file_path}} ⚠️ {{story_key}}: No story file (BACKLOG) - will create during execution Mark story as needs_creation Continue to next story ❌ {{story_key}}: Story file MISSING but status is ready-for-dev (inconsistent state) Add to validation_failures list Continue to next story Validate story completeness: - Count sections (need 12) - Check Current State word count (need β‰₯100) - Check gap analysis markers (βœ…/❌) - Count Acceptance Criteria (need β‰₯3) - Count unchecked tasks (need β‰₯3) ❌ {{story_key}}: INSUFFICIENT TASKS ({{task_count}}/3 minimum) Add to validation_failures: "{{story_key}}: Only {{task_count}} tasks" ⚠️ {{story_key}}: Story incomplete ({{sections_found}}/12 sections{{#if !gap_analysis}}, no gap analysis{{/if}}) Add to validation_warnings: "{{story_key}}: Needs regeneration" βœ… {{story_key}}: Valid and ready Add to validated_stories list ❌ **Validation Failures ({{validation_failures.length}}):** {{#each validation_failures}} - {{this}} {{/each}} These stories CANNOT be processed. Options: 1. Remove them from selection 2. Fix them manually 3. Cancel batch execution Remove failed stories and continue? (yes/no): Remove validation_failures from selected_stories βœ… Removed {{validation_failures.length}} invalid stories. Continuing with {{selected_stories.length}} valid stories. ❌ Batch processing cancelled. Please fix story validation issues first. Exit workflow ⚠️ **Validation Warnings ({{validation_warnings.length}}):** {{#each validation_warnings}} - {{this}} {{/each}} These stories have quality issues but can still be processed. Recommend regenerating with /create-story-with-gap-analysis for better quality. Continue with these stories anyway? (yes/no): ❌ Batch processing cancelled. Exit workflow ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ βœ… Implementation Readiness: PASS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Validated:** {{validated_stories.length}} stories **Needs Creation:** {{needs_creation.length}} stories (BACKLOG) **Quality:** All stories meet minimum standards ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ βœ… All stories have files - skipping story creation Jump to Step 3 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“ BATCH STORY CREATION ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ {{needs_creation.length}} stories need creation (BACKLOG status): {{#each needs_creation}} - {{story_key}} {{/each}} These will be created using /create-story (lightweight, no gap analysis). Gap analysis will happen just-in-time during implementation (Step 2 of super-dev-pipeline). Create these {{needs_creation.length}} story files now? (yes/no): ⏭️ Skipping story creation. These stories will be removed from batch. Remove needs_creation stories from selected_stories ❌ No stories remaining after removing backlog stories. Exiting. Exit workflow πŸš€ Spawning {{needs_creation.length}} parallel agents for story creation... Spawn Task agents in PARALLEL (send all Task calls in SINGLE message): For each story in needs_creation: Task tool call: - subagent_type: "general-purpose" - description: "Create story {{story_key}}" - prompt: "Create basic story file for {{story_key}}. INSTRUCTIONS: 1. Read epic description from docs/epics.md (Epic {{epic_num}}) 2. Read PRD requirements (docs/prd-art-collective-tenants.md) 3. Read architecture (docs/architecture-space-rentals.md) 4. Extract FRs for this story from PRD 5. Break down into 3-7 tasks with subtasks 6. Create story file at: docs/sprint-artifacts/{{story_key}}.md 7. Use template from: _bmad/bmm/workflows/4-implementation/create-story/template.md 8. NO gap analysis (defer to implementation) 9. Commit story file when complete 10. Report: story file path Mode: batch (lightweight, no codebase scanning)" - Store returned agent_id for tracking ⏳ Waiting for {{needs_creation.length}} parallel agents to complete... Story creation agents: {{#each needs_creation}} - Agent {{@index}}: {{story_key}} {{/each}} Wait for ALL agents to complete (blocking) Check each agent output: Parse agent output for {{story_key}} βœ… Story created: {{story_key}} Verify file exists at docs/sprint-artifacts/{{story_key}}.md Mark story.needs_story_creation = false ❌ Failed to create story: {{story_key}} Add to failed_creations list Remove from selected_stories ⚠️ {{failed_creations.length}} stories failed creation: {{#each failed_creations}} - {{this}} {{/each}} These will be skipped in batch execution. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ βœ… Story Creation Complete ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Created:** {{needs_creation.length - failed_creations.length}} stories **Failed:** {{failed_creations.length}} stories **Ready for implementation:** {{selected_stories.length}} stories Note: Gap analysis will happen just-in-time during implementation. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ╔═══════════════════════════════════════════════════════════════════╗ β•‘ BATCH SUPER-DEV: Execution Mode Selection β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• βš•οΈ HOSPITAL-GRADE CODE STANDARDS ACTIVE βš•οΈ Lives are at stake. All code must meet safety-critical reliability standards. **Choose execution mode:** [I] INTERACTIVE CHECKPOINT MODE - After each story completes, pause for your review - You approve before proceeding to next story - Allows course correction if issues detected - Best for: When you want to monitor progress [A] FULLY AUTONOMOUS MODE - Process all selected stories without pausing - No human interaction until completion - Best for: When stories are well-defined and you trust the process Which mode? [I/A]: Read user input Set execution_mode = "interactive_checkpoint" βœ… Interactive Checkpoint Mode Selected After each story implementation: - Full quality report displayed - You approve before next story begins - Allows real-time oversight and intervention Set execution_mode = "fully_autonomous" βš•οΈ Fully Autonomous Mode Selected - HOSPITAL-GRADE STANDARDS ENFORCED Quality enhancements for autonomous mode: βœ… Double validation at each step βœ… Comprehensive error checking βœ… Detailed audit trail generation βœ… Zero-tolerance for shortcuts βœ… Hospital-grade code verification Processing will continue until ALL selected stories complete. NO human interaction required until completion. QUALITY OVER SPEED: Taking time to ensure correctness. Activate hospital_grade_mode = true Set quality_multiplier = 1.5 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“Š ANALYZING STORY DEPENDENCIES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ For each selected story: Read story file Tasks section Analyze task descriptions for dependencies on other selected stories: Dependency detection rules: - Look for mentions of other story keys (e.g., "18-1", "18-2") - Look for phrases like "requires", "depends on", "needs", "after" - Look for file paths that other stories create - Look for models/services that other stories define Build dependency map: story_key: { depends_on: [list of story keys this depends on], blocks: [list of story keys that depend on this] } Compute waves using topological sort: Wave 1: Stories with no dependencies (can start immediately) Wave 2: Stories that only depend on Wave 1 Wave 3: Stories that depend on Wave 2 ... πŸ“Š **Dependency Analysis Complete** {{#each waves}} **Wave {{@index}}** ({{count}} stories): {{#each stories}} - {{story_key}}{{#if depends_on}} [depends on: {{depends_on}}]{{/if}} {{/each}} {{/each}} **Execution Strategy:** {{#if waves.length == 1}} βœ… All stories are independent - can run fully in parallel {{else}} βš™οΈ Dependencies detected - wave-based execution recommended - Wave 1: {{wave_1_count}} stories (parallel) - Total waves: {{waves.length}} - Sequential time: {{total_time_sequential}} - Wave-based time: {{total_time_waves}} ({{time_savings}}% faster) {{/if}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **How should these stories be processed?** Options: - **S**: Sequential - Run stories one-by-one (Task agent finishes before next starts) - **P**: Parallel - Run stories concurrently (Multiple Task agents running simultaneously) **Note:** Both modes use Task agents to keep story context out of the main thread. The only difference is the number running at once. Enter: S or P Capture response as: execution_strategy Set execution_mode = "sequential" Set parallel_count = 1 Set use_task_agents = true ⏺ βœ… Sequential mode selected - stories will be processed one-by-one Each story runs in its own Task agent. Agents execute sequentially (one completes before next starts). This keeps the main thread clean while maintaining easy monitoring. Set execution_mode = "parallel" Set use_task_agents = true **How many agents should run in parallel?** Options: - **2**: Conservative (low resource usage, easier debugging) - **4**: Moderate (balanced performance, recommended) - **8**: Aggressive (higher throughput) - **10**: Maximum (10 agent limit for safety) - **all**: Use all stories (max 10 agents) Enter number (2-10) or 'all': Capture response as: parallel_count If parallel_count == 'all': set parallel_count = min(count of selected_stories, 10) If parallel_count > 10: set parallel_count = 10 (safety limit) ⚠️ Requested {{original_count}} agents, capped at 10 (safety limit) ⏺ βœ… Parallel mode selected - {{parallel_count}} Task agents will run concurrently Each story runs in its own Task agent. Multiple agents execute in parallel for faster completion. ## βš™οΈ Execution Plan **Mode:** {{execution_mode}} **Task Agents:** {{parallel_count}} {{#if parallel_count > 1}}running concurrently{{else}}running sequentially{{/if}} **Agent Type:** general-purpose (autonomous) **Stories to process:** {{count}} **Estimated total time:** {{#if parallel_count > 1}} - With {{parallel_count}} agents: {{estimated_hours / parallel_count}} hours {{else}} - Sequential: {{estimated_hours}} hours {{/if}} **Complexity Routing:** {{#each stories_by_complexity}} - {{complexity}}: {{count}} stories ({{pipeline_description}}) {{/each}} Confirm execution plan? (yes/no): ❌ Batch processing cancelled. Exit workflow Initialize counters: completed=0, failed=0, failed_stories=[], reconciliation_warnings=[], reconciliation_warnings_count=0 Set start_time = current timestamp Jump to Step 4-Sequential (Task agents, one at a time) Jump to Step 4-Wave (Task agents, wave-based parallel) Jump to Step 4-Parallel (Task agents, multiple concurrent) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸš€ WAVE-BASED PARALLEL PROCESSING STARTED ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Stories:** {{count}} **Total waves:** {{waves.length}} **Mode:** Task agents (parallel by wave) **Max concurrent agents:** {{parallel_count}} **Continue on failure:** {{continue_on_failure}} **Pattern:** Wave barrier (complete wave before next wave) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“Š **Wave Plan (from dependency analysis):** {{#each waves}} Wave {{@index}}: {{count}} stories {{#each stories}} - {{story_key}}{{#if depends_on}} [depends on: {{depends_on}}]{{/if}} {{/each}} {{/each}} Set abort_batch = false For each wave in waves (in order): ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🌊 STARTING WAVE {{@index}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Stories in this wave: {{#each stories}} - {{story_key}}{{#if depends_on}} (depends on: {{depends_on}}){{/if}} {{/each}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Initialize wave worker pool state: - wave_queue = stories - Resolve wave_queue items to full story objects by matching story_key in selected_stories (include complexity_level, story_file_path) - active_workers = {} (map of worker_id β†’ {story_key, task_id, started_at}) - completed_wave_stories = [] - failed_wave_stories = [] - next_story_index = 0 - max_workers = min(parallel_count, wave_queue.length) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ”§ Initializing {{max_workers}} worker slots for Wave {{@index}}... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Spawn first {{max_workers}} agents (or fewer if less stories): While next_story_index < min(max_workers, wave_queue.length): story_key = wave_queue[next_story_index].story_key complexity_level = wave_queue[next_story_index].complexity_level story_file_path = wave_queue[next_story_index].story_file_path worker_id = next_story_index + 1 Spawn Task agent: - subagent_type: "general-purpose" - description: "Implement story {{story_key}}" - prompt: "Execute super-dev-pipeline workflow for story {{story_key}}. Story file: docs/sprint-artifacts/{{story_key}}.md Complexity: {{complexity_level}} Mode: batch Load workflow: /Users/jonahschulte/git/BMAD-METHOD/src/modules/bmm/workflows/4-implementation/super-dev-pipeline Follow the multi-agent pipeline (builder, inspector, reviewer, fixer). Commit when complete, update story status, report results." - run_in_background: true (non-blocking) Store in active_workers[worker_id]: story_key: {{story_key}} task_id: {{returned_task_id}} started_at: {{timestamp}} status: "running" Increment next_story_index πŸš€ Worker {{worker_id}} started: {{story_key}} WAVE BARRIER: Complete all stories in this wave before starting next wave While active_workers.size > 0 OR next_story_index < wave_queue.length: Poll for completed workers (check task outputs non-blocking): For each worker_id in active_workers: Check if worker task completed using TaskOutput(task_id, block=false) Continue to next worker (don't wait) Get worker details: story_key = active_workers[worker_id].story_key βœ… Worker {{worker_id}} completed: {{story_key}} Execute Step 4.5: Smart Story Reconciliation Load reconciliation instructions: {installed_path}/step-4.5-reconcile-story-status.md Execute reconciliation with story_key={{story_key}} 🚨 MANDATORY STORY FILE VERIFICATION - MAIN ORCHESTRATOR MUST RUN BASH STORY_FILE="docs/sprint-artifacts/{{story_key}}.md" echo "πŸ” Verifying story file: {{story_key}}" CHECKED_COUNT=$(grep -c "^- \[x\]" "$STORY_FILE" 2>/dev/null || echo "0") TOTAL_COUNT=$(grep -c "^- \[.\]" "$STORY_FILE" 2>/dev/null || echo "0") echo " Checked tasks: $CHECKED_COUNT/$TOTAL_COUNT" RECORD_FILLED=$(grep -A 20 "^### Dev Agent Record" "$STORY_FILE" 2>/dev/null | grep -c "Claude Sonnet" || echo "0") echo " Dev Agent Record: $RECORD_FILLED" echo "$CHECKED_COUNT" > /tmp/checked_{{story_key}}.txt echo "$RECORD_FILLED" > /tmp/record_{{story_key}}.txt ❌ Story {{story_key}}: Agent FAILED to update story file Checked tasks: {{checked_tasks}}/{{total_tasks}} Dev Agent Record: {{dev_agent_record_status}} πŸ”§ EXECUTING AUTO-FIX RECONCILIATION... AUTO-FIX PROCEDURE: 1. Read agent's commit to see what files were created/modified 2. Read story Tasks section to see what was supposed to be built 3. For each task, check if corresponding code exists in commit 4. If code exists, check off the task using Edit tool 5. Fill in Dev Agent Record with commit details 6. Verify fixes worked (re-count checked tasks) βœ… AUTO-FIX SUCCESS: {{checked_tasks}}/{{total_tasks}} tasks now checked Continue with story completion ❌ AUTO-FIX FAILED: Cannot reconcile story {{story_key}} After auto-fix attempts: - Checked tasks: {{checked_tasks}}/{{total_tasks}} - Dev Agent Record: {{dev_agent_record_status}} **Agent produced code but story file cannot be updated.** Marking story as "in-progress" (not done) and continuing with warnings. Override story status to "in-progress" Add to reconciliation_warnings with detailed diagnostic Continue (do NOT kill workers) βœ… COMPLETED: {{story_key}} (reconciled and verified) Tasks: {{checked_tasks}}/{{total_tasks}} ({{task_completion_pct}}%) Increment completed counter Add to completed_wave_stories ⚠️ WARNING: {{story_key}} - Low completion ({{task_completion_pct}}%) Add to reconciliation_warnings: {story_key: {{story_key}}, warning_message: "Only {{task_completion_pct}}% tasks checked - manual verification needed"} Remove worker_id from active_workers (free the slot) IMMEDIATELY refill slot if stories remain in this wave: story_key = wave_queue[next_story_index].story_key complexity_level = wave_queue[next_story_index].complexity_level story_file_path = wave_queue[next_story_index].story_file_path πŸ”„ Worker {{worker_id}} refilled: {{story_key}} Spawn new Task agent for this worker_id (same parameters as init) Update active_workers[worker_id] with new task_id and story_key Increment next_story_index Get worker details: story_key = active_workers[worker_id].story_key ❌ Worker {{worker_id}} failed: {{story_key}} Increment failed counter Add story_key to failed_stories list Add to failed_wave_stories Remove worker_id from active_workers (free the slot) ⚠️ Stopping wave and batch due to failure (continue_on_failure=false) Kill all active workers Clear active_workers Set abort_batch = true Break worker pool loop story_key = wave_queue[next_story_index].story_key complexity_level = wave_queue[next_story_index].complexity_level story_file_path = wave_queue[next_story_index].story_file_path πŸ”„ Worker {{worker_id}} refilled: {{story_key}} (despite previous failure) Spawn new Task agent for this worker_id Update active_workers[worker_id] with new task_id and story_key Increment next_story_index Break worker pool loop Display live progress every 30 seconds: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“Š Live Progress (Wave {{@index}} - {{timestamp}}) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ βœ… Completed: {{completed}} ❌ Failed: {{failed}} πŸ”„ Active workers: {{active_workers.size}} πŸ“‹ Queued in wave: {{wave_queue.length - next_story_index}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Sleep 5 seconds before next poll (prevents tight loop) β›” Aborting remaining waves due to failure and continue_on_failure=false Jump to Step 5 (Summary) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ βœ… WAVE {{@index}} COMPLETE Stories completed: {{completed_wave_stories.length}} Stories failed: {{failed_wave_stories.length}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ After all waves processed, jump to Step 5 (Summary) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸš€ SEQUENTIAL BATCH PROCESSING STARTED ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Stories:** {{count}} **Mode:** Task agents (sequential, one at a time) **Continue on failure:** {{continue_on_failure}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ For each story in selected_stories: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“¦ Story {{current_index}}/{{total_count}}: {{story_key}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Complexity: {{complexity_level}} Pipeline: {{#if complexity_level == 'micro'}}Lightweight (skip tests, skip review){{else if complexity_level == 'standard'}}Full quality gates{{else}}Enhanced validation{{/if}} Spawning Task agent... Use Task tool to spawn agent: - subagent_type: "general-purpose" - description: "Implement story {{story_key}}" - prompt: "Execute super-dev-pipeline workflow for story {{story_key}}. Story file: docs/sprint-artifacts/{{story_key}}.md Complexity: {{complexity_level}} Mode: batch Load workflow: /Users/jonahschulte/git/BMAD-METHOD/src/modules/bmm/workflows/4-implementation/super-dev-pipeline Follow the multi-agent pipeline (builder, inspector, reviewer, fixer). Commit when complete, update story status, report results." - Store agent_id WAIT for agent to complete (blocking call) βœ… Implementation complete: {{story_key}} 🚨 STORY RECONCILIATION - ORCHESTRATOR DOES THIS NOW (NOT AGENTS) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ”§ RECONCILING STORY FILE: {{story_key}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Main orchestrator performing reconciliation (not delegating) YOU (orchestrator) must use Bash tool NOW with this command: STORY_FILE="docs/sprint-artifacts/{{story_key}}.md" echo "Verifying story file: $STORY_FILE" CHECKED_COUNT=$(grep -c "^- \[x\]" "$STORY_FILE" 2>/dev/null || echo "0") TOTAL_COUNT=$(grep -c "^- \[.\]" "$STORY_FILE" 2>/dev/null || echo "0") echo "Checked tasks: $CHECKED_COUNT/$TOTAL_COUNT" RECORD_FILLED=$(grep -A 20 "^### Dev Agent Record" "$STORY_FILE" 2>/dev/null | grep -c "Claude Sonnet" || echo "0") echo "Dev Agent Record: $RECORD_FILLED" echo "checked_count=$CHECKED_COUNT" echo "record_filled=$RECORD_FILLED" After running Bash tool, read the output and extract checked_count and record_filled values ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ❌ STORY FILE VERIFICATION FAILED ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Story: {{story_key}} Checked tasks: {{checked_count}}/{{total_count}} Dev Agent Record: {{#if record_filled > 0}}FILLED{{else}}EMPTY{{/if}} 🚨 The agent DID NOT update the story file. YOU (the main orchestrator) must fix this NOW. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ MANDATORY AUTO-FIX - MAIN ORCHESTRATOR MUST EXECUTE THIS AUTO-FIX PROCEDURE (YOU MUST DO THIS): # Step 1: Get commit for this story COMMIT_SHA=$(git log -1 --grep="{{story_key}}" --pretty=format:"%H" 2>/dev/null) if [ -z "$COMMIT_SHA" ]; then # Try finding by story key pattern COMMIT_SHA=$(git log -5 --pretty=format:"%H %s" | grep -i "{{story_key}}" | head -1 | cut -d' ' -f1) fi echo "Found commit: $COMMIT_SHA" # Step 2: Get files changed git diff ${COMMIT_SHA}~1 $COMMIT_SHA --name-only | grep -v "test/" | grep -v "__tests__" Step 3: Read story file to get Tasks section: docs/sprint-artifacts/{{story_key}}.md Step 4: For EACH task in Tasks section: For each line starting with "- [ ]": - Extract task description - Check if git diff contains related file/function - If YES: Use Edit tool to change "- [ ]" to "- [x]" - Verify edit: Run bash grep to confirm checkbox is now checked Step 5: Fill Dev Agent Record using Edit tool: - Find "### Dev Agent Record" section - Replace with actual data: * Agent Model: Claude Sonnet 4.5 (multi-agent pipeline) * Date: {{current_date}} * Files: {{files_from_git_diff}} * Notes: {{from_commit_message}} Step 6: Re-run verification bash commands: CHECKED_COUNT=$(grep -c "^- \[x\]" "$STORY_FILE") RECORD_FILLED=$(grep -A 20 "^### Dev Agent Record" "$STORY_FILE" | grep -c "Claude Sonnet") echo "After auto-fix:" echo " Checked tasks: $CHECKED_COUNT" echo " Dev Agent Record: $RECORD_FILLED" if [ "$CHECKED_COUNT" -eq 0 ]; then echo "❌ AUTO-FIX FAILED: Story file still not updated" exit 1 fi echo "βœ… AUTO-FIX SUCCESS" βœ… AUTO-FIX SUCCESS: Story file now updated ({{checked_count}} tasks checked) Continue with story as completed ❌ AUTO-FIX FAILED: Cannot reconcile story {{story_key}} After multiple fix attempts, story file still shows: - Checked tasks: {{checked_count}} - Dev Agent Record: {{record_status}} Marking story as "in-progress" (not done). Update sprint-status to "in-progress" instead of "done" Add to failed_stories list Continue to next story (if continue_on_failure) ⚠️ WARNING: Story {{story_key}} - LOW TASK COMPLETION Only {{checked_tasks}}/{{total_tasks}} tasks checked ({{task_completion_pct}}%). This suggests incomplete implementation. Cannot mark as "done". Marking as "in-progress" instead. Override story status to "in-progress" Override sprint-status to "in-progress" Add to reconciliation_warnings βœ… COMPLETED: {{story_key}} (reconciled and verified) Tasks: {{checked_tasks}}/{{total_tasks}} ({{task_completion_pct}}%) Increment completed counter PAUSE FOR USER REVIEW ╔═══════════════════════════════════════════════════════════════════╗ β•‘ INTERACTIVE CHECKPOINT: Story {{story_key}} Complete β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• βœ… Story {{story_key}} successfully implemented and reconciled Quality Summary: - All tests passing - Type checks passing - Linter passing - Code review completed - Sprint status updated Remaining stories: {{remaining}} Options: [C] Continue to next story [R] Review implementation details [P] Pause batch (exit workflow) Your choice [C/R/P]: Read user input βœ… Continuing to next story... πŸ“‹ Implementation Details for {{story_key}} Display story file, test results, review findings Press [C] to continue or [P] to pause: Read user input βœ… Continuing to next story... ⏸️ Batch paused. Run batch-super-dev again to continue with remaining stories. Jump to Step 5 (Summary) ⏸️ Batch paused. Run batch-super-dev again to continue with remaining stories. Jump to Step 5 (Summary) βœ… {{story_key}} complete. Automatically continuing to next story (autonomous mode)... ⚠️ WARNING: {{story_key}} completed but reconciliation failed Increment completed counter (implementation was successful) Add to reconciliation_warnings: {story_key: {{story_key}}, warning_message: "Reconciliation failed - manual verification needed"} Increment reconciliation_warnings_count ❌ FAILED: {{story_key}} Increment failed counter Add story_key to failed_stories list ⚠️ Stopping batch due to failure (continue_on_failure=false) Jump to Step 5 (Summary) **Progress:** {{completed}} completed, {{failed}} failed, {{remaining}} remaining ⏸️ Pausing {{pause_between_stories}} seconds before next story... Wait {{pause_between_stories}} seconds After all stories processed, jump to Step 5 (Summary) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸš€ PARALLEL PROCESSING STARTED (Semaphore Pattern) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Stories:** {{count}} **Mode:** Task agents (autonomous, continuous) **Max concurrent agents:** {{parallel_count}} **Continue on failure:** {{continue_on_failure}} **Pattern:** Worker pool with {{parallel_count}} slots ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“Š **Semaphore Pattern Benefits:** - No idle time between batches - Constant {{parallel_count}} agents running - As soon as slot frees β†’ next story starts immediately - Faster completion (no batch synchronization delays) Initialize worker pool state: - story_queue = selected_stories (all stories to process) - active_workers = {} (map of worker_id β†’ {story_key, task_id, started_at}) - completed_stories = [] - failed_stories = [] - next_story_index = 0 - max_workers = {{parallel_count}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ”§ Initializing {{max_workers}} worker slots... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Spawn first {{max_workers}} agents (or fewer if less stories): While next_story_index < min(max_workers, story_queue.length): story_key = story_queue[next_story_index] worker_id = next_story_index + 1 Spawn Task agent: - subagent_type: "general-purpose" - description: "Implement story {{story_key}}" - prompt: "Execute super-dev-pipeline workflow for story {{story_key}}. Story file: docs/sprint-artifacts/{{story_key}}.md Complexity: {{complexity_level}} Mode: batch Load workflow: /Users/jonahschulte/git/BMAD-METHOD/src/modules/bmm/workflows/4-implementation/super-dev-pipeline Follow the multi-agent pipeline (builder, inspector, reviewer, fixer). Commit when complete, update story status, report results." - run_in_background: true (non-blocking - critical for semaphore pattern) Store in active_workers[worker_id]: story_key: {{story_key}} task_id: {{returned_task_id}} started_at: {{timestamp}} status: "running" Increment next_story_index πŸš€ Worker {{worker_id}} started: {{story_key}} After spawning initial workers: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ βœ… {{active_workers.size}} workers active πŸ“‹ {{story_queue.length - next_story_index}} stories queued ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SEMAPHORE PATTERN: Keep {{max_workers}} agents running continuously While active_workers.size > 0 OR next_story_index < story_queue.length: Poll for completed workers (check task outputs non-blocking): For each worker_id in active_workers: Check if worker task completed using TaskOutput(task_id, block=false) Continue to next worker (don't wait) Get worker details: story_key = active_workers[worker_id].story_key βœ… Worker {{worker_id}} completed: {{story_key}} Execute Step 4.5: Smart Story Reconciliation Load reconciliation instructions: {installed_path}/step-4.5-reconcile-story-status.md Execute reconciliation with story_key={{story_key}} 🚨 MANDATORY STORY FILE VERIFICATION - MAIN ORCHESTRATOR MUST RUN BASH STORY_FILE="docs/sprint-artifacts/{{story_key}}.md" echo "πŸ” Verifying story file: {{story_key}}" CHECKED_COUNT=$(grep -c "^- \[x\]" "$STORY_FILE" 2>/dev/null || echo "0") TOTAL_COUNT=$(grep -c "^- \[.\]" "$STORY_FILE" 2>/dev/null || echo "0") echo " Checked tasks: $CHECKED_COUNT/$TOTAL_COUNT" RECORD_FILLED=$(grep -A 20 "^### Dev Agent Record" "$STORY_FILE" 2>/dev/null | grep -c "Claude Sonnet" || echo "0") echo " Dev Agent Record: $RECORD_FILLED" echo "$CHECKED_COUNT" > /tmp/checked_{{story_key}}.txt echo "$RECORD_FILLED" > /tmp/record_{{story_key}}.txt ❌ Story {{story_key}}: Agent FAILED to update story file Checked tasks: {{checked_tasks}}/{{total_tasks}} Dev Agent Record: {{dev_agent_record_status}} πŸ”§ EXECUTING AUTO-FIX RECONCILIATION... AUTO-FIX PROCEDURE: 1. Read agent's commit to see what files were created/modified 2. Read story Tasks section to see what was supposed to be built 3. For each task, check if corresponding code exists in commit 4. If code exists, check off the task using Edit tool 5. Fill in Dev Agent Record with commit details 6. Verify fixes worked (re-count checked tasks) βœ… AUTO-FIX SUCCESS: {{checked_tasks}}/{{total_tasks}} tasks now checked Continue with story completion ❌ AUTO-FIX FAILED: Cannot reconcile story {{story_key}} After auto-fix attempts: - Checked tasks: {{checked_tasks}}/{{total_tasks}} - Dev Agent Record: {{dev_agent_record_status}} **Agent produced code but story file cannot be updated.** Marking story as "in-progress" (not done) and continuing with warnings. Override story status to "in-progress" Add to reconciliation_warnings with detailed diagnostic Continue (do NOT kill workers) βœ… COMPLETED: {{story_key}} (reconciled and verified) Tasks: {{checked_tasks}}/{{total_tasks}} ({{task_completion_pct}}%) Add to completed_stories ⚠️ WARNING: {{story_key}} - Low completion ({{task_completion_pct}}%) Add to reconciliation_warnings: {story_key: {{story_key}}, warning_message: "Only {{task_completion_pct}}% tasks checked - manual verification needed"} Remove worker_id from active_workers (free the slot) IMMEDIATELY refill slot if stories remain: story_key = story_queue[next_story_index] πŸ”„ Worker {{worker_id}} refilled: {{story_key}} Spawn new Task agent for this worker_id (same parameters as init) Update active_workers[worker_id] with new task_id and story_key Increment next_story_index Get worker details: story_key = active_workers[worker_id].story_key ❌ Worker {{worker_id}} failed: {{story_key}} Add to failed_stories Remove worker_id from active_workers (free the slot) ⚠️ Stopping all workers due to failure (continue_on_failure=false) Kill all active workers Clear story_queue Break worker pool loop story_key = story_queue[next_story_index] πŸ”„ Worker {{worker_id}} refilled: {{story_key}} (despite previous failure) Spawn new Task agent for this worker_id Update active_workers[worker_id] with new task_id and story_key Increment next_story_index Display live progress every 30 seconds: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“Š Live Progress ({{timestamp}}) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ βœ… Completed: {{completed_stories.length}} ❌ Failed: {{failed_stories.length}} πŸ”„ Active workers: {{active_workers.size}} πŸ“‹ Queued: {{story_queue.length - next_story_index}} Active stories: {{#each active_workers}} Worker {{@key}}: {{story_key}} (running {{duration}}) {{/each}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Sleep 5 seconds before next poll (prevents tight loop) After worker pool drains (all stories processed), jump to Step 5 (Summary) Calculate end_time and total_duration Calculate success_rate = (completed / total_count) * 100 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“Š BATCH SUMMARY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Total stories:** {{total_count}} **βœ… Completed:** {{completed}} **❌ Failed:** {{failed}} **⚠️ Reconciliation warnings:** {{reconciliation_warnings_count}} **Success rate:** {{success_rate}}% **Duration:** {{total_duration}} {{#if failed > 0}} **Failed stories:** {{#each failed_stories}} - {{this}} {{/each}} **Retry failed stories:** ```bash {{#each failed_stories}} /bmad:bmm:workflows:super-dev-pipeline mode=batch story_key={{this}} {{/each}} ``` {{/if}} {{#if reconciliation_warnings_count > 0}} **⚠️ Reconciliation warnings (stories completed but status may be inaccurate):** {{#each reconciliation_warnings}} - {{story_key}}: {{warning_message}} {{/each}} **Manual reconciliation needed:** Review these stories to ensure checkboxes and status are accurate. Check Dev Agent Record vs Acceptance Criteria/Tasks/DoD sections. {{/if}} {{#if manual_actions_required.length > 0}} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⚠️ MANUAL ACTIONS REQUIRED ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **{{manual_actions_required.length}} stories require manual intervention:** {{#each manual_actions_required}} {{@index}}. **{{story_key}}** Action: Regenerate story with proper BMAD format Command: `/create-story-with-gap-analysis` {{/each}} **After completing these actions:** 1. Validate all stories: `./scripts/validate-all-stories.sh` 2. Re-run batch-super-dev for these stories ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ {{/if}} **Next steps:** 1. Check sprint-status.yaml - stories should be marked "done" or "review" 2. Run tests: `pnpm test` 3. Check coverage: `pnpm test --coverage` 4. Review commits: `git log -{{completed}}` 5. Spot-check 2-3 stories for quality **Run another batch?** `/bmad:bmm:workflows:batch-super-dev` ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Save batch log to {batch_log} Log contents: start_time, end_time, total_duration, selected_stories, completed_stories, failed_stories, success_rate