diff --git a/README-changes.md b/README-changes.md new file mode 100644 index 00000000..640a376f --- /dev/null +++ b/README-changes.md @@ -0,0 +1,284 @@ +# Fork Changes: @jonahschulte/bmad-method + +This document describes the customizations and enhancements in this fork compared to the [upstream BMAD-METHOD repository](https://github.com/bmad-code-org/BMAD-METHOD). + +## Overview + +This fork extends the official BMAD Method with **production automation workflows** focused on: + +- **Quality assurance automation** - Multi-stage validation pipelines +- **Token efficiency** - 60-70% reduction in token usage per story +- **Autonomous processing** - Unattended epic completion +- **Anti-vibe-coding enforcement** - Mandatory gap analysis and code review + +**Stats:** ~26,000+ lines of additions across 122 files + +--- + +## Key Features Added + +### 1. Super-Dev Pipeline (`/super-dev-pipeline`) + +A comprehensive quality workflow that ensures stories are **truly complete** before marking done: + +``` +Pre-validation → Development → Post-validation → Code Review → Fixes → Done ✅ +``` + +**What it solves:** +- Prevents premature task completion ("stupid-dev" syndrome) +- Catches partial implementations +- Finds missed edge cases automatically +- Runs adversarial code review before human review + +**Location:** `src/modules/bmm/workflows/4-implementation/super-dev-pipeline/` + +--- + +### 2. Story Pipeline v2.0 (`/story-pipeline`) + +Single-session step-file architecture with **60-70% token savings**: + +| Mode | Token Usage | Savings vs Legacy | +|------|-------------|-------------------| +| Interactive | ~25K | 65% | +| Batch (YOLO) | ~30K | 58% | + +**How it works:** +- Replaces 6 separate Claude CLI calls with 1 session +- Just-in-time step loading +- Checkpoint/resume capability +- Role switching within session (SM → TEA → DEV → SM) + +**Automated steps:** +1. Initialize & load context +2. Create story (SM role) +3. Validate story (adversarial - must find 3-10 issues) +4. ATDD test generation (TEA role) +5. Implementation (DEV role) +6. Code review (adversarial) +7. Complete & commit +8. Generate audit trail + +**Location:** `src/modules/bmm/workflows/4-implementation/story-pipeline/` + +--- + +### 3. Batch Super-Dev (`/batch-super-dev`) ⭐ Primary + +Interactive batch workflow for processing multiple stories with full quality gates: + +```bash +/batch-super-dev + +→ Select stories: 1-3,5,7 (or "all") +→ Validates story files (creates missing, regenerates invalid) +→ Processes each with super-dev-pipeline +→ Reconciles story status after each +→ All stories complete! ✅ +``` + +**Features (v1.2.0):** +- **Smart Story Validation** - Checks 12 required BMAD sections +- **Auto-Creation** - Creates missing story files with codebase gap analysis +- **Auto-Regeneration** - Regenerates invalid/incomplete stories +- **Sequential or Parallel** execution modes +- **Story Reconciliation** - Verifies checkboxes match implementation +- **Epic filtering** - Process only specific epic's stories + +**Location:** `src/modules/bmm/workflows/4-implementation/batch-super-dev/` + +--- + +### 4. Gap Analysis (`/gap-analysis`) + +Dev-time codebase validation that solves the **batch planning staleness problem**: + +**The Problem:** Stories planned days ago become stale as the codebase evolves. + +**The Solution:** Mandatory gap analysis before development: +1. Scans current codebase +2. Validates DRAFT tasks against reality +3. Proposes refinements (add/modify/remove tasks) +4. User approves with 6 options: Y/A/n/e/s/r + +**Location:** `src/modules/bmm/workflows/4-implementation/gap-analysis/` + +--- + +### 5. Push-All Workflow (`/push-all`) + +Safe automated git operations with comprehensive safety checks: + +- Secret detection (API keys, credentials) +- Large file warnings +- Build artifact detection +- Smart commit message generation +- Auto-push with error handling + +**Location:** `src/modules/bmm/workflows/4-implementation/push-all/` + +--- + +### 7. Story Validation System + +Multi-level story validation with LLM-powered verification: + +| Workflow | Purpose | +|----------|---------| +| `/validate-story` | Single story validation | +| `/validate-story-deep` | Comprehensive deep validation | +| `/validate-all-stories` | Batch validation for epic | +| `/validate-all-stories-deep` | Deep validation for all stories | +| `/validate-epic-status` | Epic status reconciliation | +| `/validate-all-epics` | Full sprint validation | + +**Location:** `src/modules/bmm/workflows/4-implementation/validate-*/` + +--- + +### 8. Sprint Status Management Scripts + +Python/TypeScript utilities for sprint tracking: + +| Script | Purpose | +|--------|---------| +| `sprint-status-updater.py` | Update story statuses across epics | +| `task-verification-engine.py` | LLM-powered task completion verification | +| `llm-task-verifier.py` | Haiku-based task validation | +| `validation-progress-tracker.py` | Track validation progress | +| `add-status-fields.py` | Add status fields to story files | + +**Features:** +- Bedrock/Claude API clients with rate limiting +- File utilities for story parsing +- Resumable validation runs + +**Location:** `scripts/lib/` + +--- + +### 9. BMAD Guide Skill + +Automatic Claude Code skill for BMAD navigation: + +```bash +# Auto-installed with BMAD +# Provides workflow selection guidance +``` + +**What it does:** +- Phase detection (where am I?) +- Project level routing +- Workflow decision tree +- Critical rules enforcement + +**Location:** `resources/skills/bmad-guide.md` + +--- + +### 10. Claude Code Commands + +Pre-configured Claude CLI commands: + +| Command | Description | +|---------|-------------| +| `batch-super-dev` | Run batch super-dev pipeline | +| `story-pipeline` | Execute story pipeline | +| `super-dev-pipeline` | Run super-dev with quality gates | +| `validate-epic-status` | Validate epic status | +| `validate-all-epics` | Validate all epics | + +**Location:** `.claude-commands/` + +--- + +## Package Changes + +```json +{ + "name": "@jonahschulte/bmad-method", + "description": "...Enhanced with super-dev-pipeline and smart batching" +} +``` + +This fork is published to npm under the `@jonahschulte` scope for independent installation. + +--- + +## Modules Modified + +### BMM (BMAD Main Method) +- Enhanced `dev.agent.yaml` with new workflow menu items +- Enhanced `sm.agent.yaml` with new workflow menu items +- Modified `create-story` workflow for requirements-focused planning +- Enhanced `dev-story` workflow with gap analysis integration + +### BMGD (BMAD Game Dev) +- Added parallel workflows for game development context +- Enhanced `game-dev.agent.yaml` and `game-scrum-master.agent.yaml` + +--- + +## Installation + +This fork can be installed via: + +```bash +npm install @jonahschulte/bmad-method +``` + +Or used directly by cloning this repository. + +--- + +## Documentation Added + +| Document | Purpose | +|----------|---------| +| `docs/super-dev-mode.md` | Super-dev workflow guide | +| `docs/autonomous-epic-processing.md` | Auto-epic documentation | +| `docs/gap-analysis.md` | Gap analysis user guide | +| `docs/gap-analysis-migration.md` | Migration from legacy | +| `docs/workflows/SPRINT-STATUS-SYNC-GUIDE.md` | Sprint status management | +| `docs/HOW-TO-VALIDATE-SPRINT-STATUS.md` | Validation how-to | +| `FEATURE-SUMMARY.md` | Complete feature overview | +| `INTEGRATION-NOTES.md` | Integration documentation | +| `TESTING-GUIDE.md` | Testing procedures | + +--- + +## Compatibility + +- **Backwards compatible** with upstream BMAD +- **No breaking changes** to existing workflows +- Users can opt-in to new features +- All schema validation passing +- All linting/formatting passing +- All tests passing + +--- + +## Contributing Back + +These features are candidates for upstream contribution: + +1. **Gap Analysis** - Solves a real problem with batch planning +2. **Story Pipeline v2.0** - Significant token savings +3. **Super-Dev Mode** - Quality enforcement + +See `PR-DESCRIPTION.md` and `PR-STORY-PIPELINE.md` for prepared PR descriptions. + +--- + +## Last Sync with Upstream + +**Date:** 2026-01-07 +**Upstream Commit:** `5c766577` (Add CNAME file) +**Merge Commit:** `9df79392` + +To sync with upstream: +```bash +git fetch upstream +git merge upstream/main +``` diff --git a/docs/autonomous-epic-processing.md b/docs/autonomous-epic-processing.md deleted file mode 100644 index bbe3b918..00000000 --- a/docs/autonomous-epic-processing.md +++ /dev/null @@ -1,190 +0,0 @@ -# Autonomous Epic Processing - -## Concept - -**Full-auto epic completion** - Create and develop all stories in an epic with zero human intervention. - -``` -/auto-epic epic-2 - -→ Creates story 2.1 → Super-dev → Done -→ Creates story 2.2 → Super-dev → Done -→ Creates story 2.3 → Super-dev → Done -... -→ Entire epic complete! ✅ -``` - -## Workflow - -``` -┌──────────────────────────────────────┐ -│ Auto-Epic Processor │ -│ │ -│ 1. Read epic definition │ -│ 2. For each story in epic: │ -│ ├─ create-story │ -│ ├─ super-dev-story │ -│ │ ├─ Pre gap analysis │ -│ │ ├─ Development │ -│ │ ├─ Post gap analysis │ -│ │ ├─ Code review │ -│ │ └─ Fix issues │ -│ └─ Mark done │ -│ 3. Epic retrospective │ -│ 4. Report completion │ -└──────────────────────────────────────┘ -``` - -## Use Cases - -### 1. Overnight Processing -```bash -# Start before leaving office -/auto-epic epic-3 - -# Come back next morning -# → Epic 100% complete -``` - -### 2. CI/CD Integration -```bash -# In GitHub Actions -bmad auto-epic epic-2 --config production.yaml -``` - -### 3. Batch Sprints -```bash -# Process multiple epics -/auto-epic epic-1,epic-2,epic-3 -``` - -## Configuration - -```yaml -# _bmad/bmm/config.yaml - -autonomous_mode: - enabled: true - - # Fail behavior - halt_on_error: false # Continue even if story fails - max_retry_per_story: 3 # Retry failed stories - - # Quality gates - require_super_dev: true # Use super-dev for all stories - require_100_percent: false # Require 100% test coverage - - # Notification - notify_on_complete: true # Send notification when done - notify_webhook: "" # Slack/Discord webhook -``` - -## Safety - -### Validation Before Start - -``` -Autonomous processing will: -- Create 15 stories -- Develop all automatically -- Take approximately 8 hours -- Commit all changes to: feature/epic-2-auto - -Confirm? [Y/n]: -``` - -### Checkpoints - -- Creates git branch for the epic -- Commits after each story -- Saves progress if interrupted -- Can resume from last completed story - -### Rollback - -```bash -# If something goes wrong -/auto-epic rollback epic-2 - -# Restores to pre-processing state -``` - -## Example Output - -``` -🤖 AUTONOMOUS EPIC PROCESSING: Epic 2 - User Management - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Story 2.1: User Registration -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -✅ create-story complete -✅ Pre-gap analysis: 0 changes needed -✅ Development: 8 tasks completed -✅ Post-gap analysis: All verified -✅ Code review: 2 minor issues found -✅ Fixes applied -✅ Story 2.1 DONE - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Story 2.2: User Login -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -✅ create-story complete -✅ Pre-gap analysis: Reuse registration code -✅ Development: 6 tasks completed -✅ Post-gap analysis: All verified -✅ Code review: No issues -✅ Story 2.2 DONE - -... - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -EPIC 2 COMPLETE! 🎉 -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Stories completed: 15/15 -Total time: 7h 23m -Test coverage: 94% -Code review issues: 12 (all fixed) - -Branch: feature/epic-2-auto -Ready to merge! -``` - -## Implementation Status - -- ✅ **IMPLEMENTED** in BMAD v6.0.0-alpha.22+ -- Available as: `/autonomous-epic` workflow -- Requires: Gap analysis and super-dev-story workflows -- Status: Ready for testing and feedback - -## Usage - -```bash -# Load any BMAD agent (PM, Dev, SM) -/autonomous-epic - -# Or specify epic number directly: -/autonomous-epic 2 -``` - -See [autonomous-epic workflow README](../src/modules/bmm/workflows/4-implementation/autonomous-epic/README.md) for complete documentation. - -## Real-World Usage - -**This is production-ready but experimental.** We recommend: -1. Test with small epics first (3-5 stories) -2. Monitor token usage and quality -3. Review completion reports thoroughly -4. Provide feedback to improve the feature - -## Contributing - -Found issues or have improvements? - -See [CONTRIBUTING.md](../CONTRIBUTING.md) - ---- - -**The future is NOW: Tell BMAD "Do Epic 4" and come back when it's done** ✨ diff --git a/docs/workflows/SPRINT-STATUS-SYNC-GUIDE.md b/docs/workflows/SPRINT-STATUS-SYNC-GUIDE.md deleted file mode 100644 index 0cb2b0ea..00000000 --- a/docs/workflows/SPRINT-STATUS-SYNC-GUIDE.md +++ /dev/null @@ -1,482 +0,0 @@ -# Sprint Status Sync - Complete Guide - -**Created:** 2026-01-02 -**Purpose:** Prevent drift between story files and sprint-status.yaml -**Status:** PRODUCTION READY - ---- - -## 🚨 THE PROBLEM WE SOLVED - -**Before Fix (2026-01-02):** -- 78% of story files (435/552) had NO `Status:` field -- 30+ completed stories not reflected in sprint-status.yaml -- Epic 19: 28 stories done, sprint-status said "in-progress" -- Epic 16d: 3 stories done, sprint-status said "backlog" -- Last verification: 32+ hours old - -**Root Cause:** -- Autonomous workflows prioritized velocity over tracking -- Manual workflows didn't enforce status updates -- No automated sync mechanism -- sprint-status.yaml manually maintained - ---- - -## ✅ THE SOLUTION (Full Workflow Fix) - -### Component 1: Automated Sync Script - -**Script:** `scripts/sync-sprint-status.sh` -**Purpose:** Scan story Status: fields → Update sprint-status.yaml - -**Usage:** -```bash -# Update sprint-status.yaml -pnpm sync:sprint-status - -# Preview changes (no modifications) -pnpm sync:sprint-status:dry-run - -# Validate only (exit 1 if out of sync) -pnpm validate:sprint-status -``` - -**Features:** -- Only updates stories WITH explicit Status: fields -- Skips stories without Status: (trusts sprint-status.yaml) -- Creates automatic backups (.sprint-status-backups/) -- Preserves all comments and structure -- Returns clear pass/fail exit codes - ---- - -### Component 2: Workflow Enforcement - -**Modified Files:** -1. `_bmad/bmm/workflows/4-implementation/dev-story/instructions.xml` -2. `_bmad/bmm/workflows/4-implementation/autonomous-epic/instructions.xml` - -**Changes:** -- ✅ HALT if story not found in sprint-status.yaml (was: warning) -- ✅ Verify sprint-status.yaml update persisted (new validation) -- ✅ Update both story Status: field AND sprint-status.yaml -- ✅ Fail loudly if either update fails - -**Before:** Workflows logged warnings, continued anyway -**After:** Workflows HALT if tracking update fails - ---- - -### Component 3: CI/CD Validation - -**Workflow:** `.github/workflows/validate-sprint-status.yml` -**Trigger:** Every PR touching docs/sprint-artifacts/ - -**Checks:** -1. sprint-status.yaml exists -2. All changed story files have Status: fields -3. sprint-status.yaml is in sync (runs validation) -4. Blocks merge if validation fails - -**How to fix CI failures:** -```bash -# See what's wrong -./scripts/sync-sprint-status.sh --dry-run - -# Fix it -./scripts/sync-sprint-status.sh - -# Commit -git add docs/sprint-artifacts/sprint-status.yaml -git commit -m "chore: sync sprint-status.yaml" -git push -``` - ---- - -### Component 4: pnpm Scripts - -**Added to package.json:** -```json -{ - "scripts": { - "sync:sprint-status": "./scripts/sync-sprint-status.sh", - "sync:sprint-status:dry-run": "./scripts/sync-sprint-status.sh --dry-run", - "validate:sprint-status": "./scripts/sync-sprint-status.sh --validate" - } -} -``` - -**When to run:** -- `pnpm sync:sprint-status` - After manually updating story Status: fields -- `pnpm validate:sprint-status` - Before committing changes -- Automatically in CI/CD - Validates on every PR - ---- - -## 🎯 NEW WORKFLOW (How It Works Now) - -### When Creating a Story - -``` -/create-story workflow - ↓ -1. Generate story file with Status: ready-for-dev - ↓ -2. Add entry to sprint-status.yaml with status "ready-for-dev" - ↓ -3. HALT if sprint-status.yaml update fails - ↓ -✅ Story file and sprint-status.yaml both updated -``` - -### When Implementing a Story - -``` -/dev-story workflow - ↓ -1. Load story, start work - ↓ -2. Mark tasks complete [x] - ↓ -3. Run tests, validate - ↓ -4. Update story Status: "in-progress" → "review" - ↓ -5. Update sprint-status.yaml: "in-progress" → "review" - ↓ -6. VERIFY sprint-status.yaml update persisted - ↓ -7. HALT if verification fails - ↓ -✅ Both updated and verified -``` - -### When Running Autonomous Epic - -``` -/autonomous-epic workflow - ↓ -For each story: - 1. Run super-dev-pipeline - ↓ - 2. Check all tasks complete - ↓ - 3. Update story Status: "done" - ↓ - 4. Update sprint-status.yaml entry to "done" - ↓ - 5. Verify update persisted - ↓ - 6. Log failure if verification fails (don't halt - continue) - ↓ -After all stories: - 7. Mark epic "done" in sprint-status.yaml - ↓ - 8. Verify epic status persisted - ↓ -✅ All stories and epic status updated -``` - ---- - -## 🛡️ ENFORCEMENT MECHANISMS - -### 1. Required Fields (Create-Story) -- **Enforcement:** Story MUST be added to sprint-status.yaml during creation -- **Validation:** Workflow HALTS if story not found after creation -- **Result:** No orphaned stories - -### 2. Status Updates (Dev-Story) -- **Enforcement:** Both Status: field AND sprint-status.yaml MUST update -- **Validation:** Re-read sprint-status.yaml to verify update -- **Result:** No silent failures - -### 3. Verification (Autonomous-Epic) -- **Enforcement:** Sprint-status.yaml updated after each story -- **Validation:** Verify update persisted, log failure if not -- **Result:** Tracking stays in sync even during autonomous runs - -### 4. CI/CD Gates (GitHub Actions) -- **Enforcement:** PR merge blocked if validation fails -- **Validation:** Runs `pnpm validate:sprint-status` on every PR -- **Result:** Drift cannot be merged - ---- - -## 📋 MANUAL SYNC PROCEDURES - -### If sprint-status.yaml Gets Out of Sync - -**Scenario 1: Story Status: fields updated but sprint-status.yaml not synced** -```bash -# See what needs updating -pnpm sync:sprint-status:dry-run - -# Apply updates -pnpm sync:sprint-status - -# Verify -pnpm validate:sprint-status - -# Commit -git add docs/sprint-artifacts/sprint-status.yaml -git commit -m "chore: sync sprint-status.yaml with story updates" -``` - -**Scenario 2: sprint-status.yaml has truth, story files missing Status: fields** -```bash -# Create script to backfill Status: fields FROM sprint-status.yaml -./scripts/backfill-story-status-fields.sh # (To be created if needed) - -# This would: -# 1. Read sprint-status.yaml -# 2. For each story entry, find the story file -# 3. Add/update Status: field to match sprint-status.yaml -# 4. Preserve all other content -``` - -**Scenario 3: Massive drift after autonomous work** -```bash -# Option A: Trust sprint-status.yaml (if it was manually verified) -# - Backfill story Status: fields from sprint-status.yaml -# - Don't run sync (sprint-status.yaml is source of truth) - -# Option B: Trust story Status: fields (if recently updated) -# - Run sync to update sprint-status.yaml -pnpm sync:sprint-status - -# Option C: Manual audit (when both are uncertain) -# - Review SPRINT-STATUS-AUDIT-2026-01-02.md -# - Check git commits for completion evidence -# - Manually correct both files -``` - ---- - -## 🧪 TESTING - -### Test 1: Validate Current State -```bash -pnpm validate:sprint-status -# Should exit 0 if in sync, exit 1 if discrepancies -``` - -### Test 2: Dry Run (No Changes) -```bash -pnpm sync:sprint-status:dry-run -# Shows what WOULD change without applying -``` - -### Test 3: Apply Sync -```bash -pnpm sync:sprint-status -# Updates sprint-status.yaml, creates backup -``` - -### Test 4: CI/CD Simulation -```bash -# Simulate PR validation -.github/workflows/validate-sprint-status.yml -# (Run via act or GitHub Actions) -``` - ---- - -## 📊 METRICS & MONITORING - -### How to Check Sprint Health - -**Check 1: Discrepancy Count** -```bash -pnpm sync:sprint-status:dry-run 2>&1 | grep "discrepancies" -# Should show: "0 discrepancies" if healthy -``` - -**Check 2: Last Verification Timestamp** -```bash -head -5 docs/sprint-artifacts/sprint-status.yaml | grep last_verified -# Should be within last 24 hours -``` - -**Check 3: Stories Missing Status: Fields** -```bash -grep -L "^Status:" docs/sprint-artifacts/*.md | wc -l -# Should decrease over time as stories get Status: fields -``` - -### Alerts to Set Up (Future) - -- ⚠️ If last_verified > 7 days old → Manual audit recommended -- ⚠️ If discrepancy count > 10 → Investigate why sync not running -- ⚠️ If stories without Status: > 50 → Backfill campaign needed - ---- - -## 🎓 BEST PRACTICES - -### For Story Creators -1. Always use `/create-story` workflow (adds to sprint-status.yaml automatically) -2. Never create story .md files manually -3. Always include Status: field in story template - -### For Story Implementers -1. Use `/dev-story` workflow (updates both Status: and sprint-status.yaml) -2. If manually updating Status: field, run `pnpm sync:sprint-status` after -3. Before marking "done", verify sprint-status.yaml reflects your work - -### For Autonomous Workflows -1. autonomous-epic workflow now includes sprint-status.yaml updates -2. Verifies updates persisted after each story -3. Logs failures but continues (doesn't halt entire epic for tracking issues) - -### For Code Reviewers -1. Check that PR includes sprint-status.yaml update if stories changed -2. Verify CI/CD validation passes -3. If validation fails, request sync before approving - ---- - -## 🔧 MAINTENANCE - -### Weekly Tasks -- [ ] Review discrepancy count: `pnpm sync:sprint-status:dry-run` -- [ ] Run sync if needed: `pnpm sync:sprint-status` -- [ ] Check backup count: `ls -1 .sprint-status-backups/ | wc -l` -- [ ] Clean old backups (keep last 30 days) - -### Monthly Tasks -- [ ] Full audit: Review SPRINT-STATUS-AUDIT template -- [ ] Backfill missing Status: fields (reduce count to <10) -- [ ] Verify all epics have correct status -- [ ] Update this guide based on learnings - ---- - -## 📝 FILE REFERENCE - -**Core Files:** -- `docs/sprint-artifacts/sprint-status.yaml` - Single source of truth -- `scripts/sync-sprint-status.sh` - Bash wrapper script -- `scripts/lib/sprint-status-updater.py` - Python updater logic - -**Workflow Files:** -- `_bmad/bmm/workflows/4-implementation/dev-story/instructions.xml` -- `_bmad/bmm/workflows/4-implementation/autonomous-epic/instructions.xml` -- `_bmad/bmm/workflows/4-implementation/create-story-with-gap-analysis/step-03-generate-story.md` - -**CI/CD:** -- `.github/workflows/validate-sprint-status.yml` - -**Documentation:** -- `SPRINT-STATUS-AUDIT-2026-01-02.md` - Initial audit findings -- `docs/workflows/SPRINT-STATUS-SYNC-GUIDE.md` - This file - ---- - -## 🐛 TROUBLESHOOTING - -### Issue: "Story not found in sprint-status.yaml" - -**Cause:** Story file created outside of /create-story workflow -**Fix:** -```bash -# Manually add to sprint-status.yaml under correct epic -vim docs/sprint-artifacts/sprint-status.yaml -# Add line: story-id: ready-for-dev - -# Or re-run create-story workflow -/create-story -``` - -### Issue: "sprint-status.yaml update failed to persist" - -**Cause:** File system permissions or concurrent writes -**Fix:** -```bash -# Check file permissions -ls -la docs/sprint-artifacts/sprint-status.yaml - -# Check for file locks -lsof | grep sprint-status.yaml - -# Manual update if needed -vim docs/sprint-artifacts/sprint-status.yaml -``` - -### Issue: "85 discrepancies found" - -**Cause:** Story Status: fields not updated after completion -**Fix:** -```bash -# Review discrepancies -pnpm sync:sprint-status:dry-run - -# Apply updates (will update sprint-status.yaml to match story files) -pnpm sync:sprint-status - -# If story files are WRONG (Status: ready-for-dev but actually done): -# Manually update story Status: fields first -# Then run sync -``` - ---- - -## 🎯 SUCCESS CRITERIA - -**System is working correctly when:** -- ✅ `pnpm validate:sprint-status` exits 0 (no discrepancies) -- ✅ Last verified timestamp < 24 hours old -- ✅ Stories with missing Status: fields < 10 -- ✅ CI/CD validation passes on all PRs -- ✅ New stories automatically added to sprint-status.yaml - -**System needs attention when:** -- ❌ Discrepancy count > 10 -- ❌ Last verified > 7 days old -- ❌ CI/CD validation failing frequently -- ❌ Stories missing Status: fields > 50 - ---- - -## 🔄 MIGRATION CHECKLIST (One-Time) - -If implementing this on an existing project: - -- [x] Create scripts/sync-sprint-status.sh -- [x] Create scripts/lib/sprint-status-updater.py -- [x] Modify dev-story workflow (add enforcement) -- [x] Modify autonomous-epic workflow (add verification) -- [x] Add CI/CD validation workflow -- [x] Add pnpm scripts -- [x] Run initial sync: `pnpm sync:sprint-status` -- [ ] Backfill missing Status: fields (optional, gradual) -- [x] Document in this guide -- [ ] Train team on new workflow -- [ ] Monitor for 2 weeks, adjust as needed - ---- - -## 📈 EXPECTED OUTCOMES - -**Immediate (Week 1):** -- sprint-status.yaml stays in sync -- New stories automatically tracked -- Autonomous work properly recorded - -**Short-term (Month 1):** -- Discrepancy count approaches zero -- CI/CD catches drift before merge -- Team trusts sprint-status.yaml as source of truth - -**Long-term (Month 3+):** -- Zero manual sprint-status.yaml updates needed -- Automated reporting reliable -- Velocity metrics accurate - ---- - -**Last Updated:** 2026-01-02 -**Status:** Active - Production Ready -**Maintained By:** Platform Team diff --git a/src/modules/bmgd/agents/game-dev.agent.yaml b/src/modules/bmgd/agents/game-dev.agent.yaml index 290e6071..d657d0e0 100644 --- a/src/modules/bmgd/agents/game-dev.agent.yaml +++ b/src/modules/bmgd/agents/game-dev.agent.yaml @@ -41,10 +41,6 @@ agent: workflow: "{project-root}/_bmad/bmgd/workflows/4-production/gap-analysis/workflow.yaml" description: "[GA] Run Gap Analysis - audit story tasks against codebase without starting development" - - trigger: AEP or fuzzy match on autonomous-epic - workflow: "{project-root}/_bmad/bmgd/workflows/4-production/autonomous-epic/workflow.yaml" - description: "[AEP] Autonomous Epic Processing - create and develop all stories in an epic automatically" - - trigger: PA or fuzzy match on push-all workflow: "{project-root}/_bmad/bmgd/workflows/4-production/push-all/workflow.yaml" description: "[PA] Push-All - stage, commit, and push all changes with safety validation" diff --git a/src/modules/bmgd/agents/game-scrum-master.agent.yaml b/src/modules/bmgd/agents/game-scrum-master.agent.yaml index 339ffda7..778c2f6b 100644 --- a/src/modules/bmgd/agents/game-scrum-master.agent.yaml +++ b/src/modules/bmgd/agents/game-scrum-master.agent.yaml @@ -45,10 +45,6 @@ agent: workflow: "{project-root}/_bmad/bmgd/workflows/4-production/gap-analysis/workflow.yaml" description: "[GA] Run Gap Analysis - audit story tasks against codebase (useful for sprint health checks)" - - trigger: AEP or fuzzy match on autonomous-epic - workflow: "{project-root}/_bmad/bmgd/workflows/4-production/autonomous-epic/workflow.yaml" - description: "[AEP] Autonomous Epic Processing - create and develop all stories in an epic automatically" - - trigger: VS or fuzzy match on validate-story validate-workflow: "{project-root}/_bmad/bmgd/workflows/4-production/create-story/workflow.yaml" description: "[VS] Validate Story Draft with Independent Review (Highly Recommended)" diff --git a/src/modules/bmgd/workflows/4-production/autonomous-epic/README.md b/src/modules/bmgd/workflows/4-production/autonomous-epic/README.md deleted file mode 100644 index a7b02bb6..00000000 --- a/src/modules/bmgd/workflows/4-production/autonomous-epic/README.md +++ /dev/null @@ -1,651 +0,0 @@ -# Autonomous Epic Processing - -**"Do Epic 4 for me" - Full automation of epic completion** - -## What It Does - -Autonomous epic processing combines just-in-time planning with automated development: - -``` -/autonomous-epic 2 - -→ Creates Story 2.1 → Develops with super-dev-story → Commits → Done ✅ -→ Creates Story 2.2 → Develops with super-dev-story → Commits → Done ✅ -→ Creates Story 2.3 → Develops with super-dev-story → Commits → Done ✅ -... -→ Entire Epic 2 complete! 🎉 -``` - -## How It Works - -``` -┌──────────────────────────────────────────────────┐ -│ Autonomous Epic Processor │ -│ │ -│ For each story in epic (sequential): │ -│ ┌─────────────────────────────────────────────┐ │ -│ │ 1. create-story (just-in-time planning) │ │ -│ │ ↓ │ │ -│ │ 2. super-dev-story (or dev-story) │ │ -│ │ ├─ Pre-dev gap analysis │ │ -│ │ ├─ Development (TDD) │ │ -│ │ ├─ Post-dev gap analysis (super-dev only) │ │ -│ │ ├─ Code review (super-dev only) │ │ -│ │ └─ Fix issues │ │ -│ │ ↓ │ │ -│ │ 3. Git commit │ │ -│ │ ↓ │ │ -│ │ 4. Save progress │ │ -│ └─────────────────────────────────────────────┘ │ -│ │ -│ Epic completion report generated │ -└──────────────────────────────────────────────────┘ -``` - -## Usage - -### Basic Usage - -```bash -# Load any BMAD agent -/autonomous-epic - -# Will prompt for epic number: -Enter epic number: 2 - -# Or provide directly: -/autonomous-epic epic-2 -``` - -### With Defaults - -```bash -/autonomous-epic 3 - -# Uses default settings: -# ✅ super-dev-story (comprehensive quality) -# ✅ Auto-accept gap analysis -# ✅ Create git commits -# ✅ Continue on errors -``` - -### With Custom Settings - -```bash -/autonomous-epic 3 - -# When prompted: -[C] Custom settings - -# Then configure: -# - dev-story or super-dev-story? -# - Auto-accept gap analysis? -# - Create git commits? -# - Halt on error or continue? -``` - -## Configuration - -### Default Settings (workflow.yaml) - -```yaml -autonomous_settings: - use_super_dev: true # Use super-dev-story (vs dev-story) - auto_accept_gap_analysis: true # Auto-approve gap analysis - halt_on_error: false # Continue even if story fails - max_retry_per_story: 2 # Retry failed stories - create_git_commits: true # Commit after each story - git_branch_prefix: "auto-epic-" # Branch: auto-epic-{epic_num} -``` - -### Per-Epic Override - -```yaml -# In sprint-status.yaml or epic frontmatter -epic-3: - autonomous_settings: - use_super_dev: false # Use dev-story (faster) - halt_on_error: true # Stop on first failure -``` - -## Time & Cost Estimates - -### Time per Story - -| Workflow | Avg Time per Story | Token Usage | -|----------|-------------------|-------------| -| **dev-story** | 20-40 minutes | 50K-100K | -| **super-dev-story** | 25-50 minutes | 80K-150K | - -### Epic Estimates - -| Epic Size | Time (dev-story) | Time (super-dev) | Tokens | -|-----------|-----------------|------------------|--------| -| Small (3-5 stories) | 1-3 hours | 2-4 hours | 250K-750K | -| Medium (6-10 stories) | 2-7 hours | 3-8 hours | 500K-1.5M | -| Large (11-20 stories) | 4-13 hours | 5-17 hours | 1M-3M | - -**Recommendation:** Run overnight for large epics - -## Example Session - -``` -🤖 Autonomous Epic Processing - -Enter epic number: 2 - -📊 Epic 2 Status -Total stories: 8 -- Backlog: 5 (will create + develop) -- Ready-for-dev: 2 (will develop) -- In-progress: 1 (will resume) -- Review: 0 -- Done: 0 - -Work Remaining: 8 stories -Estimated Time: 4-6 hours -Estimated Tokens: ~800K-1.2M - -Proceed? [Y/C/n]: Y - -✅ Starting autonomous epic processing... - -📝 Created git branch: auto-epic-2 - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Story 1/8: 2-1-user-registration -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Status: backlog - -📝 Creating story 2-1-user-registration... -✅ Story created - -💻 Developing story using super-dev-story... - Pre-gap: ✅ 0 changes needed - Development: ✅ 8 tasks completed - Post-gap: ✅ All verified - Code review: ✅ No issues -✅ Story complete (42 minutes, 95K tokens) - -📝 Committed: a1b2c3d - -Progress: 1 ✅ | 0 ❌ | 7 pending - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Story 2/8: 2-2-user-login -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -📝 Creating story 2-2-user-login... -✅ Story created - -💻 Developing story using super-dev-story... - Pre-gap: ✅ Reusing registration code (3 tasks refined) - Development: ✅ 6 tasks completed - Post-gap: ✅ All verified - Code review: ⚠️ 1 medium issue found - Code review: ✅ Issue fixed -✅ Story complete (38 minutes, 110K tokens) - -📝 Committed: d4e5f6g - -Progress: 2 ✅ | 0 ❌ | 6 pending - -[... continues for all 8 stories ...] - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -🎉 EPIC 2 AUTONOMOUS PROCESSING COMPLETE! -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Results: -✅ Stories completed: 8/8 -❌ Stories failed: 0 - -Statistics: -- Total time: 5h 23m -- Files created/modified: 47 -- Test coverage: 94% -- Code review issues: 6 (all fixed) - -Git Branch: auto-epic-2 -Commits: 8 - -Next Steps: -1. Review completion report -2. Run human code review -3. Merge auto-epic-2 -``` - -## Progress Tracking - -### Progress File - -Autonomous epic maintains state in `.autonomous-epic-progress.yaml`: - -```yaml -epic_num: 2 -started: 2025-01-18T10:00:00Z -total_stories: 8 -completed_stories: - - 2-1-user-registration - - 2-2-user-login -failed_stories: [] -current_story: 2-3-password-reset -status: running -``` - -### Resume from Interruption - -If interrupted (crash, manual stop, timeout): - -```bash -/autonomous-epic 2 - -# Detects existing progress file -# Shows: "Found in-progress epic processing. Resume? [Y/n]" -# Continues from last completed story -``` - -## Error Handling - -### Story Failures - -**With `halt_on_error: false` (default):** -``` -Story 2.3 fails -→ Logged in failed_stories -→ Continue to Story 2.4 -→ Report failures at end -``` - -**With `halt_on_error: true`:** -``` -Story 2.3 fails -→ Stop processing immediately -→ Report error -→ User fixes manually -→ Resume from Story 2.3 -``` - -### Retry Logic - -Each story gets {{max_retry_per_story}} attempts (default: 2): - -``` -Story 2.5 fails -→ Retry 1/2: Attempt again -→ Retry 2/2: Attempt again -→ Max retries: Mark failed, continue to next story -``` - -## Git Integration - -### Automatic Branching - -```bash -# Autonomous epic creates: -Branch: auto-epic-{epic_num} - -# Example: -/autonomous-epic 3 -→ Creates branch: auto-epic-3 -``` - -### Commits per Story - -Each story gets its own commit: - -``` -feat(epic-2): complete story 2-1-user-registration -feat(epic-2): complete story 2-2-user-login -feat(epic-2): complete story 2-3-password-reset -... -``` - -### Merge When Done - -```bash -# After autonomous epic completes: -git checkout main -git merge auto-epic-2 - -# Or create PR: -gh pr create --base main --head auto-epic-2 --title "Epic 2: User Management" -``` - -## Completion Report - -Generated at: `{{story_dir}}/epic-{{epic_num}}-completion-report.md` - -```markdown -# Epic 2 Completion Report - -**Generated:** 2025-01-18 -**Processing Time:** 5h 23m -**Success Rate:** 100% (8/8 stories) - -## Story Summary - -| Story | Status | Time | Files | Coverage | Issues | -|-------|--------|------|-------|----------|--------| -| 2.1 | ✅ Done | 42m | 6 | 95% | 0 | -| 2.2 | ✅ Done | 38m | 5 | 92% | 1 | -| 2.3 | ✅ Done | 45m | 7 | 96% | 2 | -... - -## Epic Statistics - -- Total files: 47 (35 created, 12 modified) -- Average coverage: 94% -- Code review issues: 6 (all resolved) -- Total commits: 8 - -## Quality Metrics - -- Stories passing first time: 6/8 (75%) -- Average fix iterations: 0.25 -- Zero critical issues escaped - -## Git Branch - -Branch: auto-epic-2 -Ready to merge - -## Recommendations - -- All stories met acceptance criteria -- Test coverage exceeds 90% target -- Code review found minimal issues -- Ready for human review and merge -``` - -## Best Practices - -### 1. Epic Sizing - -**Recommended epic sizes:** -- **Small (3-5 stories):** Can complete in single session -- **Medium (6-10 stories):** Overnight processing ideal -- **Large (11+ stories):** Consider breaking into sub-epics - -### 2. Choosing dev-story vs super-dev-story - -**Use super-dev-story for:** -- Security-critical epics -- Customer-facing features -- Complex business logic -- High-stakes production releases - -**Use dev-story for:** -- Internal tools -- Experimental features -- Non-critical improvements -- When speed matters more than extra validation - -### 3. Monitoring Progress - -```bash -# In another terminal, watch progress: -watch -n 10 'cat docs/sprint-artifacts/.autonomous-epic-progress.yaml' - -# Or tail completion report: -tail -f docs/sprint-artifacts/epic-2-completion-report.md -``` - -### 4. Interruption Handling - -**Safe to interrupt:** -- Ctrl+C between stories (progress saved) -- Terminal disconnect (can resume) -- Timeout (restarts from last completed) - -**Not safe to interrupt:** -- During story development (may leave partial work) -- During git commit (may corrupt repository) - -### 5. Resource Management - -**Token budgets:** -- Set LLM API limits to prevent runaway costs -- Monitor token usage in real-time -- Consider using dev-story for token savings - -**Time management:** -- Run overnight for large epics -- Schedule during low-activity periods -- Use CI/CD for completely automated runs - -## Troubleshooting - -### "Autonomous epic stuck on one story" - -**Cause:** Story has issues preventing completion -**Solution:** -- Check progress file for current_story -- Review that story's dev log -- May need manual intervention - -### "Epic processing stopped mid-story" - -**Cause:** Interruption during development -**Solution:** -- Check progress file status -- Resume with `/autonomous-epic {epic_num}` -- May need to manually clean up partial work - -### "Too many token failures" - -**Cause:** Hitting API rate limits -**Solution:** -- Reduce concurrent processing -- Use dev-story instead of super-dev-story -- Increase API tier/limits - -### "Git merge conflicts after autonomous epic" - -**Cause:** Other changes merged to main during processing -**Solution:** -- Rebase auto-epic branch on latest main -- Resolve conflicts manually -- This is expected for long-running processes - -## Safety Features - -### Max Retry Protection - -Prevents infinite loops: -- Each story: max 2 retries (default) -- After max retries: skip to next story -- Report failures at end - -### Progress Checkpoints - -After each story: -- Progress file updated -- Git commit created (if enabled) -- Can resume from this point - -### Fail-Safe Modes - -```yaml -# Conservative (halt on first problem): -halt_on_error: true -max_retry_per_story: 0 - -# Aggressive (push through everything): -halt_on_error: false -max_retry_per_story: 3 - -# Balanced (default): -halt_on_error: false -max_retry_per_story: 2 -``` - -## Use Cases - -### Use Case 1: Overnight Epic Completion - -```bash -# Before leaving office: -/autonomous-epic 4 - -# Next morning: -# → Epic 100% complete -# → All stories developed -# → All commits created -# → Ready for review -``` - -### Use Case 2: CI/CD Integration - -```bash -# In GitHub Actions: -name: Auto Epic Processing -on: - workflow_dispatch: - inputs: - epic_number: - required: true - -jobs: - process-epic: - steps: - - run: npx bmad-method@alpha autonomous-epic ${{ inputs.epic_number }} -``` - -### Use Case 3: Sprint Automation - -```bash -# Monday: Plan all epics for sprint -/sprint-planning - -# Tuesday: Auto-process Epic 1 -/autonomous-epic 1 - -# Wednesday: Auto-process Epic 2 -/autonomous-epic 2 - -# Thursday-Friday: Human review and merge -``` - -## Comparison to Manual Processing - -### Manual Workflow - -``` -Day 1: Create Story 2.1 → Review → Approve (30m) -Day 2: Develop Story 2.1 → Test → Review → Fix → Done (4h) -Day 3: Create Story 2.2 → Review → Approve (30m) -Day 4: Develop Story 2.2 → Test → Review → Fix → Done (3h) -... - -8 stories = 16 days minimum (with human bottlenecks) -``` - -### Autonomous Workflow - -``` -Day 1 (evening): /autonomous-epic 2 -Day 2 (morning): Epic complete, review ready - -8 stories = 6 hours machine time + 1-2 days human review -``` - -**Savings:** ~14 days, 90% reduction in calendar time - -## Limitations - -### What Autonomous Epic CAN'T Do - -- **Complex requirement clarifications** - Needs human for ambiguous requirements -- **Architectural decisions** - Major tech choices need human input -- **UX design decisions** - Visual/interaction design needs human creativity -- **Business logic validation** - Domain expertise often needs human verification - -### When to Use Manual Processing - -- First epic in new project (learning patterns) -- Experimental features (high uncertainty) -- Stories requiring extensive research -- Complex integrations with unknowns - -## Monitoring Output - -### Real-Time Progress - -```bash -# Terminal output shows: -Story 3/8: 2-3-password-reset - Pre-gap: ✅ 2 tasks refined - Development: ⏳ 2/6 tasks complete - ... -``` - -### Progress File - -```bash -# Check progress programmatically: -cat docs/sprint-artifacts/.autonomous-epic-progress.yaml - -# Example: -epic_num: 2 -status: running -completed_stories: [2-1-user-registration, 2-2-user-login] -current_story: 2-3-password-reset -``` - -### Completion Report - -```bash -# Generated when epic completes: -cat docs/sprint-artifacts/epic-2-completion-report.md -``` - -## Advanced: Batch Epic Processing - -Process multiple epics: - -```bash -# Sequential processing: -/autonomous-epic 1 -/autonomous-epic 2 -/autonomous-epic 3 - -# Or create meta-workflow for parallel processing -``` - -## FAQ - -### Q: Can I stop autonomous processing mid-epic? - -**A:** Yes, Ctrl+C between stories. Progress saved. Resume with `/autonomous-epic {num}` - -### Q: What if a story fails? - -**A:** Logged in failed_stories. By default, continues to next story. Fix manually later. - -### Q: Does this work with existing stories? - -**A:** Yes! Picks up any ready-for-dev or in-progress stories and develops them. - -### Q: Can I customize per story? - -**A:** Not currently. All stories in epic use same settings. Manual development for custom needs. - -### Q: What about dependencies between stories? - -**A:** Stories processed sequentially, so Story 2.2 can leverage Story 2.1's code (gap analysis handles this!) - -### Q: Token budget concerns? - -**A:** Use dev-story instead of super-dev-story to reduce token usage by ~30% - -## See Also - -- [super-dev-story](../super-dev-story/) - Enhanced quality workflow -- [dev-story](../dev-story/) - Standard development workflow -- [gap-analysis](../gap-analysis/) - Standalone audit tool -- [Autonomous Epic Concept](../../../../docs/autonomous-epic-processing.md) - Vision document - ---- - -**Autonomous Epic Processing: "Do Epic 4 for me" is now reality** ✨ diff --git a/src/modules/bmgd/workflows/4-production/autonomous-epic/instructions.xml b/src/modules/bmgd/workflows/4-production/autonomous-epic/instructions.xml deleted file mode 100644 index 866c374c..00000000 --- a/src/modules/bmgd/workflows/4-production/autonomous-epic/instructions.xml +++ /dev/null @@ -1,208 +0,0 @@ - - The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml - You MUST have already loaded and processed: {installed_path}/workflow.yaml - Communicate all responses in {communication_language} - 🤖 AUTONOMOUS EPIC PROCESSING - Full automation of epic completion! - This workflow orchestrates create-story and super-dev-story for each story in an epic - - - 🤖 **Autonomous Epic Processing** - - This workflow will automatically: - 1. Create each story just-in-time (using create-story) - 2. Develop each story (using super-dev-story or dev-story) - 3. Commit and push after each story (integrated in super-dev) - 4. Generate epic completion report - - **Time Estimate:** Varies by epic size - - Small epic (3-5 stories): 3-6 hours - - Medium epic (6-10 stories): 6-12 hours - - Large epic (11+ stories): 12-24 hours - - **Token Usage:** ~100K-150K per story - - - - Use provided epic number - - - - Enter epic number to process (e.g., "2" or "epic-3"), or [q] to quit: - - - Parse epic number from input - - - - - 👋 Autonomous epic processing cancelled. - HALT - - - - - Load {{sprint_status}} file - Find epic-{{epic_num}} entry - Count stories by status (backlog, ready-for-dev, in-progress, review, done) - - - 📊 **Epic {{epic_num}} Status** - - Total stories: {{total_story_count}} - - Backlog: {{backlog_count}} (will create + develop) - - Ready-for-dev: {{ready_count}} (will develop) - - In-progress: {{inprogress_count}} (will resume) - - Review/Done: {{done_count}} (will skip) - - **Work Remaining:** {{work_count}} stories - **Estimated Time:** {{estimated_hours}} hours - **Estimated Tokens:** ~{{estimated_tokens}}K - - - **Proceed with autonomous processing?** - - [Y] Yes - Use super-dev-story (comprehensive validation) - [D] Dev-story - Faster, less validation - [n] No - Cancel - - - - Set {{dev_workflow}} = "super-dev-story" - - - - Set {{dev_workflow}} = "dev-story" - - - - ❌ Cancelled - HALT - - - - - Get current branch name - Create new branch: auto-epic-{{epic_num}} - 📝 Created branch: auto-epic-{{epic_num}} - - Initialize progress tracking file: - - epic_num - - started timestamp - - total_stories - - completed_stories: [] - - current_story: null - - status: running - - - - - 🔄 STORY LOOP - Create and develop each story - - Find all stories in epic {{epic_num}} needing work - Sort by story number (ascending) - Initialize counters: success=0, failure=0 - - - - Set {{current_story}} - - - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Story {{counter}}/{{work_count}}: {{current_story.key}} - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - - - - 📝 Creating story... - - - - Create story just-in-time - - - ✅ Story created - - - - ❌ Failed to create story: {{error}} - Add to failed_stories, continue to next - - - - - - 💻 Developing with {{dev_workflow}}... - - - - - - Includes: dev + post-gap + review + push-all - - - - - - - - - - - Commit and push story changes - - - - ✅ Story complete and pushed - Increment success_count - Update progress file - - - - ❌ Story failed: {{error}} - Add to failed_stories, continue - Increment failure_count - - - Progress: {{success_count}} ✅ | {{failure_count}} ❌ | {{remaining}} pending - - - Update progress file status: complete - - - - - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - 🎉 EPIC {{epic_num}} COMPLETE! - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - **Results:** - ✅ Stories completed: {{success_count}}/{{total_count}} - {{if_failures}}❌ Stories failed: {{failure_count}}{{endif}} - - **Branch:** auto-epic-{{epic_num}} - **All changes pushed to remote** - - {{if_all_success}} - **Epic {{epic_num}} marked complete in sprint-status.yaml** - {{endif}} - - **Next Steps:** - 1. Review the work on branch auto-epic-{{epic_num}} - 2. Run human code review - 3. Merge when approved - - {{if_failures}} - **Failed Stories Need Attention:** - {{list_failed_stories}} - {{endif}} - - - - Update sprint-status: epic-{{epic_num}} = "done" - - - Remove progress file - - - diff --git a/src/modules/bmgd/workflows/4-production/autonomous-epic/workflow.yaml b/src/modules/bmgd/workflows/4-production/autonomous-epic/workflow.yaml deleted file mode 100644 index af6744b7..00000000 --- a/src/modules/bmgd/workflows/4-production/autonomous-epic/workflow.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: autonomous-epic -description: "Autonomous epic processing - creates and develops all stories in an epic with minimal human intervention" -author: "BMad" - -# Critical variables from config -config_source: "{project-root}/_bmad/bmgd/config.yaml" -user_name: "{config_source}:user_name" -communication_language: "{config_source}:communication_language" -implementation_artifacts: "{config_source}:implementation_artifacts" -story_dir: "{implementation_artifacts}" - -# Workflow components -installed_path: "{project-root}/_bmad/bmgd/workflows/4-production/autonomous-epic" -instructions: "{installed_path}/instructions.xml" -progress_file: "{story_dir}/.autonomous-epic-progress.yaml" - -# Variables -epic_num: "" # User provides or auto-discover next epic -sprint_status: "{implementation_artifacts}/sprint-status.yaml" -project_context: "**/project-context.md" - -# Autonomous mode settings -autonomous_settings: - use_super_dev: true # Use super-dev-story vs dev-story - auto_accept_gap_analysis: true # Auto-approve gap analysis refinements - halt_on_error: false # Continue even if story fails - max_retry_per_story: 2 # Retry failed stories - create_git_commits: true # Commit after each story - git_branch_prefix: "auto-epic-" # Branch name format: auto-epic-{epic_num} - -standalone: true - -web_bundle: false diff --git a/src/modules/bmm/agents/dev.agent.yaml b/src/modules/bmm/agents/dev.agent.yaml index de8e4f5e..50201eea 100644 --- a/src/modules/bmm/agents/dev.agent.yaml +++ b/src/modules/bmm/agents/dev.agent.yaml @@ -48,10 +48,6 @@ agent: workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/gap-analysis/workflow.yaml" description: "[GA] Run Gap Analysis - audit story tasks against codebase without starting development" - - trigger: AE or fuzzy match on autonomous-epic - workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml" - description: "[AE] Autonomous Epic Processing - create and develop all stories in an epic automatically" - - trigger: PA or fuzzy match on push-all workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/push-all/workflow.yaml" description: "[PA] Push-All - stage, commit, and push all changes with safety validation" diff --git a/src/modules/bmm/agents/sm.agent.yaml b/src/modules/bmm/agents/sm.agent.yaml index 9a8ebb4a..0bffebf4 100644 --- a/src/modules/bmm/agents/sm.agent.yaml +++ b/src/modules/bmm/agents/sm.agent.yaml @@ -41,10 +41,6 @@ agent: workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/gap-analysis/workflow.yaml" description: "[GA] Run Gap Analysis - audit story tasks against codebase (useful for sprint health checks)" - - trigger: AEP or fuzzy match on autonomous-epic - workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml" - description: "[AEP] Autonomous Epic Processing - create and develop all stories in an epic automatically" - - trigger: ER or fuzzy match on epic-retrospective workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/retrospective/workflow.yaml" data: "{project-root}/_bmad/_config/agent-manifest.csv" diff --git a/src/modules/bmm/workflows/4-implementation/autonomous-epic/README.md b/src/modules/bmm/workflows/4-implementation/autonomous-epic/README.md deleted file mode 100644 index 65094db2..00000000 --- a/src/modules/bmm/workflows/4-implementation/autonomous-epic/README.md +++ /dev/null @@ -1,704 +0,0 @@ -# Autonomous Epic Processing v2.0 - -**"Do Epic 4 for me" - Full automation of epic completion with anti-vibe-coding enforcement** - -## What It Does - -Autonomous epic processing combines just-in-time planning with disciplined automated development: - -``` -/autonomous-epic 2 - -→ Creates Story 2.1 (if backlog) → super-dev-pipeline → Commits → Done ✅ -→ Develops Story 2.2 → super-dev-pipeline → Commits → Done ✅ -→ Develops Story 2.3 → super-dev-pipeline → Commits → Done ✅ -... -→ Entire Epic 2 complete! 🎉 -``` - -## How It Works - -``` -┌──────────────────────────────────────────────────┐ -│ Autonomous Epic Processor v2.0 │ -│ │ -│ For each story in epic (sequential): │ -│ ┌─────────────────────────────────────────────┐ │ -│ │ 1. create-story (if backlog) │ │ -│ │ ↓ │ │ -│ │ 2. super-dev-pipeline (step-file discipline) │ │ -│ │ ├─ Pre-gap analysis (validate existing) │ │ -│ │ ├─ Adaptive implementation (TDD/refactor) │ │ -│ │ ├─ Post-validation (catch false positives)│ │ -│ │ ├─ Code review (find 3-10 issues) │ │ -│ │ └─ Complete (commit + push) │ │ -│ │ ↓ │ │ -│ │ 3. Verify completion (task-based) │ │ -│ │ ↓ │ │ -│ │ 4. Save progress │ │ -│ └─────────────────────────────────────────────┘ │ -│ │ -│ Epic completion report generated │ -└──────────────────────────────────────────────────┘ -``` - -## Usage - -### Basic Usage - -```bash -# Load any BMAD agent -/autonomous-epic - -# Will prompt for epic number: -Enter epic number: 2 - -# Or provide directly: -/autonomous-epic epic-2 -``` - -### With Defaults - -```bash -/autonomous-epic 3 - -# Uses default settings: -# ✅ super-dev-story (comprehensive quality) -# ✅ Auto-accept gap analysis -# ✅ Create git commits -# ✅ Continue on errors -``` - -### With Custom Settings - -```bash -/autonomous-epic 3 - -# When prompted: -[C] Custom settings - -# Then configure: -# - dev-story or super-dev-story? -# - Auto-accept gap analysis? -# - Create git commits? -# - Halt on error or continue? -``` - -## Configuration - -### Default Settings (workflow.yaml) - -```yaml -autonomous_settings: - use_super_dev_pipeline: true # Use super-dev-pipeline (step-file discipline) - pipeline_mode: "batch" # Batch mode for autonomous execution - halt_on_error: false # Continue even if story fails - max_retry_per_story: 2 # Retry failed stories - create_git_commits: true # Commit after each story - git_branch_prefix: "auto-epic-" # Branch: auto-epic-{epic_num} - -# super-dev-pipeline features -super_dev_pipeline_features: - token_efficiency: "40-60K per story (vs 100-150K)" - works_for: "Both greenfield AND brownfield" - anti_vibe_coding: "Step-file architecture prevents deviation" - brownfield_support: "Validates existing code before implementation" - -# Task-based completion verification -completion_verification: - task_based_completion: true # Check actual tasks, not just status - process_review_with_unchecked: true # Process "review" stories with unchecked tasks - process_done_with_unchecked: true # Process "done" stories if tasks remain - verify_after_development: true # Re-check after each story - strict_epic_completion: true # Epic only done when ALL tasks complete -``` - -### Task-Based Completion (Important!) - -**The autonomous epic workflow now uses TASK-BASED completion**, not just status-based: - -| What Changed | Old Behavior | New Behavior | -|--------------|--------------|--------------| -| "review" status | ⏭️ Skipped | ✅ Processed if unchecked tasks exist | -| "done" status | ⏭️ Skipped | ✅ Verified, processed if tasks remain | -| Completion check | Status-based | Task-based (count `- [ ]`) | -| Epic marked done | When all stories "done" | When ALL tasks `- [x]` | - -**Why this matters:** Code reviews often add new tasks (CR-1, CR-2, etc.) that need implementation. The old workflow would skip these stories because they were marked "review". Now we scan for actual unchecked tasks. - -``` -📊 Epic 4 Status (Task-Based Analysis) - -By Actual Task Completion: -- ✅ Truly Done: 0 (all tasks checked, will skip) -- 🔧 Needs Work: 7 (has unchecked tasks) - 4-1: 6 unchecked (CR tasks) - 4-2: 4 unchecked (original work) - 4-3: 7 unchecked (CR tasks) - ... -- 📝 Backlog: 0 (will create + develop) -``` - -### Per-Epic Override - -```yaml -# In sprint-status.yaml or epic frontmatter -epic-3: - autonomous_settings: - use_super_dev: false # Use dev-story (faster) - halt_on_error: true # Stop on first failure -``` - -## Time & Cost Estimates (v2.0) - -### Time per Story - -| Workflow | Avg Time per Story | Token Usage | -|----------|-------------------|-------------| -| **super-dev-pipeline** (default) | 20-45 minutes | 40K-60K | -| story-pipeline (greenfield only) | 15-30 minutes | 25K-30K | -| super-dev-story (legacy) | 25-50 minutes | 100K-150K | - -### Epic Estimates (using super-dev-pipeline) - -| Epic Size | Time Estimate | Token Estimate | -|-----------|--------------|----------------| -| Small (3-5 stories) | 2-5 hours | 120K-300K | -| Medium (6-10 stories) | 5-10 hours | 400K-600K | -| Large (11-20 stories) | 10-20 hours | 880K-1.2M | - -**Savings vs v1.0:** ~50% token reduction, ~25% time reduction - -**Recommendation:** Run overnight for large epics - -## Example Session - -``` -🤖 Autonomous Epic Processing - -Enter epic number: 2 - -📊 Epic 2 Status -Total stories: 8 -- Backlog: 5 (will create + develop) -- Ready-for-dev: 2 (will develop) -- In-progress: 1 (will resume) -- Review: 0 -- Done: 0 - -Work Remaining: 8 stories -Estimated Time: 4-6 hours -Estimated Tokens: ~800K-1.2M - -Proceed? [Y/C/n]: Y - -✅ Starting autonomous epic processing... - -📝 Created git branch: auto-epic-2 - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Story 1/8: 2-1-user-registration -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Status: backlog - -📝 Creating story 2-1-user-registration... -✅ Story created - -💻 Developing story using super-dev-pipeline... - Init: ✅ Greenfield detected - Pre-gap: ✅ 2 tasks refined, 1 added - Implementation: ✅ 9 tasks completed (TDD) - Post-validation: ✅ All verified - Code review: ✅ 4 issues found and fixed - Complete: ✅ Committed + pushed -✅ Story complete (38 minutes, 48K tokens) - -📝 Committed: a1b2c3d - -Progress: 1 ✅ | 0 ❌ | 7 pending - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Story 2/8: 2-2-user-login -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -📝 Creating story 2-2-user-login... -✅ Story created - -💻 Developing story using super-dev-story... - Pre-gap: ✅ Reusing registration code (3 tasks refined) - Development: ✅ 6 tasks completed - Post-gap: ✅ All verified - Code review: ⚠️ 1 medium issue found - Code review: ✅ Issue fixed -✅ Story complete (38 minutes, 110K tokens) - -📝 Committed: d4e5f6g - -Progress: 2 ✅ | 0 ❌ | 6 pending - -[... continues for all 8 stories ...] - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -🎉 EPIC 2 AUTONOMOUS PROCESSING COMPLETE! -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Results: -✅ Stories completed: 8/8 -❌ Stories failed: 0 - -Statistics: -- Total time: 5h 23m -- Files created/modified: 47 -- Test coverage: 94% -- Code review issues: 6 (all fixed) - -Git Branch: auto-epic-2 -Commits: 8 - -Next Steps: -1. Review completion report -2. Run human code review -3. Merge auto-epic-2 -``` - -## Progress Tracking - -### Progress File - -Autonomous epic maintains state in `.autonomous-epic-{{epic_num}}-progress.yaml`: - -> **Note:** Each epic gets its own tracking file to support parallel epic processing. -> For example: `.autonomous-epic-02-progress.yaml` for epic 02. -> -> **Backwards Compatibility:** The workflow checks for both the new format -> (`.autonomous-epic-02-progress.yaml`) and legacy format -> (`.autonomous-epic-progress-epic-02.yaml`) when looking for existing progress files. - -```yaml -epic_num: 2 -started: 2025-01-18T10:00:00Z -total_stories: 8 -completed_stories: - - 2-1-user-registration - - 2-2-user-login -failed_stories: [] -current_story: 2-3-password-reset -status: running -``` - -### Resume from Interruption - -If interrupted (crash, manual stop, timeout): - -```bash -/autonomous-epic 2 - -# Detects existing progress file -# Shows: "Found in-progress epic processing. Resume? [Y/n]" -# Continues from last completed story -``` - -## Error Handling - -### Story Failures - -**With `halt_on_error: false` (default):** -``` -Story 2.3 fails -→ Logged in failed_stories -→ Continue to Story 2.4 -→ Report failures at end -``` - -**With `halt_on_error: true`:** -``` -Story 2.3 fails -→ Stop processing immediately -→ Report error -→ User fixes manually -→ Resume from Story 2.3 -``` - -### Retry Logic - -Each story gets {{max_retry_per_story}} attempts (default: 2): - -``` -Story 2.5 fails -→ Retry 1/2: Attempt again -→ Retry 2/2: Attempt again -→ Max retries: Mark failed, continue to next story -``` - -## Git Integration - -### Automatic Branching - -```bash -# Autonomous epic creates: -Branch: auto-epic-{epic_num} - -# Example: -/autonomous-epic 3 -→ Creates branch: auto-epic-3 -``` - -### Commits per Story - -Each story gets its own commit: - -``` -feat(epic-2): complete story 2-1-user-registration -feat(epic-2): complete story 2-2-user-login -feat(epic-2): complete story 2-3-password-reset -... -``` - -### Merge When Done - -```bash -# After autonomous epic completes: -git checkout main -git merge auto-epic-2 - -# Or create PR: -gh pr create --base main --head auto-epic-2 --title "Epic 2: User Management" -``` - -## Completion Report - -Generated at: `{{story_dir}}/epic-{{epic_num}}-completion-report.md` - -```markdown -# Epic 2 Completion Report - -**Generated:** 2025-01-18 -**Processing Time:** 5h 23m -**Success Rate:** 100% (8/8 stories) - -## Story Summary - -| Story | Status | Time | Files | Coverage | Issues | -|-------|--------|------|-------|----------|--------| -| 2.1 | ✅ Done | 42m | 6 | 95% | 0 | -| 2.2 | ✅ Done | 38m | 5 | 92% | 1 | -| 2.3 | ✅ Done | 45m | 7 | 96% | 2 | -... - -## Epic Statistics - -- Total files: 47 (35 created, 12 modified) -- Average coverage: 94% -- Code review issues: 6 (all resolved) -- Total commits: 8 - -## Quality Metrics - -- Stories passing first time: 6/8 (75%) -- Average fix iterations: 0.25 -- Zero critical issues escaped - -## Git Branch - -Branch: auto-epic-2 -Ready to merge - -## Recommendations - -- All stories met acceptance criteria -- Test coverage exceeds 90% target -- Code review found minimal issues -- Ready for human review and merge -``` - -## Best Practices - -### 1. Epic Sizing - -**Recommended epic sizes:** -- **Small (3-5 stories):** Can complete in single session -- **Medium (6-10 stories):** Overnight processing ideal -- **Large (11+ stories):** Consider breaking into sub-epics - -### 2. Choosing dev-story vs super-dev-story - -**Use super-dev-story for:** -- Security-critical epics -- Customer-facing features -- Complex business logic -- High-stakes production releases - -**Use dev-story for:** -- Internal tools -- Experimental features -- Non-critical improvements -- When speed matters more than extra validation - -### 3. Monitoring Progress - -```bash -# In another terminal, watch progress: -watch -n 10 'cat _bmad-output/implementation-artifacts/.autonomous-epic-progress.yaml' - -# Or tail completion report: -tail -f _bmad-output/implementation-artifacts/epic-2-completion-report.md -``` - -### 4. Interruption Handling - -**Safe to interrupt:** -- Ctrl+C between stories (progress saved) -- Terminal disconnect (can resume) -- Timeout (restarts from last completed) - -**Not safe to interrupt:** -- During story development (may leave partial work) -- During git commit (may corrupt repository) - -### 5. Resource Management - -**Token budgets:** -- Set LLM API limits to prevent runaway costs -- Monitor token usage in real-time -- Consider using dev-story for token savings - -**Time management:** -- Run overnight for large epics -- Schedule during low-activity periods -- Use CI/CD for completely automated runs - -## Troubleshooting - -### "Autonomous epic stuck on one story" - -**Cause:** Story has issues preventing completion -**Solution:** -- Check progress file for current_story -- Review that story's dev log -- May need manual intervention - -### "Epic processing stopped mid-story" - -**Cause:** Interruption during development -**Solution:** -- Check progress file status -- Resume with `/autonomous-epic {epic_num}` -- May need to manually clean up partial work - -### "Too many token failures" - -**Cause:** Hitting API rate limits -**Solution:** -- Reduce concurrent processing -- Use dev-story instead of super-dev-story -- Increase API tier/limits - -### "Git merge conflicts after autonomous epic" - -**Cause:** Other changes merged to main during processing -**Solution:** -- Rebase auto-epic branch on latest main -- Resolve conflicts manually -- This is expected for long-running processes - -## Safety Features - -### Max Retry Protection - -Prevents infinite loops: -- Each story: max 2 retries (default) -- After max retries: skip to next story -- Report failures at end - -### Progress Checkpoints - -After each story: -- Progress file updated -- Git commit created (if enabled) -- Can resume from this point - -### Fail-Safe Modes - -```yaml -# Conservative (halt on first problem): -halt_on_error: true -max_retry_per_story: 0 - -# Aggressive (push through everything): -halt_on_error: false -max_retry_per_story: 3 - -# Balanced (default): -halt_on_error: false -max_retry_per_story: 2 -``` - -## Use Cases - -### Use Case 1: Overnight Epic Completion - -```bash -# Before leaving office: -/autonomous-epic 4 - -# Next morning: -# → Epic 100% complete -# → All stories developed -# → All commits created -# → Ready for review -``` - -### Use Case 2: CI/CD Integration - -```bash -# In GitHub Actions: -name: Auto Epic Processing -on: - workflow_dispatch: - inputs: - epic_number: - required: true - -jobs: - process-epic: - steps: - - run: npx bmad-method@alpha autonomous-epic ${{ inputs.epic_number }} -``` - -### Use Case 3: Sprint Automation - -```bash -# Monday: Plan all epics for sprint -/sprint-planning - -# Tuesday: Auto-process Epic 1 -/autonomous-epic 1 - -# Wednesday: Auto-process Epic 2 -/autonomous-epic 2 - -# Thursday-Friday: Human review and merge -``` - -## Comparison to Manual Processing - -### Manual Workflow - -``` -Day 1: Create Story 2.1 → Review → Approve (30m) -Day 2: Develop Story 2.1 → Test → Review → Fix → Done (4h) -Day 3: Create Story 2.2 → Review → Approve (30m) -Day 4: Develop Story 2.2 → Test → Review → Fix → Done (3h) -... - -8 stories = 16 days minimum (with human bottlenecks) -``` - -### Autonomous Workflow - -``` -Day 1 (evening): /autonomous-epic 2 -Day 2 (morning): Epic complete, review ready - -8 stories = 6 hours machine time + 1-2 days human review -``` - -**Savings:** ~14 days, 90% reduction in calendar time - -## Limitations - -### What Autonomous Epic CAN'T Do - -- **Complex requirement clarifications** - Needs human for ambiguous requirements -- **Architectural decisions** - Major tech choices need human input -- **UX design decisions** - Visual/interaction design needs human creativity -- **Business logic validation** - Domain expertise often needs human verification - -### When to Use Manual Processing - -- First epic in new project (learning patterns) -- Experimental features (high uncertainty) -- Stories requiring extensive research -- Complex integrations with unknowns - -## Monitoring Output - -### Real-Time Progress - -```bash -# Terminal output shows: -Story 3/8: 2-3-password-reset - Pre-gap: ✅ 2 tasks refined - Development: ⏳ 2/6 tasks complete - ... -``` - -### Progress File - -```bash -# Check progress programmatically: -cat _bmad-output/implementation-artifacts/.autonomous-epic-progress.yaml - -# Example: -epic_num: 2 -status: running -completed_stories: [2-1-user-registration, 2-2-user-login] -current_story: 2-3-password-reset -``` - -### Completion Report - -```bash -# Generated when epic completes: -cat _bmad-output/implementation-artifacts/epic-2-completion-report.md -``` - -## Advanced: Batch Epic Processing - -Process multiple epics: - -```bash -# Sequential processing: -/autonomous-epic 1 -/autonomous-epic 2 -/autonomous-epic 3 - -# Or create meta-workflow for parallel processing -``` - -## FAQ - -### Q: Can I stop autonomous processing mid-epic? - -**A:** Yes, Ctrl+C between stories. Progress saved. Resume with `/autonomous-epic {num}` - -### Q: What if a story fails? - -**A:** Logged in failed_stories. By default, continues to next story. Fix manually later. - -### Q: Does this work with existing stories? - -**A:** Yes! Picks up any ready-for-dev or in-progress stories and develops them. - -### Q: Can I customize per story? - -**A:** Not currently. All stories in epic use same settings. Manual development for custom needs. - -### Q: What about dependencies between stories? - -**A:** Stories processed sequentially, so Story 2.2 can leverage Story 2.1's code (gap analysis handles this!) - -### Q: Token budget concerns? - -**A:** Use dev-story instead of super-dev-story to reduce token usage by ~30% - -## See Also - -- [super-dev-story](../super-dev-story/) - Enhanced quality workflow -- [dev-story](../dev-story/) - Standard development workflow -- [gap-analysis](../gap-analysis/) - Standalone audit tool -- [Autonomous Epic Concept](../../../../docs/autonomous-epic-processing.md) - Vision document - ---- - -**Autonomous Epic Processing: "Do Epic 4 for me" is now reality** ✨ diff --git a/src/modules/bmm/workflows/4-implementation/autonomous-epic/instructions.xml b/src/modules/bmm/workflows/4-implementation/autonomous-epic/instructions.xml deleted file mode 100644 index e0e7eb4a..00000000 --- a/src/modules/bmm/workflows/4-implementation/autonomous-epic/instructions.xml +++ /dev/null @@ -1,332 +0,0 @@ - - The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml - You MUST have already loaded and processed: {installed_path}/workflow.yaml - Communicate all responses in {communication_language} - 🤖 AUTONOMOUS EPIC PROCESSING - Full automation of epic completion! - This workflow orchestrates super-dev-pipeline for each story in an epic - TASK-BASED COMPLETION: A story is ONLY complete when it has ZERO unchecked tasks (- [ ]) - - - ⚡ AUTONOMOUS MODE: When auto_accept_gap_analysis=true in workflow.yaml, you MUST: - - NEVER ask the user to approve gap analysis refinements - - AUTOMATICALLY accept all gap analysis proposals - - PROCEED immediately without waiting for user input on gap analysis - - Only ask for user input at the START of the workflow (epic selection, Y/D/n choice) - - ⚡ INVOKING SUB-WORKFLOWS: When you see invoke-workflow, you must: - 1. Load the referenced workflow.yaml file - 2. Load its instructions.xml file - 3. Execute that workflow completely - 4. Return to this workflow and continue - - - - - 🔍 **Epic Status Validation Mode** - -This will: -1. Scan ALL story files for task completion (count checkboxes) -2. Validate story file quality (>=10KB, proper task lists) -3. Update sprint-status.yaml to match REALITY (task completion) -4. Report suspicious stories (poor quality, false positives) - -**NO code will be generated** - validation only. - - - - - 🤖 **Autonomous Epic Processing** - -This workflow will automatically: -1. Develop each story using super-dev-pipeline -2. **Verify completion** by checking ALL tasks are done (- [x]) -3. Commit and push after each story (integrated in super-dev-pipeline) -4. Generate epic completion report - -**super-dev-pipeline includes:** -- Pre-gap analysis (understand existing code) -- Smart task batching (group related work) -- Implementation (systematic execution) -- **Post-implementation validation** (catches false positives!) -- Code review (adversarial, multi-agent) -- Completion (commit + push) - -**Key Improvement:** Stories in "review" status with unchecked tasks -WILL be processed - we check actual task completion, not just status! - - - - - Use provided epic number - - - - Enter epic number to process (e.g., "2" or "epic-3"), or [q] to quit: - - - Parse epic number from input - - - - - 👋 Autonomous epic processing cancelled. - HALT - - - - - Load {{sprint_status}} file - Find epic-{{epic_num}} entry and all story entries for this epic - - - For each story in epic: - 1. Read the story file from {{story_dir}}/{{story_key}}.md - 2. Check file exists (if missing, mark story as "backlog") - 3. Check file size (if <10KB, flag as poor quality) - 4. Count unchecked tasks: grep -c "^- \[ \]" or regex match "- \[ \]" - 5. Count checked tasks: grep -c "^- \[x\]" or regex match "- \[x\]" - 6. Count total tasks (unchecked + checked) - 7. Calculate completion rate: (checked / total * 100) - 8. Categorize story: - - "truly_done": unchecked_tasks=0 AND file_size>=10KB AND total_tasks>=5 - - "in_progress": unchecked_tasks>0 AND checked_tasks>0 - - "ready_for_dev": unchecked_tasks=total_tasks (nothing checked yet) - - "poor_quality": file_size<10KB OR total_tasks<5 (needs regeneration) - - "needs_work": unchecked_tasks > 0 (regardless of status) - - "backlog": status=backlog (file may not exist yet) - - - - 📊 **Epic {{epic_num}} Status (Task-Based Analysis)** - - Total stories: {{total_story_count}} - - **By Actual Task Completion:** - - ✅ Truly Done: {{truly_done_count}} (all tasks checked, will skip) - - 🔧 Needs Work: {{needs_work_count}} (has unchecked tasks) - {{list_needs_work_with_task_counts}} - - 📝 Backlog: {{backlog_count}} (will create + develop) - - **By Status (for reference):** - - done: {{done_status_count}} - - review: {{review_status_count}} - - in-progress: {{inprogress_status_count}} - - ready-for-dev: {{ready_status_count}} - - backlog: {{backlog_status_count}} - - **Work Remaining:** {{work_count}} stories with {{total_unchecked_tasks}} unchecked tasks - **Estimated Time:** {{estimated_hours}} hours - **Estimated Tokens:** ~{{estimated_tokens}}K - - - **Proceed with autonomous processing?** - - [Y] Yes - Use super-dev-pipeline (step-file architecture, brownfield-compatible) - [n] No - Cancel - - Note: super-dev-pipeline uses disciplined step-file execution with smart batching! - - - - Set {{use_super_dev_pipeline}} = true - - - - ❌ Cancelled - HALT - - - - - Get current branch name and store as {{current_branch}} - - - Create new branch: auto-epic-{{epic_num}} - 📝 Created branch: auto-epic-{{epic_num}} - - - - 📝 Staying on current branch: {{current_branch}} (parallel epic mode) - - - - Check for existing progress file: - 1. New format: .autonomous-epic-{{epic_num}}-progress.yaml - 2. Legacy format: .autonomous-epic-progress-epic-{{epic_num}}.yaml - Set {{progress_file_path}} to whichever exists, or new format if neither exist - - - - 📋 Found existing progress file: {{progress_file_path}} - ⚠️ Resuming from last saved state - Load existing progress from {{progress_file_path}} - - - - 📋 Creating new progress file: .autonomous-epic-{{epic_num}}-progress.yaml - Initialize progress tracking file at: .autonomous-epic-{{epic_num}}-progress.yaml - - epic_num - - started timestamp - - total_stories - - completed_stories: [] - - current_story: null - - status: running - - - - - - 🔄 STORY LOOP - Create and develop each story until ALL tasks complete - - Build ordered list of stories needing work: - 1. All stories with unchecked tasks (regardless of status) - 2. All backlog stories - 3. Sort by story number (ascending) - - Initialize counters: success=0, failure=0 - - - - Set {{current_story}} - Read story file from {{story_dir}}/{{current_story.key}}.md - - - ❌ Story file missing: {{current_story.key}}.md - Mark story as "backlog" in sprint-status.yaml - Continue to next story - - - Get file size in KB - Count unchecked tasks: grep -c "^- \[ \]" - Count checked tasks: grep -c "^- \[x\]" - Count total tasks - Calculate completion_rate = (checked / total * 100) - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Story {{counter}}/{{work_count}}: {{current_story.key}} -Size: {{file_size_kb}}KB | Tasks: {{checked}}/{{total}} ({{completion_rate}}%) -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - - - - Determine correct status: - IF unchecked_tasks == 0 AND file_size >= 10KB AND total_tasks >= 5 - → correct_status = "done" - ELSE IF unchecked_tasks > 0 AND checked_tasks > 0 - → correct_status = "in-progress" - ELSE IF unchecked_tasks == total_tasks - → correct_status = "ready-for-dev" - ELSE IF file_size < 10KB OR total_tasks < 5 - → correct_status = "ready-for-dev" (needs regeneration) - - - Update story status in sprint-status.yaml to {{correct_status}} - - - ⚠️ POOR QUALITY - File too small or missing tasks (needs /create-story regeneration) - - - Continue to next story (skip super-dev-pipeline) - - - - - - - 💻 Processing story with super-dev-pipeline ({{unchecked_count}} tasks remaining)... - - - - - - Full lifecycle: pre-gap → implement (batched) → post-validate → review → commit - - - - ✅ super-dev-pipeline completed - - - Re-read story file and count unchecked tasks - - - ⚠️ Story still has {{remaining_unchecked}} unchecked tasks after pipeline - Log incomplete tasks for review - Mark as partial success - - - - ✅ Story complete - all tasks checked! - Update story status to "done" in sprint-status.yaml - - - Increment success_count - Update progress file: {{progress_file_path}} - - - - ❌ super-dev-pipeline failed: {{error}} - Add to failed_stories with error details - Increment failure_count - - - - - Progress: {{success_count}} ✅ | {{failure_count}} ❌ | {{remaining}} pending - - - Update progress file status to complete: {{progress_file_path}} - - - - - Re-scan all epic stories for unchecked tasks - Calculate: total_remaining_tasks across all stories - - - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - 🎉 EPIC {{epic_num}} PROCESSING COMPLETE! - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - **Results:** - ✅ Stories processed: {{success_count}}/{{total_count}} - {{if_failures}}❌ Stories failed: {{failure_count}}{{endif}} - - **Task Completion:** - - Total tasks in epic: {{total_tasks}} - - Completed: {{completed_tasks}} ✅ - - Remaining: {{remaining_tasks}} ⏳ - - **Branch:** {{current_branch}} - **All changes committed** - - {{if_all_tasks_complete}} - ✅ **All tasks complete! Epic {{epic_num}} marked done in sprint-status.yaml** - {{endif}} - - {{if_tasks_remaining}} - ⚠️ **{{remaining_tasks}} tasks still unchecked - epic NOT marked complete** - Stories with remaining work: - {{list_incomplete_stories}} - {{endif}} - - **Next Steps:** - 1. Review the work on branch {{current_branch}} - 2. Run human code review - 3. Merge when approved - - {{if_failures}} - **Failed Stories Need Attention:** - {{list_failed_stories}} - {{endif}} - - - - Update sprint-status: epic-{{epic_num}} = "done" - - - Remove progress file: {{progress_file_path}} - - - diff --git a/src/modules/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml b/src/modules/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml deleted file mode 100644 index 9f457031..00000000 --- a/src/modules/bmm/workflows/4-implementation/autonomous-epic/workflow.yaml +++ /dev/null @@ -1,71 +0,0 @@ -name: autonomous-epic -description: "Autonomous epic processing using super-dev-pipeline - creates and develops all stories in an epic with minimal human intervention. Step-file architecture with smart batching!" -author: "BMad" -version: "3.0.0" # Upgraded to use super-dev-pipeline (works for both greenfield and brownfield) - -# Critical variables from config -config_source: "{project-root}/_bmad/bmm/config.yaml" -user_name: "{config_source}:user_name" -communication_language: "{config_source}:communication_language" -implementation_artifacts: "{config_source}:implementation_artifacts" -story_dir: "{implementation_artifacts}" - -# Workflow components -installed_path: "{project-root}/_bmad/bmm/workflows/4-implementation/autonomous-epic" -instructions: "{installed_path}/instructions.xml" -progress_file: "{story_dir}/.autonomous-epic-{epic_num}-progress.yaml" - -# Variables -epic_num: "" # User provides or auto-discover next epic -sprint_status: "{implementation_artifacts}/sprint-status.yaml" -project_context: "**/project-context.md" -validation_only: false # NEW: If true, only validate/fix status, don't implement - -# Autonomous mode settings -autonomous_settings: - use_super_dev_pipeline: true # Use super-dev-pipeline workflow (step-file architecture) - pipeline_mode: "batch" # Run super-dev-pipeline in batch mode (unattended) - halt_on_error: false # Continue even if story fails - max_retry_per_story: 2 # Retry failed stories - create_git_commits: true # Commit after each story (handled by super-dev-pipeline) - create_epic_branch: false # When false, stay on current branch (good for parallel epics) - git_branch_prefix: "auto-epic-" # Branch name format: auto-epic-{epic_num} (only used if create_epic_branch=true) - -# super-dev-pipeline benefits -super_dev_pipeline_features: - token_efficiency: "Step-file architecture prevents context bloat" - brownfield_support: "Works with existing codebases (unlike story-pipeline)" - includes: - - "Pre-gap analysis (understand what exists before starting)" - - "Smart batching (group related tasks)" - - "Implementation (systematic execution)" - - "Post-validation (verify changes work)" - - "Code review (adversarial, multi-agent)" - - "Completion (commit + push)" - quality_gates: "Same rigor as story-pipeline, works for brownfield" - checkpoint_resume: "Can resume from any step after failure" - -# TASK-BASED COMPLETION SETTINGS (NEW) -# These settings ensure stories are truly complete, not just marked as such -completion_verification: - # Use task-based completion instead of status-based - # A story is ONLY complete when it has ZERO unchecked tasks (- [ ]) - task_based_completion: true - - # Include stories in "review" status if they have unchecked tasks - # This catches code review findings that were added but not implemented - process_review_with_unchecked: true - - # Include stories in "done" status if they have unchecked tasks - # This catches stories incorrectly marked done - process_done_with_unchecked: true - - # Verify completion after each story by re-scanning for unchecked tasks - verify_after_development: true - - # Only mark epic as "done" if ALL stories have ZERO unchecked tasks - strict_epic_completion: true - -standalone: true - -web_bundle: false diff --git a/src/modules/bmm/workflows/4-implementation/dev-story/workflow.yaml b/src/modules/bmm/workflows/4-implementation/dev-story/workflow.yaml index 0dc61a8d..9c54c125 100644 --- a/src/modules/bmm/workflows/4-implementation/dev-story/workflow.yaml +++ b/src/modules/bmm/workflows/4-implementation/dev-story/workflow.yaml @@ -22,7 +22,7 @@ implementation_artifacts: "{config_source}:implementation_artifacts" sprint_status: "{implementation_artifacts}/sprint-status.yaml" project_context: "**/project-context.md" -# Autonomous mode settings (passed from parent workflow like autonomous-epic) +# Autonomous mode settings (passed from parent workflow like batch-super-dev) auto_accept_gap_analysis: false # When true, skip gap analysis approval prompt standalone: true diff --git a/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/README.md b/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/README.md index 71904d6f..71972414 100644 --- a/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/README.md +++ b/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/README.md @@ -61,9 +61,9 @@ Combines the best of both worlds: bmad super-dev-pipeline ``` -### From autonomous-epic +### From batch-super-dev ```bash -bmad autonomous-epic +bmad batch-super-dev # Automatically uses super-dev-pipeline for each story ``` @@ -116,7 +116,7 @@ Step-file architecture enforces: **Use super-dev-pipeline when:** - Working with existing codebase (brownfield) - Need vibe-coding prevention -- Running autonomous-epic +- Running batch-super-dev - Token counts will be high - Want disciplined execution diff --git a/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/steps/step-01-init.md b/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/steps/step-01-init.md index 76c99d4d..f5891601 100644 --- a/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/steps/step-01-init.md +++ b/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/steps/step-01-init.md @@ -38,7 +38,7 @@ Initialize the super-dev-pipeline: ### 1. Detect Execution Mode Check if running in batch or interactive mode: -- Batch mode: Invoked from autonomous-epic +- Batch mode: Invoked from batch-super-dev - Interactive mode: User-initiated Set `{mode}` variable. diff --git a/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/workflow.md b/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/workflow.md index 12155f81..db0d099c 100644 --- a/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/workflow.md +++ b/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/workflow.md @@ -165,7 +165,7 @@ Features: - User approval at quality gates - Can pause and resume -### Batch Mode (For autonomous-epic) +### Batch Mode (For batch-super-dev) ```bash bmad super-dev-pipeline --batch ``` @@ -289,4 +289,4 @@ This workflow **prevents vibe coding** through: --- -**super-dev-pipeline is the best of both worlds for autonomous-epic!** +**super-dev-pipeline is the best of both worlds for batch-super-dev!** diff --git a/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/workflow.yaml b/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/workflow.yaml index a436a17c..5ecb4e00 100644 --- a/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/workflow.yaml +++ b/src/modules/bmm/workflows/4-implementation/super-dev-pipeline/workflow.yaml @@ -28,7 +28,7 @@ modes: requires_approval: true smart_batching: true # User can approve batching plan batch: - description: "Unattended execution for autonomous-epic" + description: "Unattended execution for batch-super-dev" checkpoint_on_failure: true requires_approval: false fail_fast: true diff --git a/src/modules/bmm/workflows/4-implementation/super-dev-story/workflow.yaml b/src/modules/bmm/workflows/4-implementation/super-dev-story/workflow.yaml index 2a52de76..530f041c 100644 --- a/src/modules/bmm/workflows/4-implementation/super-dev-story/workflow.yaml +++ b/src/modules/bmm/workflows/4-implementation/super-dev-story/workflow.yaml @@ -29,7 +29,7 @@ super_dev_settings: fail_on_critical_issues: true max_fix_iterations: 3 -# Autonomous mode settings (passed from parent workflow like autonomous-epic) +# Autonomous mode settings (passed from parent workflow like batch-super-dev) auto_accept_gap_analysis: false # When true, skip gap analysis approval prompt standalone: true diff --git a/src/modules/bmm/workflows/4-implementation/validate-epic-status/instructions.xml b/src/modules/bmm/workflows/4-implementation/validate-epic-status/instructions.xml index 343c8cc7..94b10823 100644 --- a/src/modules/bmm/workflows/4-implementation/validate-epic-status/instructions.xml +++ b/src/modules/bmm/workflows/4-implementation/validate-epic-status/instructions.xml @@ -2,7 +2,7 @@ The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml You MUST have already loaded and processed: {installed_path}/workflow.yaml This is VALIDATION-ONLY mode - NO implementation, only status correction - Uses same logic as autonomous-epic but READS instead of WRITES code + Uses same logic as batch-super-dev but READS instead of WRITES code Check if {{epic_num}} was provided @@ -96,7 +96,7 @@ Analyzing {{story_count}} story files... Search {{story_dir}} for files: - .epic-{{epic_num}}-completion-report.md - - .autonomous-epic-{{epic_num}}-progress.yaml + - .batch-super-dev-{{epic_num}}-progress.yaml