master workflow integration

This commit is contained in:
Brian Madison
2025-10-12 18:10:23 -05:00
parent c3c51945bb
commit 88989d5403
17 changed files with 1455 additions and 278 deletions

View File

@@ -2,79 +2,171 @@
<workflow>
<critical>This is the INITIAL ASSESSMENT phase - determines which instruction set to load</critical>
<critical>This workflow requires a workflow status file to exist</critical>
<critical>ALWAYS check for existing project-workflow-status.md first</critical>
<critical>If no status file exists, direct user to run workflow-status first</critical>
<critical>The workflow execution engine is governed by: {project_root}/bmad/core/tasks/workflow.xml</critical>
<step n="1" goal="Check for existing workflow status or create new versioned file">
<step n="1" goal="Check for existing workflow status file - REQUIRED">
<action>Check if any project-workflow-status\*.md files exist in {output_folder}/</action>
<check if="not exists">
<output>**⚠️ No Workflow Status File Found**
The `plan-project` workflow requires an existing workflow status file.
Please run `workflow-status` first to:
- Map out your complete workflow journey
- Determine project type and level
- Create the status file with your planned workflow
**To proceed:**
1. Load any agent (Analyst, PM, or use bmad-master)
2. Run: `workflow-status`
3. Complete the workflow planning
4. Return here to continue with `plan-project`
Or tell me: "run workflow-status"
</output>
<action>Exit workflow - cannot proceed without status file</action>
</check>
<check if="exists">
<action>Find the most recent project-workflow-status-YYYY-MM-DD.md file</action>
<action>Load the status file</action>
<action>Check for existing workflow outputs based on level in status file:</action>
<action>Extract key information:</action>
**From Status File:**
- project_type: From "Project Type:" field
- project_level: From "Project Level:" field (0, 1, 2, 3, or 4)
- field_type: From "Greenfield/Brownfield:" field
- planned_workflow: From "Planned Workflow Journey" table
- current_step: From "Current Step:" field
- next_step: From "Next Step:" field
<action>Validate this workflow is the correct next step</action>
<check if='next_step != "plan-project"'>
<ask>**⚠️ Workflow Sequence Warning**
According to your status file, your next planned step is: **{{next_step}}**
But you're trying to run: **plan-project**
Options:
1. **Continue anyway** - Run plan-project (status file will be updated)
2. **Follow planned workflow** - Run {{next_step}} instead
3. **Update workflow plan** - Run workflow-status to revise plan
Your choice (1-3):</ask>
<check if='choice == "2"'>
<output>**Recommended Next Step:**
Load agent: {{next_step_agent}}
Run: {{next_step}}
Or tell me: "run {{next_step}}"
</output>
<action>Exit workflow</action>
</check>
<check if='choice == "3"'>
<output>**Update Workflow Plan:**
Run: `workflow-status`
After updating your plan, return here if needed.
</output>
<action>Exit workflow</action>
</check>
</check>
<action>Set status_file_path = existing file path</action>
<action>Check for existing workflow outputs based on level in status file:</action>
- Level 0: Check for tech-spec.md
- Level 1-2: Check for PRD.md, epic-stories.md, tech-spec.md
- Level 3-4: Check for PRD.md, epics.md
<ask>Found existing workflow status file: project-workflow-status-{{file_date}}.md (Level {{project_level}})
<check if="outputs exist">
<ask>Found existing workflow status file: project-workflow-status-{{file_date}}.md (Level {{project_level}})
**Existing documents detected:**
{{list_existing_docs}}
Options:
1. Continue with this workflow (will update existing status file)
2. Start new workflow (will create new dated status file: project-workflow-status-{{today}}.md)
3. Review and modify previous status
4. I'm working on something else (ignore this file)
1. **Continue** - Update existing documents
2. **Start fresh** - Archive old documents, create new ones
3. **Exit** - I'm not ready to regenerate these
</ask>
Your choice (1-3):</ask>
<check if='option == "1"'>
<action>Set continuation_mode = true</action>
<action>Will update existing documents</action>
</check>
<check if='option == "2"'>
<action>Archive existing documents to: "{output_folder}/archive/"</action>
<action>Set continuation_mode = false</action>
<action>Will create fresh documents</action>
</check>
<check if='option == "3"'>
<action>Exit workflow</action>
</check>
<check if='option == "1"'>
<action>Set status_file_path = existing file path</action>
<action>Set continuation_mode = true</action>
</check>
<check if='option == "2"'>
<action>Set status_file_path = "{output_folder}/project-workflow-status-{{today}}.md"</action>
<action>Archive old status file to: "{output_folder}/archive/project-workflow-status-{{old_date}}.md"</action>
<check if="outputs do not exist">
<action>Set continuation_mode = false</action>
<action>Proceed to new assessment</action>
<action>Ready to create new documents</action>
</check>
<check if='option == "4"'>
<action>Do not use status file for this session</action>
<action>Proceed with user's requested workflow</action>
<action>Exit router (user is not using BMM planning workflow)</action>
</check>
</check>
<check if="not exists">
<action>Create new versioned status file</action>
<action>Set status_file_path = "{output_folder}/project-workflow-status-{{today}}.md"</action>
<action>Set start_date = {{today}}</action>
<action>Proceed to assessment</action>
</check>
</step>
<step n="2" goal="Determine workflow path">
<step n="2" goal="Use status file data and determine specific planning path">
<output>**Status File Data Loaded:**
- Project Type: {{project_type}}
- Project Level: {{project_level}}
- Field Type: {{field_type}}
- Current Phase: {{current_phase}}
</output>
<ask>What type of planning do you need?
**Quick Selection:**
**Based on your project (Level {{project_level}} {{project_type}}):**
1. Full project planning (PRD, Tech Spec, etc.)
2. UX/UI specification only
3. Tech spec only (for small changes)
4. Generate AI Frontend Prompt from existing specs
{{#if project_level == 0}}
**Recommended:** Tech spec only (Level 0 path)
{{/if}}
Select an option or describe your needs:
</ask>
{{#if project_level == 1}}
**Recommended:** Tech spec + epic/stories (Level 1 path)
{{/if}}
{{#if project_level >= 2}}
**Recommended:** Full PRD + epics (Level {{project_level}} path)
{{/if}}
**Other Options:**
1. **Follow recommended path** (recommended)
2. **UX/UI specification only**
3. **Generate AI Frontend Prompt** (from existing specs)
4. **Describe custom needs**
Select an option (1-4):</ask>
<action>Capture user selection as {{planning_type}}</action>
@@ -84,251 +176,153 @@ Select an option or describe your needs:
<action>Exit router workflow (skip remaining steps)</action>
</check>
<check if='{{planning_type}} == "4" OR "Generate AI Frontend Prompt"'>
<check if='{{planning_type}} == "3" OR "Generate AI Frontend Prompt"'>
<action>Check for existing UX spec or PRD</action>
<invoke-task>{project-root}/bmad/bmm/tasks/ai-fe-prompt.md</invoke-task>
<action>Exit router workflow after prompt generation</action>
</check>
<action if='{{planning_type}} == "1" OR "3" OR "Tech spec only" OR "Full project planning"'>Continue to step 3 for project assessment</action>
<action if='{{planning_type}} == "1" OR "Follow recommended path"'>Use project_level and project_type from status file to route to appropriate workflow</action>
</step>
<step n="3" goal="Project context assessment" if="not_ux_only">
<step n="3" goal="Gather additional context if needed">
<ask>Let's understand your project needs:
<action>Read status file to check if additional context is needed</action>
**1. Project Type:**
<check if='field_type == "brownfield" AND needs_documentation == true'>
<ask>**⚠️ Brownfield Documentation Needed**
1. Game
2. Web application
3. Mobile application
4. Desktop application
5. Backend service/API
6. Library/package
7. Other - Please specify
Your status file indicates this brownfield project needs codebase documentation.
**2. Project Context:**
a. New project (greenfield)
b. Adding to existing clean codebase (brownfield - well documented)
c. Working with messy/legacy code (brownfield - needs documentation)
**3. What are you building?** (brief description)
</ask>
<action>Capture field_type = "greenfield" or "brownfield"</action>
<check if='field_type == "brownfield" AND (project_context == "c" OR project_context == "Working with messy/legacy code")'>
<action>Check for {project-root}/docs/index.ts or {project-root}/docs/index.md</action>
<check if="not exists">
<ask>This brownfield project needs codebase documentation for effective planning.
**Documentation Status:** No index.ts or index.md found in docs/
The document-project workflow was flagged in your planned workflow.
**Options:**
1. Generate docs now (run document-project workflow - ~10-15 min, recommended)
2. I'll provide context through questions during planning
3. Continue anyway (may need more context later during implementation)
**Recommendation for Level 0-1:** Option 1 or 2 ensures faster, more accurate planning
1. **Generate docs now** - Run document-project workflow (~10-15 min)
2. **Skip for now** - I'll provide context through questions
3. **Already have docs** - I have documentation to reference
Choose option (1-3):</ask>
<check if='option == "1"'>
<action>Set needs_documentation = true</action>
<action>Will invoke document-project after assessment</action>
</check>
<check if='option == "2"'>
<action>Set gather_context_via_questions = true</action>
<action>Will ask detailed questions during tech-spec generation</action>
</check>
<check if='option == "3"'>
<action>Set proceed_without_docs = true</action>
<action>Note: May require additional context gathering during implementation</action>
</check>
<check if='option == "1"'>
<action>Invoke document-project workflow before continuing</action>
<invoke-workflow>{project-root}/bmad/bmm/workflows/1-analysis/document-project/workflow.yaml</invoke-workflow>
<action>Wait for documentation to complete</action>
<action>Update status file: Mark document-project as "Complete" in planned workflow</action>
</check>
<check if="exists">
<check if='option == "2"'>
<action>Set gather_context_via_questions = true</action>
<action>Will ask detailed questions during spec generation</action>
</check>
<check if='option == "3"'>
<action>Set has_documentation = true</action>
<action>Will reference docs/index.ts during planning</action>
<action>Will reference existing documentation</action>
</check>
</check>
<action>Detect if project_type == "game"</action>
<check if='project_level == "TBD"'>
<ask>**Project Level Not Yet Determined**
Your status file indicates the project level will be determined during planning.
**Based on what you want to build, what level best describes your project?**
0. **Single atomic change** - Bug fix, add endpoint, single file change
1. **Coherent feature** - Add search, implement SSO, new component (2-3 stories)
2. **Small complete system** - Admin tool, team app, prototype (multiple epics)
3. **Full product** - Customer portal, SaaS MVP (subsystems, integrations)
4. **Platform/ecosystem** - Enterprise suite, multi-tenant system
Your level (0-4):</ask>
<action>Capture confirmed_level</action>
<action>Update status file with confirmed project_level</action>
</check>
<check if='project_type == "TBD" OR project_type == "custom"'>
<ask>**Project Type Clarification Needed**
Please describe your project type so we can load the correct planning template.
Examples: web, mobile, desktop, backend, library, cli, game, embedded, data, extension, infra
Your project type:</ask>
<action>Capture and map to project_type_id from project-types.csv</action>
<action>Update status file with confirmed project_type</action>
</check>
</step>
<step n="4" goal="Update status file and route to appropriate workflow">
<action>Update status file before proceeding:</action>
<template-output file="{{status_file_path}}">current_workflow</template-output>
<check if="project_level == 0">Set to: "tech-spec (Level 0 - in progress)"</check>
<check if="project_level == 1">Set to: "tech-spec (Level 1 - in progress)"</check>
<check if="project_level >= 2">Set to: "PRD (Level {{project_level}} - in progress)"</check>
<template-output file="{{status_file_path}}">current_step</template-output>
Set to: "plan-project"
<template-output file="{{status_file_path}}">progress_percentage</template-output>
Increment by 10% (planning started)
<action>Add to decisions log:</action>
```
- **{{date}}**: Started plan-project workflow. Routing to {{workflow_type}} workflow based on Level {{project_level}} {{project_type}} project.
```
<critical>Based on project type and level from status file, load ONLY the needed instructions:</critical>
<check if='project_type == "game"'>
<action>Set workflow_type = "gdd"</action>
<action>Skip level classification (GDD workflow handles all game project levels)</action>
<action>Jump to step 5 for GDD-specific assessment</action>
</check>
<action>Else, based on their description, analyze and suggest scope level:</action>
Examples:
- "Fix login bug" → Suggests Level 0 (single atomic change)
- "Add OAuth to existing app" → Suggests Level 1 (coherent feature)
- "Build internal admin dashboard" → Suggests Level 2 (small system)
- "Create customer portal with payments" → Suggests Level 3 (full product)
- "Multi-tenant SaaS platform" → Suggests Level 4 (platform)
<ask>Based on your description, this appears to be a **{{suggested_level}}** project.
**3. Quick Scope Guide - Please confirm or adjust:**
1. **Single atomic change** → Bug fix, add endpoint, single file change (Level 0)
2. **Coherent feature** → Add search, implement SSO, new component (Level 1)
3. **Small complete system** → Admin tool, team app, prototype (Level 2)
4. **Full product** → Customer portal, SaaS MVP (Level 3)
5. **Platform/ecosystem** → Enterprise suite, multi-tenant system (Level 4)
**4. Do you have existing documentation?**
1. Product Brief
2. Market Research
3. Technical docs/Architecture
4. None
</ask>
</step>
<step n="4" goal="Determine project level and workflow path">
<action>Based on responses, determine:</action>
**Level Classification:**
- **Level 0**: Single atomic change → tech-spec only
- **Level 1**: Single feature, 1-10 stories → minimal PRD + tech-spec
- **Level 2**: Small system, 5-15 stories → focused PRD + tech-spec
- **Level 3**: Full product, 12-40 stories → full PRD + architect handoff
- **Level 4**: Platform, 40+ stories → enterprise PRD + architect handoff
<action>For brownfield without docs:</action>
- Levels 0-2: Can proceed with context gathering
- Levels 3-4: MUST run architect assessment first
</step>
<step n="4a" goal="Run document-project if needed" optional="true">
<check if="needs_documentation == true">
<action>Invoke document-project workflow before continuing with planning</action>
<invoke-workflow>{project-root}/bmad/bmm/workflows/1-analysis/document-project/workflow.yaml</invoke-workflow>
<action>Wait for documentation to complete</action>
<action>Verify docs/index.ts or docs/index.md was created</action>
</check>
</step>
<step n="5" goal="Create workflow status document">
<action>Initialize status file using status_template from workflow.yaml</action>
<action>Write to versioned file path: {{status_file_path}}</action>
<action>Set start_date = {{today}} in template variables</action>
<critical>Capture any technical preferences mentioned during assessment</critical>
<critical>Initialize Workflow Status Tracker with current state</critical>
Generate comprehensive status document with all assessment data.
<template-output file="{{status_file_path}}">project_type</template-output>
<template-output file="project-workflow-status.md">project_level</template-output>
<template-output file="project-workflow-status.md">instruction_set</template-output>
<template-output file="project-workflow-status.md">scope_description</template-output>
<template-output file="project-workflow-status.md">story_count</template-output>
<template-output file="project-workflow-status.md">epic_count</template-output>
<template-output file="project-workflow-status.md">timeline</template-output>
<template-output file="project-workflow-status.md">field_type</template-output>
<template-output file="project-workflow-status.md">existing_docs</template-output>
<template-output file="project-workflow-status.md">team_size</template-output>
<template-output file="project-workflow-status.md">deployment_intent</template-output>
<template-output file="project-workflow-status.md">expected_outputs</template-output>
<template-output file="project-workflow-status.md">workflow_steps</template-output>
<template-output file="project-workflow-status.md">next_steps</template-output>
<template-output file="project-workflow-status.md">special_notes</template-output>
<template-output file="project-workflow-status.md">technical_preferences</template-output>
<action>Initialize Workflow Status Tracker section:</action>
<template-output file="project-workflow-status.md">current_phase</template-output>
Set to: "2-Plan"
<template-output file="project-workflow-status.md">current_workflow</template-output>
<check if="Level 0">Set to: "tech-spec (Level 0 - starting)"</check>
<check if="Level 1">Set to: "tech-spec (Level 1 - starting)"</check>
<check if="Level 2+">Set to: "PRD (Level {{project_level}} - starting)"</check>
<template-output file="project-workflow-status.md">progress_percentage</template-output>
Set to: 10% (assessment complete)
<template-output file="project-workflow-status.md">artifacts_table</template-output>
Initialize with:
```
| project-workflow-status.md | Complete | {output_folder}/project-workflow-status.md | {{date}} |
```
<template-output file="project-workflow-status.md">next_action</template-output>
<check if="Level 0">Set to: "Generate technical specification and single user story"</check>
<check if="Level 1">Set to: "Generate technical specification and epic/stories (2-3 stories)"</check>
<check if="Level 2+">Set to: "Generate PRD and epic breakdown"</check>
<template-output file="project-workflow-status.md">decisions_log</template-output>
Add first entry:
```
- **{{date}}**: Project assessment completed. Classified as Level {{project_level}} {{field_type}} project. Routing to {{instruction_set}} workflow.
```
</step>
<step n="6" goal="Load appropriate instruction set and handle continuation">
<critical>Based on project type and level, load ONLY the needed instructions:</critical>
<check if='workflow_type == "gdd"'>
<invoke-workflow>{installed_path}/gdd/workflow.yaml</invoke-workflow>
<action>GDD workflow handles all game project levels internally</action>
<action>Pass status_file_path and continuation_mode to workflow</action>
</check>
<check if="Level 0">
<check if='project_level == 0 AND project_type != "game"'>
<invoke-workflow>{installed_path}/tech-spec/workflow.yaml</invoke-workflow>
<action>Pass level=0 to tech-spec workflow</action>
<action>Tech-spec workflow will generate user-story.md after tech-spec completion</action>
<action>Tech-spec workflow will generate tech-spec + 1 story</action>
<action>Pass status_file_path and continuation_mode to workflow</action>
</check>
<check if="Level 1">
<check if='project_level == 1 AND project_type != "game"'>
<invoke-workflow>{installed_path}/tech-spec/workflow.yaml</invoke-workflow>
<action>Pass level=1 to tech-spec workflow</action>
<action>Tech-spec workflow will generate epic-stories.md after tech-spec completion</action>
<action>Tech-spec workflow will generate tech-spec + epic + 2-3 stories</action>
<action>Pass status_file_path and continuation_mode to workflow</action>
</check>
<check if="Level 2">
<check if='project_level == 2 AND project_type != "game"'>
<invoke-workflow>{installed_path}/prd/workflow.yaml</invoke-workflow>
<action>Pass level context to PRD workflow (loads instructions-med.md)</action>
<action>Pass level=2 context to PRD workflow (loads instructions-med.md)</action>
<action>Pass status_file_path and continuation_mode to workflow</action>
</check>
<check if="Level 3-4">
<check if='project_level >= 3 AND project_type != "game"'>
<invoke-workflow>{installed_path}/prd/workflow.yaml</invoke-workflow>
<action>Pass level context to PRD workflow (loads instructions-lg.md)</action>
<action>Pass status_file_path and continuation_mode to workflow</action>
</check>
<critical>Pass continuation context to invoked workflow:</critical>
<critical>Pass context to invoked workflow:</critical>
- continuation_mode: true/false
- last_completed_step: {{step_number}}
- status_file_path: {{status_file_path}}
- continuation_mode: {{continuation_mode}}
- existing_documents: {{document_list}}
- project_level: {{level}}
- project_level: {{project_level}}
- project_type: {{project_type}}
- field_type: {{field_type}}
- gather_context_via_questions: {{gather_context_via_questions}} (if brownfield without docs)
<critical>The invoked workflow's instruction set should check continuation_mode and adjust accordingly</critical>
<critical>The invoked workflow will update the status file when complete</critical>
</step>