Shell-Out Plugins as Agent Tool Compatibility Layer

repoaiagentsclitypescriptmcpagent-loopsmemorycoordinationswarm-tools

shell-out wrapper pattern maps to joelclaw Pi extensions when CLIs are already the source of truth

Clawdbot didn’t get a whole new orchestration brain here. It got an adapter. This swarm-tools commit adds packages/swarm-tools as a plugin that exposes 25 tools across Hive, Hivemind, Swarm Mail, and Swarm orchestration.

The clever bit is the plugin doesn’t own the state. The index.ts implementation shells out to the swarm CLI with swarm tool <name> --json, which keeps the CLI as the source of truth and avoids native dependency bundling bullshit inside the host plugin runtime.

There’s also a fallback MCP server in bin/mcp-server.ts, plus a session-to-hivemind hook that queries memory on command:new and stores a session summary on session:end. That’s the useful shape for joelclaw: keep durable behavior in boring CLIs, then expose those CLIs through whatever agent surface needs them.

Key Ideas

  • Clawdbot gets Swarm capabilities through a thin plugin instead of a second implementation.
  • swarm tool <name> --json is the compatibility seam: one command shape can feed plugins, hooks, and MCP tools.
  • Hive handles task cells, Hivemind handles semantic memory, and Swarm Mail handles agent coordination and file reservations.
  • The session-to-hivemind hook makes context survival explicit instead of hoping the model remembers after compaction.
  • The MCP fallback converts JSON Schema tool definitions into Zod schemas, which keeps the same tool surface available to MCP-capable clients.
  • The swarm-coordination skill writes down the coordinator/worker split: decompose, create an epic, spawn workers, reserve files, report progress, review, close.