Pilot
Built for the dreamDEX Perps Bounty · MVP

Your agent writes the order. Pilot holds it short.

An MCP server between your agent and dreamDEX perps on the Somnia testnet.

Bay 1 · Codex CLI02:41 UTC
held short
callsignCodex
marketBTCshort
size0.00050.00031
notional$40.11cap $25
Refused · nothing sent
cleared
callsignCodex
marketBTCshort
size0.00031
notional$24.86cap $25
Cleared · filled

0x385c1486…8080 · block 31576050

v0.1.0 · Somnia testnetstrip 01 of 10
The hook

Handing an agent a trading key is all or nothing.

callsignAgent
marketany
sizeany
sentimmediately

The SDK + a key: any order the exchange accepts.

Pilotstrip 02 of 10
The problem, from a real run

Asked for a short, Codex planned $40.11. You allow $25.

BTC short 0.0005
your cap $25$40.11
$0$50

Codex CLI, 2026-10-24 02:41:11 UTC, commit 0d18cec · evidence/p3-mcp-run-codex-journal.jsonl row 4

Pilotstrip 03 of 10

Held short, then cleared.

Bay 1 · Codex CLI · 2026-10-24
held short · 02:41:11
callsignCodex
marketBTCshort · IOC
size0.00050.00031
notional$40.11cap $25
Refused · nothing sent

maxNotionalUsd · next safe action: reduce size to at most 0.00031 BTC

stop bar · your limitschecked before broadcast
cleared · 02:41:21
callsignCodex
marketBTCshort · IOC
size0.00031
notional$24.86cap $25
Cleared · filled

0x385c1486…8080 · success @ block 31576050

Pilotstrip 04 of 10
Pilot architecture. An agent (Claude Code or Codex CLI) calls pilot over MCP stdio. plan_order runs the SDK previews and your policy, which caps the position an order leaves; an ok plan gets a one-shot plan_id, and place_order re-checks on live state before @somnia-chain/markets-sdk sends to dreamDEX perps on the Somnia Hideki testnet (chain 50383). In the real Codex run, the 0.0005 BTC short is refused at $40.11 against the $25 cap with nothing sent, pilot names 0.00031, and the re-planned 0.00031 BTC short fills in tx 0x385c1486…8080. Every plan, refusal and transaction lands in an append-only journal.
Pilotstrip 05 of 10
The run, twice

The journal and the explorer: same block.

pilot journal · Codex CLIrows 4–7
02:41:11plan_order BTC short 0.0005
refusal · maxNotionalUsd
$40.11 notional, above the $25 cap
next: at most 0.00031 BTC
02:41:18plan_order BTC short 0.00031
02:41:21place_order
filled 0.00031 · block 31576050
02:41:24close_position BTC
position after 0 · block 31576075
Two crops of one capture of dreamDEX Hideki markets explorer for tx 0x385c…8080: block 31576050, one sell order filled, crossed on arrival.

dreamDEX Hideki markets explorer, captured 2026-10-27, two crops of one page; it rounds the size to 0.0003.

Pilotstrip 06 of 10
DEMO.md · refusals, nothing sent

Seven ways it said no.

Your limits 11 rows
maxNotionalUsd0.57 SOL
6
allowedMarkets200 DOGE
4
minLiquidationDistancePct3 SOL
1
Pilot's own checks 4 rows
minQuantity0.04 SOL
1
unknownPlan
1
planExpired
1
planAlreadyUsed
1

Each refusal names its rule and a next safe action.

Pilotstrip 07 of 10
Why not just the SDK

The cap is on the position, not the order.

Small orders cannot stack

open 0.2 SOLplanned at $20.54
add 0.1 SOLleaves $30.80 > $25

Limits no tool can edit

Read-only to pilot.

Closing is never blocked

Not even by an invalid policy file.

Pilotstrip 08 of 10
Receipts · DEMO.md

Every number is counted from the journals.

15refused, nothing sent
9/9opened, closed flat
7distinct rules
2agents: Claude Code, Codex
Testnet only. Nothing here has run on mainnet.README · Honest limits
Pilotstrip 09 of 10
The ask

Run it. Then read the 15 refusals.

npm ci && npm test

github.com/edycutjong/dreamdex-pilot

v0.1.0 · MITstrip 10 of 10
strip 01 of 10