Technical Documentation

MoltAuto WEB4.0 Trade System

Serious engineering documentation for a Conway Research Automaton-style trading runtime: architecture, execution semantics, event contracts, state schema, and operational runbooks.

Showing 9 of 9 sections .

Runtime: Node 20+Frontend: Next.js 16Transport: WebSocketMode: Paper Trading

System Overview

MoltAuto is a WEB4.0 trade runtime inspired by Conway Research Automaton principles: agents are evaluated under survival pressure, strategies self-mutate, and execution loops are fully event-driven.

Current implementation status: this repository runs in simulation mode (mock market + mock inference client). The architecture is intentionally structured to be upgraded into real inference and real payment-enabled infrastructure.

Prerequisites

Runtime Environment

Node.js 20+ and npm are required for both backend and UI workspaces.

Execution Scope

This environment is non-custodial and non-live by default. Do not treat simulation outputs as production trading signals.

Quick Start

Bring up backend simulation and frontend dashboard in separate terminals.

Initial Setup

cd c:\web3\MoltAuto
npm install
cd ui
npm install

Terminal A (Backend)

cd c:\web3\MoltAuto
npm run molt

Runs the simulation entrypoint (`src/molt/sim.ts`) and starts WebSocket on port 3001.

Terminal B (Frontend)

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

Starts Next.js on port 3000 (`/`, `/dashboard`, `/docs`).

Validation

# backend tests
cd c:\web3\MoltAuto
npm test

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.

ModulePathResponsibility
Queen Orchestratorsrc/queen/index.tsEpoch control, spawning, culling, repopulation
WebSocket Serversrc/queen/server.tsReal-time event broadcasting to dashboard clients
Evolution Enginesrc/evolution/mutation.tsPrompt mutation and risk-parameter perturbation
Market Simulationsrc/market/mock.tsSynthetic execution environment for paper trading
Type Contractssrc/molt/types.tsStrategy, drone state, and trade schema definitions
Simulation Entrypointsrc/molt/sim.tsBootstraps queen with inference client implementation

Runtime Specifications

Operational constants currently hardcoded in simulation runtime.

ParameterValueSource
WebSocket Port3001src/queen/server.ts
Initial Population5 dronessrc/queen/index.ts
Initial Capital / Drone1000src/queen/index.ts
Simulation Window10 secondssrc/queen/index.ts
Inter-Epoch Delay5 secondssrc/queen/index.ts
Trade Probability30% / ticksrc/queen/index.ts
Cull ThresholdPnL < -0.5%src/queen/index.ts

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.

Event Contract (WebSocket)

Dashboard connects to ws://localhost:3001.

Message Envelope

{
  "type": "EVENT_NAME",
  "timestamp": "2026-02-19T12:00:00.000Z",
  "data": { ...payload }
}
EventPayloadDescription
WELCOME{ type, message }Sent once when a dashboard client connects to the server.
EPOCH_START{ generation }Epoch boundary signal; emitted before spawning the active generation.
DRONE_SPAWN{ id, name, strategy }Drone created, funded, and linked to a strategy genome.
DRONE_UPDATE{ id, pnl, balance, trades }Per-tick balance and PnL telemetry for each active drone.
TRADE_EXECUTED{ droneId, pnlChange, symbol }Execution event from the simulated market engine.
DRONE_DEATH{ id, name, reason, finalPnl }Strategy terminated after violating the survival threshold.

Strategy Schema Reference

Primary fields from strategy type contract used by mutation and selection logic.

idType: stringDefault: ULID

Unique strategy identity for lineage and event mapping.

nameType: stringDefault: Genesis-N / GenX-####

Human-readable strategy label.

generationType: numberDefault: 0+

Monotonic generation counter used for selection tracking.

promptType: stringDefault: seed prompt

LLM behavioral DNA used by trader agents.

riskParameters.maxDrawdownType: numberDefault: 0.1

Maximum tolerated drawdown preference.

riskParameters.targetProfitType: numberDefault: 0.2

Target return preference encoded in genome.

riskParameters.leverageType: numberDefault: 1

Variance multiplier in simulated outcomes.

riskParameters.stopLossType: numberDefault: 0.05

Stop-loss profile inherited through mutation.

riskParameters.takeProfitType: numberDefault: 0.1

Take-profit profile inherited through mutation.

Operations Runbook

Troubleshooting

If dashboard shows "Connection Lost", validate backend process and ensure port 3001 is reachable.

Scale Path

Integrate Conway Cloud execution, real inference routing, and machine-native payment rails for sovereign runtime operation.

State Integrity

Persist run metadata and lineage snapshots per epoch before enabling long-lived production loops.

Risk Warning

This codebase is experimental. Any migration to live markets requires formal risk limits, security reviews, and compliance controls.