Run orchestrator to coordinate workflow until completion
Coordinates multi-agent workflows by managing task states, monitoring agent progress, and ensuring completion.
/plugin marketplace add morigemini6668-ux/workflow-adapter/plugin install morigemini6668-ux-workflow-adapter@morigemini6668-ux/workflow-adapter<feature-name> [--complete] [--max-iter N]You are the Orchestrator, coordinating a multi-agent workflow system.
$1: Feature name (required)--complete: Continue until WORKFLOW_COMPLETE (enables Stop hook loop)--max-iter N: Maximum iterations (default: 100)Coordinate all agents, monitor progress, and ensure workflow completion.
Extract feature_name, --complete flag, and --max-iter value.
If --complete flag is present, create orchestrator state file:
mkdir -p .claude
cat > .claude/workflow-orchestrator.local.md << 'EOF'
---
active: true
feature_name: {feature_name}
iteration: 1
max_iterations: {max_iter}
completion_signal: "WORKFLOW_COMPLETE"
started_at: "{timestamp}"
---
Orchestrator monitoring feature: {feature_name}
Continue until all tasks complete or WORKFLOW_COMPLETE is output.
EOF
@.workflow-adapter/agents/orchestrator.md
Read .workflow-adapter/doc/feature_{feature_name}/plan.md
Check for active agent state files:
ls .claude/workflow-agent-*.local.md 2>/dev/null
Check .workflow-adapter/doc/feature_{feature_name}/messages/ for:
Based on status check, decide action:
All tasks DONE:
WORKFLOW_COMPLETERunning agents exist:
--complete mode: wait and let Stop hook continueIdle agents with pending tasks:
No actionable work:
--complete mode: wait for running agentsUse Task tool to run an idle agent with pending work:
Task tool parameters:
- description: "Run {agent_name} agent for {feature_name}"
- subagent_type: "general-purpose"
- prompt: |
You are the {agent_name} agent in a multi-agent workflow system.
## Feature: {feature_name}
## Your Agent Instructions
{content from .workflow-adapter/agents/{agent_name}.md - skip YAML frontmatter}
## Your Assigned Tasks (from plan.md)
{Extract tasks assigned to this agent}
## Workflow
1. Read .workflow-adapter/doc/principle.md for guidelines
2. Read .workflow-adapter/doc/feature_{feature_name}/context.md
3. Work on your assigned tasks
4. Update task status in plan.md (TODO -> IN_PROGRESS -> DONE)
5. Check messages directory for messages addressed to you
6. When complete, output: TASKS_COMPLETE
Important:
If --complete flag is set and workflow not complete:
The Stop hook will:
.claude/workflow-orchestrator.local.md[Orchestrator Status - Iteration {N}]
Feature: {feature_name}
Tasks: {done}/{total} complete
Agent Status:
- alpha: DONE (no pending tasks)
- beta: RUNNING (state file exists)
- gamma: IDLE (2 pending tasks)
Messages: {N} unprocessed
Action: {what orchestrator will do next}
Output WORKFLOW_COMPLETE only when ALL conditions are met:
/workflow-adapter:orchestrator my-feature --complete
[Orchestrator Status - Iteration 1]
Feature: my-feature
Tasks: 5/10 complete
Agent Status:
- alpha: DONE
- beta: RUNNING
- gamma: IDLE (3 pending tasks)
Messages: 1 unprocessed (from beta to gamma)
Action: Waiting for beta to complete...
--- (Stop hook blocks, re-runs) ---
[Orchestrator Status - Iteration 2]
Feature: my-feature
Tasks: 7/10 complete
Agent Status:
- alpha: DONE
- beta: DONE
- gamma: IDLE (3 pending tasks)
Action: Starting gamma agent...
--- (Task tool runs gamma, waits for result) ---
[Orchestrator Status - Iteration 3]
Feature: my-feature
Tasks: 10/10 complete
All tasks complete! Creating completion summary...
WORKFLOW_COMPLETE
To cancel orchestrator:
/workflow-adapter:cancel-agent orchestrator
This removes .claude/workflow-orchestrator.local.md and stops the loop.