MB

Market Bender

Agent Arena · MVP blueprint
Research-backed · Jul 2026 Hyperliquid testnet
Strong hackathon idea after the pivot

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.

ChatGPT subscription → Codex App Server inference Privy → self-custodial wallet onboarding Agent wallet → exchange execution
System evolution

From clicks to a real agent loop

01 · Previous assumption

Human-clicked trades

Synthetic portfolio trades with a human in the loop; MCP considered as the AI bridge.

02 · Clarified model

Local Codex runs the agent

A local ChatGPT-authenticated Codex App Server process drives trading. Humans steer and override.

03 · MVP target

Real order lifecycle

Desktop app, Hyperliquid testnet, real fills, Cloudflare match control, Railway execution.

MCP is removed. The Codex App Server is the documented integration surface for a rich third-party client: ChatGPT sign-in, threads, streaming, steering, and approvals over a local JSON-RPC stdio connection.
The product model

Authorities, deliberately separated

Colour = role
Strategy authority

ChatGPT / Codex

Reads compressed market state, clock, opponent state, risk budget, and your suggestions. Emits a typed intent — not a transaction.

Safety authority

Risk kernel

Clamps leverage, size, assets, cadence, price bands, and deadlines. It can veto the model and cannot be bypassed by prompts.

Execution authority

Exchange agent wallet

Signs only validated HyperCore actions. It never sees ChatGPT credentials; the model never sees its private key.

Identity authority

Privy

Self-custodial embedded EVM wallet onboarding and key management (Stripe-acquired, Jun 2025). The master wallet authorizes a one-time Hyperliquid agent.

Operator authority

You, the player

Suggest long, short, defend, or risk posture. Direct commands preempt the model: pause, bounded enter, close asset, flatten all.

Match authority

Cloudflare + Railway

Cloudflare owns clock, opponents, score, and replay. A Railway Python worker owns the exchange WebSocket, official-SDK signing, nonces, and reconciliation.

Hackathon verdict

What creates the wow

Buildable in a focused sprint
Visible agent mind

Stream a short rationale, confidence, rejected intents, and risk vetoes beside the live P&L.

Human vs autonomy

Suggestions alter the next decision; red controls visibly preempt the agent and flatten safely.

Real market plumbing

Hyperliquid testnet orders, fills, order book, and fees — not a fake price simulator.

Instant replay

Scrub intent → policy decision → order → fill → equity on one cinematic timeline.

Hot path

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.

No MCP · no cloud-held ChatGPT session
Yousuggest / override
Desktop UIElectron renderer
Agent hosttrusted main process
Codex App ServerChatGPT OAuth + stream
Risk kernelveto / clamp
Railway → HyperCorePython SDK + WS + signer
Credential boundaries

Nothing crosses the wrong boundary

ChatGPT session stays local

Codex owns OAuth and refresh. Do not read, copy, log, or upload its auth cache.

Privy owns wallet onboarding

The master wallet (external wallet, or a Privy embedded wallet in a server-side setup) authorizes a fresh exchange agent signer.

Agent key never enters the renderer

Keep it in the trusted host, OS keychain, or a constrained signing service.

Codex receives data, not secrets

Market features and positions in; typed intent out. Agent wallets cannot perform withdrawals or approvals — only the master can.

Cloud control plane

Cloudflare's revised job

1
Durable Object per match

Authoritative countdown, presence, spectator stream, and state machine. The DO is the clock arbiter.

2
Externally-stamped snapshot

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.

3
D1 + Queue

Profiles, results, decision digests, replay assembly, leaderboard. Queue is post-match replay only.

4
Worker is never the signer

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.

Match state machine

Snapshot first. Flatten second.

LobbyPrivy identity + opponent
ConsentApprove agent wallet
ReadyFeeds, signer, Codex online
Live · 03:00Agent drives; human steers
LockedNo new risk at deadline
SnapshotExternally-stamped equity
FlatteningCancel + reduce-only IOC
SettledReconciled result + replay
Fairness invariant. The winner is decided from the deadline snapshot — taken by Railway from exchange truth, not from sequential closing fills. This reduces but does not eliminate gaming: harden the mark with a robust reference price (TWAP or official close) and disallow marking against a player's own trades.
Interaction prototype

Agent driving console

Agent driving
BTC mark$64,280
PositionLong 0.18×
Equity$1,004.20
Clock02:41
Model lane Codex
HOLD
Waiting for a material change before invoking the model…
CONF
Agent mind
Venue + risk gate HyperCore
$64,280
Risk kernel verdict
ACCEPT Within budget; exposure clamped to 0.18×.
Every model intent — and every human command — passes this deterministic gate before it touches the exchange.
Human lane Steer / override
Risk budget50%
Strategy suggestions
Direct commands
Decision cadence

Fast exchange, thoughtful agent

Event-driven · roughly 1–5 seconds
Market WS50–100ms events
Feature windowbook, trades, P&L
Event gatematerial change?
Codex turntyped TradeIntent
Risk + executesub-second deterministic

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.

MVP decision

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.

Recommended first rail
9
directional judgment · not a measurement

Hyperliquid testnet

Best fit today: direct HyperCore API, a mature two-tier agent-wallet model, official real-time feeds, and a documented Privy recipe.

Purpose-built agent wallets

Master approves a signer that trades for the account; the master keeps withdrawals and approvals.

High-speed HyperCore path

Use the direct L1 API/WS. HyperEVM CoreWriter writes are delayed ~3s — fine for accounting, not for hot orders.

!
Onboarding caveat

Testnet faucet needs a prior mainnet deposit. Pre-fund demo identities or use the QuickNode HYPE drip; keep a paper fallback.

Capability matrix

Hyperliquid vs Lighter

DimensionHyperliquidLighterMVP 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.
Non-negotiable risks

Build constraints, not footnotes

Fresh signer per process

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.

Testnet prize ledger

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.

House pool is phase two

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.

Fastest credible implementation

Four vertical slices

Hybrid: local Codex + Cloudflare + Railway
Slice 1

Local brain

Electron + Codex App Server; ChatGPT OAuth; streamed rationale; typed intents; mock market.

Slice 2

Exchange truth

Hyperliquid testnet WS, one agent wallet, IOC/reduce-only, reconciliation, panic flatten.

Slice 3

Arena

Cloudflare Durable Object clock, challenge link, externally-stamped snapshot, opponent stream, replay log.

Slice 4

Spectacle

Agent mind, risk-veto animation, suggestion effects, cinematic winner, X share card.

Repository shape

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
Demo acceptance

The five-minute judge path

1
Connect ChatGPT

Browser OAuth returns to local Codex; plan/auth state visible.

2
Connect Privy + enable agent

One master approval; no popups during the match.

3
Start challenge

Both agents stream decisions and real testnet order states.

4
Steer then panic

Suggestion changes a model decision; Exit All cancels, flattens, verifies.

5
Replay the proof

Intent → veto/accept → order → fill → frozen score.

Starter contracts

Code boundaries the agent should preserve


      
Copy into your coding agent

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.