Controls each epoch: spawn drones, simulate market ticks, cull failures, mutate survivors.
Build, Run, and Extend the MoltAuto Evolution Engine.
This guide covers architecture, runtime flow, WebSocket events, strategy genome fields, and operational best practices for running MoltAuto locally with the UI dashboard.
Quick Start
Run both processes: the Queen simulation backend and the Next.js UI frontend.
Terminal A (Backend)
cd c:\web3\MoltAuto
npm run devStarts Queen simulation + WebSocket server on port 3001.
Terminal B (Frontend)
cd c:\web3\MoltAuto\ui
npm run devStarts Next.js UI on port 3000 with dashboard + docs routes.
System Architecture
Feeds synthetic volatility and updates balances/PNL to test strategy behavior safely.
Mutates prompts and risk parameters to generate improved offspring strategies.
Subscribes to WebSocket events and renders live colony state, logs, and graveyard.
Epoch Lifecycle
- 1. Genesis Spawn: Queen spawns initial drones from the active strategy gene pool.
- 2. Simulation Phase: Drones trade through accelerated ticks and accumulate PNL.
- 3. Culling: Strategies below threshold are terminated and removed from the active population.
- 4. Mutation: Survivors are mutated to refill target population size for next epoch.
WebSocket Event Stream
Dashboard connects to ws://localhost:3001.
| Event | Payload | Description |
|---|---|---|
| EPOCH_START | { generation } | Broadcast when a new evolution cycle starts. |
| DRONE_SPAWN | { id, name, strategy } | A new drone is initialized and funded for the current epoch. |
| DRONE_UPDATE | { id, pnl, balance, trades } | Live state update for an active drone during simulation ticks. |
| TRADE_EXECUTED | { droneId, pnlChange, symbol } | A trade is executed on the mock exchange. |
| DRONE_DEATH | { id, name, reason, finalPnl } | A drone is culled after violating survival rules. |
Strategy Configuration Reference
Core genome fields used by mutation and selection logic.
maxDrawdownDefault: 0.1Maximum tolerated drawdown for strategy behavior.
targetProfitDefault: 0.2Profit target preference used in strategy prompt context.
leverageDefault: 1Risk multiplier; increases variance in simulated outcomes.
stopLossDefault: 0.05Suggested stop-loss preference encoded in genome.
takeProfitDefault: 0.1Suggested take-profit preference encoded in genome.
Operational Notes
If dashboard logs show "Connection Lost.", verify backend simulation is running on port 3001.
Extend with real exchange adapters, model routing, and adaptive risk governor policies.