How Mandate
keeps your agent in line.

Mandate is a module for your smart wallet. You set the rules once and sign them. Your AI agent can then trade only through Mandate, which checks every trade before and after it runs and undoes anything outside your rules.

Spec v0.2BasePrototype, not audited
Basics01–04

01What Mandate does

The rules live in a contract, not in the agent's prompt. So they hold even if the agent's key is stolen, or someone talks the agent into something in a chat.

  1. Your money can't leave your wallet. No transfers to anyone, and no trades that pay out to someone else.
  2. The agent can't change the rules, your keys or your wallet's settings.
  3. Losses per trade are capped, against your whole portfolio and against the trade itself.
  4. Losses per 24 hours are capped. Hitting the cap stops the agent.
  5. A falling market slows the agent down: first it may only sell, then it stops.
  6. No open-ended approvals. The agent can only let a protocol take exactly what a trade needs.
  7. No price, no trade. If the price feed is stale or the network is unhealthy, the agent waits.

02How a trade is checked

  1. The agent sends a trade to Mandate, never to your wallet directly. It has no other way in.
  2. Before: Mandate checks who is asking, whether the agent is active, and every call in the trade against the safety floor and your list of allowed actions.
  3. Mandate notes your portfolio and reads prices from oracles, once.
  4. The trade runs.
  5. After: Mandate values the portfolio again at the same prices. The difference is exactly what this trade cost you, whatever the market did. Your rules are checked against it.
  6. Anything outside the rules is undone as if it never happened, and the reason is recorded. Repeated attempts count as violations and can freeze the agent.

Your own actions as the owner don't go through Mandate. You can always move, withdraw or trade your money yourself.

03Who can do what

WhoCanCan't
You, the ownerEverything: set and change rules, choose or revoke the agent, unfreeze it—
The agentTrade within your rules until its access expiresMove money out, change rules, unfreeze itself
A guardian (optional)Freeze the agent or switch it to sell only, e.g. a monitoring serviceLoosen anything or touch the money
AnyoneAsk Mandate to revalue your portfolio at current pricesMake your status softer

Agent access always has an end date (30 days in the playground). You can renew or revoke it at any time.

04Try it

The playground runs on Base Sepolia, a test network. Nothing there is real money.

  1. Connect a wallet: MetaMask or Phantom (turn on testnet mode). We send a little test ETH for fees.
  2. Pick rules: a template, or your own.
  3. Sign once. You get a smart account with $10,000 in test USDC, your rules and an agent.
  4. Try to break it. Give the agent normal tasks, scam messages and risky trades, and watch which rule stops what. The market moves on its own and sometimes crashes.
Specification v0.205–13

05Safety floor

Always on, in every policy. No setting can turn these off.

#The agent can never
F1–F2Call your wallet or Mandate itself, so it can't change settings, keys or rules
F3Send ETH to a plain address
F4Run code in your wallet's name (delegatecall)
F5Transfer tokens or NFTs, or sign permits that let someone else take them
F6Approve a spender you didn't allow, or approve more than a trade uses
F7Pack more than 8 calls into one trade
F8Send a call without a function name

With the floor alone and no other rules, the agent can trade any size and can lose money on bad trades, but it still can't move money out.

06What the agent may call

  • Only actions on your list. Each one is a specific protocol and function, for example “swap on Uniswap”. Anything else is refused.
  • The payout goes to you. For each allowed action you can pin who receives the result. In the playground a swap must pay out to your account, so a swap “to my friend's address” is refused.
  • Exact approvals. The agent may approve only spenders you allowed, only on tokens Mandate tracks, and the approval must be fully used in the same trade. Nothing is left open afterwards.
  • A spending cap on ETH sent with each allowed call, if you set one.

07How the portfolio is valued

  • You choose which tokens count (up to 16), each with a USD price feed. Stablecoins are marked as base assets.
  • A token not on the list is worth $0. Buying a scam token looks like losing the money, so the loss rules catch it.
  • Prices come only from oracles (Chainlink), never from a trading pool that someone could push for a moment.
  • Stale price or unhealthy network ⇒ no trading. Mandate also checks Base's sequencer and waits an hour after it comes back.
  • Debt counts as negative when lending positions are supported.
TermMeans
Portfolio valueEverything tracked, minus debt
Trade lossPortfolio value before minus after, at the same prices
Trade sizeHow much value moved between assets
ShareOne asset's part of the portfolio
PeakThe highest portfolio value Mandate has seen

08Rules you can set

Every rule is optional; leave it empty or at 0 and it's off. A policy can be one rule or none. Rules are checked after the trade runs, in the order below.

