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)
This commit is contained in:
Jonah Schulte 2026-01-01 02:52:48 -05:00
parent 387c42178e
commit eecff22f91
12 changed files with 205 additions and 36 deletions

View File

@ -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

View File

@ -20,6 +20,43 @@
4. Return to this workflow and continue
</critical>
<!-- ═══════════════════════════════════════════════════════════════════════════════ -->
<!-- 🚨 CRITICAL: YOLO MODE CLARIFICATION 🚨 -->
<!-- ═══════════════════════════════════════════════════════════════════════════════ -->
<critical>🚨 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
</critical>
<!-- ═══════════════════════════════════════════════════════════════════════════════ -->
<!-- 🚨 ANTI-SKIP SAFEGUARDS - THESE ARE NON-NEGOTIABLE 🚨 -->
<!-- ═══════════════════════════════════════════════════════════════════════════════ -->
<critical>🚨 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
</critical>
<critical>🚨 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
</critical>
<critical>🚨 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
</critical>
<step n="1" goal="Initialize and validate epic">
<output>🤖 **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
</action>
<!-- Keep sprint-status accurate at start -->
<action>Update sprint-status: if epic-{{epic_num}} is "backlog" or "contexted", set to "in-progress"</action>
</step>
<step n="3" goal="Process all stories in epic">
@ -172,27 +219,77 @@
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
</output>
<!-- CREATE STORY IF BACKLOG -->
<!-- ═══════════════════════════════════════════════════════════════════════ -->
<!-- CREATE STORY IF BACKLOG - WITH MANDATORY VERIFICATION -->
<!-- ═══════════════════════════════════════════════════════════════════════ -->
<check if="status == 'backlog'">
<output>📝 Creating story from epic...</output>
<output>📝 Creating story from epic - THIS REQUIRES FULL WORKFLOW EXECUTION...</output>
<output>⚠️ REMINDER: You MUST fully execute create-story, not just output messages!</output>
<try>
<!-- STEP 1: Actually invoke and execute create-story workflow -->
<invoke-workflow path="{project-root}/_bmad/bmm/workflows/4-implementation/create-story/workflow.yaml">
<note>Create story just-in-time</note>
<input name="story_id" value="{{current_story.key}}" />
<note>Create story just-in-time - MUST FULLY EXECUTE ALL STEPS</note>
<note>This workflow must load epics, PRD, architecture, UX docs</note>
<note>This workflow must produce a comprehensive 4kb+ story file</note>
</invoke-workflow>
<output>✅ Story created</output>
<!-- STEP 2: HARD VERIFICATION - Story file must exist -->
<action>Set {{expected_story_file}} = {{story_dir}}/story-{{epic_num}}.{{story_num}}.md</action>
<action>Check if file exists: {{expected_story_file}}</action>
<check if="story file does NOT exist">
<output>🚨 CRITICAL ERROR: Story file was NOT created!</output>
<output>Expected file: {{expected_story_file}}</output>
<output>The create-story workflow did not execute properly.</output>
<output>This story CANNOT proceed without a proper story file.</output>
<action>Add to failed_stories with reason: "Story file not created"</action>
<continue />
</check>
<!-- STEP 3: HARD VERIFICATION - Story file must be at least 4kb -->
<action>Get file size of {{expected_story_file}} in bytes</action>
<check if="file size < 4000 bytes">
<output>🚨 CRITICAL ERROR: Story file is too small ({{file_size}} bytes)!</output>
<output>Minimum required: 4000 bytes</output>
<output>This indicates create-story was skipped or improperly executed.</output>
<output>A proper story file should contain:</output>
<output> - Detailed acceptance criteria</output>
<output> - Comprehensive tasks/subtasks</output>
<output> - Dev notes with architecture constraints</output>
<output> - Source references</output>
<output>This story CANNOT proceed with an incomplete story file.</output>
<action>Add to failed_stories with reason: "Story file too small - workflow not properly executed"</action>
<continue />
</check>
<!-- STEP 4: HARD VERIFICATION - Story file must have required sections -->
<action>Read {{expected_story_file}} and check for required sections</action>
<check if="file missing '## Tasks' OR '## Acceptance Criteria'">
<output>🚨 CRITICAL ERROR: Story file missing required sections!</output>
<output>Required sections: Tasks, Acceptance Criteria</output>
<output>This story CANNOT proceed without proper structure.</output>
<action>Add to failed_stories with reason: "Story file missing required sections"</action>
<continue />
</check>
<output>✅ Story created and verified:</output>
<output> - File exists: {{expected_story_file}}</output>
<output> - File size: {{file_size}} bytes (meets 4kb minimum)</output>
<output> - Required sections: present</output>
<action>Update sprint-status: set {{current_story.key}} to "ready-for-dev" (if not already)</action>
</try>
<catch>
<output>❌ Failed to create story: {{error}}</output>
<action>Add to failed_stories, continue to next</action>
<action>Add to failed_stories with error details</action>
<continue />
</catch>
</check>
<!-- DEVELOP STORY WITH SUPER-DEV-PIPELINE (handles both greenfield AND brownfield) -->
<check if="{{unchecked_count}} > 0">
<action>Update sprint-status: set {{current_story.key}} to "in-progress"</action>
<output>💻 Developing story with super-dev-pipeline ({{unchecked_count}} tasks remaining)...</output>
<try>
@ -213,6 +310,7 @@
<output>⚠️ Story still has {{remaining_unchecked}} unchecked tasks after super-dev-pipeline</output>
<action>Log incomplete tasks for review</action>
<action>Mark as partial success</action>
<action>Update sprint-status: set {{current_story.key}} to "review"</action>
</check>
<check if="{{remaining_unchecked}} == 0">

