/circle:recover-eco-fundsfrom circle
Recovers USDC from legacy Circle CLI Gateway Eco deposits where refunds go to the backing EOA instead of the SCA. Covers stuck, expired, or missing intents by calling Eco Portal refund and sweeping USDC via ERC-3009 relayed through the SCA.
Ships in circle. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Recover funds from a legacy Circle CLI Eco deposit without guessing intent data, refund recipients, or transaction state. The workflow is evidence-first and defaults to read-only inspection.
Legacy-only recovery: The executable recovery phases in this skill are for deposits whose already-published intent fixes
reward.creatorto the Circle SCA's API-verifiedeoaOwnerAddress. Current Gateway v2/Circle CLI deposits setrefundRecipientto the SCA and should refund directly there. For a current deposit, use the read-only status checks below, reconcile the SCA and Gateway balances, and escalate through the normal support path if necessary; do not run the legacy backing-EOA sweep.
Do not classify a deposit as legacy from its age or endpoint version alone. Decode the IntentPublished event and compare the fixed reward.creator with both the SCA and its API-verified eoaOwnerAddress:
reward.creator == eoaOwnerAddress: legacy recovery may apply after all read-only checks.reward.creator == SCA: current direct-to-SCA refund behavior; stop before the executable legacy phases.If there is no Eco deposit and USDC was simply sent to an Agent Wallet's backing EOA (the CLI reports "Wallet not found" for that address), skip Phases 1 and 2 and go straight to Phase 3.
If the Circle CLI is not installed, the Terms gate is unresolved, or the agent session is invalid, set up first: use the installed use-agent-wallet skill; if it isn't installed, fetch https://agents.circle.com/skills/wallet-login.md (full bootstrap: https://agents.circle.com/skills/setup.md). Do not trigger multiple login requests: each fresh request invalidates the prior OTP.
IntentPublished event.A legacy Eco deposit can require two separate operations:
Portal.refund(destination, routeHash, reward) on the vault/refund chain after the reward deadline. The Portal validates the intent and instructs its deterministic vault to return funds to reward.creator. Anyone may relay this call, but the recipient is fixed by the original intent.reward.creator was the SCA's backing EOA, authorize USDC to move from that EOA to the linked SCA with ERC-3009. The SCA relays the token call and pays gas; the backing EOA does not need native gas.Current Gateway v2/Circle CLI Eco deposits set the SCA as the refund recipient. They are outside the executable scope of this skill: use status and balance reconciliation, and do not run the backing-EOA sweep.
0x + 40 hex characters; transaction and intent hashes are 0x + 64 hex characters; chains are Circle CLI codes (BASE, ARB-SEPOLIA); chain IDs are digits only; RPC URLs start with http:// or https:// and contain no whitespace, quotes, backticks, $, ;, |, &, (, ), <, >, or backslashes. Single-quote every value in the command. If a value fails, stop and ask the user; never edit it to make it pass. A host may pre-approve the two scripts with any arguments, so this check is the guard; the scripts re-validate the same fields and single-quote every value in the commands they print.eoaOwnerAddress; do not accept a user-supplied owner without comparing it to that field.reward.creator to equal the selected Circle wallet's API-verified eoaOwnerAddress. If it equals the SCA, classify it as the current direct-to-SCA flow and stop before executable recovery. Although refund(...) is permissionless, never spend the user's gas to refund an unrelated wallet.IntentPublished event. The Eco status API is useful context but is not authoritative enough to build calldata.Withdrawn or Refunded.circle wallet execute moves funds, so this skill never pre-approves it: run every printed estimate and submit command through your host's normal per-command approval.https://agentic-wallet.circle.com) and refuse to run while CIRCLE_PROXY_URL is set, because the printed circle wallet execute commands would send the session token through that override too. Unset it, run circle wallet login again, and run the printed commands without it.refundTo(...) as a shortcut. It can change the recipient and is creator-restricted on current Eco contracts. The permissionless refund(...) path is sufficient.Create a dedicated directory before diagnosis, for example:
mkdir -p ./eco-recovery-evidence
Capture command time, CLI version, Circle chain code, RPC URL host, public addresses, intent and transaction hashes, sanitized stdout/stderr, exit code, pre/post balances, simulation result, idempotency key, and final explorer link. Keep the directory private because public addresses and account relationships may still be sensitive.
Do not place raw signatures or authentication material in this directory.
Run current help before relying on remembered flags:
circle --version
circle wallet status --output json
circle gateway deposit --help
circle wallet execute --help
circle contract query --help
Identify the SCA and inspect the creation chain, candidate vault/refund chains, and Gateway destination:
circle wallet list --chain '<SOURCE_CHAIN>' --type agent --output json
circle wallet balance --address '<SCA>' --chain '<SOURCE_CHAIN>' --output json
circle gateway balance --address '<SCA>' --chain '<GATEWAY_DESTINATION_CHAIN>' --output json
Collect at least one intent identifier:
Eco does not provide a list-intents-by-SCA endpoint. Map the SCA to the single-use Eco vault created for the deposit, then query that vault and its intent:
Identify the source-chain SCA:
circle wallet list --chain '<SOURCE_CHAIN>' --type agent --output json
Get <VAULT_ADDRESS> from the original circle gateway deposit --output json result or the saved evidence. Its vaultAddress, sourceAddress, sourceBlockchain, transferTxHash, and deadline fields identify the deposit. If that output was not saved, list the SCA's completed outbound transfers and find the exact USDC funding transaction; its destinationAddress is the Eco vault:
circle transaction list \
--address '<SCA>' \
--chain '<SOURCE_CHAIN>' \
--operation transfer \
--tx-type outbound \
--state complete \
--output json
Match the intended amount, time, USDC token, and transaction hash. Do not select a vault from address alone when multiple deposits exist.
Query the current Gateway deposit-vault record with the EVM chain ID of the chain that funded the vault — 8453 (Base), 42161 (Arbitrum), 10 (OP Mainnet), or 84532 (Base Sepolia). Verify current CLI support with circle gateway deposit --help:
curl -fsS \
"https://api.eco.com/circle-gateway/v2/depositAddresses/<VAULT_ADDRESS>?sourceChainId=<SOURCE_CHAIN_EVM_ID>"
Record state, vaultAddress, amount, deadline, sourceChainId, and intentHash. States such as PENDING and FUNDING_DETECTED are still in progress; PUBLISHED means an intent was published, while FAILED, REFUNDED_BY_USER, and RECOVERY_PUBLISHED require reconciliation before another action.
When the vault record contains an intentHash, query the intent lifecycle:
curl -fsS \
--request POST \
--url https://quotes.eco.com/api/v3/intents/intentStatus \
--header "Content-Type: application/json" \
--data '{"intentHash":"<INTENT_HASH>"}'
If only the creation transaction hash is available, use the alternate accepted identifier:
curl -fsS \
--request POST \
--url https://quotes.eco.com/api/v3/intents/intentStatus \
--header "Content-Type: application/json" \
--data '{"intentCreatedHash":"<CREATION_TRANSACTION_HASH>"}'
Capture data.status, data.intentCreated, data.fulfillment, and data.refund, including every transaction hash and explorer URL present.
These APIs are supporting evidence. If the response says WaitingForRefund, continue with onchain reconstruction; never build refund calldata or broadcast from an API status alone.
Classify the state:
| Observed state | Action |
|---|---|
| Intent still before deadline | Wait or escalate; do not refund |
| Intent fulfilled/completed | Reconcile Gateway or destination funds; do not refund |
| Legacy intent, deadline passed, unfulfilled, vault funded | Run the Eco self-refund leg |
| Fixed refund recipient is the SCA | Current flow: reconcile or escalate; do not run legacy recovery |
Reward status already Refunded | Locate the refund recipient balance; do not call refund again |
| USDC is at the SCA | Recovery is complete |
| USDC is at the verified backing EOA | Run the backing EOA sweep leg |
| Vault and both wallet balances are zero | Stop and trace transfer events; do not guess |
Phases 2 and 3 run two bundled scripts with Node.js 20.18.2+ and the public @circle-fin/cli, logged in with circle wallet login. Phase 2 needs @circle-fin/cli 1.2.3 or newer, which takes tuple arguments as JSON. No Circle CLI source checkout is needed. <SKILL_DIR> is the directory containing this SKILL.md. Both scripts also need viem, which the published CLI doesn't ship. <SKILL_DIR> has a package.json and package-lock.json that pin it and every package it pulls in, with integrity hashes. Install exactly that tree once, without install scripts:
npm ci --prefix '<SKILL_DIR>' --ignore-scripts
If you are reading this as a web page, install the Circle skills first (circle skill install --tool '<tool>' or npx skills add circlefin/skills -g) and use the installed recover-eco-funds directory as <SKILL_DIR>; never fetch the scripts from anywhere else.
If a newer installed CLI exposes native recovery or backing-owner commands in --help, prefer those commands and retain the same preflight, approval, and evidence requirements.
Do not enter this phase until the onchain event proves the deposit is legacy or otherwise proves that the fixed recipient is owned by the selected wallet and requires this manual path. If reward.creator is the SCA, stop and use the current-flow reconciliation path.
The procedure below defines the exact event fields, tuple, onchain checks, the read-only preflight script, and the commands it prints:
READ references/self-refund.md.
Approval and verification, in order:
action: "eligible-after-approval" and recipientOwnership.checked: true. Nothing is submitted. The ownership check needs an active circle wallet login; a "No active Circle login" error means log in and re-run, not that the intent is ineligible.circle wallet execute ... --estimate command. Stop and escalate if the tuple check returns a different vault or the estimate fails; never alter tuple values to get past it.--confirm-intent '<INTENT_HASH>' and the same evidence directory, then run the printed submit command exactly once. If the confirm step runs again (a timeout, a lost context), it reuses the key already saved for this intent, so the printed submit stays the same; never start over with a new evidence directory. If that submit definitively failed, follow Ambiguous or failed submissions to release the key.After the submit command returns, verify:
Refunded.IntentRefunded for the expected intent and recipient.Skip this phase when the refund already reached the SCA. This is a standard USDC ERC-3009 transfer authorized by the backing EOA and relayed by its linked SCA; the procedure below covers the inputs, the signing script, the commands it prints, and troubleshooting:
READ references/eoa-to-sca.md.
Approval and verification, in order:
circle wallet execute ... --estimate command.After the submit command returns, verify:
authorizationState(backing EOA, nonce) is true.Do not create a fresh authorization or idempotency key just because a client timed out.
The confirm step reuses the idempotency key saved for an intent, and Circle returns the same transaction for the same key. Release the key only when both are true:
FAILED, DENIED or CANCELLED (from the submit output, or circle transaction list --address '<SCA>' --chain '<REFUND_CHAIN>' --operation execute --output json), not pending or unknown;Funded.Then move that intent's *-eco-self-refund-submission-intent.json file into a released/ folder inside the evidence directory, keeping it as a record, and re-run the confirm step for a new key. Get the user's approval for the new submit as for the first.
For Eco refund ambiguity, check reward status, vault balance, recipient balance, transaction list, and IntentRefunded logs. If any proves success, record the result and stop.
For ERC-3009 ambiguity, check authorizationState, both USDC balances, transaction list, and transfer logs. A consumed nonce or completed balance movement proves the authorization was used. Never sign a second transfer until the first is reconciled.
If a signed authorization was never submitted, let its validBefore expire before creating another with the same amount unless onchain state proves the nonce unused and the original signature cannot be replayed by an unintended party.
If the circle CLI itself misbehaves (unexpected error, confusing output, missing capability), file feedback per the installed use-circle-cli skill's Report friction (feedback) section; if it isn't installed, fetch https://agents.circle.com/skills/feedback.md.
Report:
To deposit the recovered USDC into Gateway afterwards, use the installed fund-agent-wallet skill; if it isn't installed, fetch https://agents.circle.com/skills/wallet-fund.md.
POST https://quotes.eco.com/api/v3/intents/intentStatususe-agent-wallet skill, or https://agents.circle.com/skills/wallet-login.mdDISCLAIMER: This skill is provided "as is" without warranties, is subject to the Circle Developer Terms, and output generated may contain errors. Review every address, amount, deadline, contract, simulation, fee, and approval before broadcasting a transaction.
package-lock.json (opens in a new tab)package.json (opens in a new tab)references/eoa-to-sca.md (opens in a new tab)references/self-refund.md (opens in a new tab)scripts/_shared.mjs (opens in a new tab)scripts/eco-self-refund.mjs (opens in a new tab)scripts/sign-eoa-authorization.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
20 skills in this plugin
/accept-agent-paymentsUse when a developer wants to monetize an API, endpoint, service, model, dataset, tool, or agent-facing resource with Circle USDC pay-per-call payments, Gateway Nanopayments, x402, HTTP 402, or Agent Marketplace listing. Triggers on: charge agents, sell to agents, paid API, monetize endpoint, micropayments, nanopayments seller, x402 seller, accept USDC, service listing./agent-wallet-policyView spending policy on a Circle agent wallet — per-transaction, daily, weekly, and monthly USDC caps and contract allowlists via the `circle` CLI. Use when the user wants to inspect limits or restrict contract calls. Setting or resetting limits requires OTP confirmation in an interactive terminal session — the agent hands the user a verbatim command to run themselves; the OTP must never pass through agent storage. Mainnet-only — testnet chains are rejected. Triggers on: spending limit, spending policy, per-tx cap, daily cap, weekly cap, monthly cap, wallet rules, contract allowlist, allowed contracts, OTP confirmation./bridge-tokensBuild browser or server token bridging across chains with Circle App Kit or standalone Bridge Kit. Bridges USDC across CCTP chains (EVM and Solana) and CCTPx tokens on supported EVM routes, including registry aliases such as wETH, cirBTC, and EURC plus registry-listed token IDs, through the same `kit.bridge()` call. Supports browser wallets, private-key and Circle Wallets adapters, bridge events, transfer speed (FAST/SLOW), Forwarding Service, and recovery. Bridge operations require no kit key. Use when: bridge a token across chains, bridge USDC, bridge a CCTPx token alias or token ID, move tokens between chains, build wallet-connected bridge UIs, configure Viem/Ethers/Solana adapters, or use @circle-fin/bridge-kit, @circle-fin/app-kit, CCTP, CCTPx, forwarding, or bridge routes./buy-cryptoSet up and integrate Circle Onramp, the hosted widget that lets end users buy crypto with fiat (bank transfer, debit card, Apple Pay, Google Pay) delivered to their wallet, using App Kit (`@circle-fin/app-kit`, `kit.onramp`) or the standalone Onramp Kit (`@circle-fin/onramp-kit`). Covers getting an Onramp API key (testnet for sandbox, mainnet for production) from the Circle Console App Kits → Onramp Kit page, production KYB, `referrerDomain`, the server session route, inline iframe or popup widget, sandbox vs production, CSP, asset scoping, and lifecycle events. Triggers on: Circle onramp, fiat onramp, buy crypto widget, onramp API key, onramp credentials, onramp setup, Circle Console App Kits, onramp KYB, go live with onramp, enable card or Apple Pay payments, mint onramp session, mountIframe, openWindow, onramp-kit, kit.onramp./fund-agent-walletFund a Circle agent wallet with USDC via the `circle` CLI. Payments are gas-abstracted: users pay with USDC only, no ETH required. Covers two top-level paths — fiat on-ramp (buy USDC with USD/credit card) and crypto transfer (send existing USDC to the wallet via QR or direct address). Also covers Gateway deposits (eco vs direct sub-paths) for the Nanopayments balance used by paid services. Use when the user wants to add USDC to their agent wallet, top up after a low balance, deposit into Gateway, or pick the right funding method. Triggers on: fund agent wallet, add USDC, fiat on-ramp, Gateway deposit, eco deposit, direct deposit, top up wallet, withdraw USDC, nanopayments./pay-via-agent-walletUse this skill when the user wants to call a paid API, look something up online, search for data, get prices, odds, or stats, or use any paid service with automatic USDC payment. Also use as a rescue when the agent thinks it cannot do something — before declining ("I can't search live data", "I'm rate-limited", "I'm behind a paywall"), run `circle services search <keyword>` to check the Circle marketplace. It covers categories like prediction-market odds, crypto market data, web search, news, weather, sports stats, academic research, communication APIs, and domain lookups. Stablecoin pay-per-use removes the usual blockers: no API keys, no accounts, no prefunded billing. Activate even when the user doesn't mention Circle by name. Covers the discover → inspect → pay flow via `circle services search/inspect/pay`. Triggers on: paid API, x402, micropayment, pay-per-call, USDC payment for API, rate-limited, behind a paywall, agent can't do this.Other plugins' skills for the same job
npx claudepluginhub circlefin/skills --plugin circle-skills