buoy-wallet
v0.0.14
Published
Self-custodial agentic vault on X Layer with on-chain TapeOut circuit policies, gas-free OKX Agentic Wallet execution, and 1-click Fast Start.
Maintainers
Readme
Buoy
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. Every decision is made by a TapeOut policy circuit whose bytes are fixed and hashed — real silicon on chain — and every refusal comes with a receipt anyone can replay offline.
There is no dashboard. You talk to your agent; the agent talks to the contract.
What that adds to an agent that simply holds a hot wallet:
- A pooled, self-custodial Master Vault. The money stays in a vault only you can withdraw from. The agent's own wallet holds $0 at rest: it is funded for one invoice and ends at zero.
- Budget Trees, to the cent. A daily ceiling for the vault and a smaller cap for each agent inside it, counted and enforced on chain.
- Autonomous x402 buying, with the money back when it fails.
buoy fetch(the agent'sbuoy_fetch) buys a paid API in one call; if the seller fails, the payment is voided on chain and exactly what was drawn is returned to the vault. - 0 OKB. An agent's transactions through OKX Agentic Wallet are gas-free on X Layer.
- Bit-exact proofs. Every allow and every refusal replays offline, against the circuit the
chain names (
buoy verify).
Ask your agent:
Set up Buoy Wallet from https://masterwattson.site/skill.mdOr do it yourself, in one command, from any folder, with Node 22 or later:
npx -y buoy-wallet@latest initThat is the whole first run, with no stop in the middle. It connects your agent (Claude Code
and Cursor), finds the agent's address — installing OKX's onchainos CLI and signing it in only
if that is what it takes — opens one approval in your own OKX Wallet, waits until it is mined,
and tells you where to send USDT0. Restart Claude Code once at the end, and the buoy_* tools
are there.
It asks before it installs anything (--yes to say yes ahead of time), it will not make a second
vault over one you already have (--force if you mean to), and if you already have an agent
address, --agent 0x… skips onchainos altogether. The pieces are still there on their own:
npx -y buoy-wallet@latest install -y only wires the MCP server in, and
npx -y buoy-wallet@latest onchainos install only installs the one official onchainos binary,
from OKX's own release page, checked against OKX's own checksum — no skills, no daemon.
Why a shared gatekeeper
TAP #84 §0.2.4 states the problem plainly: "A policy's state belongs to one gatekeeper. A daily limit enforced by one escrow-side vault counts the requests that vault saw, not the agent's requests everywhere." §4.2(5) forbids pretending otherwise.
So one budget across several accounts is only spec-compliant if one gatekeeper sees them all — which is what this is. Spend from the vault and the Safe's allowance drops too, because the budget was never per-account.
Nobody here holds a key
| Lane | What it can do | Where the key lives | |---|---|---| | reads | status, balances, the budget tree, verification | nowhere — no key at all | | agent payments | ask the vault to pay or swap | OKX Agentic Wallet's TEE | | owner actions | first-time setup, agents, budgets, withdrawing | your own OKX Wallet |
The agent can spend by itself, and only inside what you allowed. Ask it to pay and it calls
buoy_pay with broadcast: true: the server asks the contract, hands the call to OKX Agentic
Wallet once, waits for it, and replays the recorded verdict — one call, a transaction hash and a
proof back. Nobody pastes hex. What keeps that safe is not the server's restraint but the
contract's: the lane sends pay and swap on your vault and refuses every other address and
function on the bytes about to be signed, and both go through the gatekeeper, the policy circuit
and the budget tree. So the most a prompt-injected model can spend is the day's budget — and it
cannot withdraw, raise a cap or add an agent, which are yours to sign. The key never enters the
process; BUOY_BROADCAST=off turns sending off for a whole machine. ts/test/run-okx.mjs
fails the suite if any other module reaches the signing lane.
That is held by tests, not by a list kept up to date: every state-changing function in the
contracts' build artifacts except pay and swap is tried against the lane and refused; every
tool on the real server is a look, a spend inside the budget, the agent's own sign-in, or a link
for you — and none takes a key; and on a fork the agent's own key is refused each owner function
by the contracts themselves, while yours is not.
Just say it. "Swap 0.35 USDT0 to OKB" is sent — no minimum to supply: the least to accept is worked out from the pool's price at that moment, 1% below it, and a swap that would fill worse is not sent. Every spend, refusal and verification comes back with one line of proof and a link:
Swapped 0.35 USDT0 for at least 0.00411266 WOKB.
Enforced on-chain by Buoy's TapeOut circuit (CPU #439) · bit-exact verified.
https://www.oklink.com/x-layer/evm/tx/0x…The line says only what is true of that verdict: a refusal by the shared daily cap is the gatekeeper's arithmetic, not a circuit's output, and is called "verified against the chain" rather than bit-exact.
The agent's sign-in. The agent signs with OKX Agentic Wallet, and Buoy signs it in the way
OKX's CLI is built to be driven: one login link, then waiting on that same link. If the saved
session ever stops being able to sign — on Windows the OS credential store and its file fallback
can end up holding two different logins — nothing is retried against it: it is cleared, and you
get one link to sign back in. Your agent's address and your funds do not change. In a chat that
is the agent's job (buoy_agent_session); in a terminal, buoy session reset.
Gas. An agent's transactions through OKX Agentic Wallet are gas-free on X Layer: the agent's wallet needs no OKB. Only your own wallet needs a little, for setup and for owner approvals.
Owner actions open a one-card sign-link on loopback — single use, 32-byte nonce, five-minute expiry — which signs in your wallet and sends back only a transaction hash.
A machine with no vault of its own is shown none. The deployment was launched with a vault of
its own, and its addresses ship in this package. A new machine does not read it: buoy status
says there is no vault yet and offers one — a Master Vault with a $100 a day ceiling and one
agent — and nothing else answers until you have yours.
First-time setup is one of those links (buoy owner setup): it creates the vault, switches its
policy on, sets the daily ceiling and lets the first agent spend. It is one link and one tab. How
many wallet prompts it is depends on the deployment, and the card states the count before you
press anything. On X Layer mainnet it is one transaction: the one-transaction factory builds
the vault, sets it up and hands it to you inside that transaction, with a handover that works
exactly once, and keeps no access afterwards. On a deployment without that factory, or with
BUOY_V2=none, it is twelve transactions, each an owner-only call on a contract you hold directly
from the first block. A policy of your own adds one signature either way, and only the wallet
holding the deployment's subject circuit can sign one; any other is told so before it sends
anything.
Once the deployment's owner has published a shared policy, setup needs no signature at all: one
transaction (or nine, as above) and gas, with no BEM and no circuit of your own. That is Fast
Start, and it is what mainnet offers today. One honest line comes with it, on the card before
you press anything: the policy was signed by Buoy's deployer, who could revoke it — which would
stop your vault spending, but can never move your funds, since withdrawing is yours alone — and
it runs until one shared expiry date. A policy of your own (--independent) has neither caveat,
and today only the deployment's circuit holder can sign one.
A budget for the vault, and smaller ones inside it
Master Vault — holds $40.00 · $5.00 a day · $3.50 left today
Scout — $1.00 a day · $1.00 left today
agent Scout (0x1a2b…3c4d)
Trading Dept — $3.00 a day · $1.50 left today
Sub-agent A — $2.00 a day · $0.50 left today
agent Sub-agent A (0x5e6f…7a8b)
Sub-agent B — $2.00 a day · $1.50 left today (its own limit has $2.00 left; Trading Dept above it has less)
agent Sub-agent B (0x9c0d…1e2f)That is what "how much do I have, and what are my limits?" gets back, whole: what the vault holds, every budget with its daily limit and what can really still be spent from it today, and the wallet or wallets spending from each, on that budget's own line. A deeper line is only ever a budget inside the one above it; a budget two or more wallets spend from says "Shared budget".
Budgets nest, four levels at most: a team inside the vault, sub-agents inside the team. A spend
counts against the agent's own budget and every budget above it in the same transaction — so
a team's limit stops a sub-agent that still has room of its own, the vault's stops a team, and two
agents can never spend the vault's day twice. When a payment is refused, buoy verify names the
budget that decided it.
Two rules, both said in a sentence when they apply. A budget can never be larger than the one it
sits inside: "Big"'s daily limit ($10.00) cannot exceed its parent budget's limit ($5.00). And
budgets side by side may add up to more than their parent — $3 + $3 inside $5 — because the
parent's figure is what they can spend together.
Many at once is one card too. "Four agents — Marketing, Research, Shopping, Trading — with two
sub-agents under each" gives each agent its own OKX Agentic Wallet account under the same sign-in,
then one hierarchy card puts all twelve on their budgets: every cap and name is checked before
the card exists, and a wallet that can batch approves it in a few batches (here three) instead of
sixty prompts. "Have Trading swap $0.20" then goes from Trading's own wallet, against Trading's
own budget.
In a chat you just say it — "make a Trading Dept with $3 a day, and put a sub-agent on $2 inside it" — and approve one card. From a terminal, changing the tree is an owner card too:
buoy init --agent-cap 5 at setup: built in the same one transaction
buoy owner agent cap --agent Primary --cap 5 give one agent its own daily cap
buoy owner budget create --name Trader --cap 20 a new budget (add --agent, --agent-name, --parent)
buoy owner budget set-cap --budget Trader --cap 10 change one; the vault's own is --budget vault
buoy owner agent move --agent Primary --budget Trader which budget an agent draws on
buoy owner agent replace --replaces Primary --agent 0x… a new wallet takes Primary's budget and name; the old stopsCaps are in USDT0, to the cent: --cap 5, --cap 0.30. A vault counts its budgets in the
unit its signed policy names, and each payment is counted rounded up to that unit. A vault made
on the cent policy counts in cents. A vault made on the first shared policy counts in whole USDT0
for life: there a 0.10 payment uses 1 USDT0 of the day's cap, and --cap 0.3 is refused with that
explanation rather than rounded to something you did not ask for. buoy status says which a vault
is, every tool reads the unit from the vault itself, and a figure finer than it (--cap 0.005) is
refused in words. Budgets are always shown as money — 0.30 USDT0 left — never as a count of units.
One limit is not a budget: a pay-only agent is judged by a circuit that also refuses any single payment above 1,000 of the vault's units — 10 USDT0 on a cent vault, 1,000 USDT0 on a whole-USDT0 one. The card says so before you approve. Agents that may pay and swap have no per-payment limit. On a Master Vault that runs on Buoy's shared policy a pay-only agent is refused outright: that policy lists no payees, so it could pay nobody. Pay-and-swap, the default, is what buys paid APIs.
Money going back is never a spend. Asking to send money to the vault's owner is the owner
taking their own money out: it is routed to an owner withdrawal, which no daily limit applies to
and only the owner can approve. And if an agent's own wallet is ever holding money, buoy return
(the agent's buoy_return_to_vault) puts it back in the vault with one plain transfer — the
contract that judges spends is never asked, so no budget is checked or used.
The approval card will not let an agent approve its own budget: if the wallet that connects is the agent's address, the button locks, in red, until you switch to your owner account.
Buying a paid API, and getting the money back when it fails
buoy fetch https://api.example/data --yes
buoy fetch https://api.example/quote --method POST --body '{"chainIndex":"196"}' --header 'X-Api: 1' --yesA URL that answers HTTP 402 (x402) is bought in one call — by you, or by the agent with
buoy_fetch and broadcast: true:
- the request is sent as given, and the seller's price is read. Only a USDT0 offer on X Layer is taken; another token or chain is refused, never converted;
- exactly that price is drawn from the vault into the agent's wallet, and the contract rules on the draw. Over budget is a refusal with a receipt, and nothing has moved;
- the agent's wallet signs that one offer, what it signed is read back and compared with what was drawn for, and the same request is sent again with the payment;
paidis true only if the seller answered 2xx. The agent's wallet is then back at zero.
If the seller answers an error, rejects the payment or does not answer within 20 seconds
(--timeout), the purchase is undone: the payment authorization is voided on chain, so the
seller can never collect it later, and exactly the drawn amount — never "whatever the wallet
holds" — goes back to the vault. The result says both, with the transactions. What cannot be
undone is said too: the budget the draw used is not given back, because the gatekeeper has no
credit path. A purchase that was interrupted is finished by the next one, or by buoy recover.
Spends from one agent wallet take turns — pay, swap and fetch, across the MCP server and
any terminal on the same machine — so two at once never collide on the wallet's nonce.
Ask a question, not a URL
What's the live price of OKB on X Layer? · Show top traders for this token. · Check Nansen smart-money netflow on Ethereum.
Buoy ships a list of 27 paid data routes that take USDT0 on X Layer — 17 from OKX's Market API
($0.0001–$0.0002 a call) and 10 from Nansen ($0.01–$0.05) — each kept because the seller answered
a live, unpaid request with an X Layer USDT0 price. The agent looks the question up
(buoy_discover), builds the request the seller documents, buys it from the budget and answers.
You never see a URL.
buoy discover live price of OKB on X Layer
buoy fetch --service okx.price --request '[{"chainIndex":"196","tokenContractAddress":"0xe538…9b2b"}]' --yesThese sellers charge before they look at a request, so three mistakes cost money and return nothing. Buoy refuses each before anything is drawn:
- the wrong shape. The request is checked against the seller's own documented schema first. OKX's POST routes take a JSON array of objects, even for one token; a bare object is refused;
- the wrong chain. Nansen is paid in USDT0 on X Layer and holds no X Layer data. Its routes say so, are never matched to an X Layer question, and refuse a request that names X Layer;
- the wrong offer. No listed seller puts X Layer USDT0 first. It is found by its network and token in the live answer, and that position is what the wallet is told to sign.
A listed route bought without a ceiling of your own is held to the price it was listed at: if the seller has raised it, nothing is paid until you say how much you will pay. Any other 402 URL still works as above — the list is a help, not an allowlist.
Only the contract may refuse
Buoy will tell you a payment looks over budget and then send it anyway. A refusal computed in
the agent is a refusal nobody can check; a refusal from the gatekeeper is recorded on chain, and
buoy verify <txHash> re-runs the exact circuit locally and prints BIT-EXACT MATCH — for any
wallet of this deployment, not only your own.
A cumulative-cap refusal is not circuit-replayable — the 128-bit request word carries no limit
pin — so it is verified against the chain's own figure and says so, rather than overstating the
evidence. Where the owner changed a cap later in the refusal's own block, that figure cannot be
read back, and verify says it could not check rather than calling a correct refusal a discrepancy.
Live on X Layer mainnet
Chain 196. Every address below has been read back from the chain; STATE.md has the full list
and what was checked.
| | |
|---|---|
| One-transaction factory — what a setup is sent to | 0xa8027e391994a82Cda54998fE3FD6F8Fe3903A1B |
| Policy adapter | 0x5305A1014B0Bda17D7bb395f7731b0B09ba26128 |
| Registry | 0xEe98dfD35450e84B2EAB3de56395A481ec20521F |
| Processor (TapeOut CPU #439) | 0x2AADaaab1Fc7881374B1Fc20229d8Fb00AeFa581 |
| Buoy's shared policy (what a new Master Vault runs on), in force until 2036-11-18 | binding 0xa000b48d1a2a3478e582520c3eacccb481a28eee43da0bc545afe858fe6fbacc, published in 0x50add1509854d1c11560cbbb24d227f2ff06d2bfe29027164c2993ac46dfc5d0 |
| Settlement token (USDT0) | 0x779Ded0c9e1022225f8E0630b35a9b54bE713736 |
Two receipts, both sent by an agent that holds no OKB and paid no gas, and both replayed offline
to BIT-EXACT MATCH — run buoy verify on either to do it yourself:
| What | Transaction |
|---|---|
| A payment: 0.10 USDT0 from a vault to an allowed payee | 0x11a5a533d93155b067dbed2fcadff2b3787519ab6e53f1e27bdfa38bc8d7359f |
| A swap: 0.10 USDT0 into WOKB, which landed in the vault and not with the agent | 0x1b48f06c1ed11c9b5cba0dafd559a17e9dfec7b958221e477cac166e5ee65810 |
Two different vaults made them, and both verify from a fresh install with no flags. buoy verify
replays a verdict from any wallet of this deployment and says which one it was: the wallet in
play, the wallet the launch built, or one this deployment's factory provably created. "Provably"
is arithmetic, not a registry lookup — the factory's deployer makes each gatekeeper with CREATE,
so its address can be recomputed from the deployer's address and a counter. A verdict-shaped
event from any other contract is refused rather than replayed, because any contract can emit
one.
Commands
buoy init first run, start to finish: connect the agent, find its address, make the vault
buoy install -y wire the MCP into Claude Code and Cursor
buoy onchainos install install OKX's onchainos CLI: the one official binary, nothing else
buoy mcp run the MCP server on stdio (what install registers)
buoy status is it set up, and the budget tree with what is left today
buoy balance what it holds, and what is left to spend today
buoy agents who can spend, by name
buoy pay --to … --amount 150 # 150 USDT0; 0.10 is ten cents. Asks the contract; --yes sends it
buoy swap --amount 10 # 10 USDT0 for WOKB, floor from the pool's price (--min-out to set your own); --yes sends it
buoy owner withdraw --amount all # the owner's money back out, on a card in their own wallet
buoy discover <question> which paid data service answers it: token prices, traders, smart money…
buoy fetch <url> --yes buy a paid (x402) API from the budget: --method POST --body '{…}' --header 'N: v'
buoy recover finish a purchase that was interrupted: void it, return what was drawn
buoy session your agent's wallet sign-in: look; `sign-in`; or `reset` one that cannot sign
buoy return put what the agent's own wallet holds back in the vault: no limit applies; --yes sends it
buoy verify <txHash> replay the verdict offline
buoy owner <action> prepare an owner action and open a sign-linkRun any of them without installing: npx -y buoy-wallet@latest status.
Addresses come from the deployments/ folder that ships with the package, so the commands work
from any directory and there is nothing to configure. The one thing Buoy writes on your machine is
which vault it reads after a setup — addresses only, never a key — in ~/.buoy (BUOY_HOME
moves it).
Test
The contracts and their suites are in the source tree, not in the npm package. From a checkout:
npm test # Node suites, then 199 Foundry tests
npm run fork:up # a free local rehearsal of the real launch
npm run test:on-fork # every suite that needs a chain, plus the red team
node scripts/mutate.mjs # the Solidity mutation pass: each guard removed once, each killed by a named testnpm run fork:up runs script/Launch.s.sol — the same script the mainnet launch runs, with
only --rpc-url different. A rehearsal that shares no instructions with the real thing rehearses
nothing.
Layout
Of the source tree. The npm package carries the ts/ runtime, bin/, the mainnet deployments/
files, the policy circuits and the skill.
| | |
|---|---|
| src/ | the contracts. Names are historical (FloatVault, FloatGatekeeper, …) and deliberately unchanged — renaming them would churn the audited surface for nothing |
| ts/mcp/ | reads and unsigned payloads. No key, no broadcast |
| ts/approve/ | the owner sign-link and its one card |
| ts/okx/ | the two steps that need a key, via OKX Agentic Wallet |
| bin/buoy.mjs | the CLI |
| skills/buoy-wallet/ | what an agent reads to run all of it |
| vectors/ | the official TAP #84 vectors and the five policy circuits |
Read STATE.md for what is true right now and DECISIONS.md for why it is built this way.