View File

@ -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

View File

@ -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/
---

View File

@ -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:**

View File

@ -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

View File

@ -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"

View File

@ -3,6 +3,11 @@
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
<critical>Communicate all responses in {communication_language} and generate all documents in {document_output_language}</critical>
<critical>🚨 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>
<critical>🔥 CRITICAL MISSION: You are creating the ULTIMATE story context engine that prevents LLM developer mistakes, omissions or
disasters! 🔥</critical>
<critical>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 @@
<action>Save file, preserving ALL comments and structure including STATUS DEFINITIONS</action>
</check>
<critical>QUALITY VERIFICATION - Story file must meet minimum requirements before completion</critical>
<action>Verify story file was created on disk</action>
<check if="story file does not exist on disk">
<output>🚫 CRITICAL ERROR: Story file was NOT created at {{story_file}}</output>
<output>This is a workflow execution failure. The file must be written to disk.</output>
<action>HALT - Story creation failed</action>
</check>
<action>Get file size of {{story_file}}</action>
<check if="file size is less than 4000 bytes">
<output>🚫 CRITICAL ERROR: Story file is too small ({{file_size}} bytes, minimum 4000 bytes)</output>
<output>This indicates the story was not comprehensively created.</output>
<output>Required sections: ## Story, ## Acceptance Criteria, ## Tasks, ## Dev Notes, Gap Analysis, Architecture Constraints</output>
<action>HALT - Story creation incomplete. Re-run with full analysis.</action>
</check>
<action>Verify required sections exist in story file</action>
<check if="missing ## Tasks section">
<output>🚫 CRITICAL ERROR: Story file is missing ## Tasks section</output>
<action>HALT - Story creation incomplete</action>
</check>
<check if="missing ## Acceptance Criteria section">
<output>🚫 CRITICAL ERROR: Story file is missing ## Acceptance Criteria section</output>
<action>HALT - Story creation incomplete</action>
</check>
<action>Report completion</action>
<output>**🎯 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}}

View File

@ -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

View File

@ -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

View File

@ -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/
```

View File

@ -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