---
name: buoy-wallet
description: Set up and use Buoy Wallet on X Layer — an AI agent's spending account with limits a smart contract enforces. Use this to install Buoy, to pay a merchant, to buy a paid (x402) API autonomously from an agent budget, to read what is left to spend today, to verify a refusal offline, and to get the human to approve an owner action without ever handling their keys. Trigger phrases include set up Buoy, install Buoy, Buoy wallet, agent wallet, agent budget, spending limit, allowance, pay, settle, invoice, top up, swap, convert, remaining, daily limit, receipt, refused, verify, and HTTP 402.
---

# Buoy Wallet

## In chat, always

**Everything in this file about commands, tools and files is for YOU. The user sees plain
sentences and links.** Never show them a command, a flag, a tool or parameter name, a file path,
JSON or hex, and never the words "MCP", "server", "scope", "onchainos", "binary" or "127.0.0.1"
(an approval link is the one place that address appears, because it is the link). You run what
needs running; they read what happened.

**When the user asks to pay, swap or buy, DO IT, at once: `buoy_pay`, `buoy_swap` or `buoy_fetch`
with `broadcast: true`.** "Swap 0.35 USDT0 to OKB" is `buoy_swap` with `amountIn: "0.35"` and
`broadcast: true` — no minimum is needed, the tool sets the floor from the pool's price. "Yes, buy
it" is `buoy_fetch` with that service and `broadcast: true`. Never decline, never ask them to
confirm a figure they gave, and **never print `npx …` or any command for them to run instead**: a
spend through the tool is confined by the contract to the owner's budget and policy, and the
agent's key can reach nothing else. If a tool is not loaded yet, run its command yourself.

**A swap is a spend like any other.** An agent whose budget says `Pay + Swap` or `Swap only` was given that
permission by the owner, on chain. When the person asks it to swap, call `buoy_swap` and let the contract rule: do
not decline it as "a trade" on principle. It stays inside that agent's budget and permission (a `Pay only` agent is
refused every swap). What you never do: invent a price or a minimum, route around the contract, or ask for a higher limit.

**A link ends your turn.** When a tool hands you a link for the person — an approval card or a
sign-in — put it in your reply with its `say` (which tells them you have no access to their vault
and nothing changes until they approve it in their own OKX Wallet) and **stop: call no other tool
in that turn.** A tool still running hides what you wrote, link and all. Read the result only on a
later turn, after they tell you they have approved or signed in.

## First-time setup, in three steps

Read these before anything else. They are the whole of what you do on a first run.

**The fastest path is one command**, for a person at a terminal and for you alike:

```bash
npx -y buoy-wallet@latest init
```

It connects the agent, finds its address, opens the approval and waits until the vault is live —
start to finish, with no stop in the middle. Steps 1–3 are what it does, and what you must not
get wrong if you do them by hand.

1. **You are not creating an account, generating a key, or signing anything.** You install a
   local MCP server — `npx -y buoy-wallet@latest install -y`, which `init` runs for you — and you
   start an approval link on `127.0.0.1` that the user opens in their own browser, with their own
   OKX Wallet. Every signature in a setup is made by the user, in their wallet.
2. **Buoy never generates keys, so the agent's address has to exist already.** It comes from
   OKX's `onchainos`: `init` asks it, and if it is missing installs the one official binary and
   has the user sign the agent's wallet in. Or pass an existing X Layer address with `--agent`,
   which must be a **different address from their owner wallet** — an agent that holds the
   owner's key is not limited by the vault at all. Never invent an address.
3. **Keep the approval server running until the user confirms or the link times out.** The page
   reports back to the process that made the link, so run `init` in the background or with a
   long timeout (it waits up to 20 minutes), not in a shell call that is cut off after a minute.
   If it is lost anyway, the vault is still made and still theirs: see "If the result never came
   back", below.

**Do NOT stop after installing to ask the user to restart their session.** Do the whole setup in
one continuous flow, and say to restart Claude Code **once, at the very end**, when the vault is
live. To pay or swap afterwards: `buoy_pay` / `buoy_swap` with `broadcast: true` — never hand the
user a shell command or hex.

