bmad-method 4.23.0 → 4.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/bmad-core/agents/bmad-master.md +14 -1
  4. package/bmad-core/agents/bmad-orchestrator.md +14 -0
  5. package/bmad-core/core-config.yml +5 -0
  6. package/bmad-core/tasks/create-brownfield-story.md +355 -0
  7. package/bmad-core/tasks/create-next-story.md +25 -0
  8. package/bmad-core/tasks/create-workflow-plan.md +289 -0
  9. package/bmad-core/tasks/update-workflow-plan.md +248 -0
  10. package/bmad-core/templates/brownfield-prd-tmpl.md +52 -28
  11. package/bmad-core/utils/plan-management.md +223 -0
  12. package/bmad-core/workflows/brownfield-fullstack.yml +240 -55
  13. package/bmad-core/workflows/brownfield-service.yml +110 -36
  14. package/bmad-core/workflows/brownfield-ui.yml +110 -36
  15. package/bmad-core/workflows/greenfield-fullstack.yml +110 -36
  16. package/bmad-core/workflows/greenfield-service.yml +110 -36
  17. package/bmad-core/workflows/greenfield-ui.yml +110 -36
  18. package/common/tasks/create-doc.md +21 -1
  19. package/dist/agents/analyst.txt +23 -1
  20. package/dist/agents/architect.txt +21 -1
  21. package/dist/agents/bmad-master.txt +883 -30
  22. package/dist/agents/bmad-orchestrator.txt +806 -1
  23. package/dist/agents/pm.txt +73 -29
  24. package/dist/agents/sm.txt +25 -0
  25. package/dist/agents/ux-expert.txt +21 -1
  26. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.txt +21 -1
  27. package/dist/expansion-packs/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +804 -1
  28. package/dist/expansion-packs/bmad-infrastructure-devops/agents/infra-devops-platform.txt +21 -1
  29. package/dist/teams/team-all.txt +1675 -266
  30. package/dist/teams/team-fullstack.txt +1650 -266
  31. package/dist/teams/team-ide-minimal.txt +831 -1
  32. package/dist/teams/team-no-ui.txt +1079 -102
  33. package/package.json +1 -1
  34. package/tools/installer/lib/installer.js +2 -12
  35. package/tools/installer/package.json +1 -1
  36. package/tools/lib/dependency-resolver.js +2 -2
@@ -149,6 +149,9 @@ startup:
149
149
  - Announce: Introduce yourself as the BMAD Orchestrator, explain you can coordinate agents and workflows
150
150
  - IMPORTANT: Tell users that all commands start with * (e.g., *help, *agent, *workflow)
151
151
  - Mention *help shows all available commands and options
152
+ - Check for active workflow plan using utils#plan-management
153
+ - 'If plan exists: Show 📋 Active plan: {workflow} ({progress}% complete). Use *plan-status for details.'
154
+ - 'If plan exists: Suggest next action based on plan progress'
152
155
  - Assess user goal against available agents and workflows in this bundle
153
156
  - If clear match to an agent's expertise, suggest transformation with *agent command
154
157
  - If project-oriented, suggest *workflow-guidance to explore options
@@ -163,6 +166,9 @@ commands:
163
166
  task: Run a specific task (list if name not specified)
164
167
  workflow: Start a specific workflow (list if name not specified)
165
168
  workflow-guidance: Get personalized help selecting the right workflow
169
+ plan: Create detailed workflow plan before starting
170
+ plan-status: Show current workflow plan progress
171
+ plan-update: Update workflow plan status
166
172
  checklist: Execute a checklist (list if name not specified)
167
173
  yolo: Toggle skip confirmations mode
168
174
  party-mode: Group chat with all agents
@@ -186,6 +192,9 @@ help-display-template: |
186
192
  Workflow Commands:
187
193
  *workflow [name] .... Start specific workflow (list if no name)
188
194
  *workflow-guidance .. Get personalized help selecting the right workflow
195
+ *plan ............... Create detailed workflow plan before starting
196
+ *plan-status ........ Show current workflow plan progress
197
+ *plan-update ........ Update workflow plan status
189
198
 
190
199
  Other Commands:
191
200
  *yolo ............... Toggle skip confirmations mode
@@ -226,6 +235,8 @@ workflow-guidance:
226
235
  - Understand each workflow's purpose, options, and decision points
227
236
  - Ask clarifying questions based on the workflow's structure
228
237
  - Guide users through workflow selection when multiple options exist
238
+ - For complex projects, offer to create a workflow plan using create-workflow-plan task
239
+ - When appropriate, suggest: Would you like me to create a detailed workflow plan before starting?
229
240
  - For workflows with divergent paths, help users choose the right path
230
241
  - Adapt questions to the specific domain (e.g., game dev vs infrastructure vs web dev)
