This major enhancement revolutionizes the tech-spec workflow from a basic template-filling exercise into a context-aware, intelligent planning system for rapid development of bug fixes and small features. ## Tech-Spec Workflow Transformation (11 files) ### Core Workflow Intelligence (instructions.md) - Add standalone mode with interactive level/field-type detection - Implement brownfield convention detection and user confirmation - Integrate WebSearch for current framework versions and starter templates - Add comprehensive context discovery (stack, patterns, dependencies) - Implement auto-validation with quality scoring (always runs) - Add UX/UI considerations capture for user-facing changes - Add test framework detection and pattern analysis - Transform from batch generation to living document approach ### Comprehensive Tech-Spec Template (tech-spec-template.md) - Expand from 8 to 23 sections for complete context - Add Context section (available docs, project stack, existing structure) - Add Development Context (conventions, test framework, existing code) - Add UX/UI Considerations section - Add Developer Resources (file paths, key locations, testing) - Add Integration Points and Configuration Changes - All sections populated via template-output tags during workflow ### Enhanced Story Generation - Level 0 (instructions-level0-story.md): Extract from comprehensive tech-spec - Level 1 (instructions-level1-stories.md): Add story sequence validation, AC quality checks - User Story Template: Add Dev Agent Record sections for implementation tracking - Epic Template: Complete rewrite with proper structure and variables ### Validation & Quality (checklist.md) - Add context gathering completeness checks - Add definitiveness validation (no "use X or Y" statements) - Add brownfield integration quality scoring - Add stack alignment verification - Add implementation readiness assessment - Auto-generates validation report with scores ### Configuration (workflow.yaml) - Add runtime variables: project_level, project_type, development_context, change_type, field_type - Enable standalone operation without workflow-status.yaml - Support both workflow-init integration and quick-start mode ## Phase 4 Integration (3 files) ### Story Context Workflow - Add tech_spec to input_file_patterns (recognizes as authoritative source) - Update instructions to prioritize tech-spec for Level 0-1 projects - Tech-spec provides brownfield analysis, framework details, existing patterns ### Create Story Workflow - Add tech_spec to input_file_patterns - Enable story generation from tech-spec (alternative to PRD) - Supports both Quick Spec Flow and traditional BMM flow ## Documentation (2 new files) ### Quick Spec Flow Guide (docs/quick-spec-flow.md) - Comprehensive 595-line guide for Level 0-1 rapid development - Complete user journey examples (bug fix, small feature) - Context discovery explanation (stack, brownfield, conventions) - Auto-validation details and benefits - Integration with Phase 4 workflows - Comparison: Quick Spec vs Full BMM - Real-world examples and best practices ### Scale Adaptive System (docs/scale-adaptive-system.md) - Complete 950-line technical guide to BMad Method's 5-level system - Key terminology: Analysis, Tech-Spec, Epic-Tech-Spec, Architecture - Level 0-4 workflows, planning docs, and progression - Brownfield emphasis: document-project required first - Tech-spec (upfront, Level 0-1) vs epic-tech-spec (during implementation, Level 2-4) - Architecture document replaces tech-spec at Level 2+ (scales with complexity) - Retrospectives after each epic in multi-epic projects - Workflow path configuration reference ### README Updates - Add Quick Spec Flow announcement with benefits - Link to Scale Adaptive System documentation - Clarify when to use Quick Spec Flow vs Full BMM ## Key Features ### Context-Aware Intelligence - Auto-detects project stack from package.json, requirements.txt, etc. - Analyzes brownfield codebases using document-project output - Detects code conventions and confirms with user before proceeding - Uses WebSearch for up-to-date framework info and starter templates ### Brownfield Respect - Detects existing patterns (code style, test framework, naming conventions) - Asks user for confirmation before applying conventions - Adapts to existing code vs forcing changes - References document-project analysis for comprehensive context ### Auto-Validation - Always runs (not optional) - Validates context gathering, definitiveness, brownfield integration - Scores tech-spec quality and implementation readiness - Validates story sequence for Level 1 (no forward dependencies) ### Living Document Approach - Write to tech-spec continuously during discovery - Progressive refinement vs batch generation - Template variables populated via template-output tags in real-time ## Breaking Changes None - all changes are additive and backward compatible. ## Impact This transformation enables: - Bug fixes and small features implemented in minutes vs hours - Automatic stack detection and brownfield analysis - Respect for existing conventions and patterns - Current best practices via WebSearch integration - Comprehensive context that can replace story-context for simple efforts - Seamless integration with Phase 4 implementation workflows Quick Spec Flow now provides a **true fast path from idea to implementation** for Level 0-1 projects while maintaining quality through auto-validation and comprehensive context gathering. |
||
|---|---|---|
| .. | ||
| README.md | ||
| checklist.md | ||
| context-template.xml | ||
| instructions.md | ||
| workflow.yaml | ||
README.md
Story Context Assembly Workflow
Overview
Assembles a dynamic Story Context XML by pulling latest documentation and existing code/library artifacts relevant to a drafted story. Creates comprehensive development context for AI agents and developers working on specific stories.
Key Features
- Automated Context Discovery - Scans documentation and codebase for relevant artifacts
- XML Output Format - Structured context optimized for LLM consumption
- Dependency Detection - Identifies frameworks, packages, and technical dependencies
- Interface Mapping - Locates existing APIs and interfaces to reuse
- Testing Integration - Includes testing standards and generates test ideas
- Status Tracking - Updates story status and maintains context references
Usage
Basic Invocation
workflow story-context
With Specific Story
# Process specific story file
workflow story-context --input /path/to/story.md
# Using story path variable
workflow story-context --story_path "docs/stories/1.2.feature-name.md"
Configuration
- story_path: Path to target story markdown file (defaults to latest.md)
- auto_update_status: Whether to automatically update story status (default: false)
Workflow Structure
Files Included
story-context/
├── workflow.yaml # Configuration and metadata
├── instructions.md # Step-by-step execution guide
├── context-template.xml # XML structure template
├── checklist.md # Validation criteria
└── README.md # This file
Workflow Process
Phase 1: Story Analysis (Steps 1-2)
- Story Location: Finds and loads target story markdown file
- Content Parsing: Extracts epic ID, story ID, title, acceptance criteria, and tasks
- Template Initialization: Creates initial XML context structure
- User Story Extraction: Parses "As a... I want... So that..." components
Phase 2: Documentation Discovery (Step 3)
- Keyword Analysis: Identifies relevant terms from story content
- Document Scanning: Searches docs and module documentation
- Authority Prioritization: Prefers PRDs, architecture docs, and specs
- Context Extraction: Captures relevant sections with snippets
Phase 3: Code Analysis (Step 4)
- Symbol Search: Finds relevant modules, functions, and components
- Interface Identification: Locates existing APIs and interfaces
- Constraint Extraction: Identifies development patterns and requirements
- Reuse Opportunities: Highlights existing code to leverage
Phase 4: Dependency Analysis (Step 5)
- Manifest Detection: Scans for package.json, requirements.txt, go.mod, etc.
- Framework Identification: Identifies Unity, Node.js, Python, Go ecosystems
- Version Tracking: Captures dependency versions where available
- Configuration Discovery: Finds relevant project configurations
Phase 5: Testing Context (Step 6)
- Standards Extraction: Identifies testing frameworks and patterns
- Location Mapping: Documents where tests should be placed
- Test Ideas: Generates initial test concepts for acceptance criteria
- Framework Integration: Links to existing test infrastructure
Phase 6: Validation and Updates (Steps 7-8)
- XML Validation: Ensures proper structure and completeness
- Status Updates: Changes story status from Draft to ContextReadyDraft
- Reference Tracking: Adds context file reference to story document
- Quality Assurance: Validates against workflow checklist
Output
Generated Files
- Primary output: story-context-{epic_id}.{story_id}-{date}.xml
- Story updates: Modified original story file with context references
Output Structure
<storyContext>
<story>
<basicInfo>
<epicId>...</epicId>
<storyId>...</storyId>
<title>...</title>
<status>...</status>
</basicInfo>
<userStory>
<asA>...</asA>
<iWant>...</iWant>
<soThat>...</soThat>
</userStory>
<acceptanceCriteria>
<criterion id="1">...</criterion>
</acceptanceCriteria>
<tasks>
<task>...</task>
</tasks>
</story>
<artifacts>
<docs>
<doc path="..." title="..." section="..." snippet="..."/>
</docs>
<code>
<file path="..." kind="..." symbol="..." lines="..." reason="..."/>
</code>
<dependencies>
<node>
<package name="..." version="..."/>
</node>
</dependencies>
</artifacts>
<interfaces>
<interface name="..." kind="..." signature="..." path="..."/>
</interfaces>
<constraints>
<constraint>...</constraint>
</constraints>
<tests>
<standards>...</standards>
<locations>
<location>...</location>
</locations>
<ideas>
<idea ac="1">...</idea>
</ideas>
</tests>
</storyContext>
Requirements
- Story File: Valid story markdown with proper structure (epic.story.title.md format)
- Repository Access: Ability to scan documentation and source code
- Documentation: Project documentation in standard locations (docs/, src/, etc.)
Best Practices
Before Starting
- Ensure Story Quality: Verify story has clear acceptance criteria and tasks
- Update Documentation: Ensure relevant docs are current and discoverable
- Clean Repository: Remove obsolete code that might confuse context assembly
During Execution
- Review Extracted Context: Verify that discovered artifacts are actually relevant
- Check Interface Accuracy: Ensure identified APIs and interfaces are current
- Validate Dependencies: Confirm dependency information matches project state
After Completion
- Review XML Output: Validate the generated context makes sense
- Test with Developer: Have a developer review context usefulness
- Update Story Status: Verify story status was properly updated
Troubleshooting
Common Issues
Issue: Context contains irrelevant or outdated information
- Solution: Review keyword extraction and document filtering logic
- Check: Ensure story title and acceptance criteria are specific and clear
Issue: Missing relevant code or interfaces
- Solution: Verify code search patterns and symbol extraction
- Check: Ensure relevant code follows project naming conventions
Issue: Dependency information is incomplete or wrong
- Solution: Check for multiple package manifests or unusual project structure
- Check: Verify dependency files are in expected locations and formats
Customization
To customize this workflow:
- Modify Search Patterns: Update instructions.md to adjust code and doc discovery
- Extend XML Schema: Customize context-template.xml for additional context types
- Add Validation: Extend checklist.md with project-specific quality criteria
- Configure Dependencies: Adjust dependency detection for specific tech stacks
Version History
- v6.0.0 - XML-based context assembly with comprehensive artifact discovery
- Multi-ecosystem dependency detection
- Interface and constraint extraction
- Testing context integration
- Story status management
Support
For issues or questions:
- Review the workflow creation guide at
/bmad/bmb/workflows/create-workflow/workflow-creation-guide.md - Validate output using
checklist.md - Ensure story files follow expected markdown structure
- Check that repository structure supports automated discovery
Part of the BMad Method v6 - BMM (Method) Module