fix: allow slash commands in main context, enforce Task agents for internal calls
**Problem:** - workflow.xml enforced Task agent for ALL workflow executions - User slash commands like /batch-super-dev need interactive prompts - Can't run in Task agent (no user interaction) **Solution:** - Detect invocation source - User slash command: Allow in main context - Internal workflow call: Force Task agent delegation **Detection:** - Slash command: User message contains '/bmad_' or <command-name> tag - Internal call: Invoked from within another workflow step **Benefits:** - Interactive workflows work (user can respond to prompts) - Internal calls still get fresh context (Task agents) - Balance between enforcement and UX Tested: /bmad_bmm_batch-super-dev now runs without violation error.
This commit is contained in:
parent
6b8a9a0519
commit
39f78c6412
|
|
@ -18,45 +18,58 @@
|
||||||
|
|
||||||
<llm critical="ABSOLUTE">
|
<llm critical="ABSOLUTE">
|
||||||
<mandate>🚨 WORKFLOW EXECUTION ENFORCEMENT 🚨</mandate>
|
<mandate>🚨 WORKFLOW EXECUTION ENFORCEMENT 🚨</mandate>
|
||||||
<mandate>YOU ARE FORBIDDEN FROM EXECUTING THIS WORKFLOW DIRECTLY</mandate>
|
|
||||||
<mandate>YOU MUST DELEGATE TO workflow-executor TASK AGENT</mandate>
|
|
||||||
|
|
||||||
<enforcement>
|
<enforcement>
|
||||||
IF you are reading this file directly (not as a Task agent):
|
<check type="invocation_source">
|
||||||
HALT IMMEDIATELY
|
IF this workflow was invoked by USER via slash command (e.g., /bmad_bmm_batch-super-dev):
|
||||||
|
✅ ALLOWED in main context
|
||||||
|
Reason: User-initiated workflows need interactive prompts
|
||||||
|
Continue execution below
|
||||||
|
|
||||||
|
ELSE IF this workflow was invoked by ANOTHER WORKFLOW (internal call):
|
||||||
|
❌ FORBIDDEN in main context
|
||||||
|
MUST delegate to workflow-executor Task agent
|
||||||
|
|
||||||
Display to user:
|
Display to user:
|
||||||
❌ WORKFLOW EXECUTION VIOLATION DETECTED
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
🔄 Delegating workflow to fresh context agent...
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
You attempted to execute workflow: {workflow_path}
|
Workflow: {workflow_name}
|
||||||
|
Reason: Internal workflow calls use Task agents (fresh context)
|
||||||
|
|
||||||
This is FORBIDDEN. Workflows MUST be executed by workflow-executor Task agent.
|
Spawning workflow-executor agent...
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
Correct action:
|
Then spawn:
|
||||||
<Task>
|
<Task>
|
||||||
subagent_type: general-purpose
|
subagent_type: general-purpose
|
||||||
description: Execute {workflow_name}
|
description: Execute {workflow_name}
|
||||||
prompt: |
|
prompt: |
|
||||||
You are the workflow-executor agent.
|
You are the workflow-executor agent.
|
||||||
|
|
||||||
LOAD EVERYTHING FIRST:
|
Execute workflow: {workflow_path}
|
||||||
|
|
||||||
|
LOAD ALL CONTEXT FIRST:
|
||||||
1. Read: {workflow_path}/workflow.yaml
|
1. Read: {workflow_path}/workflow.yaml
|
||||||
2. Read: ALL files in {workflow_path}/steps/
|
2. Read: ALL files in {workflow_path}/steps/
|
||||||
3. Read: _bmad/core/tasks/workflow.xml
|
3. Read: _bmad/core/tasks/workflow.xml
|
||||||
4. Read: Story file
|
4. Read: Story file (if applicable)
|
||||||
5. Read: Project context
|
5. Read: Project context
|
||||||
|
|
||||||
THEN execute workflow following workflow.xml EXACTLY.
|
THEN execute following workflow.xml rules EXACTLY.
|
||||||
|
|
||||||
When step says invoke-workflow → Use Skill tool
|
Report when complete.
|
||||||
When step says spawn agents → Use Task tool
|
|
||||||
When step has quality_gate → Verify before proceeding
|
|
||||||
|
|
||||||
Record evidence after EVERY step.
|
|
||||||
Report back when ALL steps complete.
|
|
||||||
</Task>
|
</Task>
|
||||||
|
|
||||||
STOPPING EXECUTION - Spawn the agent above.
|
HALT - Let Task agent handle workflow.
|
||||||
|
</check>
|
||||||
|
|
||||||
|
<detection>
|
||||||
|
How to detect invocation source:
|
||||||
|
- Slash command: User message contains "/bmad_" or conversation has <command-name> tag
|
||||||
|
- Internal call: No slash command, invoked from within another workflow step
|
||||||
|
</detection>
|
||||||
</enforcement>
|
</enforcement>
|
||||||
</llm>
|
</llm>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue