agentleFS
sendaifunsendaifun/solana-agent-kit/CLAUDE.md

solana-agent-kit

CLAUDE.md1.7k starsChanged 23 months agoApache-2.0View on GitHub

This is a monorepo using pnpm workspaces and Turborepo for building AI agents that interact with Solana protocols. Plugin System: V2 uses a composable plugin architecture. Plugins register methods (direct function calls) and actions (AI agent tools with schemas). Agent Initialization: Wallet Interface: Uses BaseWallet interface - can be KeypairWallet for server-side or wallet adapter for browser. Each plugin follows this structure: Actions vs Tools: Actions wrap tools with Zod schemas, descriptions, and examples for AI agent consumption. Tools contain…

  • Reads credentials
  • Installs packages
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Build & Development Commands

# Install dependencies (requires pnpm 9+, Node 22+)
pnpm install

# Build all packages
pnpm run build

# Build specific packages
pnpm run build:core              # Core package only
pnpm run build:plugin-token      # Token plugin
pnpm run build:plugin-defi       # DeFi plugin
pnpm run build:plugin-nft        # NFT plugin
pnpm run build:plugin-misc       # Misc plugin
pnpm run build:plugin-blinks     # Blinks plugin
pnpm run build:adapter-mcp       # MCP adapter

# Lint and format
pnpm run lint                    # Check with Biome
pnpm run lint:fix                # Auto-fix lint issues
pnpm run format                  # Format code with Biome

# Run tests (interactive - prompts for "agent" or "programmatic" mode)
# Requires OPENAI_API_KEY, RPC_URL, SOLANA_PRIVATE_KEY in test/.env
pnpm run test

# Generate documentation
pnpm run docs

# Clean all build artifacts
pnpm run clean

Architecture Overview

This is a monorepo using pnpm workspaces and Turborepo for building AI agents that interact with Solana protocols.

Package Structure

packages/
├── core/           # solana-agent-kit - Main SDK with SolanaAgentKit class
├── plugin-token/   # Token operations (transfers, swaps, Jupiter, PumpFun)
├── plugin-defi/    # DeFi protocols (Drift, Orca, Raydium, Meteora, etc.)
├── plugin-nft/     # NFT operations (Metaplex, 3Land)
├── plugin-misc/    # Utilities (CoinGecko, Allora, domains, webhooks)
├── plugin-blinks/  # Solana Blinks (arcade games)
└── adapter-mcp/    # Model Context Protocol server adapter

Core Concepts

Plugin System: V2 uses a composable plugin architecture. Plugins register methods (direct function calls) and actions (AI agent tools with schemas).

// Plugin structure
interface Plugin {
  name: string;
  methods: Record<string, Function>;  // Programmatic API
  actions: Action[];                   // AI agent tools with Zod schemas
  initialize(agent: SolanaAgentKit): void;
}

// Action structure for AI tools
interface Action {
  name: string;
  similes: string[];           // Alternative trigger phrases
  description: string;
  examples: ActionExample[][];
  schema: z.ZodType<any>;      // Input validation
  handler: Handler;            // Execution function
}

Agent Initialization:

const agent = new SolanaAgentKit(wallet, rpcUrl, config)
  .use(TokenPlugin)
  .use(DefiPlugin);

// Methods are type-safe on agent.methods
await agent.methods.trade(...);

// Actions exposed via agent.actions for AI frameworks
const tools = createVercelAITools(agent, agent.actions);

Wallet Interface: Uses BaseWallet interface - can be KeypairWallet for server-side or wallet adapter for browser.

AI Framework Integration

  • createVercelAITools(agent, actions) - For Vercel AI SDK
  • createLangchainTools(agent, actions) - For LangChain
  • createOpenAITools(agent, actions) - For OpenAI Agents SDK

Plugin Organization Pattern

Each plugin follows this structure:

plugin-*/src/
├── index.ts           # Plugin definition, exports methods & actions
├── protocol-name/
│   ├── actions/       # Action definitions (AI tool schemas)
│   ├── tools/         # Implementation functions
│   └── types/         # TypeScript types (optional)

Actions vs Tools: Actions wrap tools with Zod schemas, descriptions, and examples for AI agent consumption. Tools contain the actual implementation logic.

Code Style

  • Linting/Formatting: Biome (not ESLint/Prettier for main code)
  • Commit Messages: Conventional Commits (feat:, fix:, docs:)
  • Naming: camelCase for functions/variables, PascalCase for types/classes
  • TypeScript strict mode, ESM modules

Key Files

  • packages/core/src/agent/index.ts - SolanaAgentKit class definition
  • packages/core/src/types/index.ts - Core types (Plugin, Action, Config)
  • packages/core/src/types/wallet.ts - Wallet interface definitions
  • turbo.json - Turborepo build configuration
  • biome.json - Linting and formatting rules

Download now (ZIP)

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 1 mentionMar 2026: 1 mentionApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 2 mentionsOct 2026: 3 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the sendaifun/solana-agent-kit repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about sendaifun/solana-agent-kit

The biggest 5 of 16 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 16

Talked about on GitHub (16 times).

On GitHub · 16

11 more on GitHub

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.