Agents Need Git-Backed Coordination More Than More Context

repoaiagentsagent-loopscliinfrastructuretypescriptmemoryevent-sourcing

Maps directly to joelclaw agent-loop coordination: durable task cells, file reservations, agent mail, and outcome learning.

Swarm is a local multi-agent coordination layer for OpenCode and Claude Code. It breaks a task apart, writes the work into a git-backed Hive, reserves files, spawns workers, coordinates through Swarm Mail, reviews completions, and records what worked.

The clever bit is that it treats agent work as durable project state, not chat residue. The .hive/ directory survives context death. libSQL and SQLite keep an append-only event log. Ollama embeddings power Hivemind, with full-text search fallback when embeddings aren’t available. That is the right kind of boring: local files, local databases, explicit locks, git sync.

Joel dropped this in Slack with “this works really well,” which is the useful receipt here. The repo is basically a portable version of the same coordination pressure inside joelclaw: split the work, avoid file fights, keep durable checkpoints, and make the next run smarter because the last run left evidence instead of vibes.

This is especially interesting because it doesn’t pretend one agent with a giant prompt is the answer. It gives agents a shared workbench: tasks, mail, reservations, outcomes, and memory. Less magic. More receipts.

Key Ideas

  • Hive stores task cells in .hive/, giving agent work a git-backed shape that survives session loss.
  • Swarm Mail uses actor-style coordination for messages, file reservations, checkpoints, and handoffs.
  • Hivemind stores semantic learnings with Ollama embeddings and falls back to full-text search.
  • The architecture uses append-only event sourcing with events like agent_registered, message_sent, file_reserved, checkpoint, and outcome.
  • Completion records include duration, errors, files touched, and success, which lets patterns mature from candidate to established to proven.
  • The local-first dependency stack — Bun, libSQL, SQLite, Git, and optional Ollama — keeps the system inspectable instead of hiding coordination in a SaaS box.
  • The plugin works across OpenCode and Claude Code, which makes the coordination model more interesting than any single agent client.