Earn 6.19% APY staking with Solana Compass + help grow Solana's ecosystem

Stake natively or with our LST compassSOL to earn a market leading APY

Sol CLI Guide: Every Solana Command for AI Agents and Humans

Published on 2026-02-25

The complete guide to Sol CLI — trade, stake, lend, and manage portfolios on Solana from OpenClaw, Claude Code, or any AI agent. No API keys, no code required.

Why Sol CLI: A Solana CLI for AI Agents and Humans

The Solana ecosystem has excellent developer tools. If you want to build a dApp, deploy a program, or integrate DeFi protocols into your code, you're well served. But there's a gap between "developer SDK" and "thing anyone can use."

Most people — and most AI agents — don't want to construct transactions, manage program instructions, or think about blockhash expiry. They want to say "buy 50 USDC worth of BONK" and have it happen.

Sol CLI fills that gap. It's a command-line tool where every command reads like what you'd say out loud:

sol token swap 50 usdc bonk
sol stake new 10
sol wallet balance
sol portfolio pnl

It was built with two audiences in mind: people who prefer the command line, and AI agents — whether that's an OpenClaw bot managing a portfolio, a Claude Code agent executing trades, or any LLM with shell access — that need a reliable interface for financial operations on Solana.


Design Philosophy: Natural Language Solana Commands

Commands model what the user wants, not how Solana works

When you stake SOL on Solana, the underlying process involves creating a stake account, transferring SOL to it, and delegating it to a validator — three separate instructions. With Sol CLI, you say sol stake new 10 and it's done in a single transaction.

When you want to withdraw staked SOL, the process depends on the account's state: it might need deactivation first, it might need to wait for cooldown, it might need splitting. Sol CLI handles all of that behind sol stake withdraw.

The principle is consistent across every command group: you express intent, the tool handles mechanics.

Natural language syntax

Commands use positional arguments for the common case and flags for overrides:

sol token swap 50 usdc bonk                  # the common case
sol token swap 50 usdc bonk --slippage 100   # override slippage
sol token swap 50 usdc bonk --wallet backup  # override wallet
sol token swap 50 usdc bonk --quote-only     # preview mode

This makes the tool natural for humans to type and for AI agents to generate. An LLM doesn't need to remember flag names for the basic case — the command reads like a sentence.

Dual output: human and machine

Every command supports two output modes. By default, you get clean human-readable text. Add --json and you get a structured response:

{
  "ok": true,
  "data": {
    "from": { "symbol": "USDC", "amount": 50 },
    "to": { "symbol": "BONK", "amount": 2450000 },
    "price_per_token": 0.0000204,
    "tx_signature": "4xK9..."
  },
  "meta": { "elapsed_ms": 3200 }
}

The envelope is consistent across all commands: ok tells you if it worked, data contains the result, error and message explain failures, and meta includes timing. Error codes are predictable UPPER_SNAKE_CASE identifiers like SWAP_FAILED or INSUFFICIENT_BALANCE.

This dual-mode design means the same tool works for interactive use and automation without any compromise to either.

No API keys, no env vars

Sol CLI requires zero configuration beyond an RPC endpoint. Token prices come from Jupiter's free API. Swaps route through Jupiter's aggregator. Staking, lending, and transfers use on-chain programs directly.

Wallet keys are stored as local files with chmod 600 permissions — no seed phrases in environment variables, no API tokens to rotate.

Signpost next actions

After output, the CLI tells you what you can do next. stake list reminds you about claimable MEV tips. wallet list hints at wallet balance for detailed holdings. The goal is to never leave you wondering "what now?"


What Your AI Agent Can Do on Solana

Wallet management

Create, import, label, and organise wallets. Each wallet is a local key file compatible with the Solana CLI format.