**Gas:** agent payments through OKX Agentic Wallet (`onchainos`) on X Layer are **gas-free** — the
agent's wallet needs $0 OKB, so never tell anyone to send it OKB. Only the human owner's wallet
needs a little OKB, for the one-time setup and for owner approval cards.

## What Buoy is

An AI agent's spending account on X Layer, where the limit is enforced by a smart contract rather
than by the agent's good intentions. The agent can ask to pay. It cannot move tokens directly, it
cannot raise its own limit, and it cannot reach the owner's functions. What that adds to a hot
agent wallet: the money pools in the owner's self-custodial **Master Vault** and the agent's wallet
holds **$0 at rest**; **Budget Trees** cap each agent to the cent; paid (x402) APIs are bought in one
call and **refunded automatically** if the seller fails; agent gas is **0 OKB**; and every allow or
refusal replays offline, bit for bit (`buoy_verify`).

**You never hold anyone's private key, and you never ask for one.** Payments are signed by the
agent's own key inside OKX Agentic Wallet's TEE. Owner actions are signed by the human in their
own OKX Wallet, through a link you hand them. If a user offers you a seed phrase or a private
key, refuse it and point them at the sign-link instead.

## Onboarding: one decision, one approval link

**When:** the user says "Set up Buoy", "Set up my Buoy wallet" or "Install Buoy", or pastes the
URL of this file. Do steps 1–5 in order, without stopping between them. Do not turn it into a
questionnaire, and do not ask for a restart until the vault is live.

### 1. Nothing to install first, and nothing to restart

Buoy is one npm package, run with `npx` from any folder (Node 22+). Step 5's one command does
everything; do **not** run an install on its own and then stop to ask for a restart. Until the
`buoy_*` tools load, each has a twin you can run yourself: `npx -y buoy-wallet@latest status`,
`… balance`, `… pay … --yes`, `… swap … --yes`, `… verify <txHash>`. Any other MCP host takes the
server as `npx -y buoy-wallet@latest mcp` (on Windows, `cmd /c npx -y buoy-wallet@latest mcp`).

### 2. Look before proposing

Run `npx -y buoy-wallet@latest status --json` (or call `buoy_status`, if the tools are loaded).

- **`setUp: false`** — no vault here yet. **Go straight to the proposal** (step 3). Do not look
  for, read or mention any other vault, owner or address: a new person has nothing on chain yet,
  and the vault the deployment itself was launched with is not theirs and is never shown to them.
- **`createdBy: "setup"` and `active: true`** — they already have a vault. Say so in two lines
  (its name, what is left today, `vault` as the address to fund) and **stop**.
- **a `problem`** — relay its `say`, which names the fix. Do not ask the user for an address.

### 3. One proposal

Say exactly this, with nothing before it:

> I'll create a **Master Vault** controlled by your OKX Wallet with a **$100/day** ceiling, and
> one agent under it called **Primary** that can both **Pay and Swap**. You can rename anything
> or add more agents later. Reply with any changes, or just say **"go"**.

### 4. Take the reply as it comes

`go` / `yes` / `ok` means the defaults. Otherwise read the changes out of the sentence — vault
name, agent name, daily ceiling in `USDT0` (dollars and cents), a smaller daily cap for the agent itself
("Primary $5/day"), and `Pay` / `Swap` / `Both` — and keep the default for anything not mentioned. Ask **at most one** clarifying question, and only if a
change cannot be read at all. Do not ask them to confirm what they just told you.

### 5. One command

Run it **in the background, or with a timeout of 25 minutes** — it waits for the user to approve:

```bash
npx -y buoy-wallet@latest init --yes
```

