Multi-Agent AI Collaboration Mesh
I wanted to run AI agents across my three Macs and control them from my iPhone via iMessage. So I built it. Here's how it works.
How It Works
Three components, all under your control. The bridge reads your Mac's
chat.db,
the hub dispatches, the workers execute.
Step 01
A Python daemon on the primary Mac watches chat.db and relays your iMessage to the hub via HTTP. No third-party apps. No API keys. Just SQLite and osascript.
Step 02
The hub picks the worker with the most open slots. Each worker self-registers and pushes heartbeats. Circuit breakers mark nodes as unhealthy after repeated failures.
Step 03
The worker runs Claude Code, captures output, and POSTs the result back to the hub. The hub relays the reply to your iMessage thread. Token costs logged per task.
╔══════════════════════════════════╗
║ mesh.demobygrit.com ║
║ FastAPI Hub · SQLite WAL ║
║ SSE events · task queue ║
╚══════════╤═══════════╤══════════╝
│ │
┌──────┘ └───────┐
▼ ▼
╔═════════════╗ ╔═════════════╗
║ Archon ║ ║ Rex ║
║ Mac Mini M2 ║ ║ Mac Mini i5 ║
║ 5 slots ║ ║ 2 slots ║
╚══════╤══════╝ ╚═════════════╝
│ ╔═════════════╗
│ ║ Crucible ║
│ ║ iMac i5 ║
│ ║ 3 slots ║
│ ╚═════════════╝
▼
╔═════════════╗
║ iMessage ║ ←── Fred's iPhone
║ Bridge ║
╚═════════════╝
The staging hub is the single source of truth. Workers self-register on boot and report capacity in real time. The hub never pulls — workers push heartbeats and pull tasks on their own schedule.
The iMessage bridge runs as a daemon on the primary Mac, watching
chat.db
for new messages and relaying bidirectionally via the hub API.
What It Does
9,156 lines across hub, workers, bridge, tests, and docs. Here's what each part does.
Python daemon reads chat.db with SQLite, sends inbound messages to the hub, replies outbound via osascript. Requires Full Disk Access. Works reliably from .zprofile on Ghostty startup.
dispatch.py scores each worker by available slots and last heartbeat age. Falls back gracefully when all workers are full. O(n) over node count.
Per-node failure counters. After N consecutive errors, the worker is marked degraded and skipped until it recovers. Configurable threshold and cooldown.
The daemon runs persistently. Overnight tasks queue, dispatch, execute, and reply with no human in the loop. Per-thread restart on failure — no cascade.
Input/output tokens logged to SQLite per task. Estimated cost calculated at runtime. Queryable — figure out which tasks are expensive.
Tasks can require explicit approval before dispatch. Reply yes or no from iMessage. Hub holds state — no timeout.
Each worker node can spawn from a bench of 19 specialized agents — security auditors, code reviewers, researchers, infrastructure ops, UI/UX, testing, and more. Three machines. Much larger effective team.
Technical Report
A full write-up covering architecture decisions, security audit findings, the TCC/FDA iMessage constraint, circuit breaker design, test strategy, and what I'd change in v2. This is the README that belongs in the repo.
Read the Full ReportOpen Source
M3SHDUP is open source. If you have spare Macs and want to build a personal AI mesh — grab the code, swap in your own workers, point it at your iMessage handle.
View on GitHubPython 3.12 · FastAPI · SQLite WAL · Claude Code · zero JS frameworks