231
242
  - Only recommend workflows that actually exist in the current bundle
@@ -234,10 +245,13 @@ dependencies:
234
245
  tasks:
235
246
  - advanced-elicitation
236
247
  - create-doc
248
+ - create-workflow-plan
237
249
  - kb-mode-interaction
250
+ - update-workflow-plan
238
251
  data:
239
252
  - bmad-kb
240
253
  utils:
254
+ - plan-management
241
255
  - workflow-management
242
256
  - template-format
243
257
  ```
@@ -988,11 +1002,22 @@ Generate documents from templates by EXECUTING (not just reading) embedded instr
988
1002
 
989
1003
  ## Execution Flow
990
1004
 
1005
+ ### 0. Check Workflow Plan (if configured)
1006
+
1007
+ [[LLM: Check if plan tracking is enabled in core-config.yml]]
1008
+
1009
+ - If `workflow.trackProgress: true`, check for active plan using utils#plan-management
1010
+ - If plan exists and this document creation is part of the plan:
1011
+ - Verify this is the expected next step
1012
+ - If out of sequence and `enforceSequence: true`, warn user and halt without user override
1013
+ - If out of sequence and `enforceSequence: false`, ask for confirmation
1014
+ - Continue with normal execution after plan check
1015
+
991
1016
  ### 1. Identify Template
992
1017
 
993
1018
  - Load from `templates#*` or `{root}/templates directory`
994
1019
  - Agent-specific templates are listed in agent's dependencies
995
- - If agent has `templates: [prd-tmpl, architecture-tmpl]`, offer to create "PRD" and "Architecture" documents
1020
+ - If agent has `templates: [prd-tmpl, architecture-tmpl]` for example, then offer to create "PRD" and "Architecture" documents
996
1021
 
997
1022
  ### 2. Ask Interaction Mode
998
1023
 
@@ -1029,6 +1054,15 @@ Generate documents from templates by EXECUTING (not just reading) embedded instr
1029
1054
  - Begin directly with content (no preamble)
1030
1055
  - Include any handoff prompts from template
1031
1056
 
1057
+ ### 6. Update Workflow Plan (if applicable)
1058
+
1059
+ [[LLM: After successful document creation]]
1060
+
1061
+ - If plan tracking is enabled and document was part of plan:
1062
+ - Call update-workflow-plan task to mark step complete
1063
+ - Parameters: task: create-doc, step_id: {from plan}, status: complete
1064
+ - Show next recommended step from plan
1065
+
1032
1066
  ## Common Mistakes to Avoid
1033
1067
 
1034
1068
  ❌ Skipping elicitation tasks
@@ -2559,6 +2593,298 @@ Templates in the BMAD method use standardized markup for AI processing. These co
2559
2593
  - All template-specific instructions are embedded within templates
2560
2594
  ==================== END: utils#template-format ====================
2561
2595
 