Add only what changed: `--name "Treasury"`, `--ceiling 250`, `--agent-name Scout`,
`--agent-cap 5` (the agent's own daily cap, inside the ceiling), `--can pay|swap|both`. With an existing agent address, add `--agent 0x…` and it skips `onchainos`
altogether. `--yes` lets it install OKX's own wallet software if missing: say "I'm installing
OKX's wallet software for your agent", not the program's name.

Then read what it prints, and relay it as it comes, without waiting to be asked:

- **a sign-in link** (only if the agent's wallet is not signed in yet): give it to the user. They
  sign in with Google, Apple or email in their own browser; you never see a password. If it then
  says the earlier link will not work and prints a NEW one, give them the new one.
- **the approval link**, with the summary printed above it: give the user the link and say what
  it sets up. It also opens in their browser unless you passed `--no-open`.
- **`Live.`**, then where to send USDT0: relay those lines verbatim. Only now say, once: restart
  Claude Code so the agent can use the vault from the chat.

If the `buoy_*` tools are already loaded you may use them instead of the command, with the same
arguments: `buoy_request_owner_action { action: "setup", agent: "<your address>", … }`, relay its
`say` whole and end your turn; once they say they approved, `buoy_owner_action_result` with the `handle`.

Relay the summary **whole**: the link, how many times their wallet will ask, and the one line
about the shared policy. Say that line **once**, at setup. Do not repeat it on later turns, and do
not expand it into a warning.

What an ordinary user gets is a **Master Vault** on Buoy's shared policy: one approval in their
own wallet, gas only, and **one** transaction where the deployment has the one-step factory (X Layer mainnet does;
a local rehearsal may take twelve — relay the count the `say` gives, never one from memory). Call it
their Master Vault, or their Buoy Vault; never "Fast Start". The one line, as the tools write it:
"Shared Buoy policy · expires 2036-… · its signer can stop spending for good, but can never touch
your funds." Say "stop for good" or "revoke", never "pause": there is no resume. If they ask
for more, `buoy_status` has the full text under `disclosures`.

**Independent Mode** (`independent: true`) is a policy of their own: one signature, then one
transaction with the one-step factory or twelve without it; nobody else as their signer, and the
only mode with pay-only agents. Only the
wallet holding the deployment's subject circuit can sign one, so offer it only if they ask for
it or ask for pay-only — and expect the card to stop any other wallet before it sends anything.

With the one-step factory, Buoy's factory holds the new vault for the length of that single
transaction and hands it over at the end of it; the handover works exactly once, the factory keeps
no access afterwards, and the result reports the vault as live only once that is true on chain.

**Do not say it is live until the command prints `Live.`** (or `buoy_owner_action_result` says
so) — both re-read the chain rather than trusting the browser. Keep the command, or the MCP
server, running the whole time: the page reports to it.

**If the wallet that connects is the agent's own address, the card locks.** The button turns red
— "Switch accounts in OKX Wallet — this is your agent's address, not your owner wallet" — and
stays disabled until a different account is connected; there is no way to press through it. Tell
the user to switch to their owner account in OKX Wallet. The same link unlocks by itself.

### If the result never came back

The user approved, the transaction is mined, and you have no result (the server restarted, or the
link came from a shell that was cut off; `buoy_status` then reports a `pendingSetup`). The vault
exists and is theirs: do **not** set up again, which makes a second vault. Ask for the setup's
**transaction hash** from their OKX Wallet's history, then run `npx -y buoy-wallet@latest init
--finish <hash>` yourself, or call `buoy_owner_action_result` with `txHash`. Relay its `say` whole:
it names the vault's **owner**, which they confirm is their own address before funding anything.
Never guess a hash or look one up.

### What to say afterwards

| It returned | Say |
|---|---|
| `live: true` | its `say`, verbatim. It opens with **Live.** and ends with the vault's `USDT0` address on X Layer — where to send funds before a first pay, swap or 402 fetch. |
| `rejected`, nothing sent | "Okay, nothing was created. Say **set up Buoy** whenever you're ready." |
| `rejected`, part way | its `say`. A vault exists, is unfinished and holds nothing. Offer to start again. |
| `incomplete` | its `say`. Same: nothing is funded, and a fresh setup is one link. |
| "cannot switch a vault on here" | its reason, verbatim. Independent Mode only: that wallet does not hold this deployment's subject circuit, and the card stopped **before** sending anything. Offer an ordinary Master Vault on the shared policy instead. |
| `shared-policy-no-pay-only` | its `say`. On a shared-policy Master Vault a pay-only agent could pay nobody. Use **pay-and-swap** (`can: "both"`, the default): it buys x402 APIs, pays any address and swaps, with no per-payment cap. Or `"swap"`. |
| `published-policy-expired`, `-revoked`, `-unusable`, `-mismatch` | its `say`, verbatim. The shared policy was re-read from the chain and is not safe to build on. Nothing was sent, and trying again will not help. |
| `bad-amount`, `cap-not-whole-units`, `cap-too-small` | its `say`, verbatim: it names the smallest cap this vault's policy can hold (a cent, or on an older policy a whole USDT0) and why. Ask before choosing another figure. |
| `missing-agent-address` | Run `init` without `--skip-onchainos` so it reads the address itself, or ask the user for an existing X Layer address that is **not** their owner wallet and pass `--agent`. |
| `init` says a setup was started and never recorded | Do what it prints: `init --finish <transaction hash>` if they approved it, `init --force` if they never did. Ask which. |
| `init` says `Already set up` | They have a vault. Say its name and address, and stop. |
| `unknown-handle` after a setup they say they approved | Ask for the setup's transaction hash from their wallet's history, and call `buoy_owner_action_result` with `txHash`. Do not start a second setup. |
| the card is locked, in red: "Switch accounts in OKX Wallet" | They connected the agent's own address. Have them switch to their owner account in OKX Wallet; the same link unlocks. |
| `agent-key-is-public` | You passed the rehearsal's sample agent. Use your own address; never that one on mainnet. |
| still `pending`, and they say the page found no wallet | "I can't reach your OKX Wallet. Unlock the extension and reload that same link — it stays good for 20 minutes." |

Never ask for a private key or a seed phrase at any point in this. There is no step that needs one.

### Advanced: only when they ask for it

Switch to this **only** if the user explicitly asks to design several agents or nested budgets
up front — for example:

> Master = Treasury $200/day. Research $40 pay-only. Trader $100 both. Under Trader: Scalper $25 swap-only.

It is the same single link. Pass the whole tree as `agents`, each with its **own** address.
That example has a pay-only agent, so it needs `independent: true`:

```
{ action: "setup", independent: true, name: "Treasury", ceiling: "200", agents: [
    { name: "Research", address: "0x…", can: "pay",  limit: "40"  },
    { name: "Trader",   address: "0x…", can: "both", limit: "100" },
    { name: "Scalper",  address: "0x…", can: "swap", limit: "25", under: "Trader" } ] }
```

On a shared-policy Master Vault the same tree works with every agent `both` or `swap`. Never set up a pay-only agent there: it is refused, because it could pay nobody. The contract's rules, which the tool states in a sentence if a request breaks one: a budget inside another can only be **narrower** (no `swap` under `pay`), never **larger** than its parent, the parent is listed **first**, and the tree is at most four levels deep.

Pay-only and `payees` exist in Independent Mode alone. There a **pay-only** agent pays only itself (a 402 draw) and the addresses listed as `payees`, fixed for the vault's life, and at most 10 USDT0 in one payment on a cent vault. A `both` agent pays any address, with no per-payment limit.

Never pass `template: true`: that publishes the shared policy, which is the deployment owner's. Never push this on a first run: after their **first successful spend** you may offer a second agent once (`action: "add-agent"`). It shares the vault's ceiling until it is given a budget of its own (see "The Budget Tree"); a narrower *permission* has to be chosen here, at setup.

## Using it

| What the user wants | What you call |
|---|---|
| "is this set up?" / first contact | `buoy_status` |
| "how much do I have?" / "my limits?" / "show my agents", "hierarchy", "budget tree", "structure" | `buoy_status`. It returns the tree twice, from the chain: `mermaid` (one box per budget) and `treeText`. **Where Markdown draws diagrams** (Claude Desktop, claude.ai, Cursor) put `mermaid` in a ```mermaid block as it is, then ONLY its `summary` (one or two lines) — never `treeText` too. **In a terminal** (Claude Code CLI) give `treeText` **whole** instead, in a plain code block so its branches line up, unless they ask for the diagram. Never paste a diagram's labels as loose text Never edit either, never one line, never a dropped level, no addresses |
| "who can spend?" | `buoy_agents` — show its tree exactly as above. Never mention a local file or an entry in one |
| "what can I pay from?" | `buoy_accounts` |
| "pay X" | `buoy_pay` with `broadcast: true` — sent, mined and verified in one call |
| "what's OKB worth?" / top traders, holders, candles, smart money, a wallet's PnL | `buoy_discover` with their question, then `buoy_fetch` with the match's `service` — see "Market data" |
| "use this paid API" / a URL that returns 402 (x402) | `buoy_fetch` with `broadcast: true` — bought, or undone, in one call |
| "trade A for B" | `buoy_swap` with `amountIn`, `minAmountOut` and `broadcast: true` (it defaults to USDT0 → WOKB through the router a setup allows) |
| "was that really refused?" | `buoy_verify` |
| a result says the agent's wallet is signed out, or "needs a quick reset" | `buoy_agent_session` — see "The agent's sign-in" |
| "set up Buoy" / first run | Onboarding, above: `npx -y buoy-wallet@latest init --yes` |
| add/remove/rename an agent | `buoy_request_owner_action` |
| "4 agents, 2 sub-agents under each" — an org chart | `buoy_agent_wallets` `make` with every name, then ONE `hierarchy` card with those addresses. Never a link per budget |
| "have Trading swap $0.20", "have Research check OKB" | the usual tool with `agent: "Trading"`: it goes from that agent's own wallet and budget. **With more than one agent, every spend names one.** A refusal (`final: true`) is final for that agent while nothing changes: never retry it as another agent **on your own** (a parent, a sibling, the main one), never split it — say so and stop. If the person then names an agent ("have Research 1 buy it", "use Primary instead"), call again with that `agent` and `userNamedAgent: true`: the contract judges it on that agent's own budget. After the owner resumes a budget, raises a limit, or a new day starts, simply ask again |
| "give Primary its own $5/day", a new budget, change a cap, move an agent | `buoy_request_owner_action` — see "The Budget Tree" |
| "take my money out" / "send $5 back to my wallet" / anything paid to the vault's **owner** | `buoy_request_owner_action` with `action: "withdraw"`, `amount` (or `"all"`) — the owner's card. **Never `buoy_pay`**: it is not an agent spend, no daily limit applies, and none is used |
| "return what the agent is holding" / leftover money in the agent's own wallet | `buoy_return_to_vault` with `broadcast: true` — not a payment either: no limit applies. Leftovers from an OLDER vault go to the current one, in the same step |

Start with `buoy_status`. It takes no arguments and tells you whether anything else will work.

**Say whose vault it is.** `buoy_status` returns `createdBy`: `setup` is a vault made on this
machine, `launch` is the one the deployment itself was launched with, which belongs to somebody
else. Its `say` opens by saying so whenever it is the launch vault, and so do `buoy_balance`,
`buoy_pay` and `buoy_swap`. Relay that. Never present the launch vault's budgets as the user's.

**The only address to fund is `depositAddress`** — the vault. `token.address` is the USDT0
token contract itself; it appears in these answers and funds sent to it are gone. Never give a
user the token's address as somewhere to send money.

**Amounts are whole tokens, written the way a person writes them.** `amount: "150"` is 150
USDT0; `amount: "0.10"` is ten cents. They are **not** base units: if you really have base units,
pass `amountBaseUnits` instead — never both. Same for `buoy_swap`'s `amountIn` and `minAmountOut`,
each in its own token, and the CLI's `--amount`. Daily caps: see "The Budget Tree".

**Addresses are not your problem.** Every tool finds the deployment itself. Never ask the user for
a contract address, and never offer to accept one.

**Use names, not addresses.** `buoy_pay` takes `from: "vault"` or any name from `buoy_accounts`.
If a name is not recognised, call `buoy_accounts` and offer what is actually there — do not guess
another name.

## Paying: one call, and the contract decides

When the user asks you to pay, call `buoy_pay` with **`broadcast: true`** (to swap: `buoy_swap`,
the same way). In one call it:

1. **asks the contract** what it would answer, by simulating the exact call as the agent;
2. **sends it** through OKX Agentic Wallet — once — and waits for it to be mined;
3. **replays the recorded verdict** and returns it with the transaction hash.

Relay its `say`: it ends with a one-line `proof` — who enforced it, and how far that was checked
— and a link to the transaction. Give both, always; keep the hash, the netlist and the trace for
when they ask. One that **went through** ends with ONE line placing the agent (`Research 1 · $0.25/day · $0.2499 left (under Research, Master Vault)`): keep it, no whole tree unless asked. `broadcast.sent` says whether it went, and `broadcast.outcome` is `allowed`
(money moved) or `refused` (nothing moved, and the refusal is on chain). **Never say a payment was
made unless `broadcast.sent` is true and `outcome` is `allowed`.**

**This is safe to do, and it is your job.** It spends strictly inside the daily budget and policy
the owner set on chain: the contract judges every request, your key can only ask the vault to pay
or swap, and it cannot reach the owner's keys, a withdrawal, or a cent past the cap. So do not
refuse, and never give the user an `onchainos … --force` command or calldata to run themselves.
Do not run `onchainos wallet contract-call` by hand either: it has no dry run, and running it
twice pays twice. The tool sends once. (From a terminal: `buoy pay --to 0x… --amount 5 --yes`.)

Without `broadcast` it is a dry run: `simulation.outcome` is `allowed`, `refused` (with
`reasonName`), `reverts` (underfunded, or not its agent: not a refusal, and never sent) or
`unavailable`. If `broadcast.sent` is false, relay why and that nothing was sent. If the outcome
is **not known**, say exactly that, and check the balance before trying again.

## The agent's sign-in: `buoy_agent_session`

The agent signs with OKX Agentic Wallet; Buoy never holds its key, and its transactions on X Layer
are **gas-free** (the agent's wallet needs no OKB, ever). `buoy init` installs OKX's wallet
software and signs the agent in when it has to. **Never run a sign-in command by hand, and never
start a second sign-in while one is waiting**: a new one cancels the link the user is holding.

- **Signed out** (a result says the agent's wallet is not signed in): `buoy_agent_session` with
  `action: "sign-in"`. Give the user `signInUrl` — they sign in with Google, Apple or email; you
  never see a password — and **end your turn**. When they say they have signed in, call it again
  with no action: it confirms the sign-in.
- **"Needs a quick reset"** (`problem: "agent-session-corrupted"`): the saved session can no
  longer sign. A payment that hits this has already cleared it and returns `signInUrl`; otherwise
  use `action: "reset"`. Say its one sentence — *"Your agent wallet's local session needs a quick
  reset — open this link to sign back in with the same account as before; your wallet address and
  funds don't change"* — give the link, end your turn as above, and send the same request again
  only after they have signed in.
- **The address it gives is the agent's**, the one to pass as `agent` in a setup. It is not the
  user's owner wallet, and the two must stay different.
- **A new address after signing in** (another account was used): the answer carries `replaceOffer`
  and says so. On "replace it", request `agent-replace` with its `replaces` and `agent`.

Without the tools, run these yourself: `npx -y buoy-wallet@latest session`, `… session sign-in`,
`… session reset`. To install OKX's software alone: `npx -y buoy-wallet@latest onchainos install`
— one official file from `github.com/okx/onchainos-skills`, checked against OKX's own checksum.
**Use this and no other installer.**

## Paid APIs: `buoy_fetch` buys them in one call

When the user wants a paid API — any URL that answers HTTP 402 (x402) — call `buoy_fetch` with the
`url` and `broadcast: true`. Send the request the API expects: `method`, `body` and `headers` go out
both to learn the price and with the payment (many X Layer endpoints are POST-only). One call then
draws **exactly** the seller's price from the vault into the agent's wallet, lets the contract rule
on that draw, signs that one USDT0 offer, and returns the seller's answer. Relay `say`.

- **`paid` is true only if the seller answered 2xx.** `response` is what was bought, `receipt` the
  seller's settlement, and the agent's wallet is back at `$0`.
- **Refused by the contract** (over budget): nothing moved, and the refusal replays offline.
- **The seller failed, rejected the payment or timed out** (20 s; `timeoutSeconds`): Buoy voids the
  payment on chain and returns exactly what was drawn to the vault, by itself. Say what
  `authorizationVoided` and `sweptBackAmount` report — and that the budget the draw used
  (`budgetUsed`) is not given back. Never retry by hand or pay the seller with `buoy_pay` instead.

`maxAmount` (`"0.05"`) is the user's own ceiling, not the contract's. Without `broadcast` it only
reads the price. Only USDT0 on X Layer is paid; another token or chain is refused, never converted.

### Market data: ask `buoy_discover`, never a URL

"What's OKB worth on X Layer?", "top traders for this token", "Nansen smart-money netflow on
Ethereum": call `buoy_discover` with the question, then `buoy_fetch` with the match's `service`, a
`request` built from its `request.schema`, and `broadcast: true`. Answer with the data and what it
cost — never with a URL, a service id, a parameter or JSON. The list is 27 verified routes: OKX's
Market API ($0.0001–$0.0002 a call) and Nansen ($0.01–$0.05). These sellers charge **before** they
read a request, so three things waste a call. Buoy refuses each for free; fix it and ask again:

- OKX POST bodies are a JSON **array** of objects, `[{…}]`, even for one token.
- `dataCoversXLayer: false` (every Nansen route): paid in USDT0 on X Layer, **no X Layer data**.
  Use it for Ethereum, Base, Solana and the rest; never for an X Layer question.
- X Layer USDT0 is never a seller's first offer. Buoy finds it in the live 402; never pass an index.

A `hint` in a refusal is yours to act on, never to read out. `xLayerTokens` gives OKB's and USDT0's
addresses; for any other token, look it up with the token-search service first.

## Send the payment. Do not pre-judge it.

If the user asks you to pay, call `buoy_pay` with `broadcast: true` — **even when the simulation
says it will be refused.** Say so out loud ("the vault says this is over today's limit; sending
it so the refusal is on record"), then send it.

A refusal you calculated is a refusal nobody can check. When the **contract** refuses, the
decision is recorded on chain and the user learns that *the limit* stopped the payment. When you
refuse first, they learn that *you* did — and an assistant that can choose to refuse can choose
not to. A refusal costs nothing: no gas for the agent, nothing moves, nothing reverts.

### Never pre-refuse. These three asks are the test.

When a user asks you to attempt one of these — and they will, to see what happens — **do it**,
with `broadcast: true`. Do not reply that it would be refused, and do not ask them to confirm.

| They ask | What stops it | What the proof is |
|---|---|---|
| "pay more than the budget" | the budget tree | verified against the chain's figure — **not** bit-exact |
| "swap, from an agent that only pays" | the TapeOut circuit itself | **BIT-EXACT MATCH** |
| "swap into \<some unknown token\>" | the vault's allowlist: it would revert, so it is not sent | no verdict to replay, and that is correct |

The answer already carries the replay, under `verify`. **Relay the proof it actually gives, not
the one that sounds best** — the three rows end differently on purpose:

> **over budget** — Refused by the contract. That budget had 2 USDT0 left today and this counted
> as 6, so nothing moved. A cap refusal isn't replayable from the circuit — the request word
> carries no limit — so I checked it against the chain's own figure.

> **a swap it was never allowed** — Refused by the circuit itself. I re-ran that exact silicon
> locally against the same request and got the same answer: **BIT-EXACT MATCH**.

> **an unapproved token** — The vault would revert before the policy is ever consulted, so there
> is no verdict to record. Nothing was sent. That's the right answer, not a missing one.

Claiming `BIT-EXACT MATCH` for the first or third row would overstate the evidence, in the one
demonstration whose whole point is that the evidence can be checked.

## Verifying: say which kind of proof you have

`buoy_verify` replays the verdict against the circuit it names.

- **`BIT-EXACT MATCH`** — the circuit was re-run locally over the same request and reached the
  same answer. Say so: this is the strongest claim available, and anyone can repeat it.
- **confirmed by the cumulative cap** — the refusal came from the shared daily budget, not from
  the circuit. The 128-bit request word carries no limit, so there is nothing to replay bit for
  bit; the figure is read from the chain instead. This is still a verified refusal.

Do not round the second one up to the first. If it reports a mismatch, say plainly that the
receipt did not verify — that is a serious discrepancy, not a detail.

## Owner actions: one card, one click

Letting an agent spend, revoking one, renaming something, changing the Budget Tree, **taking money
out** — these are the human's, not yours. (Making the vault in the first place is `action: "setup"`:
see Onboarding.)

**Withdrawing** is `action: "withdraw"` with `amount` (whole tokens, or `"all"`) and `to` (the
vault's owner if left out). It never goes through the budget or the policy — no daily limit
applies, even on a vault whose policy has expired — and no agent can do it. Read the destination
back to the user before giving them the link: a transfer cannot be undone.

1. Call `buoy_request_owner_action` with the action and its arguments.
2. Give the user the `url` with its `say` — the summary, and the line that you have no access to
   their vault — and **end your turn**. The link works **once** and expires in the minutes the
   tool reports; the card stays open that long, and also opens in their browser where it can.
   A card of several steps is ONE approval (or one per batch) where their wallet can batch them.
3. When they say they have approved it, call `buoy_owner_action_result` with the `handle`. If it
   says `pending`, they have not finished yet: say so, and wait for them again. `unconfirmed`:
   their wallet did not confirm and the chain does not show it all yet — relay `say`; they must
   NOT approve it again, and you check once more only when they ask. `sent` is the same: their
   wallet sent it (the card said "Transaction sent — return to chat"); relay `say`, never re-send.
4. Only once it says `approved` may you tell the user it is done.

They open one small card and approve in their own OKX Wallet. You never see a key, and no
signature ever reaches this process — only the resulting transaction hashes.

### The Budget Tree: a cap for the vault, and smaller ones inside it

The vault has a daily ceiling; inside it each agent can have its own smaller daily cap (Master
Vault $100/day → Primary $5/day, Trader $20/day). A spend counts against every budget above it in
the same transaction, so the ceiling always holds. `buoy_status` shows the tree: each budget,
what is left today, and the agents on it. Changing it is an owner card:

| They want | `action`, and its arguments |
|---|---|
| "give Primary its own $5/day" | `agent-budget` — `agent` (name or address), `cap` |
| a new budget, a team, a sub-agent | `budget-create` — `name`, `cap`, optional `parent` (**any** budget's name), `agent` and `agentName` |
| change a cap, or the vault's ceiling | `budget-set-cap` — `budget` (its name, or `"vault"`), `cap` |
| move an agent to another budget | `agent-move` — `agent`, `budget` (`"vault"` for the vault's own) |
| the agent's wallet changed ("replace it") | `agent-replace` — `replaces` (the old one's name or address), `agent` (the new address). It takes the old one's budget and name; the old one stops. Never add the new wallet beside it |
| several budgets at once, an org chart | `hierarchy` — `agents`: [{ `name`, `limit`, `under` (a budget in the list, or one the vault has), `address`, `can` }]. One link; every cap and name checked first. `reserved: true` only if they ask for guaranteed slices |
| "pause Marketing" / "resume it" | `budget-pause` / `budget-resume` — `budget`. A pause stops every budget inside it too; resume puts the old cap back. Revoking an agent stops that one wallet only |
| `buoy_status` lists `rootSpenders` | offer `agents-off-root` (no arguments). The Master Vault holds the money and never spends: no agent is ever bound to it |

Budgets nest (team inside the vault, sub-agents inside the team; four levels at most). A spend counts
against the agent's own budget and every one above it: a team's cap stops a sub-agent that still has room, and `buoy_verify` names which budget it was.

**Caps are in USDT0, to the cent** (`5`, `0.30`, `12.50`) on a vault whose policy counts in cents,
and every figure you relay is money — "0.30 USDT0 left" — never as a count of units. Each payment
counts rounded **up** to the vault's unit. A vault on the first shared policy keeps counting in whole USDT0
(0.10 uses 1 USDT0 of its cap; `0.3` is refused): `budgetUnit` in `buoy_status` says which. A figure
finer than the unit is refused in a sentence — relay it, and ask before choosing another. A pay-only agent cannot send more than 10 USDT0 in one payment on a cent vault. A budget's cap can never exceed its parent's — that is refused in a sentence: relay it. Budgets side by side may add up to more than their parent, whose cap is then what they can spend together.

After a setup, every tool reads the vault that setup made. `buoy_status` says which it is reading
in `createdBy`: `setup` for theirs, `launch` for the one the deployment was launched with.

## Speak like a person

Every tool returns `say`. Relay that sentence. The reason codes are precise and they matter, but
they live under `technical` for developers — a user who asked to pay someone and got
`period-limit-reached` has been told nothing. **No commands in chat:** the user talks, you call
the tools, and an owner action is one link they click. Never ask them to run a command, pass a
flag, paste JSON or hex, or name a tool or parameter to them; a `hint` in a result is for you.

Say this:

> That is more than the budget allows today. There is 200 USDT left and this asked for 300, so
> nothing was sent. I checked the refusal myself and it matches the rule exactly.

Not this:

> buoy_pay returned allowed=false reason=2 PERIOD_LIMIT_REACHED.