#RuleStopsWhen hit
P1Loss per trade, % of portfolio and/or $ capOne trade losing more than thisundone
P11Slippage, % of the tradeSandwich attacks and bad routes, even on small tradesundone
P4Loss in 24 hours, % of portfolioMany small losses adding upfrozen
P2Trade size, $One trade moving too muchundone
P3Turnover in 24 hours, $Trading too much in a dayundone
P12Can buy, per assetBuying an asset you only want soldundone
P5Any one asset, % (and per asset)Putting too much into one assetundone
P6Leverage, ×Borrowing beyond thisundone
—Drawdown → sell only, %Buying more after the portfolio fell this far from its peaksell only
—Drawdown → freeze, %Any trading after a deeper fallfrozen
—Trades per hourA runaway looprefused
—Violations in an hour → freezeAn agent that keeps tryingfrozen
—Freeze at once on an attempt to move funds outA hijacked agent, on its first tryfrozen

Details that matter

  • Prices are fixed during the check, so the market moving at the same moment never makes a good trade look bad, or the other way round.
  • 24 hours means the last 24 hours, not a calendar day. The budget can't be spent at 23:59 and again at 00:01.
  • Reducing risk is always allowed. If an asset grew past its share because its price went up, the agent can still sell it. Share, leverage and sell-only rules trip only when a trade makes things worse.
  • One big loss is undone; many small ones freeze. A single trade over the per-trade limit is undone. Losses that each passed it but add up past the 24-hour budget freeze the agent.

09Templates

The playground starts from one of three. You can change any number afterwards.

RuleFloor onlyCarefulActive trading
Loss per trade—0.5%1%, max $150
Slippage—0.5%1%
Trade size—$1,000$3,000
Turnover in 24h——$20,000
Loss in 24h—2%3%
Any one asset—20%20%; WETH 30%, cbBTC 40%
Leverage——1.5×
Drawdown → sell only / freeze—5% / 10%8% / 15%
Trades per hour—1020
Violations → freeze—33
Instant freeze on theft attempt—onon

10Status: active, sell only, frozen

StatusThe agent canGets there by
ActiveTrade within the rulesDefault; only you can bring it back
Sell onlyOnly reduce risk: sell assets, repay debtDrawdown past the soft limit, or the guardian
FrozenNothingDeep drawdown, 24h loss limit, too many violations, a theft attempt (if on), portfolio worth $0, the guardian or you
  • Only you can unfreeze or lift sell-only. Nothing unfreezes on its own, not even the next day.
  • Drawdown follows the market, not just trades: it's measured from the peak at current prices. A sleeping agent should still be stopped when the market crashes, so anyone may ask Mandate to revalue your portfolio. The playground does this when a crash hits an asset you hold. Revaluing can only make the status stricter.
  • After you withdraw money yourself, the drop looks like a drawdown and may freeze the agent. That's the safe direction. Reset the baseline to the current value afterwards.

11Violations and instant freeze

Every undone trade that broke a rule counts as a violation. When violations within the window (an hour in the playground) reach your limit, the agent is frozen. An agent talked into something in a chat usually tries several times; this stops it after a few.

Some attempts are never an honest mistake: paying a stranger, a token transfer, approving an unknown spender, leaving an approval open. With instant freeze on, the first one freezes the agent.

These don't count as violations: a stale price, a rate limit, or the protocol itself rejecting the trade (for example Uniswap's own slippage check).

12What it protects against

If…MandateWorst case
The agent's key is stolenFloor, allowed actions, loss limits, freezeBad trades within your 24h loss budget
The agent is tricked in a chatSame, plus violations freeze itSame
A trade pays out to a strangerRefused: payout must go to youNothing lost
The agent buys a scam tokenCounted as $0, so loss limits stop itNothing beyond your loss limit
Someone asks for an unlimited approvalOnly exact approvalsNothing lost
A price is manipulated for a momentOracle prices onlyNothing lost
The oracle or network failsTrading stopsThe agent waits
A bot sandwiches a swapSlippage and loss limitsUp to your per-trade limit
An allowed protocol turns maliciousLoss limits on the resultUp to your 24h loss budget
The guardian is compromisedA guardian can only freezeThe agent stops
The Mandate team is compromisedNo admin key, no upgradesNothing

13What it doesn't cover

  • Good trading. The agent can still lose money within your limits. Set them to what you're willing to lose.
  • Your own key. If the owner key is stolen, the thief is the owner.
  • Tokens you didn't add. Mandate doesn't watch them.
  • Not yet: a waiting period before loosened rules take effect, a health-factor rule for lending, perps and LP positions, several agents per wallet.

Mandate is a prototype and hasn't been audited. Use the playground; don't use it with real funds.