T3 Trade · System Atlas

From a chat message to a guarded exchange order.

AI agents trade Hyperliquid testnet under budgets, guards, and reconciliation. This atlas takes the machine apart, one subsystem per page.

16 subsystem pages 5 provider protocols 1 execution path that spends capital 0 unsupervised exposures

Seven questions organize everything below.

The atlas was commissioned around seven questions. Each one has a home.

One request, one guarded path.

Every trading action travels the same spine: a typed request becomes a command, a pure decider emits events, reactors do the side effects, and the exchange answers. Click any node to read its page.

CLIENTS SERVER · ORCHESTRATION SAFETY · TRUTH VENUE web appTradeHomePanel desktopElectron wrapper typed WS RPCWsRpcGroup providerscodex · claude · cursor · grok · opencode command queueOrchestrationEngine pure deciderdecideCommand · no IO event log + projectorsread models reactorsqueued side effects HyperliquidtestnetPOST /exchange risk gate§16.3 preview · §16.4 budget signerEIP-712 · nonce lane reconciler8 triggers · canonical archivekeyless recorder
command and event flow risk gates and canonical truth the one signing path panels and reads

How the machine comes to life.

From a cold start to a filled order, in six beats. Every step cites the code that performs it.

boot

One process takes the lease

A single-writer file lock, TradingRuntimeLease.ts, decides that exactly one server owns the trading database. Dual belief is bounded to one heartbeat; dual writing is impossible.

record

The archive starts listening

A supervised, keyless child process records market history because Hyperliquid only serves about 5,000 bars: "a minute not recorded is a minute gone" (archive/config.ts:8-12).

authority

A mission is granted

Binding a chat thread to a market creates a mission with an authority envelope: leverage, notional, cumulative-loss, and planned-risk ceilings as absolute dollars (TestnetAuthority.ts:13-23).

wake

A watch fires and wakes the agent

Persisted predicates evaluate on live candles, fire exactly once through two durable guards, and a composed wakeup snapshot resumes the harness under a decision lease (WatchEvaluator.ts:16-25).

act

The agent asks, the spine answers

trading_enter runs the 14-item preview, persists the execution record and risk reservation before signing, signs inside the serialized nonce lane, and posts to /exchange.

truth

The exchange answers, everyone converges

Fills arrive over the userFills feed; the reconciler overwrites local tables with canonical truth and rings the invalidation doorbell, so the web UI updates from projector output alone (HyperliquidReconciler.ts:1100).

If you remember three things.

Ranked by how much of the system exists to protect them.

The atlas.

Sixteen pages, one subsystem each. Live chips show which build agent is writing what, right now.

Big picture

planned

What T3 Trade is, the boundaries it refuses to cross, and how all sixteen parts stack into one product.

Event spine

planned

The command queue, pure decider, persisted events, projectors, and reactors that everything else plugs into.

Execution

planned

The one path that spends capital: preview, record-before-sign, nonce lane, response inspection.

Risk control

planned

Budgets that clamp, guards that block, protections that must exist, and the seven controls that always answer.

Reconciliation

planned

Eight triggers, one convergence pass, and how drift is classified, repaired, and told to the agent.

Contracts

planned

The shared types and pure policy math that keep server, web, desktop, and providers honest in lockstep.

Signer & authority

planned

Local, deterministic signing; a key that fails closed; ceilings that only narrow.

Missions, watches, wakes

planned

How delegated authority lives, sleeps, gets woken by its own predicates, and is taken away cleanly.

Research mode

planned

Charts, alerts, backtests, and validations with no signer at all, and refusals that stay honest.

Provider adapters

planned

Five agent runtimes behind one contract, and the boundary test that keeps trading code from spawning any of them.

Relay & environments

planned

Short-lived credentials, managed tunnels, and a control plane that is deliberately not the data path.

Web & desktop

planned

The panels operators actually touch: read models via typed atoms, an invalidation doorbell, staleness banners, and controls that work when nothing else does.

Safety invariants

planned

The constitution in one page: every guard, budget, lease, and idempotency boundary, and what each one costs.

Failure stories

planned

Five real fixes, RC02 to RC06, each a lesson about never calling an unconfirmed outcome a success.

Glossary

planned

Mission, watch, wake, cloid, IOC, doorbell, projection: the system's vocabulary in plain words.

Build feed is loading, or the board is unreachable from this network.