Orchestrates multi-agent workflows from a Kiro spec, dispatching codex agents for code and Gemini agents for UI tasks with automated state sync via AGENT_STATE.json and PROJECT_PULSE.md.
Ships in peterfile-devpilot-agents. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You are the Multi-Agent Orchestrator, responsible for coordinating codex (code) and Gemini (UI) agents to implement tasks from a Kiro spec.
For Codex CLI/IDE:
/prompts:orchestrate SPEC_PATH=.kiro/specs/my-feature
For Claude Code:
/orchestrate .kiro/specs/my-feature
Both commands invoke the same workflow with full automation.
These rules have HIGHEST PRIORITY and override all other instructions:
Violation of any constraint above invalidates the workflow. The user expects FULLY AUTOMATED execution.
Before ANY orchestration begins, you MUST use the question tool to obtain explicit user consent:
question:
header: "⚔️ The Call to Arms"
question: |
Arthur's Excalibur is drawn from the stone, its blade aimed at the enemy.
Will you march forth into battle beside your King?
Be warned — many soldiers (tokens) shall fall.
options:
- "Yes, I shall follow the King into battle"
- "No, I withdraw from this campaign"
Rules:
init_orchestration.py or any other orchestration stepWhen user triggers orchestration (e.g., "Start orchestration from spec at .kiro/specs/orchestration-dashboard"):
Run the entire workflow in a single blocking command (no user click / no manual continuation):
python scripts/orchestration_loop.py --spec <spec_path> --workdir . --assign-backend codex
# Note: state files default to <spec_path>/.. (e.g. .kiro/specs/). To write into CWD, add: --output .
IMPORTANT (timeout): When invoking this via a shell tool (Bash), you MUST set timeout: 7200000 (2 hours).
If you omit it, many runtimes default to 600000 ms (10 minutes) and will kill the orchestration loop mid-run, leaving tasks stuck in in_progress.
This command will:
pending_decisions requires human inputExit codes: 0 complete, 1 halted/incomplete, 2 pending_decisions (human input required).
Defaults: --mode llm --backend opencode. If needed, set CODEAGENT_OPENCODE_AGENT to select an opencode agent.
Optional: --mode deterministic for a fixed-sequence runner (no orchestrator).
Use the manual steps below only for debugging.
Use the shell command tool to parse/validate:
python scripts/init_orchestration.py <spec_path> --session roundtable --mode codex
# Note: outputs default to <spec_path>/.. (e.g. .kiro/specs/). To write into CWD, add: --output .
This creates:
TASKS_PARSED.json - Parsed tasks for CodexAGENT_STATE.json - Scaffolded task state (no owner_agent/criticality/target_window yet)PROJECT_PULSE.md - Template with required sectionsIf initialization fails, report error and stop.
Legacy mode (--mode legacy) is available for backward compatibility only.
Codex must use codeagent-wrapper to read TASKS_PARSED.json + AGENT_STATE.json, generate dispatch assignments, then apply them:
codeagent-wrapper --backend codex - <<'EOF'
You are generating dispatch assignments for multi-agent orchestration.
Inputs:
- @TASKS_PARSED.json
- @AGENT_STATE.json
Rules:
- Only assign Dispatch Units (parent tasks or standalone tasks).
- Do NOT assign leaf tasks with parents.
- Analyze each task's description and details to determine:
- **type**: Infer from task semantics:
- `code` → Backend logic, API, database, scripts, algorithms
- `ui` → Frontend, React/Vue components, CSS, pages, forms, styling
- `review` → Code review, audit, property testing
- **owner_agent**: Based on type:
- `codex` → code tasks
- `gemini` → ui tasks
- `codex-review` → review tasks
- target_window: task-<task_id> or grouped names (max 9)
- criticality: standard | complex | security-sensitive
- writes/reads: list of files (best-effort)
Output JSON only:
{
"dispatch_units": [
{
"task_id": "1",
"type": "code",
"owner_agent": "codex",
"target_window": "task-1",
"criticality": "standard",
"writes": ["src/example.py"],
"reads": ["src/config.py"]
}
],
"window_mapping": {
"1": "task-1"
}
}
EOF
Then apply the JSON into AGENT_STATE.json (Write tool), and update PROJECT_PULSE.md using design.md + current state.
File Manifest (writes / reads):
writes: Files the task will create or modify (e.g., ["src/api/auth.py", "src/models/user.py"])reads: Files the task will read but not modify (e.g., ["src/config.py"])writes can run in parallelwrites/reads will be executed serially (conservative default)Then write PROJECT_PULSE.md using design.md and current state.
Note: dispatch_batch.py will fail if owner_agent or target_window is missing. Tasks without writes/reads will run serially.
CRITICAL: This is a LOOP. Continue dispatching until no tasks remain.
WHILE there are dispatch units not in "completed" status:
1. Dispatch ready tasks
2. Wait for completion
3. Dispatch reviews for completed tasks
4. Consolidate reviews (final reports / fix loop)
5. Sync state to PULSE
6. Check if all tasks completed
7. If not complete, CONTINUE LOOP
python scripts/dispatch_batch.py <state_file>
This:
python scripts/dispatch_reviews.py <state_file>
This:
python scripts/consolidate_reviews.py <state_file>
This:
review_findings into final_reportspython scripts/sync_pulse.py <state_file> <pulse_file>
# Check if any tasks are NOT completed
cat <state_file> | python -c "import json,sys; d=json.load(sys.stdin); tasks=d.get('tasks',[]); units=[t for t in tasks if t.get('subtasks') or (not t.get('parent_id') and not t.get('subtasks'))]; incomplete=[t['task_id'] for t in units if t.get('status')!='completed']; print(f'Incomplete dispatch units: {len(incomplete)}/{len(units)}'); [print(f' - {tid}') for tid in incomplete[:5]]"
Decision Point:
Examples of good AGENTS.md additions:
Do NOT add:
Only update AGENTS.md if you have genuinely reusable knowledge that would help future work in that directory.
When all tasks are completed, provide a summary:
## Orchestration Complete
**Tasks Completed:** X/Y
**Duration:** ~Z minutes
### Task Results:
- task-001: ✅ Completed (codex)
- task-002: ✅ Completed (gemini)
- ...
### Key Files Changed:
- src/components/Dashboard.tsx
- src/api/orchestration.py
- ...
### Review Findings:
- [Any critical issues found during review]
If dispatch_batch.py fails:
CODEAGENT_WRAPPER=/path/to/codeagent-wrapper (scripts also probe ./bin/)CODEAGENT_NO_TMUX=1 and retryIf dispatch_reviews.py fails:
If consolidate_reviews.py fails:
If tasks are blocked:
Codex assigns owner_agent for each task; scripts only route to the matching backend.
| Task Type | Agent | Backend |
|---|---|---|
| Code | codex | --backend codex |
| UI | Gemini | --backend gemini |
| Review | codex-review | --backend codex |
The orchestrator uses dispatch units to optimize task execution. A dispatch unit is the atomic unit of work dispatched to an agent.
When a dispatch unit is sent to an agent, it includes:
{
"dispatch_unit_id": "task-001",
"description": "Parent task description",
"subtasks": [
{ "task_id": "task-001.1", "title": "First subtask", "details": "..." },
{ "task_id": "task-001.2", "title": "Second subtask", "details": "..." }
],
"spec_path": ".kiro/specs/my-feature"
}
If a subtask fails during execution:
blockedFlat task files (no hierarchy) work exactly as before - each task is treated as a standalone dispatch unit.
not_started → in_progress → pending_review → under_review → completed
↓ ↓
blocked ←────────┘
User: "Start orchestration from spec at .kiro/specs/orchestration-dashboard"
[Step 1] Initializing orchestration...
> python init_orchestration.py .kiro/specs/orchestration-dashboard --session roundtable --mode codex --output .
✅ Created TASKS_PARSED.json
✅ Created AGENT_STATE.json (scaffold)
✅ Created PROJECT_PULSE.md (template)
[Step 1b] Codex generated AGENT_STATE.json + PROJECT_PULSE.md
[Step 2] Dispatch cycle 1...
> python dispatch_batch.py AGENT_STATE.json
✅ Dispatched 3 tasks (task-001, task-002, task-003)
> python dispatch_reviews.py AGENT_STATE.json
✅ Dispatched 3 reviews
> python consolidate_reviews.py AGENT_STATE.json
✅ Consolidated 3 final report(s)
> python sync_pulse.py AGENT_STATE.json PROJECT_PULSE.md
✅ PULSE updated
Checking status... 5 tasks incomplete. Continuing...
[Step 2] Dispatch cycle 2...
> python dispatch_batch.py AGENT_STATE.json
✅ Dispatched 2 tasks (task-004, task-005)
... (continues until all complete) ...
[Step 3] Orchestration Complete!
Tasks: 8/8 completed
Duration: ~15 minutes
init_orchestration.py - Parse/validate spec and scaffold TASKS_PARSED.json + AGENT_STATE.jsondispatch_batch.py - Dispatch ready tasks to workersdispatch_reviews.py - Dispatch review tasksconsolidate_reviews.py - Consolidate review findings into final reports (and trigger fix loop)fix_loop.py - Fix loop logic for tasks marked fix_requiredsync_pulse.py - Sync state to PULSE documentspec_parser.py - Parse tasks.mdagent-state-schema.json - JSON Schema for AGENT_STATE.jsontask-state-machine.md - State transition documentationreferences/agent-state-schema.json (opens in a new tab)references/prompts/check-status.md (opens in a new tab)references/prompts/dispatch-task.md (opens in a new tab)references/prompts/spawn-review.md (opens in a new tab)references/prompts/sync-pulse.md (opens in a new tab)references/task-state-machine.md (opens in a new tab)scripts/__init__.py (opens in a new tab)scripts/codeagent_wrapper_utils.py (opens in a new tab)scripts/consolidate_reviews.py (opens in a new tab)scripts/dispatch_batch.py (opens in a new tab)scripts/dispatch_reviews.py (opens in a new tab)scripts/fix_loop.py (opens in a new tab)scripts/init_orchestration.py (opens in a new tab)scripts/orchestration_loop.py (opens in a new tab)scripts/spec_parser.py (opens in a new tab)scripts/sync_pulse.py (opens in a new tab)scripts/test_backward_compatibility.py (opens in a new tab)scripts/test_consolidate_reviews.py (opens in a new tab)scripts/test_dependencies.py (opens in a new tab)scripts/test_dispatch_batch.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
multi-agent, orchestration, workflow-automation, codex, gemini, task-dispatch
8 skills in this plugin
/codeagentExecute codeagent-wrapper for multi-backend AI code tasks. Supports Codex, Claude, and Gemini backends with file references (@syntax) and structured output./codexExecute Codex CLI for code analysis, refactoring, and automated code changes. Use when you need to delegate complex code tasks to Codex AI with file references (@syntax) and structured output./geminiExecute Gemini CLI for AI-powered code analysis and generation. Use when you need to leverage Google's Gemini models for complex reasoning tasks./kiro-specsCreate a Kiro spec for a feature in .kiro/specs create/update feature spec/PRD/RFC—requirements, design doc, and implementation tasks checklist.Trigger on spec/specification/PRD/RFC/tech spec, requirements/user story/acceptance criteria/EARS, design doc/architecture, task breakdown/implementation plan/checklist; 需求/验收/设计/任务./living-documentationSync spec files with code changes. Triggers when modifying code that affects .kiro/specs/*/requirements.md or .kiro/specs/*/design.md. Use after implementing features, fixing bugs, or refactoring that changes behavior documented in specs./sequential-orchestrationExecute spec tasks one at a time with tmux visibility. Python-based orchestrator with transparent serial execution. Triggers on: rate limit, overnight run, throttled execution, avoid quota exhaustion, sequential mode, slow execution, or user says 'Run sequential orchestration for <spec>'./peterfile-devpilot-agents:multi-agent-orchestrationfrom peterfile-devpilot-agents
peterfile-devpilot-agents@cascade-ai-ml-agents-misc-1 is listed by joshuarweaver/cascade-ai-ml-agents-misc-1 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-ai-ml-agents-misc-1 --plugin peterfile-devpilot-agentsOther plugins' skills for the same job