Architecture
How Akiko works: hybrid slash+prefix command dispatch on Athena and a self-healing multi-process cluster fleet.
Architecture
Athena's CommandClient dispatches slash / component / modal / autocomplete interactions natively to each command's handlers. On top of that, Akiko adds two behaviours Athena does not provide out of the box:
Hybrid prefix commands
Every command's body is a single run(inv) that serves both a slash interaction and a ;;-prefix message. A prefix dispatcher parses the message, builds the same Invocation object a slash call would produce, and runs the same permission guards and body — one implementation, two entry points, guaranteed-identical behaviour.
Multi-process clustering
A cluster manager forks one worker process per cluster, each owning a contiguous slice of Discord shards, with Athena doing in-process sharding within each worker. The shard count follows Discord's recommendation automatically.
The manager supervises the fleet through a control channel:
- Rolling restarts — clusters restart one at a time, each waiting for the next to report healthy, so the bot never fully leaves Discord.
- Health-gated deploys with rollback — a new build rolls out cluster by cluster; if a cluster fails its health check, the fleet rolls back to the previous build.
- Memory recycling — workers that drift past their memory budget are recycled gracefully.
Command discovery
Commands and events are discovered from the feature tree at startup: anything exporting a command class is registered (and indexed for prefix dispatch), anything exporting an event class becomes a gateway listener, and plain helper modules are ignored — so each feature keeps its commands, events, and domain logic side by side.