Protocol Documentation

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 dev

Starts Queen simulation + WebSocket server on port 3001.

Terminal B (Frontend)

cd c:\web3\MoltAuto\ui
npm run dev

Starts Next.js UI on port 3000 with dashboard + docs routes.

System Architecture

Queen Orchestrator

Controls each epoch: spawn drones, simulate market ticks, cull failures, mutate survivors.

Mock Market

Feeds synthetic volatility and updates balances/PNL to test strategy behavior safely.

Evolution Engine

Mutates prompts and risk parameters to generate improved offspring strategies.

Web Dashboard

Subscribes to WebSocket events and renders live colony state, logs, and graveyard.

Epoch Lifecycle

  1. 1. Genesis Spawn: Queen spawns initial drones from the active strategy gene pool.
  2. 2. Simulation Phase: Drones trade through accelerated ticks and accumulate PNL.
  3. 3. Culling: Strategies below threshold are terminated and removed from the active population.
  4. 4. Mutation: Survivors are mutated to refill target population size for next epoch.

WebSocket Event Stream

Dashboard connects to ws://localhost:3001.

EventPayloadDescription
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.1

Maximum tolerated drawdown for strategy behavior.

targetProfitDefault: 0.2

Profit target preference used in strategy prompt context.

leverageDefault: 1

Risk multiplier; increases variance in simulated outcomes.

stopLossDefault: 0.05

Suggested stop-loss preference encoded in genome.

takeProfitDefault: 0.1

Suggested take-profit preference encoded in genome.

Operational Notes

Troubleshooting

If dashboard logs show "Connection Lost.", verify backend simulation is running on port 3001.

Next Steps

Extend with real exchange adapters, model routing, and adaptive risk governor policies.