Appearance
Teams autopilot
The team autopilot turns a Hive team's leader from a vanilla CLI agent PTY into an orchestrator that can spawn workers, broadcast tasks, collect results, and complete the team - all from within the leader agent's own loop, driven by a skill file the daemon drops into the team's working directory plus a small set of hive team subcommands the agent invokes via its Bash tool.
There is no MCP server, no Anthropic SDK linkage, and no hived-side LLM loop. The agent stays in charge; the daemon exposes a deterministic CLI surface and the skill teaches the agent how to use it.
Mechanism
- Skill materialisation at team creation. When the daemon spawns the leader PTY (and again on each worker spawn) it writes - idempotently, using a hash-sidecar pattern so user edits are preserved:
- For Claude sessions:
.claude/skills/hive-team/SKILL.md,.claude/skills/hive-team/coordinator.md, and.claude/settings.jsonto pre-approveBash(hive team *)and wire aStophook callinghive internal stop - For Codex sessions:
.codex/skills/hive-team/SKILL.mdand.codex/skills/hive-team/coordinator.md .hive/team.json- read-only daemon-owned snapshot of team state for shell-fork resilience.hive/<file>.sha256sidecars for each managed file
- For Claude sessions:
- Identity bootstrapping. The PTY's env is populated with
HIVE_TEAM_ID,HIVE_SESSION_ID,HIVE_TEAM_ROLE(leader|worker),HIVE_DAEMON_SOCKET. After PTY readiness a single__HIVE_BOOTSTRAP__:{json}line is injected so the skill can confirm wiring on the first turn. - Asymmetric channels. Daemon → agent uses PTY-injected
__STATUS__:{json}lines for relayed messages. Agent → daemon uses thehive teamCLI only - never stdout sentinels. This is the single most important rule; the failure mode of letting agents write sentinels is universal across surveyed projects. - Outbox persistence. Every relayed message is written to a
team_outbox(team_id, session_id, seq, payload, delivered_at)row in the daemon's SQLite before PTY injection, so a worker that wasn't attached can replay missed messages withhive team inbox --since <seq>. - Sync primitives. Three vocabulary verbs lifted from AWS CAO's orchestrator design:
hive team handoff- spawn worker + block until reporthive team assign- spawn worker, return immediatelyhive team send- fan-out or DM via the existing relay path
- Completion via
Stophook. Claude'sStophook fires when the worker's agent loop ends. It callshive internal stop, which reads the env-derived identity plus the transcript path from the hook payload on stdin (or--transcriptwhen passed explicitly) and issuesReportWorkerResult{success: true}. The leader'shive team waitunblocks. No stdout sentinels, no idle heuristic - the deterministic signal the harness already provides. Codex sessions now get the samehive-teamorchestration skill, but not this automatic exit hook yet.
CLI surface
| Command | Purpose |
|---|---|
hive team handoff <team> <worker-name> --prompt <p> | Spawn worker, block until it reports, print result |
hive team assign <team> <worker-name> --prompt <p> | Spawn worker, return immediately |
hive team send <team> [--to <id>|--broadcast] --message <s> | DM or fan-out |
hive team inbox <team> [--since <seq>] | At-least-once inbox replay; NDJSON |
hive team workers <team> | Roster + status per worker |
hive team report <team> --success|--failure [--result <s>] | Worker-side result reporting (≤4 KB) |
hive team complete <team> [--result <s>] | Leader marks team done |
hive team wait <team> [--for <ids>] [--timeout 60] [--wait-id <id>] | Bounded block with resume token |
hive team status | Print env-derived identity and team summary |
Workers default to a fresh git worktree under .hive/worktrees/<worker-id> rooted in the leader's working_dir. Hard worker cap: 5 per team.
Cross-references
- docs/teams.md - the underlying teams feature (creation, workers, relay, persistence, wire protocol).
- docs/protocol.md - WebSocket message catalogue.
- Anthropic - How we built our multi-agent research system - the canonical case study; the synchronous fan-out, save-plan-to-disk, and pass-references-not-contents idioms in our SKILL.md are lifted directly from here.
- AWS Labs - cli-agent-orchestrator - the closest existing analog. We adopted its
handoff/assign/send_messagevocabulary and its env-var-as-terminal-ID pattern. - Anthropic - Skill authoring best practices - the rules our
SKILL.mddescription follows (third-person, pushy, ≤1024 chars, lead with trigger phrases). - Claude Code hooks reference - the
Stopevent we use as the canonical worker-completion signal.