From 2ca88a2484d45b1371bc038602fcd37b4b06c372 Mon Sep 17 00:00:00 2001 From: Jonah Schulte Date: Mon, 26 Jan 2026 00:27:49 -0500 Subject: [PATCH] feat: automatic dependency analysis and wave-based execution (from GSD) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **New Features:** - Step 3.1: Automatic dependency analysis (no manual input needed) - Wave-based execution option (respects dependencies) - Smart execution strategy prompt with 3 options: [W] Wave-based parallel (recommended when dependencies exist) [S] Sequential (one by one) [P] Full parallel (all at once, ignore dependencies) **Dependency Analysis:** - Scans story task descriptions for dependencies - Detects: story key mentions, 'depends on', 'requires', file paths - Builds dependency graph automatically - Computes waves via topological sort - Shows time savings for each strategy **Wave Execution (Step 4-Wave):** - Wave 1: Stories with no dependencies (parallel) - Wave 2: Stories depending on Wave 1 (parallel) - Progressive execution with parallelism within waves - Follows GSD execute-phase pattern **Epic 18 Example:** - Wave 1: [18-1, 18-2] in parallel (foundation) - Wave 2: [18-3, 18-5] in parallel (after Wave 1) - Wave 3: [18-4] (after 18-3) - Time: 5h sequential → 2h wave-based (60% faster) This is GSDMAD in action - best of both worlds! --- .../batch-super-dev/instructions.md | 202 +++++++++++++++++- 1 file changed, 192 insertions(+), 10 deletions(-) diff --git a/src/modules/bmm/workflows/4-implementation/batch-super-dev/instructions.md b/src/modules/bmm/workflows/4-implementation/batch-super-dev/instructions.md index a57add07..98d417e9 100644 --- a/src/modules/bmm/workflows/4-implementation/batch-super-dev/instructions.md +++ b/src/modules/bmm/workflows/4-implementation/batch-super-dev/instructions.md @@ -820,26 +820,130 @@ QUALITY OVER SPEED: Taking time to ensure correctness. 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?** +**Choose execution strategy:** -Options: -- **sequential**: Run stories one-by-one in this session (slower, easier to monitor) -- **parallel**: Spawn Task agents to process stories concurrently (faster, autonomous) +{{#if waves.length > 1}} +[W] WAVE-BASED PARALLEL (Recommended) + - Respects dependencies between stories + - Runs independent stories in parallel within each wave + - Wave 1: {{wave_1_stories}} → Wave 2: {{wave_2_stories}} → ... + - Estimated time: {{wave_time}} ({{savings}}% faster than sequential) + - Safer than full parallel (honors dependencies) +{{/if}} -Enter: sequential or parallel +[S] SEQUENTIAL + - Process stories one-by-one in this session + - Easier to monitor and debug + - Estimated time: {{sequential_time}} + - Best for: When you want full control + +{{#if waves.length == 1}} +[P] FULL PARALLEL (All {{count}} stories) + - All stories independent, no dependencies + - Spawn {{count}} agents concurrently + - Estimated time: {{parallel_time}} ({{savings}}% faster) +{{else}} +[P] FULL PARALLEL (Ignore dependencies - RISKY) + - Spawn all {{count}} agents concurrently + - ⚠️ May fail if stories depend on each other + - Use only if you're certain dependencies are wrong +{{/if}} + +Enter: {{#if waves.length > 1}}w{{/if}}/s/p - Capture response as: execution_mode + Capture response as: execution_strategy - + + Set execution_mode = "wave_based" + Set use_task_agents = true + Set wave_execution = true + +✅ Wave-Based Parallel Execution Selected + +Execution plan: +{{#each waves}} +Wave {{@index}}: {{count}} stories{{#if @index > 0}} (after Wave {{@index - 1}} completes){{/if}} +{{#each stories}} + - {{story_key}} +{{/each}} +{{/each}} + +Estimated time: {{wave_time}} ({{savings}}% faster than sequential) + + + + + Set execution_mode = "sequential" Set parallel_count = 1 Set use_task_agents = false + Set wave_execution = false ✅ Sequential mode selected - stories will be processed one-by-one in this session - + + Set execution_mode = "full_parallel" Set use_task_agents = true + Set wave_execution = false **How many agents should run in parallel?** @@ -895,8 +999,12 @@ Enter number (2-10) or 'all': Initialize counters: completed=0, failed=0, failed_stories=[], reconciliation_warnings=[], reconciliation_warnings_count=0 Set start_time = current timestamp - - Jump to Step 4-Parallel (Task Agent execution) + + Jump to Step 4-Wave (Wave-based execution) + + + + Jump to Step 4-Parallel (Full parallel execution) @@ -904,6 +1012,80 @@ Enter number (2-10) or 'all': + + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +🚀 WAVE-BASED PARALLEL PROCESSING STARTED +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +**Stories:** {{count}} +**Mode:** Wave-based (respects dependencies) +**Waves:** {{waves.length}} +**Continue on failure:** {{continue_on_failure}} +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + + For each wave in sequence: + + + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +📦 Wave {{wave_num}}/{{waves.length}} ({{stories_in_wave}} stories) +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +{{#each stories_in_wave}} + - {{story_key}} +{{/each}} + +Spawning {{stories_in_wave.length}} parallel agents... + + + Spawn Task agents in PARALLEL (send all in single message): + + For each story in this wave: + + + Task tool: + - subagent_type: "general-purpose" + - description: "Implement story {{story_key}}" + - prompt: "Execute super-dev-pipeline for story {{story_key}}. + + Story file: docs/sprint-artifacts/{{story_key}}.md + Complexity: {{complexity_level}} + Mode: batch, wave {{wave_num}} + + Follow all 11 steps, commit when complete, report status." + - Store agent_id + + + Wait for ALL agents in this wave to complete + + For each completed agent in wave: + + + ✅ Wave {{wave_num}} - Story complete: {{story_key}} + Increment completed counter + Execute Step 4.5: Reconciliation + + + + ❌ Wave {{wave_num}} - Story failed: {{story_key}} + Increment failed counter + Add to failed_stories list + + + ⚠️ Stopping all waves due to failure + Jump to Step 5 (Summary) + + + + +Wave {{wave_num}} complete: {{completed_in_wave}} succeeded, {{failed_in_wave}} failed + + + + After all waves processed, jump to Step 5 (Summary) + + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━