The diagram is drawn at 1600 px: pinch to zoom, or open the full-size PNG.

ReinsArchitecture

The agent asks. Your policy decides.

the agent's ask
facts, setup, send
refused
read-only check
cleared
nothing signed
Who asks
Reinsone core in src/ · three surfaces: MCP stdio, CLI, page API
Phoenix on Solanamainnet

Owner a human

Writes policy.json.

Its wallet signs the pin and DelegateTrader.

Creates the Tier B files.

AI agent MCP stdio

Claude Code (recorded) · any MCP stdio client

Seven tools

plan_order
place_order

markets · policy · journal
read-only

close_position · cancel_all
Tier B: reduce-only close · read resting orders

No tool edits the policy.
No tool returns a key.

Recorded: told to raise its own limit
I didn't raise the limit. No tool can change it, …

Claude Code, claude-bypass session

No agent needed

reins plan in a terminal

reins.edycu.dev: the keyless page, Tier A

Policy ~/.reins/policy.json

Your limits: zod-strict, fail-closed. sha256 latched at start; an edit refuses every order until restart.

Pin & delegate cli.mjs

reins pin · reins delegate

Reins builds the transaction; the owner wallet signs it. Run by the human, never the agent.

One rules module

rules/phoenix.mjs · 21 rules

Same code behind MCP, CLI and page.

marketClosedminLiqDistancePctleverageTierfundingAgainst

Live facts facts.mjs

One snapshot; every value keeps its endpoint and fetchedAt.

Liquidation: Rise createMarginCalculator, run locally on a hypothetical isolated account.

Refused

rule · field · value · limit

What fits

same bet at the reopen · less leverage
or another market: a different bet

Cleared

plan_id: single use, 60 s

the only input place_order takes

Re-check plan.mjs

plan_id fresh and unused; policy sha256 unchanged. Facts fetched again, every rule run again; a failure is refused, with what fits.

Tier B gate tierb.mjs

  • agent key phoenix-mainnet.json
  • TIER_B_OK budget covers it
  • owner's Memo pin = policy sha256

files missing: would-place · pin or budget fails: refused

Journal journal.mjs

~/.reins/journal.jsonl, append-only: every plan, refusal, would-place and receipt is a numbered row.

Sign & send Tier B

Phoenix's and the local liquidation agree (or Phoenix's is read back after the fill); allow-listed programs only. The agent key signs; getTransaction re-reads it.

Signed by the owner wallet mainnet
Memo reins-policy:v1:<sha256>tx 3rug4D6W… · :revoke stops every signer
DelegateTraderagent key becomes position authority: can trade, cannot withdraw · tx 5UJx73AW…
Phoenix perp-api keyless GET
perp-api.phoenix.trade/v1/
view/exchange/statusrunningState
view/exchange/market/{symbol}leverageTiers · isolatedOnly · earningsDatesV2 · open-interest cap
market/{symbol}/next-market-calendar-transitioncurrentState · utcNextTransition
market/{symbol}/market-calendarthe session while it is shut
funding/{symbol}/ratesfunding against your side
view/orderbook/{symbol}walked to your size
market/{symbol}/mark-price
trader/state/{authority}Tier B: open exposure
Tier C Local simulation

LiteSVM with Phoenix's mainnet program binaries: a cleared plan in, fill and Hawkeye liquidation out

Signed by the agent key Tier B
Phoenix isolated market orderbuilt unsigned by POST /v1/ix/place-isolated-market-order-enhancedmainnet · 8 opens + 8 closes, re-read
Reins architecture An AI agent calls plan_order; Reins runs one rules module over live Phoenix data and the owner's policy file, then refuses with what fits or returns a one-shot plan_id; place_order re-checks and signs a Phoenix order only when the owner's Tier B files and on-chain policy pin are in place. writes signs sends plan_order GET refused plan_id place_order would-place (no funded account) · Tier A yes send pin