Skip to content

swarm-mode

Fresh

Source: BIBLE.md (Phase 12 Phase 7, swarm-mode 7 routes)

Multiple Ghost Engine instances across different machines coordinated through a central controller. Each instance manages its own browsers and accounts. They coordinate campaigns: one in Dallas, one in Miami, one on a VPS. Geographic diversity physically impossible from a single machine.

Architecture

flowchart TD
  C[Central controller] --> I1[Instance: Dallas laptop]
  C --> I2[Instance: Miami desktop]
  C --> I3[Instance: VPS in Frankfurt]
  C --> I4[Instance: Mac Studio]
  I1 -- heartbeat --> C
  I2 -- heartbeat --> C
  I3 -- heartbeat --> C
  I4 -- heartbeat --> C
  C --> A[Aggregated dashboard]

Routes (7)

MethodRouteWhat
POST/swarm/registerRegister an instance
GET/swarm/instancesList active instances
POST/swarm/heartbeatInstance check-in
POST/swarm/dispatchLoad-balanced job dispatch
POST/swarm/assign-accountsAssign accounts to specific instance
GET/swarm/topologyNetwork topology view
GET/swarm/aggregate-statsCross-instance stats

Heartbeat

Each instance sends a heartbeat every 30 seconds with its status:

json
{
  "instanceId": "ge-dallas-laptop",
  "host": "192.168.1.10",
  "uptime": 12345,
  "activeBrowsers": 2,
  "accountsAssigned": 12,
  "jobsInQueue": 3,
  "healthScore": 95
}

Account assignment

Accounts are pinned to specific instances based on geo. A "Dallas" account always runs on the Dallas instance so its IP and timing stay coherent.