sol wallet create --name trading
sol wallet create --name savings --count 3     # batch create
sol wallet import --solana-cli                  # import from Solana CLI
sol wallet list                                 # all wallets with SOL balances
sol wallet balance                              # full token breakdown + USD values
sol wallet balance trading                      # specific wallet
sol wallet set-default trading                  # change active wallet
sol wallet history --type swap --limit 10       # filtered tx history

The first wallet you create becomes the default. Override per-command with --wallet <name>.

Token trading

Swap any token for any other token on Solana. Prices route through Jupiter's aggregator for the best rate across every DEX.

sol token swap 50 usdc bonk                    # swap via Jupiter
sol token swap 1.5 sol usdc                    # sell SOL for USDC
sol token swap 50 usdc bonk --quote-only       # preview without executing
sol token price sol usdc bonk                  # check prices
sol token info bonk                            # token metadata
sol token list                                 # tokens in your wallet

Every swap is logged with the execution price, so you can calculate cost basis and P&L later.

Token discovery

Browse the Solana token ecosystem by category:

sol token browse trending                      # what's hot right now
sol token browse top-traded --interval 24h     # highest volume
sol token browse recent --limit 10             # recently launched
sol token browse lst                           # liquid staking tokens
sol token browse stocks                        # tokenized equities
sol token browse defi                          # DeFi tokens

Results populate the local token cache, so subsequent lookups resolve instantly.

Payments

Send SOL or any token to any address:

sol token send 50 usdc GkX...abc
sol token send 2 sol 7nY...xyz --yes           # skip confirmation

Use --yes to skip the interactive confirmation. In --json mode, confirmations are skipped automatically — designed for agent workflows where a human isn't at the keyboard.

Native SOL staking

Stake SOL to earn rewards. One command handles account creation, funding, and delegation:

sol stake new 10                               # stake 10 SOL
sol stake new 5 --validator DPm...xyz          # choose a validator
sol stake list                                 # your accounts + claimable MEV
sol stake claim-mev                            # compound MEV rewards
sol stake claim-mev --withdraw                 # withdraw MEV to wallet
sol stake withdraw 7gK...abc                   # smart withdraw

By default, SOL is staked with Solana Compass. Override with --validator.

Lending and borrowing

Compare rates across five protocols — Kamino, MarginFi, Drift, Jupiter Lend, and Loopscale — and auto-pick the best one, or target a specific protocol:

sol lend rates usdc                            # compare APY across all protocols
sol lend deposit 100 usdc                      # auto-picks best deposit rate
sol lend deposit 5 sol --protocol kamino       # target a specific protocol
sol lend borrow 500 usdc --collateral sol      # borrow against SOL
sol lend positions                             # everything across all protocols
sol lend withdraw 50 usdc                      # partial withdrawal
sol lend repay max usdc                        # repay everything

Earn vaults

Managed yield vaults handle strategy complexity for you — deposit and the vault optimises returns. Currently supports Kamino Earn and Loopscale vaults.

sol earn                                       # list vaults with APY and TVL
sol earn deposit 100 usdc                      # deposit into best vault
sol earn positions                             # your vault positions
sol earn withdraw 50 usdc                      # withdraw from vault

DCA and limit orders

Set up recurring buys that execute automatically, or place orders that trigger at a target price:

sol token dca new 500 usdc sol --every day --count 10   # daily DCA into SOL
sol token dca list                             # active DCA orders
sol token dca cancel <orderKey>                # stop a DCA

sol token limit new 50 usdc bonk --at 0.000003 # buy BONK at target price
sol token limit list                           # active limit orders
sol token limit cancel <orderKey>              # cancel an order

DCA constraints: $100 total minimum, at least 2 orders, $50/order minimum. Limit orders: $5 minimum.

Prediction markets

Browse and trade prediction markets on crypto, sports, politics, and more — powered by Jupiter:

