t2000-skills/skills/t2000-rebalance/SKILL.md
Rebalance the wallet to a target allocation by executing multiple swaps in one atomic Payment Intent. Use when asked to rebalance, adjust allocation, "shuffle my positions", or move from one set of holdings to another. Every leg prices against the same on-chain snapshot — no cross-leg slippage drift; user signs once.
npx skillsauth add mission69b/t2000 t2000-rebalanceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Move from a current allocation to a target allocation by emitting all
the required swap_execute calls in the same assistant turn so the
engine compiles them into one Payment Intent. Result: every leg of the
rebalance prices against the same Sui state, slippage is bounded once,
and the user signs once.
Call balance_check (engine) or t2000_balance --json (CLI) to get the
current breakdown. Compute the percentage held in each asset by USD value.
For each asset, compute the delta vs the target:
Present the plan to the user before executing:
📊 REBALANCE PLAN
─────────────────
Current Target Δ
USDC $400 $600 +$200
SUI $400 $300 −$100
GOLD $200 $100 −$100
Trades (1 atomic Payment Intent):
1. swap 0.5 SUI → ~$100 USDC
2. swap 0.05 GOLD → ~$100 USDC
Estimated slippage: 0.3% on each leg
Proceed?
Critical: emit ALL the swap_execute calls as parallel tool_use blocks
in the same assistant turn. The engine's permission gate compiles them
into ONE Payment Intent. The user signs once; every leg either succeeds or
the whole rebalance reverts.
Do NOT call them sequentially across turns — that defeats the atomicity and exposes the user to price drift between legs.
[ASSISTANT TURN — emit in parallel]
tool_use: swap_execute({ from: "SUI", to: "USDC", amount: 0.5 })
tool_use: swap_execute({ from: "GOLD", to: "USDC", amount: 0.05 })
After the Payment Intent settles, call balance_check again and show the
final allocation vs target. Highlight any drift > 1% (caused by slippage
or rounding) and ask if the user wants a follow-up swap to close it.
| Error | Cause | What to do |
|---|---|---|
| Intent failed — INSUFFICIENT_BALANCE | One of the swap legs would consume more than the wallet holds | Abort the entire intent (no swaps execute). Reduce the amount on the offending leg. |
| Intent failed — SLIPPAGE_EXCEEDED | A leg exceeded the configured slippage tolerance | Abort. Re-run with looser slippage OR smaller leg sizes. |
| Intent failed — any reason | Atomic Payment Intent reverts the WHOLE bundle | No funds moved. Tell the user the on-chain state is unchanged. |
The CLI does not support Payment Intent bundling today. To rebalance from the CLI, execute swaps one at a time:
t2000 swap 0.5 SUI to USDC
t2000 swap 0.05 GOLD to USDC
Each swap prices against the on-chain state at the moment of execution, which means small drift between legs. For larger rebalances ($1k+) prefer the agent path (which bundles into one Payment Intent).
Per swap leg:
Bundled rebalances pay the same per-leg fees — bundling reduces slippage risk, not fee cost.
optimize-all MCP prompt
instead — that's a different shape of workflow.t2000-withdraw (the safety check runs there).tools
Set up a t2000 Agent Wallet end-to-end on the user's machine. Use when the user says "set up t2000", "install the wallet", "create my Agent Wallet", "connect t2000 to Claude / Cursor", or pastes a one-prompt install URL. Covers wallet creation, optional spending limits, and MCP wiring. Read this first when bootstrapping a new user; the other skills assume this has run.
development
Discover MPP services payable via `t2 pay`. Use when the user asks "what can I pay for?", "what AI models are available?", "show me the service catalog", "is there a weather API?", or any other discovery question. Pairs with the t2000-pay skill (discovery first, then pay).
development
Pay for an MPP-protected API service using the t2000 wallet. Use when asked to call an AI model, search the web, generate images, send email, buy gift cards, send physical mail, check weather, execute code, or any task that requires a paid API. Handles the full MPP 402 challenge automatically. Use t2000_services to discover all available services first.
development
Swap tokens on Sui via Cetus Aggregator (20+ DEXs, best-route across SUI, USDC, USDsui, USDT, USDe, ETH, GOLD, NAVX, WAL, vSUI, and more). Use when asked to swap, trade, convert, exchange, or "turn X into Y". Do not use for sending — use the t2000-send skill for transfers.