Parallel Orchestration Skill
Purpose: Defines the protocol and tools for the Orchestrator Role, enabling the decomposition of large tasks into independent sub-tasks and their parallel execution via sub-agents (or mock agents).
1. Red Flags (Anti-Rationalization)
STOP and READ THIS if you are thinking:
- "I can just run
python agent.pydirectly." -> WRONG. You must use thespawn_agent_mock.pyscript to ensure shared state updates. - "I don't need file locking." -> WRONG. Multiple agents writing to
latest.yamlwill corrupt the session state. - "I'll just wait for all agents sequentially." -> WRONG. This defeats the purpose of parallelism. Spawn them in the background (
&).
2. Capabilities
- Decompose: Split complex tasks into atomic
docs/tasks/subtask-*.mdfiles. - Spawn: Launch independent agent processes that execute asynchronously.
- Synchronize: Read shared session state to track progress of all spawned agents.
3. Instructions
Phase 1: Task Decomposition
- Analyze the user request.
- Create individual task files in
docs/tasks/for each parallel unit of work. - Ensure tasks are truly independent (no shared memory requirements other than final artifacts).
Phase 2: Agent Spawning
- Call the Agent Runner script using
run_command. - Use the
&operator to run in background.python3 .agent/skills/skill-parallel-orchestration/scripts/spawn_agent_mock.py \ --task_name "subtask-A" \ --goal "Implement Logic" \ --output_dir "docs/tasks/results" & - Repeat for all sub-tasks.
Phase 3: Monitoring & Merging
- Poll
.agent/sessions/latest.yaml(read only). - Wait until all sub-tasks show status "Completed".
- Read result files from
docs/tasks/results/. - Synthesize final answer for the user.
4. Best Practices & Anti-Patterns
| DO THIS | DO NOT DO THIS |
|---|---|
Use Background Jobs (&) | Run agents sequentially |
| Check Session State | Assume agents finished after X seconds |
| Use Unique IDs | Reuse task names (causes overwrite) |
5. Scripts and Resources
scripts/spawn_agent_mock.py: Mock Agent Runner. Simulates LLM agent behavior (delay + file write) and updates session state.
