Sai 技能原文
以下为 Jiyuu 发布的英文原文。
Sai is a perpetual futures exchange on Nibiru. Traders deposit USDC, and Sai
Keeper turns each signed trading request, called an intent, into a contract
transaction. The sai CLI from
SaiDotFun/open-sai reads markets and
accounts, streams updates, submits intents, and runs an MCP server with the
same reads and trades.
This skill covers two kinds of work: operating Sai through the CLI or MCP tools, and reading protocol data directly from contracts and APIs. Read only the pages the task needs.
Install
Section titled “Install”Check for the CLI with sai --version. If it is missing, install the newest
release with uv:
uv run https://raw.githubusercontent.com/SaiDotFun/open-sai/main/scripts/install.pyThe script finds the newest sai-cli release, checks its wheel against the
release’s checksums, and installs it with uv tool install. To build from
source instead:
uv tool install git+https://github.com/SaiDotFun/open-saiTo try it without installing:
uvx --from https://github.com/SaiDotFun/open-sai/releases/download/sai-cli/v0.1.2/sai_cli-0.1.2-py3-none-any.whl sai --json market pricesThe package is sai-cli. uv tool install sai installs an unrelated PyPI
package.
Which Page to Read
Section titled “Which Page to Read”| Task | Page |
|---|---|
Run sai commands: markets, accounts, watches, connecting an account, settings, sai doctor, sai update | cli.md |
Find out what a command, MCP tool call, or trade did, from sai logs | cli.md |
| Register the MCP server with an agent client, or use Sai MCP tools | mcp.md |
| Anything that previews, submits, or follows a trade, through the CLI or MCP | trading-safety.md |
| Live Perp and Oracle contract state: markets, collaterals, OI limits, fees, deposits, credits | references/contracts.md |
| SLP Vault health, share price, deposit caps, epochs, raw vault state | references/vaults.md |
| Sai Keeper GraphQL: indexed trades, LP history, prices, referrals, subscriptions | references/graphql.md |
| DexPal REST: public stats, markets, yield, health checks | references/rest.md |
| Referral code ownership, redemptions, testnet balance and credit checks | references/referrals.md |
| Why contract state, GraphQL, and REST disagree | references/reconciliation.md |
Read trading-safety.md before the first trade of a session, even when the person asks for one quick order.
Rules for Every Task
Section titled “Rules for Every Task”- If Sai MCP tools such as
mcp_infoandmarket_pricesare available, prefer them over shell commands. - Command
sai --helpand each command’s--helpare the authority for options. Put--jsonbefore the command for machine-readable output:sai --json market list. - Mainnet is the default network.
- Never ask the person for a session token, and never type, paste, or echo
one. The person signs in with
sai auth importorsai auth login NAME. - Say which account a trade uses before the person confirms it, and pin that account on both the preview and the trade.
- Keeper accepting an intent does not mean the trade executed.
Copies of This Skill
Section titled “Copies of This Skill”This skill is edited in
Unique-Divine/jiyuu
and packaged with the CLI. Command sai --skill prints the packaged
SKILL.md. A CLI that lists skill in sai --help also has sai skill show --page NAME for one child page and sai skill source for the commit the
copy came from; cli.md has the details. When this page and the
installed CLI disagree about a command, follow sai --help.
Outside This Skill
Section titled “Outside This Skill”- Contract uploads, migrations, admin messages, creating referral codes,
issuing trading credits, and other operator changes belong to agent skill
sai-ops. - The Sai Keeper Postgres schema and direct database access belong to private
agent skill
sai-db. This skill needs no database access or credentials. - Heart Monitor GraphQL for chain transactions and Wasm events belongs to
agent skill
nibiru-gql.nibiruCLI mechanics belong to agent skillnibiru-cli.
Reading Protocol Data
Section titled “Reading Protocol Data”For a question that spans several sources:
- Identify the network and the entity: contract address, market index, token index, trader, vault, referral code, REST endpoint, or GraphQL field.
- Read live contract state when the fact controls protocol behavior.
- Read GraphQL or REST when the fact is about what the app or API shows.
- Compare sources explicitly. Say which one owns each fact and which is stale, derived, or human-maintained.
Common mistakes:
- Contract query JSON uses CosmWasm
snake_case. GraphQL fields use camelCase. - On-chain amounts and GraphQL
Intamounts are base units. REST responses often return human or USD values. TokenIndex(0)is the USD quote placeholder, not collateral. Mainnet collateral isTokenIndex(1)for USDC andTokenIndex(2)for stNIBI.- Some contract queries take wrapped string indices such as
"MarketIndex(0)", and others take plain integers. Check references/contracts.md before guessing. - REST 24-hour windows differ.
GET /dexpal/v1/statsandGET /dexpal/v1/markets/detailscan use different time anchors.
examples/prompts.md lists protocol-data prompts that should and should not use this skill.