The model drives. The human bends the model.
A three-minute, agent-versus-agent trading spectacle. ChatGPT/Codex chooses positions, a deterministic risk kernel decides what is allowed, and Hyperliquid executes. You suggest strategy — and always keep direct pause, enter, close, and panic controls.
From clicks to a real agent loop
Human-clicked trades
Synthetic portfolio trades with a human in the loop; MCP considered as the AI bridge.
Local Codex runs the agent
A local ChatGPT-authenticated Codex App Server process drives trading. Humans steer and override.
Real order lifecycle
Desktop app, Hyperliquid testnet, real fills, Cloudflare match control, Railway execution.
Authorities, deliberately separated
ChatGPT / Codex
Reads compressed market state, clock, opponent state, risk budget, and your suggestions. Emits a typed intent — not a transaction.
Risk kernel
Clamps leverage, size, assets, cadence, price bands, and deadlines. It can veto the model and cannot be bypassed by prompts.
Exchange agent wallet
Signs only validated HyperCore actions. It never sees ChatGPT credentials; the model never sees its private key.
Privy
Self-custodial embedded EVM wallet onboarding and key management (Stripe-acquired, Jun 2025). The master wallet authorizes a one-time Hyperliquid agent.
You, the player
Suggest long, short, defend, or risk posture. Direct commands preempt the model: pause, bounded enter, close asset, flatten all.
Cloudflare + Railway
Cloudflare owns clock, opponents, score, and replay. A Railway Python worker owns the exchange WebSocket, official-SDK signing, nonces, and reconciliation.
What creates the wow
Stream a short rationale, confidence, rejected intents, and risk vetoes beside the live P&L.
Suggestions alter the next decision; red controls visibly preempt the agent and flatten safely.
Hyperliquid testnet orders, fills, order book, and fees — not a fake price simulator.
Scrub intent → policy decision → order → fill → equity on one cinematic timeline.
Local intelligence, deterministic execution
Electron is chosen for hackathon velocity and JS/Node familiarity — and because OpenAI's own Codex desktop app uses the same Electron + stdio-spawn pattern. It is not the only option: Tauri's sidecar plus a Rust WebSocket server would also work with a far smaller bundle.
Nothing crosses the wrong boundary
Codex owns OAuth and refresh. Do not read, copy, log, or upload its auth cache.
The master wallet (external wallet, or a Privy embedded wallet in a server-side setup) authorizes a fresh exchange agent signer.
Keep it in the trusted host, OS keychain, or a constrained signing service.
Market features and positions in; typed intent out. Agent wallets cannot perform withdrawals or approvals — only the master can.
Cloudflare's revised job
Authoritative countdown, presence, spectator stream, and state machine. The DO is the clock arbiter.
The Railway service — closer to exchange truth — takes and signs the deadline equity snapshot. The DO adjudicates using that stamped value, deciding when the deadline fires, not what equity was.
Profiles, results, decision digests, replay assembly, leaderboard. Queue is post-match replay only.
Railway hosts the long-lived official-SDK executor for testnet. Cloudflare receives signed match events and read-only venue truth. Pin match DOs near the exchange region.
Snapshot first. Flatten second.
Agent driving console
Fast exchange, thoughtful agent
Do not market this as HFT. The chain can be fast; model inference is the strategic control loop. Stops, deadlines, cancel/replace, reconciliation, and panic flattening belong to ordinary code — not to the model.
Lead with Hyperliquid. Lighter is a credible near-peer.
Hyperliquid leads on maturity, tooling breadth, and track record. Lighter is a top-3 perp DEX with current docs and 2026 SDK releases — a strong, active second, not an afterthought.
Hyperliquid testnet
Best fit today: direct HyperCore API, a mature two-tier agent-wallet model, official real-time feeds, and a documented Privy recipe.
Master approves a signer that trades for the account; the master keeps withdrawals and approvals.
Use the direct L1 API/WS. HyperEVM CoreWriter writes are delayed ~3s — fine for accounting, not for hot orders.
Testnet faucet needs a prior mainnet deposit. Pre-fund demo identities or use the QuickNode HYPE drip; keep a paper fallback.
Hyperliquid vs Lighter
| Dimension | Hyperliquid | Lighter | MVP consequence |
|---|---|---|---|
| Autonomous signer | Agent wallet approved by master (clean two-tier) | API key per account / sub-account (up to 256) | Hyperliquid has the cleaner delegation story. |
| Key power | Agent signs only L1 trades; master signs withdrawals & approvals | Trading key can do secure withdrawals — only back to the owner's own L1 address | The security gap is narrower than it looks: no third-party drain. Fast withdrawals to other addresses still need the L1 key. |
| Fast data | Market + user WS feeds; signed WS posts | ~50ms book batches + rich account channels | Both are technically fast enough. |
| SDK fit | Official SDK + Privy recipe; signing remains delicate | First-class Python + Go signer SDKs | Electron/TypeScript MVP is simpler on Hyperliquid. |
| Safety primitive | Reduce-only, IOC, ALO (post-only), triggers, scheduleCancel | Cancel-all, IOC, TP/SL, TWAP | Both workable. scheduleCancel is a heartbeat dead-man (≥5s, max 10/day), not instant cancel-on-disconnect. |
| Venue | HyperCore L1 hot path | Custom ZK rollup (zkLighter) on Ethereum L2 | Lighter is not on zkSync — it is its own app-specific rollup. |
Build constraints, not footnotes
Atomic unique nonces
Never reuse a deregistered agent address (replay risk — strongly discouraged, not hard-blocked). Maintain unique nonces in one execution owner; the protocol enforces per-signer uniqueness, the atomic counter is the docs' recommended client-side pattern.
Derivatives · custody · scrutiny
Leveraged perps plus winner-takes-all raises derivatives exposure, custody questions, and gambling-law scrutiny risk (a skill-dominant contest can be lawful — it is not automatically gambling). No real-value pool in the hackathon build.
Use the right primitive
HLP is a fixed-strategy protocol vault — the wrong primitive for a custom pool ("legacy" = the 2023 HyperCore vault framework; HLP is still active). The modern primitive is a HyperEVM (ERC-4626) vault with CoreWriter. A real pool needs audited accounting, custody, and legal review.
Four vertical slices
Local brain
Electron + Codex App Server; ChatGPT OAuth; streamed rationale; typed intents; mock market.
Exchange truth
Hyperliquid testnet WS, one agent wallet, IOC/reduce-only, reconciliation, panic flatten.
Arena
Cloudflare Durable Object clock, challenge link, externally-stamped snapshot, opponent stream, replay log.
Spectacle
Agent mind, risk-veto animation, suggestion effects, cinematic winner, X share card.
Small, explicit modules
apps/ desktop/ Electron renderer + trusted Codex host control-plane/ Cloudflare Worker + Match Durable Object executor/ Railway Python + official exchange SDK packages/ protocol/ Zod schemas and event contracts codex-client/ App Server JSON-RPC client agent-loop/ State compressor and event gate risk-kernel/ Pure deterministic validation exchange-hyperliquid/ WS, signer, orders, reconcile replay/ Append-only match event timeline
The five-minute judge path
Browser OAuth returns to local Codex; plan/auth state visible.
One master approval; no popups during the match.
Both agents stream decisions and real testnet order states.
Suggestion changes a model decision; Exit All cancels, flattens, verifies.
Intent → veto/accept → order → fill → frozen score.
Code boundaries the agent should preserve
Market Bender MVP kickoff prompt
This prompt encodes the clarified system state, architecture, safety boundaries, and vertical-slice order — corrected against current (July 2026) primary sources.