sol predict list crypto                        # browse events by category
sol predict search "solana"                    # search by keyword
sol predict event POLY-89525                   # event detail with markets
sol predict buy 5 yes POLY-701571              # buy YES contracts
sol predict positions                          # open positions with P&L
sol predict sell <positionPubkey>              # close a position
sol predict claim <positionPubkey>             # claim resolved winnings

Positions appear in sol portfolio with unrealized P&L.

Portfolio tracking

See everything in one place — tokens, staked SOL, lending positions, earn vaults, prediction markets, and open orders — and track changes over time:

sol portfolio                                  # the full picture
sol portfolio snapshot --label "pre-rebalance"
sol portfolio compare                          # what changed since last snapshot
sol portfolio pnl                              # profit and loss

Snapshots are stored locally and can be labelled for easy reference. P&L calculation uses the transaction log as source of truth — every swap, transfer, and deposit is recorded with the USD price at execution time. Active DCA and limit orders appear with fill progress, so locked capital is always visible.

Network information

sol network                                    # epoch, TPS, inflation, staking APY
sol tx 4xK9...abc                              # look up any transaction

How Sol CLI Differs from Other Solana Tools

vs Solana Agent Kit (SendAI)

Solana Agent Kit is a TypeScript and Python SDK with 60+ pre-built actions for building custom agents. It integrates with ElizaOS, LangChain, and Vercel AI SDK — excellent for developers writing code that interacts with Solana programmatically.

Sol CLI takes a different approach: it's a finished tool, not a library. Any LLM that can execute shell commands can use it immediately — whether that's an OpenClaw bot on ClawHub, a Claude Code agent via the plugin marketplace, or any other agent platform. There's no code to write, no SDK to import, no framework to integrate with. The agent runs sol token swap 50 usdc bonk --json, parses the response, and moves on.

This matters because the barrier to entry is vastly different. Solana Agent Kit requires a developer to build an application around it. Sol CLI requires a one-line install and a wallet. For someone who wants to give their OpenClaw bot or Claude Code agent financial capabilities right now, Sol CLI is ready to go.

They're complementary tools. Agent Kit is the right choice when you're building a specialised agent application with custom logic. Sol CLI is the right choice when you want to add Solana capabilities to an existing agent workflow without writing code.

vs Existing Solana developer skills

Several Solana skills for AI agents teach the agent how to write Solana code — how to construct transactions, manage accounts, and interact with programs. These are valuable for development, but they fill context windows with implementation detail and produce code that needs to be compiled and deployed.

Sol CLI inverts this: instead of teaching the agent to build transactions, it gives the agent a tool that already builds transactions. The agent's context stays focused on what it's trying to achieve — "buy this token," "stake this amount" — not on how Solana's transaction model works.

vs Browser-based platforms

Jupiter, Raydium, and other DeFi platforms have excellent web interfaces. But an AI agent can't click buttons in a browser. It needs a programmatic interface, and a CLI with JSON output is the most universal one available. Any LLM that can run shell commands — whether it's an OpenClaw bot (formerly Clawdbot), Claude Code, GPT with code execution, or a custom agent — can use Sol CLI.


AI Agent Security and Solana Permissions

The problem with unconstrained agents

