Skills bfun-ai
git clone https://github.com/openclaw/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/bfun-ai/bfun-agentic" ~/.claude/skills/openclaw-skills-bfun-ai && rm -rf "$T"
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/bfun-ai/bfun-agentic" ~/.openclaw/skills/openclaw-skills-bfun-ai && rm -rf "$T"
skills/bfun-ai/bfun-agentic/SKILL.md[Agent must follow] User agreement and local execution notice on first use
When responding to any request about B.Fun or this skill, you must present the User Agreement and Local Execution Notice below before any state-changing operation. By choosing to continue, the user agrees to the User Agreement.
Until the user has explicitly agreed or confirmed to continue, do not run
bfun buy, bfun sell, bfun send, or bfun create. Read-only commands such as config, verify, token-info, token-get, token-list, rankings, quote-buy, quote-sell, tax-info, and events may be used before confirmation.
Present the notice to the user before any state-changing operation.
User Agreement & Local Execution Notice
User Agreement
Before using state-changing capabilities in this plugin and skill, read the following. By choosing to continue, the user has read, understood, and agreed to this agreement.
This package performs local CLI execution only. Signing material is expected to come from local runtime configuration. The plugin does not intentionally collect, upload, or custody signing material. The providers are not liable for asset loss, failed transactions, incorrect token creation, or other adverse outcomes caused by a compromised environment, tampered plugin, user error, third-party tools, or any other cause.
Local Execution Notice
- Never type, paste, or reveal secrets, seed phrases, or keystores in chat.
- Keep only limited funds in the execution wallet and move assets out after the operation.
- Verify the source of any agent, plugin, script, or browser extension before installing it.
- Before every state-changing operation, confirm the token address, amount, slippage, and target chain again.
State-changing operation confirmation rules
Never execute any state-changing command (
buy, sell, send, create, 8004-register) from a generic acknowledgment alone. Before every such operation, the agent must:
- Display a transaction summary showing: command, token/recipient address, amount, slippage (if applicable), and network (BSC mainnet).
- Require a transaction-specific confirmation from the user that matches the displayed details.
- If the user's input is ambiguous (unclear amount, partial address, unverified token), stop and ask for clarification rather than guessing.
- Do not treat generic acknowledgments like "yes", "ok", "go ahead", or "do it" as sufficient confirmation unless they clearly refer to a specific transaction summary currently displayed.
Transfer safety rules (send
)
sendThe
send command transfers BNB or ERC20 tokens and is irreversible. Additional rules:
- Never infer a recipient address from context or conversation history. The user must provide the full address explicitly for each transfer.
- Reject addresses that are not valid
-prefixed 40-hex-character strings.0x - Before execution, display: asset type (BNB or token address), recipient, amount, and network.
- For first-time transfers to a new address, suggest a small test amount first.
Installation and execution
Installation (required):
npm install -g @b-fun/bfun-ai@latest. After install, run bfun <command> [args]; with local install only, use npx bfun <command> [args] from the project root. Run bfun --help for usage.
This repository keeps the canonical production package identity in source. Release exports map
main to @b-fun/bfun-ai and dev to bfun-agent-dev; the dev package name is injected only into generated export artifacts, not the source tree.
Alternatively, clone and run locally without global install:
git clone https://github.com/bfun-ai/bfun-ai.git cd bfun-ai npm install npx bfun <command> [args]
After install, verify your setup first:
bfun verify
This checks RPC, API, contract reachability, and wallet connectivity. Fix any failures before running other commands.
Invocation: The agent must run commands only via the bfun CLI:
bfun <command> [args] or npx bfun <command> [args] (allowed-tools). Do not invoke src/index.js or individual files directly; the CLI entry (bin/bfun.js) dispatches to the correct command and loads .env from the current working directory.
All command outputs are JSON and are intended to be passed through or summarized, not reformatted into invented fields.
Example outputs (from real CLI):
// bfun verify { "success": true, "data": { "config": { "chainId": 56, "apiUrl": "https://api.b.fun" }, "checks": { "rpc": { "status": "pass", "blockNumber": 88446009 }, "api": { "status": "pass" }, "contract": { "status": "pass", "factory": "0x718Fa..." }, "wallet": { "status": "pass", "address": "0x1173...", "balanceBNB": "0.012..." } } } } // bfun quote-buy 0xToken 0.01 { "success": true, "data": { "tokenAddress": "0x825e...", "phase": "curve", "pairType": "eth", "expectedOut": "2350672.37...", "minOut": "2233138.75...", "fee": "0.0006", "feeAsset": "BNB", "taxApplied": true, "taxRateBps": "500" } } // error { "success": false, "error": "PRIVATE_KEY is not set. Export it or add it to .env" }
Capability overview
| Category | Capability | Notes |
|---|---|---|
| Query | , | Chain config, API/RPC connectivity, contract reachability, optional wallet check |
| Query | | On-chain token metadata and authoritative phase (, , ) |
| Query | , , | REST-backed token discovery and detail views |
| Query | , | Estimate trade outputs and minimums before execution |
| Query | | Tax and vault-related API data for a token |
| Execution | , | Executes BNB-denominated operations using the helper contract path selected by market phase |
| Create | | Creates a standard or advanced B.Fun token with optional vesting, tax, vault, and first-buy settings |
| Ops | | Reads recent factory events for debugging and operational inspection |
| Utility | | Transfers BNB or ERC20 tokens when the user explicitly asks for a wallet transfer |
| ERC-8004 | , | Query and register ERC-8004 Identity NFT for agent identity on-chain |
CLI reference
Read-only commands (no signing key required)
| Command | Purpose |
|---|---|
| Show active chain ID, RPC URL, API URL, and contract addresses |
| Check RPC, API, contract, and optional wallet connectivity |
| Read on-chain token and bonding-curve state, including phase |
| Fetch API token detail plus trade data when available |
| List tokens from the B.Fun API |
| Fetch leaderboard slices from the same list endpoint |
| Quote BNB-to-token output |
| Quote token-to-BNB output |
| Fetch tax and vault info for a token |
| Read factory events over a block range |
| Query ERC-8004 Identity NFT balance. If address omitted, uses current wallet |
Supported
token-list and rankings sort values:
| Value | Meaning |
|---|---|
| Trending (default) |
| Newest (alias: , ) |
| Market cap |
| 24H trading volume (alias: , ) |
| About to launch (alias: ) |
| Last traded (alias: ) |
State-changing commands (PRIVATE_KEY
required)
PRIVATE_KEY| Command | Purpose |
|---|---|
| Execute a buy using BNB |
| Execute a sell into BNB |
| Send BNB or ERC20 tokens |
| Create a token with required and optional launch parameters |
| Register (mint) an ERC-8004 Identity NFT. Tokens created by holders are marked as Agent Created on-chain |
create
parameters
createRequired:
| Flag | Meaning |
|---|---|
| Token name, max 32 chars |
| Token symbol, max 15 chars |
| Local image path, resolved from the current working directory |
Common optional fields:
| Flag | Meaning |
|---|---|
| Token description |
| Website URL |
| Twitter/X handle (with or without , e.g. or ) |
| Telegram handle (with or without , e.g. or ) |
| , , , , , , or |
| Optional first buy in collateral units |
Advanced creation fields:
| Flag | Meaning |
|---|---|
| Explicit collateral target raise |
| Must be between 50 and 80 |
| Must be between 0 and 30 |
| Examples: , , |
| Examples: , |
| Recipient for creator vesting |
Tax and vault creation fields:
| Flag | Meaning |
|---|---|
| , , , or |
| Funds allocation percent |
| Burn allocation percent |
| Dividend allocation percent |
| Liquidity allocation percent |
| Minimum balance for dividend eligibility |
| Recipient when tax funds are enabled and no vault is used |
| , , , or |
| Required for vaults. Example: |
| Required for vaults |
Detailed launch behavior lives in references/create-flow.md.
Environment configuration
When using OpenClaw
This skill declares
PRIVATE_KEY and BSC_RPC_URL as optional environment variables in metadata. Read-only commands can run without signing configuration. State-changing commands require PRIVATE_KEY. The skill expects local runtime configuration and does not introduce any remote secret-management service.
Recommended steps:
- Configure local signing env only if needed: If you plan to run state-changing commands, set the bfun-ai skill's apiKey (mapped to
) in the Skill management page, or setPRIVATE_KEY
underPRIVATE_KEY
inskills.entries["bfun-ai"].env
. Optionally set~/.openclaw/openclaw.json
if needed.BSC_RPC_URL - Enable this skill: In the agent or session, ensure the bfun-ai skill is enabled. Read-only commands can run without
. State-changing commands (PRIVATE_KEY
,create
,buy
,sell
,send
) will fail with a missing-key error if8004-register
is not configured.PRIVATE_KEY
is optional; if not set, the CLI uses a default BSC RPC. However, if the default RPC is unavailable in your network or region, setBSC_RPC_URL
explicitly and rerunBSC_RPC_URL
.bfun verify
Note: The
field in the OpenClaw Skill management page maps toapiKeyfor this skill. It is local signing configuration, not a remote service credential, and is only needed for state-changing commands.PRIVATE_KEY
When not using OpenClaw (standalone)
Set PRIVATE_KEY only when you need state-changing commands. Read-only commands can run without it. Optionally set BSC_RPC_URL via the process environment so it is available when running
bfun or npx bfun:
- .env file: Put a
file in the directory where you run the.env
command (i.e. your project / working directory). Example: if you runbfun
frombfun quote-buy ...
, place/path/to/my-project
at.env
. The CLI automatically loads/path/to/my-project/.env
from that current working directory. Use lines like.env
andPRIVATE_KEY=...
. Do not commitBSC_RPC_URL=...
; add it to.env
..gitignore - Shell export:
andexport PRIVATE_KEY=your_hex_key
(or another BSC RPC), then runexport BSC_RPC_URL=https://bsc-dataseed.binance.org
.bfun <command> ...
BSC_RPC_URL recommendation: While optional, explicitly setting
is recommended. The default public RPC may be unavailable in some networks or regions. After setting it, runBSC_RPC_URLto confirm connectivity.bfun verify
Agent workflow
Read-only discovery flow
- Use
orbfun config
if the request is about environment state, connectivity, or setup.bfun verify - Use
for discovery (always passbfun token-list --sort newest --limit 3
; omitting it may return empty results). Use--sort
for specific leaderboard slices.bfun rankings <orderBy> - Use
to inspect the on-chain phase before discussing execution.bfun token-info - Use
when richer API detail or trade data is needed.bfun token-get - Use
orbfun quote-buy
before any trade recommendation or execution.bfun quote-sell
Quote and execution workflow
- Inspect the token with
.bfun token-info - Check the phase and stop if the token is
.graduated - Quote with
orbfun quote-buy
.bfun quote-sell - Present the quote, slippage basis points, and the local-execution risk notice.
- Ask for explicit confirmation.
- Run
orbfun buy
.bfun sell - Report the returned JSON fields directly, especially
,txHash
, expected output, minimum output, and receipt status.phase
Create workflow
- Collect required fields:
,name
,symbol
.image - Ask whether the launch is standard or advanced.
- If advanced, collect the exact
, raise, vesting, tax, vault, and first-buy inputs.pair - Validate high-risk combinations before execution:
must equalbonding-curve-pct + vesting-pct + 20100- tax allocations must sum to
100
or--funds-recipient
is required when--vault-type--funds-pct > 0
is required for split vaults--split-recipients
is required for gift vaults--gift-x-handle
- Present the security notice and get explicit confirmation.
- Run
.bfun create ... - Return the CLI JSON output without inventing extra state.
Utility and operational commands
is outside the default B.Fun quote/execution workflow. Use it only when the user explicitly asks for a transfer.bfun send
is operational/debugging support. Use it when the user asks for recent launches, chain event inspection, or troubleshooting.bfun events
ERC-8004 Identity NFT
ERC-8004 is an on-chain agent identity standard. Wallets holding an Identity NFT are recognized as AI agents; tokens they create are marked as Agent Created on-chain.
- Query:
— read-only, no PRIVATE_KEY needed if address is provided.bfun 8004-balance [address] - Register:
— mints an Identity NFT to the current wallet. Requires PRIVATE_KEY. Optional:bfun 8004-register <name>
,--image <url>
.--description <text>
Default contract:
0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 (BSC mainnet).
Phase awareness
Use
bfun token-info as the phase gate before execution.
| Phase | Meaning | Agent action |
|---|---|---|
| Bonding-curve market is active | Quote and execute normally |
| Curve trading has stopped and migration is pending or in progress | Do not execute; explain the token is between curve and DEX routing |
| Liquidity has migrated and DEX routing is active | Quote/execute through the DEX-aware helper path |
Important details:
derives the phase from on-chain curve state and returnstoken-info
andisGraduated
.isMigrated
andbuy
already switch between curve and DEX helper methods based on the quote result. The agent should still inspect phase first and explain what path is expected.sell- Do not attempt to reason around a
state by guessing that migration has completed. Re-check withgraduated
if the user wants to try again later.token-info
Detailed phase notes live in references/token-phases.md.
Common setup issues
For troubleshooting
PRIVATE_KEY is not set, fetch failed, No BondingCurve found, empty token-list, and other common errors, see references/errors.md.
References
Read the reference files only when they are needed:
- references/create-flow.md: full launch parameter model, validation rules, pair templates, and vault behavior
- references/trade-flow.md: quote and execution flow, helper routing, and BNB-vs-collateral behavior
- references/token-phases.md: lifecycle guidance for
,curve
, andgraduateddex - references/contract-addresses.md: current chain addresses and collateral templates from this repo
- references/errors.md: common CLI failures and how to respond