← dashboard · flowchart · machine · audit · architecture

# BigClaw Trading System — Architecture

> An autonomous, multi-strategy trading system spanning crypto (DEX + CEX) and US equities — designed as a fleet of independent bots coordinated by two AI operators: a Chief Strategist and an Infrastructure PM.

---

## The Fund Analogy

The system is modeled as a small quantitative fund run entirely by software:

| Role | Operator | Responsibility |
|------|----------|----------------|
| **Chief Strategist** | Charlie | Strategy evolution, nightly research experiments, treasury, trade governance |
| **Infrastructure PM** | Herman | System health, auto-remediation, investigations, security triage |
| **Trading desks** | Independent per-venue bots | Execute on their exchange with venue-appropriate strategies |
| **Shared library** | Common toolkit | Standard strategies, indicators, risk models, data sync |
| **Knowledge layer** | Institutional wiki | Compounding memory across research cycles |

The two operators coordinate over a private ops channel and escalate to a human only by exception — the design goal is autonomy inside human-defined limits, not a human in every loop.

---

## Trading Desks

Each venue runs as its own isolated process with its own credentials, strategies, and failure modes. **Fault isolation is the point:** one desk crashing never takes down another.

### Crypto DEX
On-chain swaps across multiple chains using threshold-signature (MPC) wallets — no raw private key ever lives in one place. Multi-timeframe technical strategies with confluence scoring.

### Crypto CEX
Centralized-exchange spot trading via authenticated REST orders (market / limit / stop). The same strategy family as the DEX desks, adapted to CEX mechanics.

### US Equities
Equities and ETFs through a broker gateway. Currently in **paper-trading validation** — building a measured track record before any live capital is committed.

**Strategy family** (shared across desks): TD Sequential, Momentum Confluence, Mean Reversion, Volume Breakout, Whale/Flow Follow, RSI Extreme, Stochastic Bounce, VWAP Reversion — all driven by a multi-indicator confluence engine.

---

## Charlie — Chief Strategist

The research-and-strategy brain. Owns strategy parameters, the nightly experiment loop, treasury, and trade governance — operating inside **pre-ratified risk envelopes** and escalating only out-of-bounds decisions to the human.

### Nightly Research Loop
Each night the system runs a batch of self-directed experiments across four phases:

| Phase | What it does |
|-------|--------------|
| **Parameter tuning** | Adjust trading parameters against replayed trade history |
| **Strategy genes** | Mutate strategy entry / exit gates |
| **Backtest evolution** | Test strategy × asset combinations on historical candles |
| **Discovery** | An LLM proposes entirely new strategies as structured configs |

Every result — pass *or* fail — is recorded, so the system can't fool itself by forgetting its own dead ends. Promising candidates must clear a rigorous out-of-sample gauntlet before they are ever allowed near capital.

### Knowledge Layer
A version-controlled wiki that compounds across cycles: immutable experiment snapshots, LLM-maintained knowledge pages (strategies, assets, market regimes), and periodic self-audits for stale or contradictory claims. Cheaper and more transparent than a vector store — and it gets richer every night.

### Agent Treasury
The strategist holds a small on-chain USDC treasury and can autonomously pay, per request, for external data and AI services — no static API keys, with spending hard-capped by daily / weekly / monthly budgets.

---

## Herman — Infrastructure PM

Keeps the fleet alive. Runs frequent health sweeps, auto-remediates low-risk issues (process restarts, config fixes, gateway revival) inside a defined authority boundary, launches LLM-powered investigations into persistent problems, and pages a human only when something is genuinely human-or-bust.

Every action it can take is **reversible**; anything touching strategy code, funds, or credentials stays firmly off-limits.

---

## Shared Library

Common tooling every desk imports:

- **Strategy pipeline** — multi-indicator confluence engine and risk/reward calculation
- **Pricing** — layered market-data sources with automatic fallbacks
- **Execution guards** — balance checks, position reconciler, circuit breakers, rate limiters
- **Data sync** — local-first storage that syncs to a cloud data lake
- **Backtesting** — engine, metrics, and historical replay

---

## Data & Control Flow

```
        Market data sources (crypto + equities)
                       │
        ┌──────────────┼──────────────┐
        ▼              ▼              ▼
   ┌─────────┐   ┌─────────┐   ┌─────────┐
   │  DEX    │   │  CEX    │   │ Equities│      Independent trading desks
   │  desks  │   │  desk   │   │  desk   │      (isolated processes)
   └────┬────┘   └────┬────┘   └────┬────┘
        └─────────────┼─────────────┘
                      ▼
        Local-first storage (per bot)
                      │  syncs to
                      ▼
        Cloud data lake  +  vector "brain" (learnings)
                      │
        ┌─────────────┼─────────────┐
        ▼             ▼             ▼
   ┌─────────┐   ┌─────────┐   ┌──────────┐
   │ Charlie │   │ Herman  │   │   Wiki   │
   │strategy │   │  infra  │   │knowledge │
   └────┬────┘   └────┬────┘   └──────────┘
        └──────┬──────┘
               ▼
     Private ops channel  →  human (by exception)
```

---

## Key Design Decisions

**Why a fleet of bots instead of one monolith?**
Each venue has radically different authentication, order types, and failure modes. Isolation means a broker-gateway crash can't touch live crypto trading, and each desk keeps working even if the others are down.

**Why local-first storage that syncs to the cloud?**
Every bot's local database is its source of truth, so it keeps trading through a network outage. The cloud layer is for cross-desk analytics and the shared brain — never a single point of failure.

**Why a wiki instead of RAG?**
Synthesized, cross-referenced knowledge pages compound over time; raw-document retrieval does not. It's cheaper, human-readable, and auditable.

**Why two AI operators with hard authority limits?**
Separating "makes money decisions" from "keeps the lights on" — each inside explicit, reversible-action boundaries — delivers autonomy without any single agent that can both move capital and rewrite its own guardrails.

**Why pre-ratified risk envelopes?**
The strategist self-manages parameters inside human-approved bounds and auto-reverts changes that don't improve results. The system adapts continuously while the human's risk limits stay fixed — and the human's day-to-day involvement stays minimal.

---

*This document is a high-level overview intended for sharing. It intentionally omits operational specifics.*