/hive-drive — Autonomous Swarm Coordinator
Drive a swarm from start to finish autonomously. This skill enters a wave-based loop: pollinate, spawn bees as background Task agents, monitor via TaskOutput, re-pollinate, and repeat until the swarm completes or fails.
Arguments: $ARGUMENTS
Modes
Mode 1: Start and drive a new swarm
Pattern: /hive-drive <blueprint_id> <task...>
Example: /hive-drive feature-dev Add user authentication system
- •Call
mcp__hive__hive_swarm_startwith the blueprint_id and task. - •Enter the Wave Loop with the returned swarm_id.
Mode 2: Drive an existing swarm
Pattern: /hive-drive <number>
Example: /hive-drive 3
- •Call
mcp__hive__hive_swarm_summarywith the swarm_id resolved from the number. - •Verify the swarm is
buzzing. If not, report the status and exit. - •Enter the Wave Loop with the swarm_id.
Mode 3: No arguments
Pattern: /hive-drive
- •Call
mcp__hive__hive_swarm_listwith status=buzzing. - •If buzzing swarms exist, show them and ask the user which to drive.
- •If no buzzing swarms, show available blueprints and offer to start one.
Wave Loop
The core execution loop. Repeat until the swarm completes, fails, or safety limits are hit.
Variables
- •
wave— Counter starting at 1 (max 50) - •
empty_polls— Counter of consecutive empty pollinates (max 3) - •
last_epoch— Last seen epoch value (start at -1) - •
swarm_id— The swarm being driven
Each Wave
Step 1: Check epoch (skip if first wave)
- •Call
mcp__hive__hive_check_epoch. - •If epoch equals
last_epoch, sleep 5 seconds and re-check (up to 3 times). - •Update
last_epoch.
Step 2: Pollinate
- •Call
mcp__hive__hive_pollinatewith the swarm_id. - •If zero spawns returned, increment
empty_polls. - •If spawns returned, reset
empty_pollsto 0.
Step 3: Spawn bees
- •For each SpawnRequest in the pollinate result:
- •Use the
Tasktool to spawn a background agent:- •
subagent_type: "general-purpose" - •
run_in_background: true - •
prompt: The SpawnRequest'spromptfield - •
model: The SpawnRequest'smodelfield - •
max_turns: The SpawnRequest'smaxTurnsfield
- •
- •Report: "Dispatched bee
{beeId}: {flightDescription}"
- •Use the
Step 4: Monitor background tasks
- •Wait for all spawned tasks to complete using
TaskOutputwith block=true. - •Report completion of each bee.
Step 5: Check swarm status
- •Call
mcp__hive__hive_swarm_summarywith the swarm_id. - •Report progress: flight pipeline position, cell completion ratio.
- •If swarm status is
completed: callmcp__hive__hive_swarm_analyticsand report success with timing summary. Exit loop. - •If swarm status is
failed: report failure and exit loop. - •If swarm status is
cancelled: report and exit loop. - •If swarm status is
blocked: Check for gated flights. Show the gated flight details and ask the user: "Approve this flight to continue? (flight: {flight_id}, gate: approval)". If the user approves, callmcp__hive__hive_gate_approvewith the flight_id. Resume the loop.
Step 6: Safety checks
- •If
wave >= 50: report max waves reached, suggest/hive-drive {number}to continue. Exit loop. - •If
empty_polls >= 3: callmcp__hive__hive_beekeeper_check. If beekeeper finds issues, resetempty_pollsto 0. If no issues found, report possible stall and exit loop.
Step 7: Next wave
- •Increment
wave. - •Go to Step 1.
Output Format
Report progress after each wave:
Wave {N} — Swarm #{number}
Dispatched: {count} bee(s)
Pipeline: {done}/{total} flights done
Cells: {done}/{total} done
Status: {status}
On completion:
Swarm #{number} completed successfully!
Task: {task}
Waves: {count}
Flights: {total} completed
Cells: {done}/{total} done
Total time: {duration}s
Bottleneck: {flight_id} ({duration}s)
Parallelism: {ratio}x
On failure:
Swarm #{number} failed.
Task: {task}
Waves: {count}
Use `/hive resume {number}` to retry failed flights.
Important Rules
- •This skill DRIVES swarms autonomously. It spawns bee subagents and waits for them.
- •Do NOT write code, edit files, or run bash commands yourself. Bees do the work.
- •Do NOT call
hive_flight_claim,hive_flight_complete, orhive_flight_faildirectly. Bees call these. - •Always spawn bees as background Task agents so they run in parallel.
- •Use
hive_check_epochto avoid expensive polls when nothing has changed. - •If a bee task returns an error, the flight will be marked failed by the bee. Continue the loop.
- •Maximum 50 waves per invocation. The user can re-run
/hive-drive {number}to continue.