feat(analytics): Implement Analytics Dashboard and Token Management

This commit is contained in:
Michael committed 2026-01-20 13:49:24 +01:00
1 parent b38f082d6e
commit f8ddb44e38
822 files changed
+132545 -51

No files matched your search

@@ -0,0 +1,224 @@
---
name: 'step-01-init'
description: 'Initialize the architecture workflow, validate readiness, and discover input documents'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-01-init.md'
continueStepFile: '{workflow_path}/steps/step-01b-continue.md'
nextStepFile: '{workflow_path}/steps/step-02-context.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
templateFile: '{workflow_path}/templates/architecture-template.md'
# Knowledge Bases
decisionCatalog: '{workflow_path}/decision-catalog.yaml'
architecturePatterns: '{workflow_path}/architecture-patterns.yaml'
patternCategories: '{workflow_path}/pattern-categories.csv'
---
# Step 1: Initialize Architecture Workflow
**Progress: Step 1 of 9** - Next: Project Context
## STEP GOAL:
Validate workflow readiness, check for existing architecture work, discover input documents (GDD, Epics), and initialize the output document with proper frontmatter.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- CRITICAL: When loading next step with 'C', ensure entire file is read
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- Focus on architectural decisions that prevent AI agent conflicts
- This is a decision-focused workflow, not an implementation spec
### Step-Specific Rules:
- Check for existing architecture before starting fresh
- Validate that required input documents exist (GDD at minimum)
- Initialize document with proper frontmatter for state tracking
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Wait for user confirmation at each checkpoint
- Update frontmatter `stepsCompleted: [1]` before loading next step
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Check for Existing Architecture
**Search for existing architecture document:**
Look for existing architecture files in {output_folder}:
- `*architecture*.md`
- `*arch*.md`
**If existing architecture found:**
"I found an existing architecture document: `{{existing_file}}`
**Options:**
1. **Continue** - Resume from where you left off
2. **Start Fresh** - Begin a new architecture (will overwrite)
3. **Review** - Let me review the existing document first
Which would you like to do?"
**Handle user selection:**
- If **Continue**: Load `{continueStepFile}`
- If **Start Fresh**: Continue with step 2 below
- If **Review**: Show document summary and return to options
### 2. Discover Required Input Documents
**Search for GDD:**
Look for GDD files using patterns:
- `{output_folder}/*gdd*.md`
- `{output_folder}/*game-design*.md`
**If GDD not found:**
"**GDD Not Found**
The Architecture workflow works from your Game Design Document (GDD).
The GDD provides:
- Core mechanics and systems to architect
- Technical requirements and constraints
- Platform targets and performance needs
Please run the GDD workflow first: `create-gdd`"
**Exit workflow - GDD required**
**If GDD found:**
"**Input Document Found:**
- GDD: `{{gdd_file}}`
I'll analyze this to understand your game's technical requirements."
### 3. Discover Optional Input Documents
**Search for additional documents:**
- **Epics**: `{output_folder}/*epic*.md`
- **Game Brief**: `{output_folder}/*brief*.md`
- **Narrative**: `{output_folder}/*narrative*.md`
**Report findings:**
"**Additional Documents Found:**
{{list_of_found_documents}}
These will provide additional context for architectural decisions."
### 4. Confirm Workflow Start
**Present start confirmation:**
"**Ready to Start Architecture Workflow**
{{user_name}}, I'm ready to help you create the game architecture for your project.
**What we'll cover:**
1. Engine/framework selection and validation
2. Core architectural decisions (rendering, physics, networking, etc.)
3. Project structure and code organization
4. Implementation patterns for AI agent consistency
5. Cross-cutting concerns (error handling, logging, etc.)
**Input documents:**
- GDD: `{{gdd_file}}`
{{additional_documents_list}}
**The goal:** Create an architecture document that ensures all AI agents implement your game consistently.
Ready to begin? [Y/N]"
### 5. Initialize Output Document
**If user confirms, create the initial document:**
Create `{outputFile}` with frontmatter:
```markdown
---
title: 'Game Architecture'
project: '{{project_name}}'
date: '{{date}}'
author: '{{user_name}}'
version: '1.0'
stepsCompleted: [1]
status: 'in-progress'
# Source Documents
gdd: '{{gdd_file}}'
epics: '{{epics_file_or_null}}'
brief: '{{brief_file_or_null}}'
---
# Game Architecture
## Document Status
This architecture document is being created through the BMGD Architecture Workflow.
**Steps Completed:** 1 of 9 (Initialize)
---
_Content will be added as we progress through the workflow._
```
### 6. Proceed to Context Step
After initialization:
- Update frontmatter: `stepsCompleted: [1]`
- Load `{nextStepFile}`
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- Existing architecture check performed
- GDD discovered and validated
- Optional documents discovered
- User confirmed workflow start
- Output document initialized with proper frontmatter
- Frontmatter updated with stepsCompleted: [1]
### SYSTEM FAILURE:
- Skipping input document discovery
- Starting without user confirmation
- Not checking for existing architecture
- Missing frontmatter initialization
- Proceeding without GDD
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,154 @@
---
name: 'step-01b-continue'
description: 'Continue an existing architecture workflow from where it left off'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-01b-continue.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
# Step Files (for routing)
step02: '{workflow_path}/steps/step-02-context.md'
step03: '{workflow_path}/steps/step-03-starter.md'
step04: '{workflow_path}/steps/step-04-decisions.md'
step05: '{workflow_path}/steps/step-05-crosscutting.md'
step06: '{workflow_path}/steps/step-06-structure.md'
step07: '{workflow_path}/steps/step-07-patterns.md'
step08: '{workflow_path}/steps/step-08-validation.md'
step09: '{workflow_path}/steps/step-09-complete.md'
---
# Step 1b: Continue Existing Architecture
**Resuming Architecture Workflow**
## STEP GOAL:
Load the existing architecture document, determine progress, and route to the appropriate next step.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Step-Specific Rules:
- Parse frontmatter to determine completed steps
- Present summary of current progress
- Route to correct next step based on state
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Load Existing Architecture
**Read the existing architecture document:**
Load `{outputFile}` and parse the frontmatter to extract:
- `stepsCompleted` array
- `status`
- `project` name
- Source document references
### 2. Analyze Progress
**Determine workflow state:**
Map completed steps to workflow progress:
- Step 1: Initialize
- Step 2: Context
- Step 3: Starter/Engine
- Step 4: Decisions
- Step 5: Cross-cutting
- Step 6: Structure
- Step 7: Patterns
- Step 8: Validation
- Step 9: Complete
**Calculate next step:**
Find the highest completed step and determine the next step file to load.
### 3. Present Continuation Summary
"**Resuming Architecture Workflow**
{{user_name}}, I found your existing architecture for **{{project_name}}**.
**Progress:** Steps completed: {{stepsCompleted}}
**Current Status:**
- Last completed: {{last_step_name}}
- Next step: {{next_step_name}} (Step {{next_step_number}} of 9)
**Document sections completed:**
{{list_of_completed_sections}}
Would you like to:
1. **Continue** - Resume from {{next_step_name}}
2. **Review** - Show me what we've documented so far
3. **Restart Step** - Redo the last completed step
Select an option:"
### 4. Handle User Selection
**If Continue:**
- Load the next step file based on `stepsCompleted`
**If Review:**
- Present summary of all completed sections
- Return to continuation options
**If Restart Step:**
- Decrement stepsCompleted to remove last step
- Load the step file for the step being restarted
### 5. Route to Next Step
Based on next step number, load the appropriate step file:
| Next Step | File |
| --------- | -------- |
| 2 | {step02} |
| 3 | {step03} |
| 4 | {step04} |
| 5 | {step05} |
| 6 | {step06} |
| 7 | {step07} |
| 8 | {step08} |
| 9 | {step09} |
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- Existing document loaded and parsed
- Progress accurately determined
- User presented with clear options
- Correct step file loaded based on state
### SYSTEM FAILURE:
- Failing to parse frontmatter correctly
- Loading wrong step file
- Not presenting continuation options
- Overwriting existing progress without confirmation
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,263 @@
---
name: 'step-02-context'
description: 'Load and understand project context from GDD and supporting documents'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-02-context.md'
nextStepFile: '{workflow_path}/steps/step-03-starter.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
# Task References
advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
---
# Step 2: Project Context
**Progress: Step 2 of 9** - Next: Engine/Starter Selection
## STEP GOAL:
Load and analyze the GDD and supporting documents to understand the game's technical requirements, systems, and constraints that will drive architectural decisions.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- CRITICAL: When loading next step with 'C', ensure entire file is read
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- Extract technical implications from game design
- Identify complexity drivers and novel requirements
### Step-Specific Rules:
- Load ALL referenced input documents
- Identify systems that need architectural support
- Flag novel concepts requiring special attention
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Present A/P/C menu after context analysis
- ONLY proceed when user chooses C (Continue)
- Update frontmatter `stepsCompleted: [1, 2]` before loading next step
## COLLABORATION MENUS (A/P/C):
- **A (Advanced Elicitation)**: Deep dive into technical requirements
- **P (Party Mode)**: Get multiple perspectives on complexity
- **C (Continue)**: Confirm understanding and proceed
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Load GDD Document
**Load the full GDD:**
Read the GDD file identified in initialization. Extract:
- Game title and core concept
- Platform targets
- Core mechanics and systems
- Technical requirements section
- Performance constraints
- Multiplayer/networking needs
- Any technical risks identified
### 2. Load Supporting Documents
**Load any available supporting documents:**
- **Epics**: User stories and acceptance criteria
- **Game Brief**: Vision and scope constraints
- **Narrative**: Story-driven technical needs
### 3. Analyze Technical Requirements
**Extract and categorize technical needs:**
**Core Systems Identified:**
| System | Complexity | GDD Reference |
| --------------- | ------------------- | ------------- |
| {{system_name}} | {{low/medium/high}} | {{section}} |
**Platform Requirements:**
- Primary platform: {{platform}}
- Secondary platforms: {{if_any}}
- Cross-platform considerations: {{if_applicable}}
**Performance Constraints:**
- Frame rate target: {{fps}}
- Resolution support: {{resolutions}}
- Memory constraints: {{if_specified}}
- Load time requirements: {{if_specified}}
**Networking Requirements:**
- Multiplayer type: {{none/local/online}}
- Network architecture: {{p2p/client-server/hybrid}}
- Sync requirements: {{if_applicable}}
### 4. Identify Complexity Drivers
**Flag areas requiring architectural attention:**
"Based on my analysis, these are the complexity drivers:
**High Complexity:**
{{list_of_high_complexity_items}}
**Novel Concepts:**
{{unique_features_without_standard_patterns}}
**Technical Risks:**
{{risks_from_gdd}}"
### 5. Reflect Understanding
**Present analysis to user:**
"{{user_name}}, I've analyzed the technical requirements for **{{game_name}}**.
**Project Summary:**
- {{core_concept}}
- Platform: {{platform}}
- {{key_distinguishing_features}}
**Key Systems Requiring Architecture:**
1. {{system_1}} - {{brief_description}}
2. {{system_2}} - {{brief_description}}
3. {{system_3}} - {{brief_description}}
**Complexity Assessment:**
- Overall complexity: {{low/medium/high}}
- Novel elements: {{count}} requiring custom patterns
- Critical decisions: {{estimated_count}}
**Technical Constraints:**
{{summary_of_constraints}}
Does this match your understanding of the project?"
### 6. Generate Context Section
Based on the analysis, prepare the content:
```markdown
## Project Context
### Game Overview
**{{game_name}}** - {{core_concept}}
### Technical Scope
**Platform:** {{platform}}
**Genre:** {{genre}}
**Project Level:** {{complexity_level}}
### Core Systems
{{systems_table}}
### Technical Requirements
{{requirements_summary}}
### Complexity Drivers
{{complexity_analysis}}
### Technical Risks
{{identified_risks}}
```
### 7. Present Content and Menu
Show the generated content to the user and present:
"I've drafted the Project Context section based on my analysis.
**Here's what I'll add to the document:**
[Show the complete markdown content from step 6]
**Validation Check:**
- Have I captured all core systems?
- Are the complexity assessments accurate?
- Any technical constraints I missed?
**Select an Option:**
[A] Advanced Elicitation - Deep dive into technical requirements
[P] Party Mode - Get multiple perspectives on complexity
[C] Continue - Save this and move to Engine Selection (Step 3 of 9)"
### 8. Handle Menu Selection
#### IF A (Advanced Elicitation):
- Execute {advancedElicitationTask} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF P (Party Mode):
- Execute {partyModeWorkflow} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF C (Continue):
- Append the final content to `{outputFile}`
- Update frontmatter: `stepsCompleted: [1, 2]`
- Load `{nextStepFile}`
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN [C continue option] is selected and [context content saved with frontmatter updated], will you then load and read fully `{nextStepFile}`.
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- GDD fully loaded and analyzed
- Supporting documents incorporated
- Systems and complexity identified
- Technical constraints documented
- User confirmed understanding accuracy
- A/P/C menu presented and handled correctly
- Frontmatter updated with stepsCompleted: [1, 2]
### SYSTEM FAILURE:
- Generating analysis without reading documents
- Missing critical systems from GDD
- Proceeding without user confirmation
- Not presenting A/P/C menu after analysis
- Proceeding without user selecting 'C'
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,291 @@
---
name: 'step-03-starter'
description: 'Discover and evaluate game engine and starter template options'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-03-starter.md'
nextStepFile: '{workflow_path}/steps/step-04-decisions.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
# Task References
advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
---
# Step 3: Engine & Starter Selection
**Progress: Step 3 of 9** - Next: Architectural Decisions
## STEP GOAL:
Discover and evaluate game engine options and starter templates based on project requirements. Modern engines/starters make many architectural decisions automatically.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- CRITICAL: When loading next step with 'C', ensure entire file is read
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- Modern starters/engines provide many architectural decisions out of the box
- Verify current versions via web search - NEVER trust hardcoded versions
### Step-Specific Rules:
- ALWAYS search web for current versions
- Document which decisions the engine provides
- Help user understand engine trade-offs
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Present A/P/C menu after engine selection
- ONLY proceed when user chooses C (Continue)
- Update frontmatter `stepsCompleted: [1, 2, 3]` before loading next step
## COLLABORATION MENUS (A/P/C):
- **A (Advanced Elicitation)**: Explore alternative engines
- **P (Party Mode)**: Get perspectives on engine choice
- **C (Continue)**: Confirm selection and proceed
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Identify Engine Requirements
**Based on project context, determine engine needs:**
"Let's determine the right engine/framework for **{{game_name}}**.
**Your Requirements:**
- Platform: {{platform}}
- Genre: {{genre}}
- Key systems: {{key_systems}}
**Engine Considerations:**
| Requirement | Implications |
| ------------------- | --------------------- |
| **2D vs 3D** | {{2d_or_3d}} |
| **Performance** | {{performance_needs}} |
| **Networking** | {{networking_needs}} |
| **Platform Export** | {{platform_targets}} |
What engine or framework are you considering, or would you like recommendations?"
### 2. Research Engine Options
**If user has an engine in mind:**
Search the web to verify:
- Current stable version
- Platform support status
- Recent updates and roadmap
**If user wants recommendations:**
Based on requirements, search for appropriate options:
| Game Type | Recommended Options |
| ------------ | --------------------------- |
| **2D Indie** | Godot, Unity 2D, Phaser |
| **3D Indie** | Godot, Unity, Unreal |
| **Web Game** | Phaser, PixiJS, Three.js |
| **Mobile** | Unity, Godot, Flutter Flame |
| **VR/AR** | Unity, Unreal |
Search web: "{{recommended_engine}} game engine {{current_year}} version features"
### 3. Present Engine Options
**Present findings to user:**
"Based on your requirements, here are the engine options:
**Option 1: {{engine_1}}**
- Version: {{verified_version}}
- Strengths: {{strengths}}
- Considerations: {{considerations}}
- Best for: {{best_use_case}}
**Option 2: {{engine_2}}**
- Version: {{verified_version}}
- Strengths: {{strengths}}
- Considerations: {{considerations}}
- Best for: {{best_use_case}}
**Option 3: {{engine_3}}**
- Version: {{verified_version}}
- Strengths: {{strengths}}
- Considerations: {{considerations}}
- Best for: {{best_use_case}}
Which engine would you like to use for {{game_name}}?"
### 4. Document Engine Selection
**After user selects engine:**
"**Engine Selected:** {{selected_engine}} v{{version}}
**Decisions Provided by Engine:**
| Category | Decision | Provided By |
| -------------------- | ---------------------- | ----------- |
| **Rendering** | {{rendering_approach}} | Engine |
| **Physics** | {{physics_system}} | Engine |
| **Audio** | {{audio_system}} | Engine |
| **Input** | {{input_system}} | Engine |
| **Scene Management** | {{scene_approach}} | Engine |
| **Build System** | {{build_approach}} | Engine |
**Remaining Decisions:**
These architectural decisions still need to be made:
{{list_of_remaining_decisions}}
Does this look correct?"
### 5. Discover Starter Templates
**Search for project templates:**
Search web: "{{engine}} starter template {{game_type}} {{current_year}}"
**If templates found:**
"I found some starter templates for {{engine}}:
**{{template_1}}:**
- What it provides: {{features}}
- Setup command: `{{command}}`
**{{template_2}}:**
- What it provides: {{features}}
- Setup command: `{{command}}`
Would you like to use a starter template, or start from scratch?"
### 6. Generate Engine Section
Based on the conversation, prepare the content:
````markdown
## Engine & Framework
### Selected Engine
**{{engine_name}}** v{{version}}
**Rationale:** {{why_selected}}
### Project Initialization
{{if_starter_template}}
```bash
{{initialization_command}}
```
````
{{/if_starter_template}}
### Engine-Provided Architecture
| Component | Solution | Notes |
| --------- | -------- | ----- |
{{engine_provided_table}}
### Remaining Architectural Decisions
The following decisions must be made explicitly:
{{remaining_decisions_list}}
```
### 7. Present Content and Menu
Show the generated content to the user and present:
"I've drafted the Engine & Framework section.
**Here's what I'll add to the document:**
[Show the complete markdown content from step 6]
**Validation Check:**
- Is the engine version current?
- Are the engine-provided decisions accurate?
- Have we identified all remaining decisions?
**Select an Option:**
[A] Advanced Elicitation - Explore alternative engines
[P] Party Mode - Get perspectives on engine choice
[C] Continue - Save this and move to Architectural Decisions (Step 4 of 9)"
### 8. Handle Menu Selection
#### IF A (Advanced Elicitation):
- Execute {advancedElicitationTask} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF P (Party Mode):
- Execute {partyModeWorkflow} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF C (Continue):
- Append the final content to `{outputFile}`
- Update frontmatter: `stepsCompleted: [1, 2, 3]`
- Load `{nextStepFile}`
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN [C continue option] is selected and [engine content saved with frontmatter updated], will you then load and read fully `{nextStepFile}`.
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- Engine requirements clearly identified
- Current versions verified via web search
- Engine-provided decisions documented
- Remaining decisions identified
- Starter template evaluated if applicable
- A/P/C menu presented and handled correctly
- Frontmatter updated with stepsCompleted: [1, 2, 3]
### SYSTEM FAILURE:
- Using hardcoded versions without verification
- Not documenting engine-provided decisions
- Proceeding without user engine selection
- Not presenting A/P/C menu after selection
- Proceeding without user selecting 'C'
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
```
@@ -0,0 +1,301 @@
---
name: 'step-04-decisions'
description: 'Facilitate collaborative architectural decision making for game systems'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-04-decisions.md'
nextStepFile: '{workflow_path}/steps/step-05-crosscutting.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
# Knowledge Bases
decisionCatalog: '{workflow_path}/decision-catalog.yaml'
architecturePatterns: '{workflow_path}/architecture-patterns.yaml'
# Task References
advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
---
# Step 4: Architectural Decisions
**Progress: Step 4 of 9** - Next: Cross-cutting Concerns
## STEP GOAL:
Facilitate collaborative decision-making for all remaining architectural choices. Each decision must be made WITH the user, not FOR them.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- CRITICAL: When loading next step with 'C', ensure entire file is read
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- Each decision must be made WITH the user
- Present options, explain trade-offs, accept user choice
### Step-Specific Rules:
- Load decision catalog for structured guidance
- Verify technology versions via web search
- Document rationale for every decision
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Present A/P/C menu after all decisions documented
- ONLY proceed when user chooses C (Continue)
- Update frontmatter `stepsCompleted: [1, 2, 3, 4]` before loading next step
## COLLABORATION MENUS (A/P/C):
- **A (Advanced Elicitation)**: Challenge decisions and explore alternatives
- **P (Party Mode)**: Get multiple perspectives on choices
- **C (Continue)**: Confirm decisions and proceed
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Load Decision Framework
**Load decision catalog if available:**
Load `{decisionCatalog}` and `{architecturePatterns}` to guide the decision process.
**Identify required decisions based on game type:**
| Category | Decisions Needed |
| ---------------------- | --------------------------- |
| **State Management** | {{if_applicable}} |
| **Data Persistence** | Save system, config storage |
| **Networking** | {{if_multiplayer}} |
| **AI Systems** | {{if_has_ai}} |
| **Asset Loading** | Streaming, caching |
| **Scene Structure** | Scene graph, loading |
| **UI Framework** | In-game, menus |
| **Audio Architecture** | Channels, mixing |
### 2. Prioritize Decisions
**Create decision priority list:**
"Based on your project, here are the architectural decisions we need to make:
**CRITICAL (blocks everything):**
{{critical_decisions}}
**IMPORTANT (shapes architecture):**
{{important_decisions}}
**NICE-TO-HAVE (can defer):**
{{optional_decisions}}
Let's work through these in priority order."
### 3. Facilitate Each Decision
**For each decision, follow this pattern:**
"**Decision: {{decision_name}}**
{{context_about_why_this_matters}}
**Options:**
| Option | Pros | Cons |
| ------------ | -------- | -------- |
| {{option_1}} | {{pros}} | {{cons}} |
| {{option_2}} | {{pros}} | {{cons}} |
| {{option_3}} | {{pros}} | {{cons}} |
**Recommendation:** {{recommendation}} because {{reason}}
What's your preference? (or 'explain more' for details)"
**After user decides:**
Record:
- Category: {{category}}
- Decision: {{user_choice}}
- Version: {{if_applicable}}
- Rationale: {{user_reasoning}}
### 4. Game-Specific Decision Categories
**State Management:**
"How should game state be managed?
**Options:**
- **Singleton Pattern** - Simple, global access, harder to test
- **State Machine** - Clear transitions, good for game modes
- **ECS (Entity Component System)** - Scalable, decoupled, learning curve
- **Redux-style** - Predictable, time travel debugging, more boilerplate
For {{game_type}}, {{recommendation}} works well because {{reason}}.
Your choice?"
**Save System:**
"How should player progress be saved?
**Options:**
- **Local files** - JSON/binary, works offline
- **Cloud saves** - Cross-device, requires backend
- **Hybrid** - Local primary, cloud sync
- **Platform-specific** - Steam Cloud, console saves
Your choice?"
**Asset Loading:**
"How should assets be loaded?
**Options:**
- **Preload all** - Simple, longer initial load
- **Lazy loading** - Fast startup, potential hitches
- **Streaming** - Seamless, complex implementation
- **Scene-based** - Load per scene, clear boundaries
Your choice?"
### 5. Handle Version Verification
**For any technology-specific decisions:**
Search web: "{{technology}} latest stable version {{current_year}}"
Document:
- Technology: {{name}}
- Verified Version: {{version}}
- Verification Date: {{today}}
### 6. Generate Decisions Section
After all decisions are made, prepare the content:
```markdown
## Architectural Decisions
### Decision Summary
| Category | Decision | Version | Rationale |
| -------- | -------- | ------- | --------- |
{{decision_table_rows}}
### State Management
**Approach:** {{state_management_choice}}
{{state_management_details}}
### Data Persistence
**Save System:** {{save_system_choice}}
{{save_system_details}}
### Asset Management
**Loading Strategy:** {{asset_loading_choice}}
{{asset_loading_details}}
### {{Additional_Categories}}
{{additional_decision_details}}
### Architecture Decision Records
{{key_decisions_with_context}}
```
### 7. Present Content and Menu
Show the generated content to the user and present:
"I've documented all our architectural decisions.
**Here's what I'll add to the document:**
[Show the complete markdown content from step 6]
**Decisions Made:** {{count}} decisions documented
**Validation Check:**
- Are all critical decisions captured?
- Are versions current and verified?
- Does the rationale reflect your reasoning?
**Select an Option:**
[A] Advanced Elicitation - Challenge decisions, explore alternatives
[P] Party Mode - Get different perspectives on choices
[C] Continue - Save this and move to Cross-cutting Concerns (Step 5 of 9)"
### 8. Handle Menu Selection
#### IF A (Advanced Elicitation):
- Execute {advancedElicitationTask} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF P (Party Mode):
- Execute {partyModeWorkflow} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF C (Continue):
- Append the final content to `{outputFile}`
- Update frontmatter: `stepsCompleted: [1, 2, 3, 4]`
- Load `{nextStepFile}`
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN [C continue option] is selected and [decisions content saved with frontmatter updated], will you then load and read fully `{nextStepFile}`.
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- All required decisions identified
- User made each decision (not generated)
- Versions verified via web search
- Rationale documented for each decision
- A/P/C menu presented and handled correctly
- Frontmatter updated with stepsCompleted: [1, 2, 3, 4]
### SYSTEM FAILURE:
- Making decisions FOR the user
- Using unverified versions
- Missing critical decisions
- Not documenting rationale
- Not presenting A/P/C menu after decisions
- Proceeding without user selecting 'C'
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,320 @@
---
name: 'step-05-crosscutting'
description: 'Address cross-cutting concerns that affect all game systems'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-05-crosscutting.md'
nextStepFile: '{workflow_path}/steps/step-06-structure.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
# Task References
advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
---
# Step 5: Cross-cutting Concerns
**Progress: Step 5 of 9** - Next: Project Structure
## STEP GOAL:
Define patterns for concerns that affect EVERY system in the game: error handling, logging, configuration, events, and debugging. These decisions ensure consistency across all AI agent implementations.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- CRITICAL: When loading next step with 'C', ensure entire file is read
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- Cross-cutting concerns affect EVERY system
- Consistency here prevents major integration issues
### Step-Specific Rules:
- Focus on patterns that prevent AI agent conflicts
- Every decision must have a concrete example
- These become mandatory rules for all implementations
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Present A/P/C menu after all concerns documented
- ONLY proceed when user chooses C (Continue)
- Update frontmatter `stepsCompleted: [1, 2, 3, 4, 5]` before loading next step
## COLLABORATION MENUS (A/P/C):
- **A (Advanced Elicitation)**: Deep dive into specific concerns
- **P (Party Mode)**: Get perspectives on patterns
- **C (Continue)**: Confirm patterns and proceed
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Explain Cross-cutting Importance
"Now let's define cross-cutting concerns - patterns that apply to EVERY system.
**Why this matters:**
If one AI agent handles errors differently than another, your game breaks.
If logging formats vary, debugging becomes impossible.
These patterns are the 'constitution' that all code must follow.
Let's define each one."
### 2. Error Handling Strategy
"**Error Handling**
How should ALL systems handle errors?
**Options:**
| Approach | Description | Best For |
| ------------------------ | ------------------------------- | ------------------- |
| **Try-Catch Everywhere** | Explicit handling at each point | Critical systems |
| **Global Handler** | Centralized error management | Consistent recovery |
| **Signal/Event Based** | Emit errors as events | Decoupled systems |
| **Result Objects** | Return success/failure objects | Functional style |
**Game-specific considerations:**
- Should errors pause the game?
- How should critical vs recoverable errors differ?
- Should errors be visible to players?
What's your error handling strategy?"
### 3. Logging Approach
"**Logging Strategy**
How should ALL systems log information?
**Log Levels:**
- **ERROR**: Something broke
- **WARN**: Something unexpected but handled
- **INFO**: Normal operation milestones
- **DEBUG**: Detailed diagnostic info
- **TRACE**: Extremely verbose (development only)
**Questions:**
- What format? (structured JSON, plain text, engine-native)
- Where do logs go? (console, file, external service)
- What should always be logged vs conditional?
- How should performance-critical paths handle logging?
What's your logging approach?"
### 4. Configuration Management
"**Configuration Management**
How will game settings be organized and accessed?
**Configuration Types:**
- **Game constants** - Values that never change
- **Balancing values** - Tweakable gameplay numbers
- **Player settings** - User preferences
- **Platform settings** - Per-platform adjustments
**Storage options:**
- Hardcoded constants
- Configuration files (JSON, YAML)
- Engine-native systems
- Remote configuration
How should configuration be managed?"
### 5. Event/Signal System
"**Event System**
How should systems communicate without tight coupling?
**Options:**
| Pattern | Description | Complexity |
| ----------------- | --------------------- | ---------- |
| **Observer** | Direct subscription | Simple |
| **Event Bus** | Central dispatcher | Medium |
| **Signal/Slot** | Type-safe connections | Medium |
| **Message Queue** | Async processing | Complex |
**Questions:**
- Typed events or stringly-typed?
- Sync or async event processing?
- Event history/replay for debugging?
What's your event system approach?"
### 6. Debug/Development Tools
"**Debug & Development Tools**
What development tools should be built in?
**Common debug features:**
- Debug console/command system
- Visual debugging overlays
- State inspection tools
- Performance profiling hooks
- Cheat/testing commands
**Questions:**
- How are debug features enabled/disabled?
- Should they be in release builds?
- What's the debug key/activation method?
What debug tools do you want?"
### 7. Generate Cross-cutting Section
Based on the conversation, prepare the content:
````markdown
## Cross-cutting Concerns
These patterns apply to ALL systems and must be followed by every implementation.
### Error Handling
**Strategy:** {{error_strategy}}
**Error Levels:**
{{error_level_definitions}}
**Example:**
```{{language}}
{{error_handling_example}}
```
````
### Logging
**Format:** {{logging_format}}
**Destination:** {{log_destination}}
**Log Levels:**
{{log_level_usage}}
**Example:**
```{{language}}
{{logging_example}}
```
### Configuration
**Approach:** {{config_approach}}
**Configuration Structure:**
{{config_structure}}
### Event System
**Pattern:** {{event_pattern}}
**Event Naming:** {{naming_convention}}
**Example:**
```{{language}}
{{event_example}}
```
### Debug Tools
**Available Tools:**
{{debug_tool_list}}
**Activation:** {{how_to_enable}}
```
### 8. Present Content and Menu
Show the generated content to the user and present:
"I've documented all cross-cutting concerns.
**Here's what I'll add to the document:**
[Show the complete markdown content from step 7]
**Validation Check:**
- Do these patterns cover all systems?
- Are the examples clear enough for AI agents?
- Any edge cases we missed?
**Select an Option:**
[A] Advanced Elicitation - Deep dive into specific concerns
[P] Party Mode - Get perspectives on patterns
[C] Continue - Save this and move to Project Structure (Step 6 of 9)"
### 9. Handle Menu Selection
#### IF A (Advanced Elicitation):
- Execute {advancedElicitationTask} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF P (Party Mode):
- Execute {partyModeWorkflow} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF C (Continue):
- Append the final content to `{outputFile}`
- Update frontmatter: `stepsCompleted: [1, 2, 3, 4, 5]`
- Load `{nextStepFile}`
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN [C continue option] is selected and [cross-cutting content saved with frontmatter updated], will you then load and read fully `{nextStepFile}`.
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- Error handling strategy defined with example
- Logging approach documented
- Configuration management established
- Event system pattern selected
- Debug tools identified
- A/P/C menu presented and handled correctly
- Frontmatter updated with stepsCompleted: [1, 2, 3, 4, 5]
### SYSTEM FAILURE:
- Missing any cross-cutting concern
- No concrete examples provided
- Patterns too vague for AI agents to follow
- Not presenting A/P/C menu after documentation
- Proceeding without user selecting 'C'
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
```
@@ -0,0 +1,305 @@
---
name: 'step-06-structure'
description: 'Define project structure, directory organization, and architectural boundaries'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-06-structure.md'
nextStepFile: '{workflow_path}/steps/step-07-patterns.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
# Task References
advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
---
# Step 6: Project Structure
**Progress: Step 6 of 9** - Next: Implementation Patterns
## STEP GOAL:
Define the complete project structure including directory organization, file naming conventions, and architectural boundaries. This ensures all AI agents place code consistently.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- CRITICAL: When loading next step with 'C', ensure entire file is read
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- Project structure prevents "where does this go?" confusion
- Clear boundaries enable parallel development
### Step-Specific Rules:
- Structure must be complete, not generic placeholders
- Map every major system to a location
- Define naming conventions explicitly
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Present A/P/C menu after structure defined
- ONLY proceed when user chooses C (Continue)
- Update frontmatter `stepsCompleted: [1, 2, 3, 4, 5, 6]` before loading next step
## COLLABORATION MENUS (A/P/C):
- **A (Advanced Elicitation)**: Refine structure organization
- **P (Party Mode)**: Get perspectives on layout
- **C (Continue)**: Confirm structure and proceed
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Determine Organization Pattern
"Let's define how your project will be organized.
**Organization Patterns:**
| Pattern | Description | Best For |
| ----------------- | -------------------------------- | ------------- |
| **By Feature** | All related files together | Feature teams |
| **By Type** | Scripts, assets, scenes separate | Traditional |
| **Hybrid** | Types at top, features within | Balanced |
| **Domain-Driven** | By game domain/system | Complex games |
**Engine Conventions:**
- {{engine}} typically uses: {{engine_convention}}
What organization pattern do you prefer?"
### 2. Define Root Structure
"Based on {{selected_pattern}}, let's define your root structure.
**For {{engine}}, typical root looks like:**
```
{{project_name}}/
├── {{source_folder}}/ # Game source code
├── {{assets_folder}}/ # Art, audio, data
├── {{scenes_folder}}/ # Scene/level files
├── {{tests_folder}}/ # Test files
├── {{docs_folder}}/ # Documentation
└── {{config_files}} # Project config
```
Does this work, or would you like to adjust?"
### 3. Detail Source Structure
"Now let's detail the source code organization.
**Based on your systems:**
{{list_of_systems_from_context}}
**Proposed structure:**
```
{{source_folder}}/
├── core/ # Core systems (singletons, managers)
│ ├── {{core_systems}}
├── gameplay/ # Gameplay mechanics
│ ├── {{gameplay_systems}}
├── ui/ # User interface
│ ├── {{ui_organization}}
├── utils/ # Utilities and helpers
│ ├── {{util_types}}
└── data/ # Data structures and models
└── {{data_types}}
```
What adjustments would you make?"
### 4. Define Asset Structure
"Let's organize your assets.
**Asset Categories:**
- Art (sprites, textures, models)
- Audio (music, sfx, voice)
- Data (configurations, levels)
- UI (interface assets)
**Proposed asset structure:**
```
{{assets_folder}}/
├── art/
│ ├── {{art_categories}}
├── audio/
│ ├── music/
│ ├── sfx/
│ └── {{audio_categories}}
├── data/
│ └── {{data_file_types}}
└── ui/
└── {{ui_asset_types}}
```
How should assets be organized?"
### 5. Map Systems to Locations
"Let's map each major system to its location.
| System | Location | Notes |
| ------ | -------- | ----- |
{{system_location_mapping}}
Does this mapping make sense for your project?"
### 6. Define Naming Conventions
"Finally, let's establish naming conventions.
**Files:**
- Scripts: {{script_naming}} (e.g., PlayerController, enemy_spawner)
- Scenes: {{scene_naming}} (e.g., Level01, main_menu)
- Assets: {{asset_naming}} (e.g., player_idle, btn_play)
**Code Elements:**
- Classes: {{class_naming}} (e.g., PascalCase)
- Functions: {{function_naming}} (e.g., snake_case, camelCase)
- Variables: {{variable_naming}}
- Constants: {{constant_naming}} (e.g., UPPER_SNAKE)
**Game-Specific:**
- Prefabs/Scenes: {{prefab_naming}}
- Animation clips: {{animation_naming}}
- Event names: {{event_naming}}
What are your naming preferences?"
### 7. Generate Structure Section
Based on the conversation, prepare the content:
```markdown
## Project Structure
### Organization Pattern
**Pattern:** {{organization_pattern}}
**Rationale:** {{why_this_pattern}}
### Directory Structure
```
{{project_name}}/
{{complete_directory_tree}}
```
### System Location Mapping
| System | Location | Responsibility |
| ------ | -------- | -------------- |
{{system_mapping_table}}
### Naming Conventions
#### Files
{{file_naming_rules}}
#### Code Elements
| Element | Convention | Example |
| ------- | ---------- | ------- |
{{code_naming_table}}
#### Game Assets
{{asset_naming_rules}}
### Architectural Boundaries
{{boundary_rules}}
```
### 8. Present Content and Menu
Show the generated content to the user and present:
"I've defined the complete project structure.
**Here's what I'll add to the document:**
[Show the complete markdown content from step 7]
**Validation Check:**
- Can every system find its home?
- Are naming conventions clear and consistent?
- Will AI agents know exactly where to place new code?
**Select an Option:**
[A] Advanced Elicitation - Refine structure organization
[P] Party Mode - Get perspectives on layout
[C] Continue - Save this and move to Implementation Patterns (Step 7 of 9)"
### 9. Handle Menu Selection
#### IF A (Advanced Elicitation):
- Execute {advancedElicitationTask} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF P (Party Mode):
- Execute {partyModeWorkflow} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF C (Continue):
- Append the final content to `{outputFile}`
- Update frontmatter: `stepsCompleted: [1, 2, 3, 4, 5, 6]`
- Load `{nextStepFile}`
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN [C continue option] is selected and [structure content saved with frontmatter updated], will you then load and read fully `{nextStepFile}`.
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- Complete directory structure defined
- Every system mapped to location
- Naming conventions explicit and consistent
- No placeholder or generic structures
- A/P/C menu presented and handled correctly
- Frontmatter updated with stepsCompleted: [1, 2, 3, 4, 5, 6]
### SYSTEM FAILURE:
- Generic structure with placeholders
- Systems without clear locations
- Vague naming conventions
- Not presenting A/P/C menu after structure
- Proceeding without user selecting 'C'
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,350 @@
---
name: 'step-07-patterns'
description: 'Design implementation patterns and novel architectural patterns for consistency'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-07-patterns.md'
nextStepFile: '{workflow_path}/steps/step-08-validation.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
# Knowledge Bases
patternCategories: '{workflow_path}/pattern-categories.csv'
# Task References
advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
---
# Step 7: Implementation Patterns
**Progress: Step 7 of 9** - Next: Validation
## STEP GOAL:
Define implementation patterns that ensure multiple AI agents write compatible, consistent code. Also identify and design any novel patterns needed for unique game features.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- CRITICAL: When loading next step with 'C', ensure entire file is read
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- Implementation patterns prevent agent conflicts
- Novel patterns require creative collaboration
### Step-Specific Rules:
- Every pattern needs a concrete example
- Focus on what agents could decide DIFFERENTLY
- Novel patterns need full design documentation
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Present A/P/C menu after patterns defined
- ONLY proceed when user chooses C (Continue)
- Update frontmatter `stepsCompleted: [1, 2, 3, 4, 5, 6, 7]` before loading next step
## COLLABORATION MENUS (A/P/C):
- **A (Advanced Elicitation)**: Explore alternative patterns
- **P (Party Mode)**: Get perspectives on patterns
- **C (Continue)**: Confirm patterns and proceed
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Identify Novel Patterns Needed
"First, let's identify if your game needs any custom architectural patterns.
**Novel patterns are needed when:**
- Standard patterns don't fit your gameplay
- You have unique mechanics not found in other games
- Multiple systems interact in non-standard ways
**From your GDD, I identified these potentially novel concepts:**
{{list_of_unique_features}}
Do any of these need custom architectural patterns?"
### 2. Design Novel Patterns (if needed)
**For each novel pattern:**
"**Novel Pattern: {{pattern_name}}**
Let's design this pattern together.
**The challenge:** {{what_makes_this_unique}}
**Questions to answer:**
1. What components are involved?
2. How do they communicate?
3. What's the data flow?
4. How is state managed?
5. What are the edge cases?
Walk me through how you envision {{pattern_name}} working."
**After user explains:**
"Based on your description, here's the pattern design:
**{{pattern_name}} Pattern**
**Components:**
{{component_list_with_responsibilities}}
**Data Flow:**
{{sequence_or_diagram}}
**State Management:**
{{state_approach}}
**Example Usage:**
```{{language}}
{{code_example}}
```
Does this capture your vision?"
### 3. Define Standard Implementation Patterns
"Now let's define standard implementation patterns for consistency.
**These patterns ensure all AI agents:**
- Name things the same way
- Structure code identically
- Handle common situations consistently
Let's go through each category."
### 4. Component Communication Pattern
"**Component Communication**
How should game objects communicate?
**Options:**
- **Direct references** - Simple but coupled
- **Event-based** - Decoupled but indirect
- **Service locator** - Central registry
- **Dependency injection** - Explicit dependencies
For game systems, what's your preferred approach?"
### 5. Entity Creation Pattern
"**Entity Creation**
How should game entities (enemies, items, etc.) be created?
**Options:**
- **Factory pattern** - Centralized creation
- **Prefab instantiation** - Engine-native
- **Object pooling** - Performance-focused
- **Builder pattern** - Complex configuration
What's your entity creation approach?"
### 6. State Transition Pattern
"**State Transitions**
How should entities handle state changes?
**Options:**
- **State machine** - Explicit states and transitions
- **Behavior tree** - AI-focused hierarchy
- **Blackboard** - Shared data approach
- **Flag-based** - Simple boolean states
What state management pattern for entities?"
### 7. Data Access Pattern
"**Data Access**
How should systems access game data?
**Options:**
- **Direct file access** - Simple but scattered
- **Data manager** - Centralized access
- **Scriptable objects** - Engine-native (Unity)
- **Resources/Autoload** - Engine-native (Godot)
How should data be accessed?"
### 8. Generate Patterns Section
Based on the conversation, prepare the content:
````markdown
## Implementation Patterns
These patterns ensure consistent implementation across all AI agents.
{{if_novel_patterns}}
### Novel Patterns
#### {{novel_pattern_name}}
**Purpose:** {{what_it_solves}}
**Components:**
{{component_list}}
**Data Flow:**
{{flow_description}}
**Implementation Guide:**
```{{language}}
{{implementation_example}}
```
````
**Usage:**
{{when_to_use}}
{{/if_novel_patterns}}
### Communication Patterns
**Pattern:** {{communication_pattern}}
**Example:**
```{{language}}
{{communication_example}}
```
### Entity Patterns
**Creation:** {{creation_pattern}}
**Example:**
```{{language}}
{{creation_example}}
```
### State Patterns
**Pattern:** {{state_pattern}}
**Example:**
```{{language}}
{{state_example}}
```
### Data Patterns
**Access:** {{data_pattern}}
**Example:**
```{{language}}
{{data_example}}
```
### Consistency Rules
| Pattern | Convention | Enforcement |
| ------- | ---------- | ----------- |
{{consistency_rules_table}}
```
### 9. Present Content and Menu
Show the generated content to the user and present:
"I've documented all implementation patterns.
**Here's what I'll add to the document:**
[Show the complete markdown content from step 8]
**Patterns Defined:**
- {{count}} standard patterns
- {{novel_count}} novel patterns
**Validation Check:**
- Are examples clear enough for AI agents?
- Do patterns cover all major coding scenarios?
- Are novel patterns fully documented?
**Select an Option:**
[A] Advanced Elicitation - Explore alternative patterns
[P] Party Mode - Get perspectives on patterns
[C] Continue - Save this and move to Validation (Step 8 of 9)"
### 10. Handle Menu Selection
#### IF A (Advanced Elicitation):
- Execute {advancedElicitationTask} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF P (Party Mode):
- Execute {partyModeWorkflow} with the current content
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, return to A/P/C menu
- If no: Keep original, return to A/P/C menu
#### IF C (Continue):
- Append the final content to `{outputFile}`
- Update frontmatter: `stepsCompleted: [1, 2, 3, 4, 5, 6, 7]`
- Load `{nextStepFile}`
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN [C continue option] is selected and [patterns content saved with frontmatter updated], will you then load and read fully `{nextStepFile}`.
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- Novel patterns identified and designed
- Standard patterns selected with examples
- Every pattern has concrete code examples
- Consistency rules documented
- A/P/C menu presented and handled correctly
- Frontmatter updated with stepsCompleted: [1, 2, 3, 4, 5, 6, 7]
### SYSTEM FAILURE:
- Patterns without concrete examples
- Novel patterns missing design documentation
- Vague patterns that allow inconsistency
- Not presenting A/P/C menu after patterns
- Proceeding without user selecting 'C'
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
```
@@ -0,0 +1,294 @@
---
name: 'step-08-validation'
description: 'Validate architectural coherence and completeness'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-08-validation.md'
nextStepFile: '{workflow_path}/steps/step-09-complete.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
checklistFile: '{workflow_path}/checklist.md'
# Task References
advancedElicitationTask: '{project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml'
partyModeWorkflow: '{project-root}/_bmad/core/workflows/party-mode/workflow.md'
---
# Step 8: Validation
**Progress: Step 8 of 9** - Next: Completion
## STEP GOAL:
Validate that the architecture is coherent, complete, and ready to guide AI agent implementation. Check for conflicts, gaps, and missing coverage.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- CRITICAL: When loading next step with 'C', ensure entire file is read
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- Validation ensures document completeness
- Catch gaps before implementation begins
### Step-Specific Rules:
- Run through all validation checks
- Fix any issues before proceeding
- User must confirm document is ready
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Present A/P/C menu after validation complete
- ONLY proceed when user chooses C (Continue)
- Update frontmatter `stepsCompleted: [1, 2, 3, 4, 5, 6, 7, 8]` before loading next step
## COLLABORATION MENUS (A/P/C):
- **A (Advanced Elicitation)**: Deep dive into gaps
- **P (Party Mode)**: Get perspectives on completeness
- **C (Continue)**: Confirm validation and proceed
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Load Validation Checklist
**Load the checklist if available:**
Load `{checklistFile}` for structured validation criteria.
### 2. Decision Compatibility Check
"**Checking Decision Compatibility...**
Verifying all architectural decisions work together:
| Check | Status | Notes |
| ------------------------------ | ------------- | --------- |
| Engine + patterns compatible | {{pass/fail}} | {{notes}} |
| Cross-cutting + engine align | {{pass/fail}} | {{notes}} |
| Structure supports all systems | {{pass/fail}} | {{notes}} |
| No conflicting decisions | {{pass/fail}} | {{notes}} |
{{if_issues_found}}
**Issues Found:**
{{list_of_conflicts}}
How should we resolve these?
{{/if_issues_found}}"
### 3. GDD Coverage Check
"**Checking GDD Coverage...**
Verifying every GDD requirement has architectural support:
**Core Systems:**
| System | Architecture Support | Status |
| ------ | -------------------- | ------ |
{{systems_coverage_table}}
**Technical Requirements:**
| Requirement | How Addressed | Status |
| ----------- | ------------- | ------ |
{{requirements_coverage_table}}
{{if_gaps_found}}
**Gaps Found:**
{{list_of_gaps}}
How should we address these?
{{/if_gaps_found}}"
### 4. Pattern Completeness Check
"**Checking Pattern Completeness...**
Verifying implementation patterns cover all scenarios:
| Scenario | Pattern Defined | Status |
| ----------------------- | --------------- | ---------- |
| Entity creation | {{yes/no}} | {{status}} |
| Component communication | {{yes/no}} | {{status}} |
| State management | {{yes/no}} | {{status}} |
| Error handling | {{yes/no}} | {{status}} |
| Data access | {{yes/no}} | {{status}} |
| Event handling | {{yes/no}} | {{status}} |
{{if_missing_patterns}}
**Missing Patterns:**
{{list_of_missing}}
Should we define these now?
{{/if_missing_patterns}}"
### 5. Epic Mapping Check
"**Checking Epic Mapping...**
Verifying every epic/feature maps to architecture:
| Epic/Feature | Location | Patterns | Status |
| ------------ | -------- | -------- | ------ |
{{epic_mapping_table}}
{{if_unmapped_epics}}
**Unmapped Features:**
{{list_of_unmapped}}
Where should these live?
{{/if_unmapped_epics}}"
### 6. Document Completeness Check
"**Checking Document Completeness...**
Mandatory sections:
- [ ] Engine/Framework selection with version
- [ ] Decision summary table
- [ ] Project structure (complete, not placeholder)
- [ ] Cross-cutting concerns
- [ ] Implementation patterns with examples
- [ ] Naming conventions
- [ ] No placeholder text ({{placeholders}}, TODO, etc.)
{{if_incomplete}}
**Incomplete Sections:**
{{list_of_incomplete}}
Let's fix these before proceeding.
{{/if_incomplete}}"
### 7. Resolve Any Issues
**If issues were found in any check:**
For each issue:
1. Present the problem clearly
2. Propose a solution
3. Get user confirmation
4. Update the document
**Repeat validation if significant changes made.**
### 8. Generate Validation Summary
Based on the checks, prepare the summary:
```markdown
## Architecture Validation
### Validation Summary
| Check | Result | Notes |
| ---------------------- | ------------- | --------- |
| Decision Compatibility | {{pass/fail}} | {{notes}} |
| GDD Coverage | {{pass/fail}} | {{notes}} |
| Pattern Completeness | {{pass/fail}} | {{notes}} |
| Epic Mapping | {{pass/fail}} | {{notes}} |
| Document Completeness | {{pass/fail}} | {{notes}} |
### Coverage Report
**Systems Covered:** {{count}}/{{total}}
**Patterns Defined:** {{count}}
**Decisions Made:** {{count}}
### Issues Resolved
{{list_of_resolved_issues}}
### Validation Date
{{date}}
```
### 9. Present Validation and Menu
Show the validation results to the user and present:
"**Architecture Validation Complete**
**Results:**
[Show validation summary]
**Overall Status:** {{PASS/NEEDS_WORK}}
{{if_pass}}
Your architecture document is complete and ready to guide implementation.
{{/if_pass}}
{{if_needs_work}}
Some issues need resolution before the architecture is ready.
{{/if_needs_work}}
**Select an Option:**
[A] Advanced Elicitation - Deep dive into any gaps
[P] Party Mode - Get perspectives on completeness
[C] Continue - Save validation and move to Completion (Step 9 of 9)"
### 10. Handle Menu Selection
#### IF A (Advanced Elicitation):
- Execute {advancedElicitationTask} with validation results
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, re-run validation
- If no: Keep original, return to A/P/C menu
#### IF P (Party Mode):
- Execute {partyModeWorkflow} with validation results
- Ask user: "Accept these changes? (y/n)"
- If yes: Update content, re-run validation
- If no: Keep original, return to A/P/C menu
#### IF C (Continue):
- Append validation summary to `{outputFile}`
- Update frontmatter: `stepsCompleted: [1, 2, 3, 4, 5, 6, 7, 8]`
- Load `{nextStepFile}`
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN [C continue option] is selected and [validation content saved with frontmatter updated], will you then load and read fully `{nextStepFile}`.
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- All validation checks performed
- Issues identified and resolved
- GDD coverage verified
- Pattern completeness confirmed
- Document has no placeholders
- A/P/C menu presented and handled correctly
- Frontmatter updated with stepsCompleted: [1, 2, 3, 4, 5, 6, 7, 8]
### SYSTEM FAILURE:
- Skipping validation checks
- Proceeding with unresolved issues
- Incomplete document going to completion
- Not presenting A/P/C menu after validation
- Proceeding without user selecting 'C'
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,357 @@
---
name: 'step-09-complete'
description: 'Complete the architecture workflow with final review and handoff guidance'
# Path Definitions
workflow_path: '{project-root}/_bmad/bmgd/workflows/3-technical/game-architecture'
# File References
thisStepFile: '{workflow_path}/steps/step-09-complete.md'
workflowFile: '{workflow_path}/workflow.md'
outputFile: '{output_folder}/game-architecture.md'
# Handoff References
epicWorkflow: '{project-root}/_bmad/bmgd/workflows/4-production/epic-workflow/workflow.yaml'
projectContextWorkflow: '{project-root}/_bmad/bmgd/workflows/3-technical/generate-project-context/workflow.md'
---
# Step 9: Completion
**Progress: Step 9 of 9** - Architecture Complete!
## STEP GOAL:
Generate the executive summary, finalize the document, update workflow status, and provide clear handoff guidance for the next workflow phase.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- NEVER generate content without user input
- CRITICAL: Read the complete step file before taking any action
- YOU ARE A FACILITATOR, not a content generator
- NEVER mention time estimates
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Role Reinforcement:
- You are a veteran game architect facilitator
- This is the final step - ensure completeness
- Provide actionable next steps
### Step-Specific Rules:
- Generate executive summary from all content
- Ensure document is ready for AI agent consumption
- Provide clear implementation guidance
## EXECUTION PROTOCOLS:
- Show your analysis before taking any action
- Generate final sections
- Update frontmatter `stepsCompleted: [1, 2, 3, 4, 5, 6, 7, 8, 9]`
- Present completion summary and next steps
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Generate Executive Summary
**Create summary from all sections:**
Based on all documented content, synthesize an executive summary:
```markdown
## Executive Summary
**{{game_name}}** architecture is designed for {{engine}} targeting {{platform}}.
**Key Architectural Decisions:**
- {{decision_1_summary}}
- {{decision_2_summary}}
- {{decision_3_summary}}
**Project Structure:** {{organization_pattern}} organization with {{system_count}} core systems.
**Implementation Patterns:** {{pattern_count}} patterns defined ensuring AI agent consistency.
**Ready for:** Epic implementation phase
```
### 2. Generate Development Setup Section
"Let me generate the development environment setup section.
**Development Prerequisites:**
````markdown
## Development Environment
### Prerequisites
{{prerequisites_list}}
### Setup Commands
```bash
{{setup_commands}}
```
````
### First Steps
1. {{first_step}}
2. {{second_step}}
3. {{third_step}}
````
Does this capture the setup process correctly?"
### 3. Finalize Document
**Update the document with final content:**
- Add Executive Summary at the top (after frontmatter)
- Add Development Environment section
- Update document status to 'complete'
- Update frontmatter with all steps completed
**Final frontmatter:**
```yaml
---
title: 'Game Architecture'
project: '{{project_name}}'
date: '{{date}}'
author: '{{user_name}}'
version: '1.0'
stepsCompleted: [1, 2, 3, 4, 5, 6, 7, 8, 9]
status: 'complete'
engine: '{{engine}}'
platform: '{{platform}}'
---
````
### 4. Update Workflow Status
**If not in standalone mode:**
Load `{output_folder}/bmgd-workflow-status.yaml` and:
- Update `create-architecture` status to the output file path
- Preserve all comments and structure
- Determine next workflow in sequence
### 5. Present Completion Summary
"**Architecture Complete!**
{{user_name}}, the Game Architecture for **{{game_name}}** is now complete!
**Architecture Summary:**
- **Engine:** {{engine}} v{{version}}
- **Platform:** {{platform}}
- **Organization:** {{organization_pattern}}
- **Decisions Made:** {{decision_count}}
- **Patterns Defined:** {{pattern_count}}
**Sections Completed:**
1. Project Context
2. Engine & Framework
3. Architectural Decisions
4. Cross-cutting Concerns
5. Project Structure
6. Implementation Patterns
7. Validation
8. Development Setup
**Document saved to:** `{outputFile}`
Do you want to review or adjust anything before we finalize?
**Optional Enhancement: Project Context File**
Would you like to create a `project-context.md` file? This is a concise, optimized guide for AI agents that captures:
- Critical engine-specific rules they might miss
- Specific patterns and conventions for your game project
- Performance and optimization requirements
- Anti-patterns and edge cases to avoid
{if_existing_project_context}
I noticed you already have a project context file. Would you like to update it with your new architectural decisions?
{else}
This file helps ensure AI agents implement game code consistently with your project's unique requirements and patterns.
{/if_existing_project_context}
**Create/Update project context?** [Y/N]"
### 6. Handle Project Context Creation Choice
If user responds 'Y' or 'yes' to creating/updating project context:
"Excellent choice! Let me launch the Generate Project Context workflow to create a comprehensive guide for AI agents.
This will help ensure consistent implementation by capturing:
- Engine-specific patterns and rules
- Performance and optimization conventions from your architecture
- Testing and quality standards
- Anti-patterns to avoid
The workflow will collaborate with you to create an optimized `project-context.md` file that AI agents will read before implementing any game code."
**Execute the Generate Project Context workflow:**
- Load and execute: `{projectContextWorkflow}`
- The workflow will handle discovery, generation, and completion of the project context file
- After completion, return here for final handoff
If user responds 'N' or 'no':
"Understood! Your architecture is complete and ready for implementation. You can always create a project context file later using the Generate Project Context workflow if needed."
### 7. Handle Review Requests
**If user wants to review:**
"Which section would you like to review?
1. Executive Summary
2. Engine & Framework
3. Architectural Decisions
4. Cross-cutting Concerns
5. Project Structure
6. Implementation Patterns
7. Validation Summary
8. Development Setup
Or type 'all' to see the complete document."
**Show requested section and allow edits.**
### 8. Present Next Steps Menu
**After user confirms completion:**
"**Recommended Next Steps for {{game_name}}:**
1. **Initialize Project** - Run the setup commands to create your project
- Command: `{{setup_command}}`
- This creates the base structure we designed
2. **Create Epics** - Break down GDD into implementation epics
- Workflow: `create-epics`
- Input: GDD + Architecture
- Output: Implementation-ready epic stories
3. **Begin Implementation** - Start coding with AI agents
- Each agent will read this architecture
- Patterns ensure consistency across all code
**Which would you like to do next?**
1. Review the completed architecture
2. Proceed to Epic creation workflow
3. Exit workflow"
### 9. Handle User Selection
Based on user choice:
**If 1 (Review):**
- Present full document or requested section
- Return to next steps menu
**If 2 (Epic Creation):**
- Confirm architecture is saved
- Provide handoff guidance for epic workflow
- Note that architecture document will be input
**If 3 (Exit):**
- Confirm document is saved and complete
- Exit workflow gracefully
### 10. Provide Handoff Guidance
**For Epic Creation handoff:**
"**Handoff to Epic Creation**
Your architecture is ready to guide epic creation.
**What the Epic workflow will do:**
- Read your architecture document
- Break GDD features into implementable stories
- Ensure stories align with architectural patterns
- Create acceptance criteria referencing architecture
**Architecture inputs that will be used:**
- Project structure for file placement
- Implementation patterns for code style
- Cross-cutting concerns for consistency
- System mapping for story assignment
Ready to proceed to epic creation, or any questions about the architecture?"
---
## CRITICAL STEP COMPLETION NOTE
This is the final step. Ensure:
- Executive summary is generated
- All content is saved to architecture.md
- Frontmatter shows all 9 steps completed
- User has clear actionable next steps
- Handoff to epic workflow is smooth
---
## SYSTEM SUCCESS/FAILURE METRICS
### SUCCESS:
- Executive summary synthesizes all content
- Development setup is complete
- Document status updated to 'complete'
- Frontmatter shows all steps completed
- Workflow status updated (if tracking)
- User has clear next steps
- Document saved and ready for AI agent consumption
### SYSTEM FAILURE:
- Missing executive summary
- Incomplete development setup
- Frontmatter not updated
- Status not updated when tracking
- No clear next steps provided
- User left without actionable guidance
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
---
## Game Architecture Workflow Complete
The Game Architecture workflow transforms a GDD into a comprehensive architecture document through 9 collaborative steps:
1. **Initialize** - Validate readiness, discover input documents
2. **Context** - Load and understand project requirements
3. **Starter** - Select engine and starter templates
4. **Decisions** - Make collaborative architectural decisions
5. **Cross-cutting** - Define patterns for all systems
6. **Structure** - Define project organization
7. **Patterns** - Design implementation patterns
8. **Validation** - Verify completeness and coherence
9. **Complete** - Finalize and provide handoff
This step-file architecture ensures consistent, thorough architecture creation with user collaboration at every step.