From eecff22f9148a2ed99ac5c06174319b2307ce35d Mon Sep 17 00:00:00 2001 From: Jonah Schulte Date: Thu, 1 Jan 2026 02:52:48 -0500 Subject: [PATCH] feat: add anti-skip safeguards and verification to implementation workflows - Add YOLO mode clarification: auto-approve prompts only, NOT skip steps - Add mandatory story creation verification (file exists, 4kb+ size) - Add quality requirements for create-story output - Add sprint-status tracking updates - Harden autonomous-epic, create-story, and story-pipeline workflows - Ensure stories contain required sections (Tasks, Acceptance Criteria, Dev Notes) --- .../autonomous-epic/README.md | 8 +- .../autonomous-epic/instructions.xml | 108 +++++++++++++++++- .../autonomous-epic/workflow.yaml | 27 ++++- .../create-story-with-gap-analysis/README.md | 2 +- .../step-01-initialize.md | 11 +- .../step-03-generate-story.md | 16 +-- .../workflow.yaml | 5 +- .../create-story/instructions.xml | 33 ++++++ .../create-story/workflow.yaml | 17 ++- .../4-implementation/story-pipeline/README.md | 8 +- .../story-pipeline/steps/step-07-complete.md | 4 +- .../super-dev-story/README.md | 2 +- 12 files changed, 205 insertions(+), 36 deletions(-) diff --git a/src/modules/bmm/workflows/4-implementation/autonomous-epic/README.md b/src/modules/bmm/workflows/4-implementation/autonomous-epic/README.md index 90467813..714a14c9 100644 --- a/src/modules/bmm/workflows/4-implementation/autonomous-epic/README.md +++ b/src/modules/bmm/workflows/4-implementation/autonomous-epic/README.md @@ -431,10 +431,10 @@ Ready to merge ```bash # In another terminal, watch progress: -watch -n 10 'cat docs/sprint-artifacts/.autonomous-epic-progress.yaml' +watch -n 10 'cat _bmad-output/implementation-artifacts/.autonomous-epic-progress.yaml' # Or tail completion report: -tail -f docs/sprint-artifacts/epic-2-completion-report.md +tail -f _bmad-output/implementation-artifacts/epic-2-completion-report.md ``` ### 4. Interruption Handling @@ -630,7 +630,7 @@ Story 3/8: 2-3-password-reset ```bash # Check progress programmatically: -cat docs/sprint-artifacts/.autonomous-epic-progress.yaml +cat _bmad-output/implementation-artifacts/.autonomous-epic-progress.yaml # Example: epic_num: 2 @@ -643,7 +643,7 @@ current_story: 2-3-password-reset ```bash # Generated when epic completes: -cat docs/sprint-artifacts/epic-2-completion-report.md +cat _bmad-output/implementation-artifacts/epic-2-completion-report.md ``` ## Advanced: Batch Epic Processing diff --git a/src/modules/bmm/workflows/4-implementation/autonomous-epic/instructions.xml b/src/modules/bmm/workflows/4-implementation/autonomous-epic/instructions.xml index cbb9461b..fdf572cf 100644 --- a/src/modules/bmm/workflows/4-implementation/autonomous-epic/instructions.xml +++ b/src/modules/bmm/workflows/4-implementation/autonomous-epic/instructions.xml @@ -20,6 +20,43 @@ 4. Return to this workflow and continue + + + + 🚨 WHAT YOLO MODE MEANS: + - YOLO mode ONLY means: automatically answer "y", "Y", "C", or "continue" to prompts + - YOLO mode does NOT mean: skip steps, skip workflows, skip verification, or produce minimal output + - YOLO mode does NOT mean: pretend work was done when it wasn't + - ALL steps must still be fully executed - just without waiting for user confirmation + - ALL invoke-workflow calls must still be fully executed + - ALL verification checks must still pass + + + + + + 🚨 STORY CREATION IS SACRED - YOU MUST ACTUALLY RUN CREATE-STORY: + - DO NOT just output "Creating story..." and move on + - DO NOT skip the invoke-workflow tag + - DO NOT pretend the story was created + - You MUST fully execute the create-story workflow with ALL its steps + - The story file MUST exist and be verified BEFORE proceeding + + 🚨 CREATE-STORY QUALITY REQUIREMENTS: + - create-story must analyze epics, PRD, architecture, and UX documents + - create-story must produce comprehensive story files (4kb+ minimum) + - Tiny story files (under 4kb) indicate the workflow was not properly executed + - Story files MUST contain: Tasks/Subtasks, Acceptance Criteria, Dev Notes, Architecture Constraints + + 🚨 HARD VERIFICATION REQUIRED AFTER STORY CREATION: + - After invoke-workflow for create-story completes, you MUST verify: + 1. The story file EXISTS on disk (use file read/check) + 2. The story file is AT LEAST 4000 bytes (use wc -c or file size check) + 3. The story file contains required sections (Tasks, Acceptance Criteria, Dev Notes) + - If ANY verification fails: HALT and report error - do NOT proceed to super-dev-pipeline + - Do NOT trust "Story created" output without verification + + 🤖 **Autonomous Epic Processing** @@ -43,6 +80,13 @@ - ✅ Disciplined execution even at high token counts - ✅ All quality gates enforced + 🚨 **QUALITY SAFEGUARDS (Non-Negotiable):** + - Story files MUST be created via full create-story execution + - Story files MUST be at least 4kb (comprehensive, not YOLO'd) + - Story files MUST contain: Tasks, Acceptance Criteria, Dev Notes + - YOLO mode = auto-approve prompts, NOT skip steps or produce minimal output + - Verification happens AFTER each story creation - failures halt processing + **Key Improvement:** Stories in "review" status with unchecked tasks WILL be processed - we check actual task completion, not just status! @@ -148,6 +192,9 @@ - current_story: null - status: running + + + Update sprint-status: if epic-{{epic_num}} is "backlog" or "contexted", set to "in-progress" @@ -172,27 +219,77 @@ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - + + + - 📝 Creating story from epic... + 📝 Creating story from epic - THIS REQUIRES FULL WORKFLOW EXECUTION... + ⚠️ REMINDER: You MUST fully execute create-story, not just output messages! + - Create story just-in-time + + Create story just-in-time - MUST FULLY EXECUTE ALL STEPS + This workflow must load epics, PRD, architecture, UX docs + This workflow must produce a comprehensive 4kb+ story file - ✅ Story created + + Set {{expected_story_file}} = {{story_dir}}/story-{{epic_num}}.{{story_num}}.md + Check if file exists: {{expected_story_file}} + + 🚨 CRITICAL ERROR: Story file was NOT created! + Expected file: {{expected_story_file}} + The create-story workflow did not execute properly. + This story CANNOT proceed without a proper story file. + Add to failed_stories with reason: "Story file not created" + + + + + Get file size of {{expected_story_file}} in bytes + + 🚨 CRITICAL ERROR: Story file is too small ({{file_size}} bytes)! + Minimum required: 4000 bytes + This indicates create-story was skipped or improperly executed. + A proper story file should contain: + - Detailed acceptance criteria + - Comprehensive tasks/subtasks + - Dev notes with architecture constraints + - Source references + This story CANNOT proceed with an incomplete story file. + Add to failed_stories with reason: "Story file too small - workflow not properly executed" + + + + + Read {{expected_story_file}} and check for required sections + + 🚨 CRITICAL ERROR: Story file missing required sections! + Required sections: Tasks, Acceptance Criteria + This story CANNOT proceed without proper structure. + Add to failed_stories with reason: "Story file missing required sections" + + + + ✅ Story created and verified: + - File exists: {{expected_story_file}} + - File size: {{file_size}} bytes (meets 4kb minimum) + - Required sections: present + Update sprint-status: set {{current_story.key}} to "ready-for-dev" (if not already) ❌ Failed to create story: {{error}} - Add to failed_stories, continue to next + Add to failed_stories with error details + Update sprint-status: set {{current_story.key}} to "in-progress" 💻 Developing story with super-dev-pipeline ({{unchecked_count}} tasks remaining)... @@ -213,6 +310,7 @@ ⚠️ Story still has {{remaining_unchecked}} unchecked tasks after super-dev-pipeline Log incomplete tasks for review Mark as partial success + Update sprint-status: set {{current_story.key}} to "review" diff --git a/src/modules/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml b/src/modules/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml index 30f3ebac..fac0862a 100644 --- a/src/modules/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml +++ b/src/modules/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml @@ -46,6 +46,31 @@ super_dev_pipeline_features: quality_gates: "All super-dev-story gates with disciplined execution" brownfield_support: "Validates existing code before implementation" +# YOLO MODE CLARIFICATION +# YOLO mode ONLY means auto-approve prompts (answer "y", "Y", "C", "continue") +# YOLO mode does NOT mean: skip steps, skip workflows, or produce minimal output +# ALL steps, workflows, and verifications must still be fully executed +yolo_clarification: + auto_approve_prompts: true + skip_steps: false # NEVER - all steps must execute + skip_workflows: false # NEVER - invoke-workflow calls must execute + skip_verification: false # NEVER - all checks must pass + minimal_output: false # NEVER - full quality output required + +# STORY QUALITY REQUIREMENTS +# These settings ensure create-story produces comprehensive story files +story_quality_requirements: + minimum_size_bytes: 4000 # Story files must be at least 4KB + enforce_minimum_size: true + required_sections: + - "## Tasks" + - "## Acceptance Criteria" + - "## Dev Notes" + - "Architecture Constraints" + - "Gap Analysis" + halt_on_quality_failure: true # Stop processing if story fails quality check + verify_file_exists: true # Verify story file was actually created on disk + # TASK-BASED COMPLETION SETTINGS (NEW) # These settings ensure stories are truly complete, not just marked as such completion_verification: @@ -68,5 +93,3 @@ completion_verification: strict_epic_completion: true standalone: true - -web_bundle: false diff --git a/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/README.md b/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/README.md index 1cc40f3c..08f41fa6 100644 --- a/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/README.md +++ b/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/README.md @@ -38,7 +38,7 @@ Args: "1.9" (epic.story number) 2. **SCAN codebase systematically** (Glob for files, Read to verify implementation) 3. Generate gap analysis with verified ✅/❌/⚠️ status 4. Update story file with truthful checkboxes -5. Save to docs/sprint-artifacts/ +5. Save to _bmad-output/implementation-artifacts/ --- diff --git a/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-01-initialize.md b/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-01-initialize.md index 2b1c9499..6212924b 100644 --- a/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-01-initialize.md +++ b/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-01-initialize.md @@ -13,7 +13,7 @@ Which story should I regenerate with gap analysis? Options: 1. Provide story number (e.g., "1.9" or "1-9") -2. Provide story filename (e.g., "1-9-admin-user-service-bridgeid-rbac.md") +2. Provide story filename (e.g., "story-1.9.md" or legacy "1-9-admin-user-service-bridgeid-rbac.md") Your choice: ``` @@ -21,12 +21,14 @@ Your choice: **Parse input:** - Extract epic_num (e.g., "1") - Extract story_num (e.g., "9") -- Locate story file: `docs/sprint-artifacts/{epic_num}-{story_num}-*.md` +- Locate story file: `{story_dir}/story-{epic_num}.{story_num}.md` (fallback: `{story_dir}/{epic_num}-{story_num}-*.md`) ### 2. Load Existing Story Content ```bash -Read: docs/sprint-artifacts/{epic_num}-{story_num}-*.md +Read: {story_dir}/story-{epic_num}.{story_num}.md +# If not found, fallback: +Read: {story_dir}/{epic_num}-{story_num}-*.md ``` **Extract from existing story:** @@ -40,8 +42,7 @@ Read: docs/sprint-artifacts/{epic_num}-{story_num}-*.md ### 3. Load Epic Context ```bash -Glob: docs/archive/planning-round-1-greenfield/epics/epic-{epic_num}-*.md -Read: [found epic file] +Read: {planning_artifacts}/epics.md ``` **Extract from epic:** diff --git a/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-03-generate-story.md b/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-03-generate-story.md index c0a3a5e9..34281465 100644 --- a/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-03-generate-story.md +++ b/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-03-generate-story.md @@ -8,7 +8,7 @@ Generate complete 7-section story file using verified gap analysis from Step 2. ### 1. Load Template ```bash -Read: _bmad/custom/workflows/create-story-with-gap-analysis/template.md +Read: {installed_path}/template.md ``` ### 2. Fill Template Variables @@ -88,7 +88,7 @@ Read: _bmad/custom/workflows/create-story-with-gap-analysis/template.md **Write filled template:** ```bash -Write: docs/sprint-artifacts/{{epic_num}}-{{story_num}}-{{slug}}.md +Write: {story_dir}/story-{{epic_num}}.{{story_num}}.md [Complete 7-section story with verified gap analysis] ``` @@ -96,28 +96,28 @@ Write: docs/sprint-artifacts/{{epic_num}}-{{story_num}}-{{slug}}.md ```bash # Check section count -grep "^## " docs/sprint-artifacts/{{story_file}} | wc -l +grep "^## " {story_dir}/story-{{epic_num}}.{{story_num}}.md | wc -l # Should output: 7 # Check for gap analysis -grep -q "Gap Analysis.*Current State" docs/sprint-artifacts/{{story_file}} +grep -q "Gap Analysis.*Current State" {story_dir}/story-{{epic_num}}.{{story_num}}.md # Should find it # Run custom validation -./scripts/validate-bmad-format.sh docs/sprint-artifacts/{{story_file}} +./scripts/validate-bmad-format.sh {story_dir}/story-{{epic_num}}.{{story_num}}.md # Update script to expect 7 sections + gap analysis subsection ``` ### 5. Update Sprint Status ```bash -Read: docs/sprint-artifacts/sprint-status.yaml +Read: {sprint_status} # Find story entry # Update status to "ready-for-dev" if was "backlog" # Preserve all comments and structure -Write: docs/sprint-artifacts/sprint-status.yaml +Write: {sprint_status} ``` ### 6. Report Completion @@ -126,7 +126,7 @@ Write: docs/sprint-artifacts/sprint-status.yaml ``` ✅ Story {{epic_num}}.{{story_num}} Regenerated with Gap Analysis -File: docs/sprint-artifacts/{{story_file}} +File: {story_dir}/story-{{epic_num}}.{{story_num}}.md Sections: 7/7 ✅ Gap Analysis: VERIFIED with codebase scan diff --git a/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/workflow.yaml b/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/workflow.yaml index b408bbed..19217943 100644 --- a/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/workflow.yaml +++ b/src/modules/bmm/workflows/4-implementation/create-story-with-gap-analysis/workflow.yaml @@ -7,6 +7,7 @@ config_source: "{project-root}/_bmad/bmm/config.yaml" user_name: "{config_source}:user_name" communication_language: "{config_source}:communication_language" date: system-generated +planning_artifacts: "{config_source}:planning_artifacts" implementation_artifacts: "{config_source}:implementation_artifacts" output_folder: "{implementation_artifacts}" story_dir: "{implementation_artifacts}" @@ -19,8 +20,8 @@ instructions: "{installed_path}/step-01-initialize.md" # Variables and inputs variables: sprint_status: "{implementation_artifacts}/sprint-status.yaml" - epics_file: "{output_folder}/epics.md" - prd_file: "{output_folder}/PRD.md" + epics_file: "{planning_artifacts}/epics.md" + prd_file: "{planning_artifacts}/prd.md" # Project context project_context: "**/project-context.md" diff --git a/src/modules/bmm/workflows/4-implementation/create-story/instructions.xml b/src/modules/bmm/workflows/4-implementation/create-story/instructions.xml index 75d967be..d2554d16 100644 --- a/src/modules/bmm/workflows/4-implementation/create-story/instructions.xml +++ b/src/modules/bmm/workflows/4-implementation/create-story/instructions.xml @@ -3,6 +3,11 @@ You MUST have already loaded and processed: {installed_path}/workflow.yaml Communicate all responses in {communication_language} and generate all documents in {document_output_language} + 🚨 YOLO MODE CLARIFICATION: YOLO mode ONLY means auto-approve prompts (answer "y", "Y", "C", "continue"). + YOLO mode does NOT mean: skip steps, skip sections, skip analysis, or produce minimal output. + ALL steps must be fully executed. ALL sections must be populated. The output file must be COMPREHENSIVE (4KB+ minimum). + Skipping steps or producing minimal output in YOLO mode is a CRITICAL FAILURE. + 🔥 CRITICAL MISSION: You are creating the ULTIMATE story context engine that prevents LLM developer mistakes, omissions or disasters! 🔥 Your purpose is NOT to copy from epics - it's to create a comprehensive, optimized story file that gives the DEV agent @@ -302,6 +307,32 @@ Save file, preserving ALL comments and structure including STATUS DEFINITIONS + QUALITY VERIFICATION - Story file must meet minimum requirements before completion + Verify story file was created on disk + + 🚫 CRITICAL ERROR: Story file was NOT created at {{story_file}} + This is a workflow execution failure. The file must be written to disk. + HALT - Story creation failed + + + Get file size of {{story_file}} + + 🚫 CRITICAL ERROR: Story file is too small ({{file_size}} bytes, minimum 4000 bytes) + This indicates the story was not comprehensively created. + Required sections: ## Story, ## Acceptance Criteria, ## Tasks, ## Dev Notes, Gap Analysis, Architecture Constraints + HALT - Story creation incomplete. Re-run with full analysis. + + + Verify required sections exist in story file + + 🚫 CRITICAL ERROR: Story file is missing ## Tasks section + HALT - Story creation incomplete + + + 🚫 CRITICAL ERROR: Story file is missing ## Acceptance Criteria section + HALT - Story creation incomplete + + Report completion **🎯 BMad Method STORY CREATED, {user_name}!** @@ -309,6 +340,7 @@ - Story ID: {{story_id}} - Story Key: {{story_key}} - File: {{story_file}} + - File Size: {{file_size}} bytes ✅ (minimum 4000 bytes) - Status: ready-for-dev **What Was Created:** @@ -316,6 +348,7 @@ - ✅ Acceptance criteria and success metrics - ✅ DRAFT implementation tasks (based on requirements) - ✅ Developer context and architecture guardrails + - ✅ Quality verification passed **Next Steps:** 1. Review the story in {{story_file}} diff --git a/src/modules/bmm/workflows/4-implementation/create-story/workflow.yaml b/src/modules/bmm/workflows/4-implementation/create-story/workflow.yaml index e79a7f97..1a715dbb 100644 --- a/src/modules/bmm/workflows/4-implementation/create-story/workflow.yaml +++ b/src/modules/bmm/workflows/4-implementation/create-story/workflow.yaml @@ -32,6 +32,21 @@ project_context: "**/project-context.md" default_output_file: "{story_dir}/{{story_key}}.md" +# STORY QUALITY REQUIREMENTS +# Ensure comprehensive story files are produced +story_quality: + minimum_size_bytes: 4000 # Story files must be at least 4KB + required_sections: + - "## Story" # As a / I want / So that + - "## Status" + - "## Acceptance Criteria" # BDD-style Given/When/Then + - "## Tasks" # Actionable tasks with checkboxes + - "## Dev Notes" # Technical implementation notes + - "## Gap Analysis" # Codebase analysis results + - "Architecture Constraints" # From architecture.md + output_mode: "comprehensive" # Never produce minimal output + yolo_mode_note: "YOLO mode means auto-approve prompts, NOT skip sections or produce minimal output" + # Smart input file references - Simplified for enhanced approach # The epics+stories file should contain everything needed with source hints input_file_patterns: @@ -57,5 +72,3 @@ input_file_patterns: load_strategy: "SELECTIVE_LOAD" # Only load needed epic standalone: true - -web_bundle: false diff --git a/src/modules/bmm/workflows/4-implementation/story-pipeline/README.md b/src/modules/bmm/workflows/4-implementation/story-pipeline/README.md index 8f43a51c..a7edf118 100644 --- a/src/modules/bmm/workflows/4-implementation/story-pipeline/README.md +++ b/src/modules/bmm/workflows/4-implementation/story-pipeline/README.md @@ -137,7 +137,7 @@ If execution stops (context exhaustion, error, manual halt): bmad build 1-4 --resume # The pipeline reads state from: -# docs/sprint-artifacts/pipeline-state-{story-id}.yaml +# _bmad-output/implementation-artifacts/pipeline-state-{story-id}.yaml ``` Resume automatically: @@ -213,7 +213,7 @@ steps: ### Pipeline State File -Created at `docs/sprint-artifacts/pipeline-state-{story-id}.yaml`: +Created at `_bmad-output/implementation-artifacts/pipeline-state-{story-id}.yaml`: ```yaml story_id: "1-4" @@ -277,7 +277,7 @@ steps: - Acceptance criteria in BDD format (Given/When/Then) - Test scenarios for each AC - Technical notes -5. Save to `docs/sprint-artifacts/story-{id}.md` +5. Save to `_bmad-output/implementation-artifacts/story-{id}.md` **Quality Gate:** Story file exists with all required sections. @@ -417,7 +417,7 @@ Example issues found in real usage: After a complete pipeline run: ``` -docs/sprint-artifacts/ +_bmad-output/implementation-artifacts/ ├── story-{id}.md # Story file with ACs, validation report ├── pipeline-state-{id}.yaml # Execution state and summary ├── atdd-checklist-{id}.md # Test requirements checklist diff --git a/src/modules/bmm/workflows/4-implementation/story-pipeline/steps/step-07-complete.md b/src/modules/bmm/workflows/4-implementation/story-pipeline/steps/step-07-complete.md index 28d92bdf..eabbcfc4 100644 --- a/src/modules/bmm/workflows/4-implementation/story-pipeline/steps/step-07-complete.md +++ b/src/modules/bmm/workflows/4-implementation/story-pipeline/steps/step-07-complete.md @@ -96,8 +96,8 @@ stories: ```bash git add src/ -git add docs/sprint-artifacts/story-{story_id}.md -git add docs/sprint-artifacts/sprint-status.yaml +git add _bmad-output/implementation-artifacts/story-{story_id}.md +git add _bmad-output/implementation-artifacts/sprint-status.yaml git add src/supabase/migrations/ ``` diff --git a/src/modules/bmm/workflows/4-implementation/super-dev-story/README.md b/src/modules/bmm/workflows/4-implementation/super-dev-story/README.md index 6b635a63..77786969 100644 --- a/src/modules/bmm/workflows/4-implementation/super-dev-story/README.md +++ b/src/modules/bmm/workflows/4-implementation/super-dev-story/README.md @@ -97,7 +97,7 @@ Super-dev-story: ### Specify Story ```bash -/super-dev-story docs/sprint-artifacts/1-2-auth.md +/super-dev-story _bmad-output/implementation-artifacts/story-1.2.md ``` ### Expected Flow