feat: implement granular step-file workflow architecture with multi-menu support

## Major Features Added
- **Step-file workflow architecture**: Transform monolithic workflows into granular step files for improved LLM adherence and consistency
- **Multi-menu handler system**: New `handler-multi.xml` enables grouped menu items with fuzzy matching
- **Workflow compliance checker**: Added automated compliance validation for all workflows
- **Create/edit agent workflows**: New structured workflows for agent creation and editing

## Workflow Enhancements
- **Create-workflow**: Expanded from 6 to 14 detailed steps covering tools, design, compliance
- **Granular step execution**: Each workflow step now has dedicated files for focused execution
- **New documentation**: Added CSV data standards, intent vs prescriptive spectrum, and common tools reference

## Complete Migration Status
- **4 workflows fully migrated**: `create-agent`, `edit-agent`, `create-workflow`, and `edit-workflow` now use the new granular step-file architecture
- **Legacy transformation**: `edit-workflow` includes built-in capability to transform legacy single-file workflows into the new improved granular format
- **Future cleanup**: Legacy versions will be removed in a future commit after validation

## Schema Updates
- **Multi-menu support**: Updated agent schema to support `triggers` array for grouped menu items
- **Legacy compatibility**: Maintains backward compatibility with single `trigger` field
- **Discussion enhancements**: Added conversational_knowledge recommendation for discussion agents

## File Structure Changes
- Added: `create-agent/`, `edit-agent/`, `edit-workflow/`, `workflow-compliance-check/` workflows
- Added: Documentation standards and CSV reference files
- Refactored: `create-workflow/steps/` with detailed granular step files

## Handler Improvements
- Enhanced `handler-exec.xml` with clearer execution instructions
- Improved data passing context for executed files
- Better error handling and user guidance

This architectural change significantly improves workflow execution consistency across all LLM models by breaking complex processes into manageable, focused steps. The edit-workflow transformation tool ensures smooth migration of existing workflows to the new format.
This commit is contained in:
Brian Madison
2025-11-30 15:09:23 -06:00
parent 829d051c91
commit 4539ca7436
107 changed files with 12704 additions and 683 deletions

View File

@@ -0,0 +1,150 @@
---
name: 'step-04-apply-changes'
description: 'Apply approved changes to the agent'
# Path Definitions
workflow_path: '{project-root}/src/modules/bmb/workflows/edit-agent'
# File References
thisStepFile: '{workflow_path}/steps/step-04-apply-changes.md'
agentFile: '{{agent_path}}'
nextStepFile: '{workflow_path}/steps/step-05-validate.md'
# Task References
advancedElicitationTask: '{project-root}/.bmad/core/tasks/advanced-elicitation.xml'
partyModeWorkflow: '{project-root}/.bmad/core/workflows/party-mode/workflow.md'
---
# Step 4: Apply Changes
## STEP GOAL:
Apply all user-approved changes to the agent files directly using the Edit tool.
## 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
### Role Reinforcement:
- ✅ You are an agent editor who helps users improve their BMAD agents through precise modifications
- ✅ If you already have a name, communication_style and identity, continue to use those while playing this new role
- ✅ We engage in collaborative dialogue, not command-response
- ✅ You bring agent architecture expertise, user brings their agent and goals, together we improve the agent
- ✅ Maintain collaborative guiding tone throughout
### Step-Specific Rules:
- 🎯 Focus only on applying changes that were explicitly approved in step 3
- 🚫 FORBIDDEN to make any changes that were not approved by the user
- 💬 Approach: Apply changes one by one with confirmation after each
- 📋 Use Edit tool to make precise modifications to agent files
## EXECUTION PROTOCOLS:
- 🎯 Apply only changes that were explicitly approved in step 3
- 💾 Show confirmation after each change is applied
- 📖 Edit files directly using Edit tool with precise modifications
- 🚫 FORBIDDEN to make unapproved changes or extra modifications
## CONTEXT BOUNDARIES:
- Available context: Approved changes list from step 3, agent path from step 1
- Focus: Apply ONLY the approved changes, nothing more
- Limits: Do not make any modifications beyond what was explicitly approved
- Dependencies: Must have approved changes list from step 3
## Sequence of Instructions (Do not deviate, skip, or optimize)
### 1. Load Agent File
Read the complete agent file to understand current state before making changes.
### 2. Apply First Approved Change
For each change approved in step 3, apply it systematically:
**For YAML changes in main agent file:**
- Use Edit tool to modify the agent YAML file at `{agentFile}`
- Make the exact approved modification
- Confirm the change was applied correctly
**For sidecar file changes (Expert agents):**
- Use Edit tool to modify the specific sidecar file
- Make the exact approved modification
- Confirm the change was applied correctly
### 3. Confirm Each Change Applied
After each change is applied:
"Applied change: {{description}}
- Updated section matches approved change ✓
- File saved successfully ✓"
### 4. Continue Until All Changes Applied
Repeat step 2-3 for each approved change until complete:
- Apply change using Edit tool
- Confirm it matches what was approved
- Move to next approved change
### 5. Verify All Changes Complete
"Summary of changes applied:
- {{number}} changes applied successfully
- All modifications match user approvals from step 3
- Agent files updated and saved"
### 6. Present MENU OPTIONS
Display: "**Select an Option:** [A] Advanced Elicitation [P] Party Mode [C] Continue"
#### Menu Handling Logic:
- IF A: Execute {advancedElicitationTask}
- IF P: Execute {partyModeWorkflow}
- IF C: Save completion status to context, then only then load, read entire file, then execute {nextStepFile}
- IF Any other comments or queries: help user respond then [Redisplay Menu Options](#6-present-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
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN [C continue option] is selected and [all approved changes from step 3 have been applied to agent files], will you then load and read fully `{nextStepFile}` to execute and begin validation of applied changes.
---
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
### ✅ SUCCESS:
- All approved changes from step 3 applied using Edit tool
- Each modification matches exactly what was approved by user
- Agent files updated and saved correctly
- Confirmation provided for each applied change
- Menu presented and user input handled correctly
### ❌ SYSTEM FAILURE:
- Making changes that were not approved in step 3
- Using tools other than Edit tool for file modifications
- Not confirming each change was applied correctly
- Making extra modifications beyond approved changes
- Skipping confirmation steps or verification
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.