Files
L-Ami-Fiduciaire/_bmad/bmb/workflows/agent/steps-c/step-07-build-agent.md
Saad Zoubir 7a18c40361 chore: add BMAD framework modules, folder features, and tooling configs
Includes BMAD bmb/bmm/cis/tea workflow modules, folder (declaration)
feature implementation (controllers, models, enums, views, tests),
claude/cursor command configs, and email templates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 21:24:17 +01:00

8.8 KiB

name, description, nextStepFile, agentPlan, agentBuildOutput, agentYamlOutput, agentYamlOutputNoSidecar, sidecarOutput, agentTemplate, agentArch, agentCompilation, criticalActions, noSidecarExample, withSidecarExample, advancedElicitationTask, partyModeWorkflow
name description nextStepFile agentPlan agentBuildOutput agentYamlOutput agentYamlOutputNoSidecar sidecarOutput agentTemplate agentArch agentCompilation criticalActions noSidecarExample withSidecarExample advancedElicitationTask partyModeWorkflow
step-07-build-agent Generate agent YAML from plan (with or without sidecar) ./step-08-celebrate.md {bmb_creations_output_folder}/agent-plan-{agent_name}.md {bmb_creations_output_folder}/{agent-name}/ {bmb_creations_output_folder}/{agent-name}/{agent-name}.agent.yaml {bmb_creations_output_folder}/{agent-name}.agent.yaml {bmb_creations_output_folder}/{agent-name}/{agent-name}-sidecar/ ../templates/agent-template.md ../data/agent-architecture.md ../data/agent-compilation.md ../data/critical-actions.md ../data/reference/without-sidecar/commit-poet.agent.yaml ../data/reference/with-sidecar/journal-keeper/journal-keeper.agent.yaml {project-root}/_bmad/core/workflows/advanced-elicitation/workflow.xml {project-root}/_bmad/core/workflows/party-mode/workflow.md

STEP GOAL

Assemble the agent plan content into a complete agent YAML file. The build approach (with or without sidecar) is determined by the hasSidecar decision made in Step 3.


MANDATORY EXECUTION RULES

  1. DETERMINE BUILD APPROACH FIRST: Check hasSidecar from agentPlan before starting
  2. TEMPLATE COMPLIANCE: Follow agent-template.md structure exactly
  3. YAML VALIDATION: Ensure valid YAML syntax with proper indentation (2-space)
  4. EXISTING CHECK: If output file exists, ask user before overwriting
  5. NO DRIFT: Use ONLY content from agentPlan - no additions or interpretations
  6. SIDECAR REQUIREMENT: If hasSidecar=true, MUST create sidecar folder structure

EXECUTION PROTOCOLS

Phase 1: Load Architecture and Templates

  1. Read agentTemplate - defines YAML structure for agents
  2. Read agentArch - architecture requirements for agents
  3. Read agentCompilation - assembly rules for YAML generation
  4. Read criticalActions - validation requirements for critical_actions

Phase 2: Load Agent Plan

  1. Read agentPlan containing all collected content from Steps 2-5
  2. Verify plan contains:
    • hasSidecar decision (true/false)
    • Persona content
    • Commands structure
    • All metadata fields
    • Activation decisions (critical_actions)

Phase 3: Determine Build Approach

Check hasSidecar from plan:

hasSidecar: false
→ Build: Agent WITHOUT sidecar
→ Output: Single YAML file at {agentYamlOutputNoSidecar}
→ Structure: Everything in one file (~250 lines max)

hasSidecar: true
→ Build: Agent WITH sidecar
→ Output: YAML + sidecar folder structure
→ Structure: YAML file + {agent-name}-sidecar/ folder

Inform user of build approach:

"Building: Agent {WITH|WITHOUT} sidecar
hasSidecar: {true/false}
Output: {output path description}"

Phase 4: Assemble Agent YAML

For Agents WITHOUT Sidecar (hasSidecar: false)

Structure:

name: '{agent-name}'
description: '{short-description}'

author:
  name: '{author}'
  created: '{date}'

persona: |
  {multi-line persona content from plan}

system-context: |
  {expanded context from plan}

capabilities:
  - {capability from plan}
  - {capability from plan}
  # ... all capabilities

commands:
  - name: '{command-name}'
    description: '{what command does}'
    trigger: '{menu trigger}'
    steps:
      - {step 1}
      - {step 2}
    # ... all commands from plan

configuration:
  temperature: {temperature}
  max-tokens: {max-tokens}
  response-format: {format}
  # ... other configuration from plan

metadata:
  hasSidecar: false
  agent-type: 'agent'

Output: Single YAML file at {agentYamlOutputNoSidecar}

For Agents WITH Sidecar (hasSidecar: true)

Structure:

name: '{agent-name}'
description: '{short-description}'

author:
  name: '{author}'
  created: '{date}'

persona: |
  {multi-line persona content from plan}

