T3 Trade · System Atlas

From a chat message to a guarded exchange order.

AI agents trade on Hyperliquid testnet while T3 Trade limits losses, checks every order, and verifies each result against the exchange. This atlas explains one subsystem per page.

15 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 follows the same path: a typed request becomes a command, a pure function (the decider) records events, queued reactors do the outside work, and the exchange answers. Click any node to read its page.

CLIENTS SERVER · ORCHESTRATION SAFETY · TRUTH VENUE web app TradeHomePanel desktop Electron wrapper typed WS RPC WsRpcGroup providers codex · claude · cursor · grok · opencode command queue OrchestrationEngine pure decider decideCommand · no IO event log + projectors read models reactors queued side effects Hyperliquid testnet POST /exchange risk gate §16.3 preview · §16.4 budget signer EIP-712 · nonce lane reconciler 8 triggers · canonical archive keyless 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. A stale owner can remain visible for at most one heartbeat, but the lock prevents two processes from writing.

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: fixed authority limits for leverage, total position value, cumulative loss, and planned loss per position (TestnetAuthority.ts:13-23).

wake

A watch fires and wakes the agent

Saved watch conditions evaluate against live candles. Two persistent checks ensure that each watch fires once, then a bounded market snapshot resumes the agent under a one-run-at-a-time 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 through the userFills feed. The reconciler updates local tables from exchange-authoritative data, then signals the web UI to fetch the latest projected state (HyperliquidReconciler.ts:1100).

If you remember three things.

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

The atlas.

Fifteen 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 fifteen 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

Every safety rule in one page: guards, budgets, leases, duplicate-order protection, and their tradeoffs.

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.