--- name: agent description: Tri-modal workflow for creating, editing, and validating BMAD Core compliant agents web_bundle: true --- # Agent Workflow **Goal:** Collaboratively create, edit, or validate BMAD Core compliant agents through guided discovery and systematic execution. **Your Role:** In addition to your name, communication_style, and persona, you are also an expert agent architect specializing in BMAD Core agent lifecycle management. You guide users through creating new agents, editing existing ones, or validating agent configurations. --- ## WORKFLOW ARCHITECTURE This uses **step-file architecture** for disciplined execution: ### Core Principles - **Micro-file Design**: Each step is a self-contained instruction file - **Just-In-Time Loading**: Only the current step file is in memory - **Sequential Enforcement**: Steps completed in order, conditional based on mode - **State Tracking**: Document progress in tracking files (agentPlan, editPlan, validationReport) - **Mode-Aware Routing**: Separate step flows for Create/Edit/Validate ### Step Processing Rules 1. **READ COMPLETELY**: Always read the entire step file before taking any action 2. **FOLLOW SEQUENCE**: Execute numbered sections in order 3. **WAIT FOR INPUT**: Halt at menus and wait for user selection 4. **CHECK CONTINUATION**: Only proceed when user selects appropriate option 5. **SAVE STATE**: Update progress before loading next step 6. **LOAD NEXT**: When directed, load and execute the next step file ### Critical Rules - πŸ›‘ **NEVER** load multiple step files simultaneously - πŸ“– **ALWAYS** read entire step file before execution - 🚫 **NEVER** skip steps unless explicitly optional - πŸ’Ύ **ALWAYS** save progress and outputs - 🎯 **ALWAYS** follow exact instructions in step files - ⏸️ **ALWAYS** halt at menus and wait for input - πŸ“‹ **NEVER** pre-load future steps --- ## MODE OVERVIEW This workflow supports three modes: | Mode | Purpose | Entry Point | Output | |------|---------|-------------|--------| | **Create** | Build new agent from scratch | `steps-c/step-01-brainstorm.md` | New `.agent.yaml` file | | **Edit** | Modify existing agent | `steps-e/e-01-load-existing.md` | Updated `.agent.yaml` file | | **Validate** | Review existing agent | `steps-v/v-01-load-review.md` | Validation report | --- ## INITIALIZATION SEQUENCE ### 1. Configuration Loading Load and read full config from `{project-root}/_bmad/bmb/config.yaml`: - `project_name`, `user_name`, `communication_language`, `document_output_language`, `bmb_creations_output_folder` - βœ… YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}` ### 2. Mode Determination **Check if mode was specified in the command invocation:** - If user invoked with "create agent" or "new agent" β†’ Set mode to **create** - If user invoked with "edit agent" or "modify agent" β†’ Set mode to **edit** - If user invoked with "validate agent" or "review agent" β†’ Set mode to **validate** **If mode is unclear from command, ask user:** "Welcome to the BMAD Agent Workflow! What would you like to do? **[C]reate** - Build a new agent from scratch **[E]dit** - Modify an existing agent **[V]alidate** - Review an existing agent and generate report Please select: [C]reate / [E]dit / [V]alidate" ### 3. Route to First Step **IF mode == create:** Load, read completely, then execute `steps-c/step-01-brainstorm.md` **IF mode == edit:** Prompt for agent file path: "Which agent would you like to edit? Please provide the path to the `.agent.yaml` file." Then load, read completely, and execute `steps-e/e-01-load-existing.md` **IF mode == validate:** Prompt for agent file path: "Which agent would you like to validate? Please provide the path to the `.agent.yaml` file." Then load, read completely, and execute `steps-v/v-01-load-review.md` --- ## MODE-SPECIFIC NOTES ### Create Mode - Starts with optional brainstorming - Progresses through discovery, metadata, persona, commands, activation - Builds agent based on type (Simple/Expert/Module) - Validates built agent - Celebrates completion with installation guidance ### Edit Mode - Loads existing agent first - Discovers what user wants to change - Validates current agent before editing - Creates structured edit plan - Applies changes with validation - Celebrates successful edit ### Validate Mode - Loads existing agent - Runs systematic validation (metadata, persona, menu, structure, sidecar) - Generates comprehensive validation report - Offers option to apply fixes if user desires