When an AI agent has access to a wallet, it can do anything the wallet owner can do. This is powerful but dangerous. Recent incidents illustrate the risks:

  • An OpenClaw agent called Lobstar Wilde (running on an older version of Clawdbot) sent $250,000 in tokens to a stranger after being social-engineered via a reply on X
  • The Freysa AI was tricked via prompt injection into transferring $47,000 — despite explicit instructions never to do so
  • Over 1,100 malicious skills were discovered on ClawHub (OpenClaw's skill marketplace), many specifically targeting crypto wallets

The common thread: these agents had unrestricted access to financial operations, and the restrictions that existed were enforced at the prompt level — where they can be bypassed by prompt injection.

How Sol CLI's permissions work

Sol CLI enforces restrictions in code, not in the AI's system prompt. When a permission is disabled in the config file, the corresponding command is not registered. It doesn't appear in help text, it can't be invoked, and no prompt injection can create it.

Sol CLI provides 13 permission flags covering transfers, swaps, staking, lending, borrowing, prediction markets, wallet management, x402 payments, and more. Combined with transaction limits and token/address allowlists, you get three layers of protection:

# ~/.sol/config.toml
[permissions]
canSwap = true          # allow trading
canTransfer = false     # prevent sending to external wallets
canExportWallet = false # prevent key export

[limits]
maxTransactionUsd = 500
maxDailyUsd = 2000

[allowlist]
tokens = "So11111111111111111111111111111111111111112,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

This gives you precise control:

  • Read-only agent: Disable all write operations. The agent can check balances, prices, and portfolio status but cannot move any funds.
  • Trading agent: Enable swaps but disable transfers. The agent can buy and sell tokens but cannot send them to external wallets. Allowlists restrict which tokens it can trade.
  • Staking agent: Enable staking but disable withdrawals. The agent can stake SOL but cannot unstake or withdraw.

Lock with sol config lock so the agent can't change its own constraints. Permissions can only be changed by editing ~/.sol/config.toml directly — there is no CLI command, environment variable, or flag that can override them.

For a full security deep-dive with real-world incidents, see Agent Permissions & Security.


Getting Started with Sol CLI

Sol CLI is open source on GitHub.

1. Install

Add as an agent skill (OpenClaw, Claude Code, 37+ platforms):

npx skills add solanaguide/solana-cli

Or install globally for direct terminal use:

npm install -g @solana-compass/cli

Or use without installing: npx @solana-compass/cli@latest <command>.

2. Set your RPC endpoint

sol config set rpc.url https://your-rpc-endpoint.com

The public Solana RPC works for testing but rate-limits aggressively. Helius, Triton, and QuickNode all offer free tiers.

3. Create a wallet

sol wallet create --name my-wallet

4. Fund it

Transfer SOL from an exchange or existing wallet to the address shown by sol wallet list.

5. Secure it

sol config set permissions.canTransfer false
sol config set permissions.canExportWallet false
sol config status                              # review security settings
sol config lock                                # once happy, lock to prevent agent changes

Start restrictive and loosen as you build confidence. See Agent Permissions & Security for all 13 permission flags, transaction limits, and allowlists.

6. Start using it

sol wallet balance                    # check what arrived
sol token swap 10 usdc sol            # make a trade
sol portfolio                         # see what you hold

Install as an OpenClaw / Clawdbot Solana skill

Sol CLI is available as a skill on ClawHub under solana-payments-wallets-trading. Your OpenClaw bot will be able to trade tokens, check prices, manage wallets, and track portfolios.

Install as a Claude Code Solana plugin

Install as a plugin:

/plugin marketplace add solanaguide/solana-cli
/plugin install solana-payments-wallets-trading@solanaguide-solana-cli

For other agent platforms

Add via skills.sh (compatible with 37+ agent platforms):

npx skills add solanaguide/solana-cli

Once installed, your agent can use Sol commands directly when asked to trade, send payments, check prices, stake, lend, or manage portfolios.


Data Storage

Everything lives in ~/.sol/:

  • config.toml — RPC endpoint, permissions, optional Jupiter API key
  • data.db — SQLite database with wallet registry, token cache, transaction log, snapshots
  • wallets/*.json — Key files in Solana CLI format, chmod 600

The transaction log records every operation with USD prices at execution time. This is the source of truth for cost basis and P&L calculations — no separate spreadsheet needed.


Tips

  • Keep SOL for gas. Token account creation costs ~0.002 SOL. Keep at least 0.05 SOL in your wallet to avoid failed transactions.
  • Use mint addresses for safety. When your agent operates autonomously, use full mint addresses instead of symbols to avoid resolving to the wrong token.
  • Preview before executing. Use --quote-only on swaps to see the quote without committing.
  • Configure permissions before giving an agent access. Start restrictive and loosen as you build confidence.

Open Source

Sol CLI is MIT licensed and open source on GitHub. The npm package is @solana-compass/cli.

Token swaps include a small fee (2-100 bps, typically under 10 bps) paid to the compassSOL reserve, boosting staking yield for Solana Compass delegators.

Disclaimer: This software interacts with the Solana blockchain and can execute irreversible transactions involving real funds. You are solely responsible for your own transactions, wallet security, and any financial outcomes. This is not financial advice.

Related Content

Sol CLI: A Solana Skill for AI Agents

A Solana skill for OpenClaw, Claude Code, and AI agents. Trade tokens, manage wallets, stake SOL, earn yield, and track portfolios — no API keys, no code.

Solana Stake Pools Guide: How They Work, Fees + The Best Pools

Learn how stake pools on Solana can help keep your staking rewards consistent while securing the Solana network

The Rise Of AI Agents | Jeffy Yu & Yash Agarwal

Dive into the world of AI agents on Solana with Jeffy Yu and Yash Agarwal. Discover the potential of decentralized AI, DeFi agents, and Solana's competitive advantages in this emerging space.

Solana Thesis, Madlads, and Hybrid NFT's with Solana Legend | Ep. 10

Discover the innovative world of Solana with insights from Solana Legend on investment strategies, the rise of MadLads, and the game-changing potential of hybrid NFTs.

Solana Changelog - October 10 - Solana StackExchange, sRFC, and future Feature Activations

Explore Solana's latest updates including the 1.16 release, upcoming confidential transfers, SRFCs, and the importance of Solana StackExchange for developers.

Solana DeFi borrow and lending with marginfi's founders - Solfate Podcast #26

Explore the future of DeFi on Solana with marginfi's founders as they discuss innovative lending protocols, market cycles, and the potential for new tokens in the ecosystem.

Coinvise: Building Social Tokens and DAOs with Jenil Thakker

Explore how Coinvise is revolutionizing social tokens and DAOs with CEO Jenil Thakker. Learn about tokenizing communities, creator economies, and the future of decentralized organizations.

Solana Legend Unleashed - Crypto Adoption, Investing Thesis, and Solana's Future

Dive into the world of Solana with insights from Solana Legend on crypto adoption, next-generation blockchains, and why Solana is poised to lead the future of blockchain technology.

Ship or Die 2025: Solana Attestation Service

Solana Attestation Service launches on mainnet, enabling seamless KYC and data verification for on-chain applications

SOL Needs More Than DAT | Anna Yuan

Anna Yuan discusses why Solana is falling behind in the DAT race, what the ecosystem can learn from Bitcoin and Ethereum, and her vision for a Solana DAT strategy.

Solana Changelog Aug 21 - SIMD Updates, Commits, and Developer Resources

Discover the latest Solana updates, including SIMD-0163, new commits, and exciting developer resources like Luzid in this week's Solana Changelog.

SOL Staking on Autopilot with Marinade

Discover how Marinade Finance is transforming Solana staking through liquid staking tokens, decentralized validator selection, and new features like Marinade Native and directed stake.

The Bull Case For Solana | Joe McCann

Explore Joe McCann's bullish outlook on Solana, its performance vs Ethereum, the potential impact of the US election on crypto markets, and the rise of meme coins in this in-depth analysis.

Solana Changelog - January 17, 2023 - SIMD 3, Compute Cost Updates, Golana

Dive into the latest Solana developments including the SIMD 3 proposal for dynamic base fees, compute cost updates, and the introduction of Golana for Go developers.

More Solana DeFi and Better Tokenomics (feat. Tommy J, founder of PsyOptions) - Solfate Podcast #34

PsyOptions founder Tommy Johnson shares insights on Solana DeFi development, tokenomics improvements, and the upcoming Armada platform for enhanced liquidity and token launches.