system-context: |
  {expanded context from plan}

capabilities:
  - {capability from plan}
  - {capability from plan}
  # ... all capabilities

critical-actions:
  - name: '{action-name}'
    description: '{what it does}'
    invocation: '{when/how to invoke}'
    implementation: |
      {multi-line implementation}
    output: '{expected-output}'
    sidecar-folder: '{sidecar-folder-name}'
    sidecar-files:
      - '{project-root}/_bmad/_memory/{sidecar-folder}/{file1}.md'
      - '{project-root}/_bmad/_memory/{sidecar-folder}/{file2}.md'
  # ... all critical actions referencing sidecar structure

commands:
  - name: '{command-name}'
    description: '{what command does}'
    trigger: '{menu trigger}'
    steps:
      - {step 1}
      - {step 2}
    # ... all commands from plan

configuration:
  temperature: {temperature}
  max-tokens: {max-tokens}
  response-format: {format}
  # ... other configuration from plan

metadata:
  sidecar-folder: '{sidecar-folder-name}'
  sidecar-path: '{project-root}/_bmad/_memory/{sidecar-folder}/'
  hasSidecar: true
  agent-type: 'agent'
  memory-type: 'persistent'

Output: YAML file at {agentYamlOutput} + sidecar folder structure

Phase 5: Create Sidecar Structure (IF hasSidecar: true)

Skip this phase if hasSidecar: false

  1. Create Sidecar Directory:

    mkdir -p {sidecarOutput}
    
  2. Create Starter Files (if specified in critical_actions):

    touch {sidecarOutput}/memories.md
    touch {sidecarOutput}/instructions.md
    # ... additional files from critical_actions
    
  3. Add README to Sidecar:

    # {sidecar-folder} Sidecar
    
    This folder stores persistent memory for the **{agent-name}** agent.
    
    ## Purpose
    {purpose from critical_actions}
    
    ## Files
    - memories.md: User profile, session history, patterns
    - instructions.md: Protocols, boundaries, startup behavior
    - {additional files}
    
    ## Runtime Access
    After BMAD installation, this folder will be accessible at:
    `{project-root}/_bmad/_memory/{sidecar-folder}/{filename}.md`
    

Phase 6: Write Agent YAML

If hasSidecar: false:

  1. Write YAML to {agentYamlOutputNoSidecar}
  2. Confirm write success
  3. Display file location to user

If hasSidecar: true:

  1. Create directory: mkdir -p {agentBuildOutput}
  2. Write YAML to {agentYamlOutput}
  3. Confirm write success
  4. Display file location to user

Phase 7: Present MENU OPTIONS

Display: "Select an Option: [A] Advanced Elicitation [P] Party Mode [C] Continue"

Menu Handling Logic:

  • IF A: Execute {advancedElicitationTask}, and when finished redisplay the menu
  • IF P: Execute {partyModeWorkflow}, and when finished redisplay the menu
  • IF C: Write agent YAML to appropriate output path (with or without sidecar), update frontmatter, then only then load, read entire file, then execute {nextStepFile}
  • IF Any other comments or queries: help user respond then Redisplay Menu Options

EXECUTION RULES:

  • ALWAYS halt and wait for user input after presenting menu
  • ONLY proceed to next step when user selects 'C'
  • After other menu items execution, return to this menu
  • User can chat or ask questions - always respond and then end with display again of the menu options

CONTEXT BOUNDARIES

INCLUDE:

  • Template structure exactly as provided
  • All agent metadata from agentPlan
  • Persona, commands, and rules from plan
  • Configuration options specified
  • Sidecar structure if hasSidecar: true

EXCLUDE:

  • Any content not in agentPlan
  • Sidecar references if hasSidecar: false
  • Template placeholders (replace with actual content)
  • Comments or notes in final YAML

CRITICAL STEP COMPLETION NOTE

ONLY WHEN [C continue option] is selected and [complete YAML generated and written to output], will you then load and read fully {nextStepFile} to execute and celebrate completion.

This step produces:

  • If hasSidecar: false: Single agent YAML file
  • If hasSidecar: true: Agent YAML file + sidecar folder structure

Both must exist (if applicable) before proceeding to validation.


SUCCESS METRICS

SUCCESS looks like:

  • Agent YAML file exists at specified output path
  • YAML is syntactically valid and well-formed
  • All template fields populated with plan content
  • Structure matches agent architecture
  • If hasSidecar: true, sidecar folder created with starter files
  • User has selected continue to proceed

FAILURE looks like:

  • Template or architecture files not found
  • Agent plan missing required sections
  • YAML syntax errors in output
  • Content not properly mapped to template
  • File write operation fails
  • hasSidecar: true but sidecar folder not created

TRANSITION CRITERIA

Ready for Step 8 when:

  • Agent YAML successfully created (with or without sidecar as specified)
  • User selects continue
  • All build artifacts confirmed written