2596
+ ==================== START: tasks#create-workflow-plan ====================
2597
+ # Create Workflow Plan Task
2598
+
2599
+ ## Purpose
2600
+
2601
+ Guide users through workflow selection and create a detailed plan document that outlines the selected workflow steps, decision points, and expected outputs. This task helps users understand what will happen before starting a complex workflow and provides a checklist to track progress.
2602
+
2603
+ ## Task Instructions
2604
+
2605
+ ### 1. Understand User's Goal
2606
+
2607
+ [[LLM: Start with discovery questions to understand what the user wants to accomplish]]
2608
+
2609
+ Ask the user:
2610
+
2611
+ 1. **Project Type**:
2612
+ - Are you starting a new project (greenfield) or enhancing an existing one (brownfield)?
2613
+ - What type of application? (web app, service/API, UI only, full-stack)
2614
+
2615
+ 2. **For Greenfield**:
2616
+ - Do you need a quick prototype or production-ready application?
2617
+ - Will this have a UI component?
2618
+ - Single service or multiple services?
2619
+
2620
+ 3. **For Brownfield**:
2621
+ - What's the scope of the enhancement?
2622
+ - Single bug fix or small feature (few hours)
2623
+ - Small enhancement (1-3 stories)
2624
+ - Major feature requiring coordination
2625
+ - Architectural changes or modernization
2626
+ - Do you have existing documentation?
2627
+ - Are you following existing patterns or introducing new ones?
2628
+
2629
+ ### 2. Recommend Appropriate Workflow
2630
+
2631
+ Based on the answers, recommend:
2632
+
2633
+ **Greenfield Options:**
2634
+
2635
+ - `greenfield-fullstack` - Complete web application
2636
+ - `greenfield-service` - Backend API/service only
2637
+ - `greenfield-ui` - Frontend only
2638
+
2639
+ **Brownfield Options:**
2640
+
2641
+ - `brownfield-create-story` - Single small change
2642
+ - `brownfield-create-epic` - Small feature (1-3 stories)
2643
+ - `brownfield-fullstack` - Major enhancement
2644
+
2645
+ **Simplified Option:**
2646
+
2647
+ - For users unsure or wanting flexibility, suggest starting with individual agent tasks
2648
+
2649
+ ### 3. Explain Selected Workflow
2650
+
2651
+ [[LLM: Once workflow is selected, provide clear explanation]]
2652
+
2653
+ For the selected workflow, explain:
2654
+
2655
+ 1. **Overview**: What this workflow accomplishes
2656
+ 2. **Duration**: Estimated time for planning phase
2657
+ 3. **Outputs**: What documents will be created
2658
+ 4. **Decision Points**: Where user input will be needed
2659
+ 5. **Requirements**: What information should be ready
2660
+
2661
+ ### 4. Create Workflow Plan Document
2662
+
2663
+ [[LLM: Generate a comprehensive plan document with the following structure]]
2664
+
2665
+ ```markdown
2666
+ # Workflow Plan: {{Workflow Name}}
2667
+
2668
+ <!-- WORKFLOW-PLAN-META
2669
+ workflow-id: {{workflow-id}}
2670
+ status: active
2671
+ created: {{ISO-8601 timestamp}}
2672
+ updated: {{ISO-8601 timestamp}}
2673
+ version: 1.0
2674
+ -->
2675
+
2676
+ **Created Date**: {{current date}}
2677
+ **Project**: {{project name}}
2678
+ **Type**: {{greenfield/brownfield}}
2679
+ **Status**: Active
2680
+ **Estimated Planning Duration**: {{time estimate}}
2681
+
2682
+ ## Objective
2683
+
2684
+ {{Clear description of what will be accomplished}}
2685
+
2686
+ ## Selected Workflow
2687
+
2688
+ **Workflow**: `{{workflow-id}}`
2689
+ **Reason**: {{Why this workflow fits the user's needs}}
2690
+
2691
+ ## Workflow Steps
2692
+
2693
+ ### Planning Phase
2694
+
2695
+ - [ ] Step 1: {{step name}} <!-- step-id: 1.1, agent: {{agent}}, task: {{task}} -->
2696
+ - **Agent**: {{agent name}}
2697
+ - **Action**: {{what happens}}
2698
+ - **Output**: {{what's created}}
2699
+ - **User Input**: {{if any}}
2700
+
2701
+ - [ ] Step 2: {{step name}} <!-- step-id: 1.2, agent: {{agent}}, task: {{task}} -->
2702
+ - **Agent**: {{agent name}}
2703
+ - **Action**: {{what happens}}
2704
+ - **Output**: {{what's created}}
2705
+ - **Decision Point**: {{if any}} <!-- decision-id: D1 -->
2706
+
2707
+ {{Continue for all planning steps}}
2708
+
2709
+ ### Development Phase (IDE)
2710
+
2711
+ - [ ] Document Sharding <!-- step-id: 2.1, agent: po, task: shard-doc -->
2712
+ - Prepare documents for story creation
2713
+
2714
+ - [ ] Story Development Cycle <!-- step-id: 2.2, repeats: true -->
2715
+ - [ ] Create story (SM agent) <!-- step-id: 2.2.1, agent: sm, task: create-next-story -->
2716
+ - [ ] Review story (optional) <!-- step-id: 2.2.2, agent: analyst, optional: true -->
2717
+ - [ ] Implement story (Dev agent) <!-- step-id: 2.2.3, agent: dev -->
2718
+ - [ ] QA review (optional) <!-- step-id: 2.2.4, agent: qa, optional: true -->
2719
+ - [ ] Repeat for all stories
2720
+
2721
+ - [ ] Epic Retrospective (optional) <!-- step-id: 2.3, agent: po, optional: true -->
2722
+
2723
+ ## Key Decision Points
2724
+
2725
+ 1. **{{Decision Name}}** (Step {{n}}): <!-- decision-id: D1, status: pending -->
2726
+ - Trigger: {{what causes this decision}}
2727
+ - Options: {{available choices}}
2728
+ - Impact: {{how it affects the workflow}}
2729
+ - Decision Made: _Pending_
2730
+
2731
+ {{List all decision points}}
2732
+
2733
+ ## Expected Outputs
2734
+
2735
+ ### Planning Documents
2736
+ - [ ] {{document 1}} - {{description}}
2737
+ - [ ] {{document 2}} - {{description}}
2738
+ {{etc...}}
2739
+
2740
+ ### Development Artifacts
2741
+ - [ ] Stories in `docs/stories/`
2742
+ - [ ] Implementation code
2743
+ - [ ] Tests
2744
+ - [ ] Updated documentation
2745
+
2746
+ ## Prerequisites Checklist
2747
+
2748
+ Before starting this workflow, ensure you have:
2749
+
2750
+ - [ ] {{prerequisite 1}}
2751
+ - [ ] {{prerequisite 2}}
2752
+ - [ ] {{prerequisite 3}}
2753
+ {{etc...}}
2754
+
2755
+ ## Customization Options
2756
+
2757
+ Based on your project needs, you may:
2758
+ - Skip {{optional step}} if {{condition}}
2759
+ - Add {{additional step}} if {{condition}}
2760
+ - Choose {{alternative}} instead of {{default}}
2761
+
2762
+ ## Risk Considerations
2763
+
2764
+ {{For brownfield only}}
2765
+ - Integration complexity: {{assessment}}
2766
+ - Rollback strategy: {{approach}}
2767
+ - Testing requirements: {{special needs}}
2768
+
2769
+ ## Next Steps
2770
+
2771
+ 1. Review this plan and confirm it matches your expectations
2772
+ 2. Gather any missing prerequisites
2773
+ 3. Start workflow with: `*task workflow {{workflow-id}}`
2774
+ 4. Or begin with first agent: `@{{first-agent}}`
2775
+
2776
+ ## Notes
2777
+
2778
+ {{Any additional context or warnings}}
2779
+
2780
+ ---
2781
+ *This plan can be updated as you progress through the workflow. Check off completed items to track progress.*
2782
+ ```
2783
+
2784
+ ### 5. Save and Present Plan
2785
+
2786
+ 1. Save the plan as `docs/workflow-plan.md`
2787
+ 2. Inform user: "Workflow plan created at docs/workflow-plan.md"
2788
+ 3. Offer options:
2789
+ - Review the plan together
2790
+ - Start the workflow now
2791
+ - Gather prerequisites first
2792
+ - Modify the plan
2793
+
2794
+ ### 6. Plan Variations
2795
+
2796
+ [[LLM: Adjust plan detail based on workflow complexity]]
2797
+
2798
+ **For Simple Workflows** (create-story, create-epic):
2799
+
2800
+ - Simpler checklist format
2801
+ - Focus on immediate next steps
2802
+ - Less detailed explanations
2803
+
2804
+ **For Complex Workflows** (full greenfield/brownfield):
2805
+
2806
+ - Detailed step breakdowns
2807
+ - All decision points documented
2808
+ - Comprehensive output descriptions
2809
+ - Risk mitigation sections
2810
+
2811
+ **For Brownfield Workflows**:
2812
+
2813
+ - Include existing system impact analysis
2814
+ - Document integration checkpoints
2815
+ - Add rollback considerations
2816
+ - Note documentation dependencies
2817
+
2818
+ ### 7. Interactive Planning Mode
2819
+
2820
+ [[LLM: If user wants to customize the workflow]]
2821
+
2822
+ If user wants to modify the standard workflow:
2823
+
2824
+ 1. Present workflow steps as options
2825
+ 2. Allow skipping optional steps
2826
+ 3. Let user reorder certain steps
2827
+ 4. Document customizations in plan
2828
+ 5. Warn about dependencies if steps are skipped
2829
+
2830
+ ### 8. Execution Guidance
2831
+
2832
+ After plan is created, provide clear guidance:
2833
+
2834
+ ```text
2835
+ Your workflow plan is ready! Here's how to proceed:
2836
+
2837
+ 1. **Review the plan**: Check that all steps align with your goals
2838
+ 2. **Gather prerequisites**: Use the checklist to ensure you're ready
2839
+ 3. **Start execution**:
2840
+ - Full workflow: `*task workflow {{workflow-id}}`
2841
+ - Step by step: Start with `@{{first-agent}}`
2842
+ 4. **Track progress**: Check off steps in the plan as completed
2843
+
2844
+ Would you like to:
2845
+ a) Review the plan together
2846
+ b) Start the workflow now
2847
+ c) Gather prerequisites first
2848
+ d) Modify the plan
2849
+ ```
2850
+
2851
+ ## Success Criteria
2852
+
2853
+ The workflow plan is successful when:
2854
+
2855
+ 1. User clearly understands what will happen
2856
+ 2. All decision points are documented
2857
+ 3. Prerequisites are identified
2858
+ 4. Expected outputs are clear
2859
+ 5. User feels confident to proceed
2860
+ 6. Plan serves as useful progress tracker
2861
+
2862
+ ## Integration with BMad Master and Orchestrator
2863
+
2864
+ When used by BMad Master or BMad Orchestrator, this task should:
2865
+
2866
+ 1. Be offered when user asks about workflows
2867
+ 2. Be suggested before starting complex workflows
2868
+ 3. Create a plan that the agent can reference during execution
2869
+ 4. Allow the agent to track progress against the plan
2870
+
2871
+ ## Example Usage
2872
+
2873
+ ```text
2874
+ User: "I need to add a payment system to my existing app"
2875
+
2876
+ BMad Orchestrator: "Let me help you create a workflow plan for that enhancement. I'll ask a few questions to recommend the best approach..."
2877
+
2878
+ [Runs through discovery questions]
2879
+
2880
+ BMad Orchestrator: "Based on your answers, I recommend the brownfield-fullstack workflow. Let me create a detailed plan for you..."
2881
+
2882
+ [Creates and saves plan]
2883
+
2884
+ BMad Orchestrator: "I've created a workflow plan at docs/workflow-plan.md. This shows all the steps we'll go through, what documents will be created, and where you'll need to make decisions. Would you like to review it together?"
2885
+ ```
2886
+ ==================== END: tasks#create-workflow-plan ====================
2887
+
2562
2888
  ==================== START: tasks#kb-mode-interaction ====================
