mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-29 16:14:59 +00:00
Created two comprehensive guides for v6 features:
**docs/agent-customization-guide.md**
- Complete guide for customizing agent names, personas, memories, and behaviors
- Update-safe customization via bmad/_cfg/agents/ configuration files
- Real-world examples (TDD setup, multilingual agents, custom workflows)
- Troubleshooting and best practices
**docs/web-bundles-gemini-gpt-guide.md**
- Comprehensive guide for using BMad agents in Gemini Gems and Custom GPTs
- Critical setup rules with exact configuration text required
- Cost-saving strategy: web planning → local implementation (60-80% savings)
- Platform comparison (Gemini Gems strongly recommended over Custom GPTs)
- Complete workflow examples showing full planning-to-implementation cycle
- Team bundle guidance (Gemini 2.5 Pro+ only)
**README.md updates**
- Added prominent links in v6 Core Enhancements section
- Created new "Customization & Sharing" documentation category
- Web Bundles feature highlighted with direct guide link
**Unified output folder structure across all modules:**
**Before (confusing):**
- output_folder: Main docs
- game_design_docs: Separate design folder
- tech_docs: Separate technical folder
- dev_ephemeral_location: Separate ephemeral folder outside docs
**After (simplified):**
- output_folder: Single location for ALL AI-generated artifacts (default: "docs")
- Clearer prompt: "Where should AI Generated Artifacts be saved?"
- sprint_artifacts: Phase 4 ephemeral content now WITHIN output_folder
- BMM: {output_folder}/stories (stories, context, reports)
- BMGD: {output_folder}/sprint-artifacts
- No longer in separate {bmad_folder}-ephemeral location
**Benefits:**
- One clear location for all planning artifacts (PRD, Architecture, UX, etc.)
- Phase 4 ephemeral items logically grouped within output folder
- Eliminated confusing separate folder proliferation
- sprint_artifacts now configurable per module
**Files changed:**
- src/core/_module-installer/install-config.yaml
- src/modules/bmm/_module-installer/install-config.yaml
- src/modules/bmgd/_module-installer/install-config.yaml
**Also cleaned up BMGD config:**
- Renamed: specified_framework → primary_platform (clearer naming)
- Removed: unused data_path variable
Replaced old "project_level" (0-4) system with new "selected_track" terminology:
- **quick-flow**: Bug fixes and small features (replaces Level 0-1)
- **bmad-method**: Full planning track (replaces Level 2-3)
- **enterprise-bmad-method**: Extended planning (replaces Level 4)
**Core workflow updates:**
- solutioning-gate-check: Complete rewrite of validation logic for track-based artifacts
- architecture: Updated context detection, error handling, and messaging for tracks
- workflow-init: Updated artifact detection patterns for track-based paths
- All workflow status paths updated (method-greenfield, method-brownfield, enterprise-*)
Unified variable naming conventions across all workflows:
- {output_folder} → {output-folder} (hyphenated format)
- {dev_ephemeral_location} → {sprint_artifacts} (clearer purpose)
- Hardcoded status file paths → {workflow_status_file} variable
Fixed corrupted variable patterns throughout workflow files:
- {output*folder} → {output-folder}
- {ephemeral*location} → {sprint_artifacts}
- \_prd* → *prd* (escaped underscore artifacts)
- **\*\***\_\_\_**\*\*** → proper field placeholders
Affected patterns included malformed glob patterns, template variables, and markdown formatting artifacts from previous edits.
**Architecture workflow (create-architecture):**
- Fixed: "Decision Architecture" → "Create Architecture" (consistent naming)
- Improved PRD not found handling with exit/continue options
- Better user guidance when running standalone vs. within workflow path
- Removed hardcoded Level checks, now track-aware
- Enhanced validation checklist formatting (□ → - [])
- Typo fixes: "mulitple" → "multiple"
**Solutioning gate check:**
- Complete validation logic rewrite for track-based system
- Removed Level-specific artifact expectations
- Simplified document discovery (track determines what exists)
- Better analysis prompts and user feedback
**Workflow-init:**
- Updated artifact detection patterns for new folder structure
- Fixed corrupt glob patterns throughout
- Better sprint_artifacts location detection
- Improved workflow path assignment logic
**Various workflows:**
- Consistent variable naming across 40+ workflow files
- Improved error messages and user guidance
- Better markdown formatting (checkboxes, lists)
- Removed redundant validation criteria files (now inline)
Removed duplicate BMGD 4-production workflows (12 workflows):
- code-review, correct-course, create-story, dev-story
- epic-tech-context, retrospective, sprint-planning
- story-context, story-done, story-ready
**Why:** BMGD now uses shared BMM Phase 4 implementation workflows
**Benefit:** Single source of truth, no duplication to maintain
Also removed:
- validation-criteria.yaml (validation now inline in instructions)
- architecture-patterns.yaml references (patterns now managed differently)
- AUDIT-REPORT.md files (stale audit artifacts)
**BMB workflows:**
- Updated checklists for workflow and module creation
- Improved agent architecture documentation
- Minor instruction clarifications
**Core brainstorming workflow:**
- Updated README with usage examples
- Enhanced instructions and template clarity
- Better integration with other modules
**BMM installer:**
- Updated for track-based system
- sprint_artifacts configuration
**Tech Writer agent:**
- Minor configuration update for documentation workflows
Removed 200+ files that should not be in repository:
- Installed agent markdown files (analyst, architect, dev, pm, sm, tea, etc.)
- Complete workflow instruction copies
- Documentation duplicates (quick-start, agents-guide, workflows-*)
- Test architecture knowledge base (22 files, 14,000+ lines)
- Configuration files (config.yaml, team definitions)
These are generated during installation and should not be version controlled.
Removed 21 pre-generated XML bundles:
- BMM agents (analyst, architect, dev, pm, sm, tea, tech-writer, ux-designer)
- BMGD agents (game-architect, game-designer, game-dev, game-scrum-master)
- CIS agents (brainstorming-coach, creative-problem-solver, etc.)
- Team bundles (team-fullstack, team-gamedev, creative-squad)
**Why:** Users should generate fresh bundles via `npm run bundle` to get latest changes and customizations.
- **2 new documentation files** (comprehensive guides)
- **98 source files modified** (299 insertions, 6,567 deletions)
- **3 installer config files simplified** (major folder structure improvement)
- **200+ .bmad/ artifacts removed** (should not be in repo)
- **21 web-bundle files removed** (users regenerate as needed)
- **12 duplicate workflows removed** (BMGD consolidation)
- **40+ workflows updated** (track system, variable standardization, corruption fixes)
416 lines
10 KiB
Markdown
416 lines
10 KiB
Markdown
# BMAD Agent Architecture Reference
|
|
|
|
_LLM-Optimized Technical Documentation for Agent Building_
|
|
|
|
## Core Agent Structure
|
|
|
|
### Minimal Valid Agent
|
|
|
|
```xml
|
|
<agent id="path/to/agent.md" name="Name" title="Title" icon="🤖">
|
|
<persona>
|
|
<role>My primary function</role>
|
|
<identity>My background and expertise</identity>
|
|
<communication_style>How I interact</communication_style>
|
|
<principles>My core beliefs and methodology</principles>
|
|
</persona>
|
|
<menu>
|
|
<item cmd="*help">Show numbered menu</item>
|
|
<item cmd="*exit">Exit with confirmation</item>
|
|
</menu>
|
|
</agent>
|
|
```
|
|
|
|
## Agent XML Schema
|
|
|
|
### Root Element: `<agent>`
|
|
|
|
**Required Attributes:**
|
|
|
|
- `id` - Unique path identifier (e.g., "{bmad_folder}/bmm/agents/analyst.md")
|
|
- `name` - Agent's name (e.g., "Mary", "John", "Helper")
|
|
- `title` - Professional title (e.g., "Business Analyst", "Security Engineer")
|
|
- `icon` - Single emoji representing the agent
|
|
|
|
### Core Sections
|
|
|
|
#### 1. Persona Section (REQUIRED)
|
|
|
|
```xml
|
|
<persona>
|
|
<role>1-2 sentences: Professional title and primary expertise, use first-person voice</role>
|
|
<identity>2-5 sentences: Background, experience, specializations, use first-person voice</identity>
|
|
<communication_style>1-3 sentences: Interaction approach, tone, quirks, use first-person voice</communication_style>
|
|
<principles>2-5 sentences: Core beliefs, methodology, philosophy, use first-person voice</principles>
|
|
</persona>
|
|
```
|
|
|
|
**Best Practices:**
|
|
|
|
- Role: Be specific about expertise area
|
|
- Identity: Include experience indicators (years, depth)
|
|
- Communication: Describe HOW they interact, not just tone and quirks
|
|
- Principles: Start with "I believe" or "I operate" for first-person voice
|
|
|
|
#### 2. Critical Actions Section
|
|
|
|
```xml
|
|
<critical-actions>
|
|
<i>Load into memory {project-root}/{bmad_folder}/{module}/config.yaml and set variables</i>
|
|
<i>Remember the users name is {user_name}</i>
|
|
<i>ALWAYS communicate in {communication_language}</i>
|
|
<!-- Custom initialization actions -->
|
|
</critical-actions>
|
|
```
|
|
|
|
**For Expert Agents with Sidecars (CRITICAL):**
|
|
|
|
```xml
|
|
<critical-actions>
|
|
<!-- CRITICAL: Load sidecar files FIRST -->
|
|
<i critical="MANDATORY">Load COMPLETE file {agent-folder}/instructions.md and follow ALL directives</i>
|
|
<i critical="MANDATORY">Load COMPLETE file {agent-folder}/memories.md into permanent context</i>
|
|
<i critical="MANDATORY">You MUST follow all rules in instructions.md on EVERY interaction</i>
|
|
|
|
<!-- Standard initialization -->
|
|
<i>Load into memory {project-root}/{bmad_folder}/{module}/config.yaml and set variables</i>
|
|
<i>Remember the users name is {user_name}</i>
|
|
<i>ALWAYS communicate in {communication_language}</i>
|
|
|
|
<!-- Domain restrictions -->
|
|
<i>ONLY read/write files in {user-folder}/diary/ - NO OTHER FOLDERS</i>
|
|
</critical-actions>
|
|
```
|
|
|
|
**Common Patterns:**
|
|
|
|
- Config loading for module agents
|
|
- User context initialization
|
|
- Language preferences
|
|
- **Sidecar file loading (Expert agents) - MUST be explicit and CRITICAL**
|
|
- **Domain restrictions (Expert agents) - MUST be enforced**
|
|
|
|
#### 3. Menu Section (REQUIRED)
|
|
|
|
```xml
|
|
<menu>
|
|
<item cmd="*trigger" [attributes]>Description</item>
|
|
</menu>
|
|
```
|
|
|
|
**Command Attributes:**
|
|
|
|
- `run-workflow="{path}"` - Executes a workflow
|
|
- `exec="{path}"` - Executes a task
|
|
- `tmpl="{path}"` - Template reference
|
|
- `data="{path}"` - Data file reference
|
|
|
|
**Required Menu Items:**
|
|
|
|
- `*help` - Always first, shows command list
|
|
- `*exit` - Always last, exits agent
|
|
|
|
## Advanced Agent Patterns
|
|
|
|
### Activation Rules (OPTIONAL)
|
|
|
|
```xml
|
|
<activation critical="true">
|
|
<initialization critical="true" sequential="MANDATORY">
|
|
<step n="1">Load configuration</step>
|
|
<step n="2">Apply overrides</step>
|
|
<step n="3">Execute critical actions</step>
|
|
<step n="4" critical="BLOCKING">Show greeting with menu</step>
|
|
<step n="5" critical="BLOCKING">AWAIT user input</step>
|
|
</initialization>
|
|
<command-resolution critical="true">
|
|
<rule>Numeric input → Execute command at cmd_map[n]</rule>
|
|
<rule>Text input → Fuzzy match against commands</rule>
|
|
</command-resolution>
|
|
</activation>
|
|
```
|
|
|
|
### Expert Agent Sidecar Pattern
|
|
|
|
```xml
|
|
<!-- DO NOT use sidecar-resources tag - Instead use critical-actions -->
|
|
<!-- Sidecar files MUST be loaded explicitly in critical-actions -->
|
|
|
|
<!-- Example Expert Agent with Diary domain -->
|
|
<agent id="diary-keeper" name="Personal Assistant" title="Diary Keeper" icon="📔">
|
|
<critical-actions>
|
|
<!-- MANDATORY: Load all sidecar files -->
|
|
<i critical="MANDATORY">Load COMPLETE file {agent-folder}/diary-rules.md</i>
|
|
<i critical="MANDATORY">Load COMPLETE file {agent-folder}/user-memories.md</i>
|
|
<i critical="MANDATORY">Follow ALL rules from diary-rules.md</i>
|
|
|
|
<!-- Domain restriction -->
|
|
<i critical="MANDATORY">ONLY access files in {user-folder}/diary/</i>
|
|
<i critical="MANDATORY">NEVER access files outside diary folder</i>
|
|
</critical-actions>
|
|
|
|
<persona>...</persona>
|
|
<menu>...</menu>
|
|
</agent>
|
|
```
|
|
|
|
### Module Agent Integration
|
|
|
|
```xml
|
|
<module-integration>
|
|
<module-path>{project-root}/{bmad_folder}/{module-code}</module-path>
|
|
<config-source>{module-path}/config.yaml</config-source>
|
|
<workflows-path>{project-root}/{bmad_folder}/{module-code}/workflows</workflows-path>
|
|
</module-integration>
|
|
```
|
|
|
|
## Variable System
|
|
|
|
### System Variables
|
|
|
|
- `{project-root}` - Root directory of project
|
|
- `{user_name}` - User's name from config
|
|
- `{communication_language}` - Language preference
|
|
- `{date}` - Current date
|
|
- `{module}` - Current module code
|
|
|
|
### Config Variables
|
|
|
|
Format: `{config_source}:variable_name`
|
|
Example: `{config_source}:output_folder`
|
|
|
|
### Path Construction
|
|
|
|
```
|
|
Good: {project-root}/{bmad_folder}/{module}/agents/
|
|
Bad: /absolute/path/to/agents/
|
|
Bad: ../../../relative/paths/
|
|
```
|
|
|
|
## Command Patterns
|
|
|
|
### Workflow Commands
|
|
|
|
```xml
|
|
<!-- Full path -->
|
|
<item cmd="*create-prd" run-workflow="{project-root}/{bmad_folder}/bmm/workflows/prd/workflow.yaml">
|
|
Create Product Requirements Document
|
|
</item>
|
|
|
|
<!-- Placeholder for future -->
|
|
<item cmd="*analyze" run-workflow="todo">
|
|
Perform analysis (workflow to be created)
|
|
</item>
|
|
```
|
|
|
|
### Task Commands
|
|
|
|
```xml
|
|
<item cmd="*validate" exec="{project-root}/{bmad_folder}/core/tasks/validate-workflow.xml">
|
|
Validate document
|
|
</item>
|
|
```
|
|
|
|
### Template Commands
|
|
|
|
```xml
|
|
<item cmd="*brief"
|
|
exec="{project-root}/{bmad_folder}/core/tasks/create-doc.md"
|
|
tmpl="{project-root}/{bmad_folder}/bmm/templates/brief.md">
|
|
Create project brief
|
|
</item>
|
|
```
|
|
|
|
### Data-Driven Commands
|
|
|
|
```xml
|
|
<item cmd="*standup"
|
|
exec="{project-root}/{bmad_folder}/bmm/tasks/daily-standup.xml"
|
|
data="{project-root}/{bmad_folder}/_cfg/agent-manifest.csv">
|
|
Run daily standup
|
|
</item>
|
|
```
|
|
|
|
## Agent Type Specific Patterns
|
|
|
|
### Simple Agent
|
|
|
|
- Self-contained logic
|
|
- Minimal or no external dependencies
|
|
- May have embedded functions
|
|
- Good for utilities and converters
|
|
|
|
### Expert Agent
|
|
|
|
- Domain-specific with sidecar resources
|
|
- Restricted access patterns
|
|
- Memory/context files
|
|
- Good for specialized domains
|
|
|
|
### Module Agent
|
|
|
|
- Full integration with module
|
|
- Multiple workflows and tasks
|
|
- Config-driven behavior
|
|
- Good for professional tools
|
|
|
|
## Common Anti-Patterns to Avoid
|
|
|
|
### ❌ Bad Practices
|
|
|
|
```xml
|
|
<!-- Missing required persona elements -->
|
|
<persona>
|
|
<role>Helper</role>
|
|
<!-- Missing identity, style, principles -->
|
|
</persona>
|
|
|
|
<!-- Hard-coded paths -->
|
|
<item cmd="*run" exec="/Users/john/project/task.md">
|
|
|
|
<!-- No help command -->
|
|
<menu>
|
|
<item cmd="*do-something">Action</item>
|
|
<!-- Missing *help -->
|
|
</menu>
|
|
|
|
<!-- Duplicate command triggers -->
|
|
<item cmd="*analyze">First</item>
|
|
<item cmd="*analyze">Second</item>
|
|
```
|
|
|
|
### ✅ Good Practices
|
|
|
|
```xml
|
|
<!-- Complete persona -->
|
|
<persona>
|
|
<role>Data Analysis Expert</role>
|
|
<identity>Senior analyst with 10+ years...</identity>
|
|
<communication_style>Analytical and precise...</communication_style>
|
|
<principles>I believe in data-driven...</principles>
|
|
</persona>
|
|
|
|
<!-- Variable-based paths -->
|
|
<item cmd="*run" exec="{project-root}/{bmad_folder}/module/task.md">
|
|
|
|
<!-- Required commands present -->
|
|
<menu>
|
|
<item cmd="*help">Show commands</item>
|
|
<item cmd="*analyze">Perform analysis</item>
|
|
<item cmd="*exit">Exit</item>
|
|
</menu>
|
|
```
|
|
|
|
## Agent Lifecycle
|
|
|
|
### 1. Initialization
|
|
|
|
1. Load agent file
|
|
2. Parse XML structure
|
|
3. Load critical-actions
|
|
4. Apply config overrides
|
|
5. Present greeting
|
|
|
|
### 2. Command Loop
|
|
|
|
1. Show numbered menu
|
|
2. Await user input
|
|
3. Resolve command
|
|
4. Execute action
|
|
5. Return to menu
|
|
|
|
### 3. Termination
|
|
|
|
1. User enters \*exit
|
|
2. Cleanup if needed
|
|
3. Exit persona
|
|
|
|
## Testing Checklist
|
|
|
|
Before deploying an agent:
|
|
|
|
- [ ] Valid XML structure
|
|
- [ ] All persona elements present
|
|
- [ ] *help and *exit commands exist
|
|
- [ ] All paths use variables
|
|
- [ ] No duplicate commands
|
|
- [ ] Config loading works
|
|
- [ ] Commands execute properly
|
|
|
|
## LLM Building Tips
|
|
|
|
When building agents:
|
|
|
|
1. Start with agent type (Simple/Expert/Module)
|
|
2. Define complete persona first
|
|
3. Add standard critical-actions
|
|
4. Include *help and *exit
|
|
5. Add domain commands
|
|
6. Test command execution
|
|
7. Validate with checklist
|
|
|
|
## Integration Points
|
|
|
|
### With Workflows
|
|
|
|
- Agents invoke workflows via run-workflow
|
|
- Workflows can be incomplete (marked "todo")
|
|
- Workflow paths must be valid or "todo"
|
|
|
|
**Workflow Interaction Styles** (BMAD v6 default):
|
|
|
|
- **Intent-based + Interactive**: Workflows adapt to user context and skill level
|
|
- Workflows collaborate with users, not just extract data
|
|
- See workflow-creation-guide.md "Instruction Styles" section for details
|
|
- When creating workflows for your agent, default to intent-based unless you need prescriptive control
|
|
|
|
### With Tasks
|
|
|
|
- Tasks are single operations
|
|
- Executed via exec attribute
|
|
- Can include data files
|
|
|
|
### With Templates
|
|
|
|
- Templates define document structure
|
|
- Used with create-doc task
|
|
- Variables passed through
|
|
|
|
## Quick Reference
|
|
|
|
### Minimal Commands
|
|
|
|
```xml
|
|
<menu>
|
|
<item cmd="*help">Show numbered cmd list</item>
|
|
<item cmd="*exit">Exit with confirmation</item>
|
|
</menu>
|
|
```
|
|
|
|
### Standard Critical Actions
|
|
|
|
```xml
|
|
<critical-actions>
|
|
<i>Load into memory {project-root}/{bmad_folder}/{module}/config.yaml</i>
|
|
<i>Remember the users name is {user_name}</i>
|
|
<i>ALWAYS communicate in {communication_language}</i>
|
|
</critical-actions>
|
|
```
|
|
|
|
### Module Agent Pattern
|
|
|
|
```xml
|
|
<agent id="{bmad_folder}/{module}/agents/{name}.md"
|
|
name="{Name}"
|
|
title="{Title}"
|
|
icon="{emoji}">
|
|
<persona>...</persona>
|
|
<critical-actions>...</critical-actions>
|
|
<menu>
|
|
<item cmd="*help">...</item>
|
|
<item cmd="*{command}" run-workflow="{path}">...</item>
|
|
<item cmd="*exit">...</item>
|
|
</menu>
|
|
</agent>
|
|
```
|