2563
2889
  # KB Mode Interaction Task
2564
2890
 
@@ -2632,6 +2958,483 @@ Or ask me about anything else related to BMAD-METHOD!
2632
2958
  **Assistant**: [Provides focused information about workflows from the KB, then offers to explore specific workflow types or related topics]
2633
2959
  ==================== END: tasks#kb-mode-interaction ====================
2634
2960
 
2961
+ ==================== START: tasks#update-workflow-plan ====================
2962
+ # Update Workflow Plan Task
2963
+
2964
+ ## Purpose
2965
+
2966
+ Update the status of steps in an active workflow plan, mark completions, add notes about deviations, and maintain an accurate record of workflow progress. This task can be called directly by users or automatically by other tasks upon completion.
2967
+
2968
+ ## Task Instructions
2969
+
2970
+ ### 0. Load Plan Configuration
2971
+
2972
+ [[LLM: First load core-config.yml to get plan settings]]
2973
+
2974
+ Check workflow configuration:
2975
+
2976
+ - `workflow.planFile` - Location of the plan (default: docs/workflow-plan.md)
2977
+ - `workflow.trackProgress` - Whether tracking is enabled
2978
+ - `workflow.updateOnCompletion` - Whether to auto-update on task completion
2979
+
2980
+ If tracking is disabled, inform user and exit.
2981
+
2982
+ ### 1. Verify Plan Exists
2983
+
2984
+ [[LLM: Check if workflow plan exists at configured location]]
2985
+
2986
+ If no plan exists:
2987
+
2988
+ ```
2989
+ No active workflow plan found at {location}.
2990
+ Would you like to create one? Use *plan command.
2991
+ ```
2992
+
2993
+ ### 2. Determine Update Type
2994
+
2995
+ [[LLM: Ask user what type of update they want to make]]
2996
+
2997
+ Present options:
2998
+
2999
+ ```
3000
+ What would you like to update in the workflow plan?
3001
+
3002
+ 1. Mark step as complete
3003
+ 2. Update current step
3004
+ 3. Add deviation note
3005
+ 4. Mark decision point resolution
3006
+ 5. Update overall status
3007
+ 6. View current plan status only
3008
+
3009
+ Please select an option (1-6):
3010
+ ```
3011
+
3012
+ ### 3. Parse Current Plan
3013
+
3014
+ [[LLM: Read and parse the plan to understand current state]]
3015
+
3016
+ Extract:
3017
+
3018
+ - All steps with their checkbox status
3019
+ - Step IDs from comments (if present)
3020
+ - Current completion percentage
3021
+ - Any existing deviation notes
3022
+ - Decision points and their status
3023
+
3024
+ ### 4. Execute Updates
3025
+
3026
+ #### 4.1 Mark Step Complete
3027
+
3028
+ If user selected option 1:
3029
+
3030
+ 1. Show numbered list of incomplete steps
3031
+ 2. Ask which step to mark complete
3032
+ 3. Update the checkbox from `[ ]` to `[x]`
3033
+ 4. Add completion timestamp: `<!-- completed: YYYY-MM-DD HH:MM -->`
3034
+ 5. If this was the current step, identify next step
3035
+
3036
+ #### 4.2 Update Current Step
3037
+
3038
+ If user selected option 2:
3039
+
3040
+ 1. Show all steps with current status
3041
+ 2. Ask which step is now current
3042
+ 3. Add/move `<!-- current-step -->` marker
3043
+ 4. Optionally add note about why sequence changed
3044
+
3045
+ #### 4.3 Add Deviation Note
3046
+
3047
+ If user selected option 3:
3048
+
3049
+ 1. Ask for deviation description
3050
+ 2. Ask which step this relates to (or general)
3051
+ 3. Insert note in appropriate location:
3052
+
3053
+ ```markdown
3054
+ > **Deviation Note** (YYYY-MM-DD): {user_note}
3055
+ > Related to: Step X.Y or General workflow
3056
+ ```
3057
+
3058
+ #### 4.4 Mark Decision Resolution
3059
+
3060
+ If user selected option 4:
3061
+
3062
+ 1. Show pending decision points
3063
+ 2. Ask which decision was made
3064
+ 3. Record the decision and chosen path
3065
+ 4. Update related steps based on decision
3066
+
3067
+ #### 4.5 Update Overall Status
3068
+
3069
+ If user selected option 5:
3070
+
3071
+ 1. Show current overall status
3072
+ 2. Provide options:
3073
+ - Active (continuing with plan)
3074
+ - Paused (temporarily stopped)
3075
+ - Abandoned (no longer following)
3076
+ - Complete (all steps done)
3077
+ 3. Update plan header with new status
3078
+
3079
+ ### 5. Automatic Updates (When Called by Tasks)
3080
+
3081
+ [[LLM: When called automatically by another task]]
3082
+
3083
+ If called with parameters:
3084
+
3085
+ ```
3086
+ task: {task_name}
3087
+ step_id: {step_identifier}
3088
+ status: complete|skipped|failed
3089
+ note: {optional_note}
3090
+ ```
3091
+
3092
+ Automatically:
3093
+
3094
+ 1. Find the corresponding step
3095
+ 2. Update its status
3096
+ 3. Add completion metadata
3097
+ 4. Add note if provided
3098
+ 5. Calculate new progress percentage
3099
+
3100
+ ### 6. Generate Update Summary
3101
+
3102
+ After updates, show summary:
3103
+
3104
+ ```
3105
+ ✅ Workflow Plan Updated
3106
+
3107
+ Changes made:
3108
+ - {change_1}
3109
+ - {change_2}
3110
+
3111
+ New Status:
3112
+ - Progress: {X}% complete ({completed}/{total} steps)
3113
+ - Current Step: {current_step}
3114
+ - Next Recommended: {next_step}
3115
+
3116
+ Plan location: {file_path}
3117
+ ```
3118
+
3119
+ ### 7. Integration with Other Tasks
3120
+
3121
+ [[LLM: How other tasks should call this]]
3122
+
3123
+ Other tasks can integrate by:
3124
+
3125
+ 1. **After Task Completion**:
3126
+
3127
+ ```
3128
+ At end of task execution:
3129
+ - Check if task corresponds to a plan step
3130
+ - If yes, call update-workflow-plan with:
3131
+ - task: {current_task_name}
3132
+ - step_id: {matching_step}
3133
+ - status: complete
3134
+ ```
3135
+
3136
+ 2. **On Task Failure**:
3137
+
3138
+ ```
3139
+ If task fails:
3140
+ - Call update-workflow-plan with:
3141
+ - task: {current_task_name}
3142
+ - status: failed
3143
+ - note: {failure_reason}
3144
+ ```
3145
+
3146
+ ### 8. Plan Status Display
3147
+
3148
+ [[LLM: When user selects view status only]]
3149
+
3150
+ Display comprehensive status:
3151
+
3152
+ ```markdown
3153
+ 📋 Workflow Plan Status
3154
+ ━━━━━━━━━━━━━━━━━━━━
3155
+ Workflow: {workflow_name}
3156
+ Status: {Active|Paused|Complete}
3157
+ Progress: {X}% complete ({completed}/{total} steps)
3158
+ Last Updated: {timestamp}
3159
+
3160
+ ✅ Completed Steps:
3161
+ - [x] Step 1.1: {description} (completed: {date})
3162
+ - [x] Step 1.2: {description} (completed: {date})
3163
+
3164
+ 🔄 Current Step:
3165
+ - [ ] Step 2.1: {description} <!-- current-step -->
3166
+ Agent: {agent_name}
3167
+ Task: {task_name}
3168
+
3169
+ 📌 Upcoming Steps:
3170
+ - [ ] Step 2.2: {description}
3171
+ - [ ] Step 3.1: {description}
3172
+
3173
+ ⚠️ Deviations/Notes:
3174
+ {any_deviation_notes}
3175
+
3176
+ 📊 Decision Points:
3177
+ - Decision 1: {status} - {choice_made}
3178
+ - Decision 2: Pending
3179
+
3180
+ 💡 Next Action:
3181
+ Based on the plan, you should {recommended_action}
3182
+ ```
3183
+
3184
+ ## Success Criteria
3185
+
3186
+ The update is successful when:
3187
+
3188
+ 1. Plan accurately reflects current workflow state
3189
+ 2. All updates are clearly timestamped
3190
+ 3. Deviations are documented with reasons
3191
+ 4. Progress calculation is correct
3192
+ 5. Next steps are clear to user
3193
+ 6. Plan remains readable and well-formatted
3194
+
3195
+ ## Error Handling
3196
+
3197
+ - **Plan file not found**: Offer to create new plan
3198
+ - **Malformed plan**: Attempt basic updates, warn user
3199
+ - **Write permission error**: Show changes that would be made
3200
+ - **Step not found**: Show available steps, ask for clarification
3201
+ - **Concurrent updates**: Implement simple locking or warn about conflicts
3202
+
3203
+ ## Notes
3204
+
3205
+ - Always preserve plan history (don't delete old information)
3206
+ - Keep updates atomic to prevent corruption
3207
+ - Consider creating backup before major updates
3208
+ - Updates should enhance, not complicate, the workflow experience
3209
+ - If plan becomes too cluttered, suggest creating fresh plan for next phase
3210
+ ==================== END: tasks#update-workflow-plan ====================
3211
+
3212
+ ==================== START: utils#plan-management ====================
3213
+ # Plan Management Utility
3214
+
3215
+ ## Purpose
3216
+
3217
+ Provides utilities for agents and tasks to interact with workflow plans, check progress, update status, and ensure workflow steps are executed in the appropriate sequence.
3218
+
3219
+ ## Core Functions
3220
+
3221
+ ### 1. Check Plan Existence
3222
+
3223
+ [[LLM: When any agent starts or task begins, check if a workflow plan exists]]
3224
+
3225
+ ```
3226
+ Check for workflow plan:
3227
+ 1. Look for docs/workflow-plan.md (default location)
3228
+ 2. Check core-config.yml for custom plan location
3229
+ 3. Return plan status (exists/not exists)
3230
+ ```
3231
+
3232
+ ### 2. Parse Plan Status
3233
+
3234
+ [[LLM: Extract current progress from the plan document]]
3235
+
3236
+ **Plan Parsing Logic:**
3237
+
3238
+ 1. **Identify Step Structure**:
3239
+ - Look for checkbox lines: `- [ ]` or `- [x]`
3240
+ - Extract step IDs from comments: `<!-- step-id: X.Y -->`
3241
+ - Identify agent assignments: `<!-- agent: pm -->`
3242
+
3243
+ 2. **Determine Current State**:
3244
+ - Last completed step (highest numbered `[x]`)
3245
+ - Next expected step (first `[ ]` after completed steps)
3246
+ - Overall progress percentage
3247
+
3248
+ 3. **Extract Metadata**:
3249
+ - Workflow type from plan header
3250
+ - Decision points and their status
3251
+ - Any deviation notes
3252
+
3253
+ ### 3. Sequence Validation
3254
+
3255
+ [[LLM: Check if requested action aligns with plan sequence]]
3256
+
3257
+ **Validation Rules:**
3258
+
3259
+ 1. **Strict Mode** (enforceSequence: true):
3260
+ - Must complete steps in exact order
3261
+ - Warn and block if out of sequence
3262
+ - Require explicit override justification
3263
+
3264
+ 2. **Flexible Mode** (enforceSequence: false):
3265
+ - Warn about sequence deviation
3266
+ - Allow with confirmation
3267
+ - Log deviation reason
3268
+
3269
+ **Warning Templates:**
3270
+
3271
+ ```
3272
+ SEQUENCE WARNING:
3273
+ The workflow plan shows you should complete "{expected_step}" next.
3274
+ You're attempting to: "{requested_action}"
3275
+
3276
+ In strict mode: Block and require plan update
3277
+ In flexible mode: Allow with confirmation
3278
+ ```
3279
+
3280
+ ### 4. Plan Update Operations
3281
+
3282
+ [[LLM: Provide consistent way to update plan progress]]
3283
+
3284
+ **Update Actions:**
3285
+
3286
+ 1. **Mark Step Complete**:
3287
+ - Change `- [ ]` to `- [x]`
3288
+ - Add completion timestamp comment
3289
+ - Update any status metadata
3290
+
3291
+ 2. **Add Deviation Note**:
3292
+ - Insert note explaining why sequence changed
3293
+ - Reference the deviation in plan
3294
+
3295
+ 3. **Update Current Step Pointer**:
3296
+ - Add/move `<!-- current-step -->` marker
3297
+ - Update last-modified timestamp
3298
+
3299
+ ### 5. Integration Instructions
3300
+
3301
+ [[LLM: How agents and tasks should use this utility]]
3302
+
3303
+ **For Agents (startup sequence)**:
3304
+
3305
+ ```
3306
+ 1. Check if plan exists using this utility
3307
+ 2. If exists:
3308
+ - Parse current status
3309
+ - Show user: "Active workflow plan detected. Current step: {X}"
3310
+ - Suggest: "Next recommended action: {next_step}"
3311
+ 3. Continue with normal startup
3312
+ ```
3313
+
3314
+ **For Tasks (pre-execution)**:
3315
+
3316
+ ```
3317
+ 1. Check if plan exists
3318
+ 2. If exists:
3319
+ - Verify this task aligns with plan
3320
+ - If not aligned:
3321
+ - In strict mode: Show warning and stop
3322
+ - In flexible mode: Show warning and ask for confirmation
3323
+ 3. After task completion:
3324
+ - Update plan if task was a planned step
3325
+ - Add note if task was unplanned
3326
+ ```
3327
+
3328
+ ### 6. Plan Status Report Format
3329
+
3330
+ [[LLM: Standard format for showing plan status]]
3331
+
3332
+ ```
3333
+ 📋 Workflow Plan Status
3334
+ ━━━━━━━━━━━━━━━━━━━━
3335
+ Workflow: {workflow_name}
3336
+ Progress: {X}% complete ({completed}/{total} steps)
3337
+
3338
+ ✅ Completed:
3339
+ - {completed_step_1}
3340
+ - {completed_step_2}
3341
+
3342
+ 🔄 Current Step:
3343
+ - {current_step_description}
3344
+
3345
+ 📌 Upcoming:
3346
+ - {next_step_1}
3347
+ - {next_step_2}
3348
+
3349
+ ⚠️ Notes:
3350
+ - {any_deviations_or_notes}
3351
+ ```
3352
+
3353
+ ### 7. Decision Point Handling
3354
+
3355
+ [[LLM: Special handling for workflow decision points]]
3356
+
3357
+ When encountering a decision point in the plan:
3358
+
3359
+ 1. **Identify Decision Marker**: `<!-- decision: {decision_id} -->`
3360
+ 2. **Check Decision Status**: Made/Pending
3361
+ 3. **If Pending**:
3362
+ - Block progress until decision made
3363
+ - Show options to user
3364
+ - Record decision when made
3365
+ 4. **If Made**:
3366
+ - Verify current path aligns with decision
3367
+ - Warn if attempting alternate path
3368
+
3369
+ ### 8. Plan Abandonment
3370
+
3371
+ [[LLM: Graceful handling when user wants to stop following plan]]
3372
+
3373
+ If user wants to abandon plan:
3374
+
3375
+ 1. Confirm abandonment intent
3376
+ 2. Add abandonment note to plan
3377
+ 3. Mark plan as "Abandoned" in header
3378
+ 4. Stop plan checking for remainder of session
3379
+ 5. Suggest creating new plan if needed
3380
+
3381
+ ## Usage Examples
3382
+
3383
+ ### Example 1: Agent Startup Check
3384
+
3385
+ ```
3386
+ BMad Master starting...
3387
+
3388
+ [Check for plan]
3389
+ Found active workflow plan: brownfield-fullstack
3390
+ Progress: 40% complete (4/10 steps)
3391
+ Current step: Create PRD (pm agent)
3392
+
3393
+ Suggestion: Based on your plan, you should work with the PM agent next.
3394
+ Use *agent pm to switch, or *plan-status to see full progress.
3395
+ ```
3396
+
3397
+ ### Example 2: Task Sequence Warning
3398
+
3399
+ ```
3400
+ User: *task create-next-story
3401
+
3402
+ [Plan check triggered]
3403
+ ⚠️ SEQUENCE WARNING:
3404
+ Your workflow plan indicates the PRD hasn't been created yet.
3405
+ Creating stories before the PRD may lead to incomplete requirements.
3406
+
3407
+ Would you like to:
3408
+ 1. Continue anyway (will note deviation in plan)
3409
+ 2. Switch to creating PRD first (*agent pm)
3410
+ 3. View plan status (*plan-status)
3411
+ ```
3412
+
3413
+ ### Example 3: Automatic Plan Update
3414
+
3415
+ ```
3416
+ [After completing create-doc task for PRD]
3417
+
3418
+ ✅ Plan Updated: Marked "Create PRD" as complete
3419
+ 📍 Next step: Create Architecture Document (architect agent)
3420
+ ```
3421
+
3422
+ ## Implementation Notes
3423
+
3424
+ - This utility should be lightweight and fast
3425
+ - Plan parsing should be resilient to format variations
3426
+ - Always preserve user agency - warnings not blocks (unless strict mode)
3427
+ - Plan updates should be atomic to prevent corruption
3428
+ - Consider plan versioning for rollback capability
3429
+
3430
+ ## Error Handling
3431
+
3432
+ - Missing plan: Return null, don't error
3433
+ - Malformed plan: Warn but continue, treat as no plan
3434
+ - Update failures: Log but don't block task completion
3435
+ - Parse errors: Fallback to basic text search
3436
+ ==================== END: utils#plan-management ====================
3437
+
2635
3438
  ==================== START: utils#workflow-management ====================
2636
3439
  # Workflow Management
2637
3440