Production-grade safety middleware for autonomous AI agents on Solana.
As AI agents transition from read-only observers to active on-chain participants, the risks increase dramatically. Standard tooling often leads to hallucinated transaction parameters, incorrect slippage causing MEV attacks, drained wallets, or stalled workflows due to transient RPC errors and expired blockhashes.
An agent cannot operate truly autonomously if a human must constantly monitor execution, manually adjust parameters, or intervene after every failure.
The Safe On-Chain Solana Agent Skill provides a rigorous safety layer for the Solana AI Kit. It treats every agent-proposed action as untrusted until verified through pre-flight checks and mainnet simulation.
By combining scoped permissions, intelligent error recovery, and self-healing patterns, this skill enables agents to execute reliably and autonomously — even under volatile conditions.
- Simulation-First Execution — Every transaction is simulated against live mainnet state before signing. This validates exact balances, slippage, compute units, and account states.
- Scoped Permissions & Wallet Hygiene — Supports session keys and granular, time-bound allowances instead of exposing full private keys.
- Intelligent Error Parsing + Autonomous Retry — Translates raw Solana program errors into meaningful feedback. Automatically recovers from transient RPC issues, blockhash expirations, and minor slippage failures.
- Pre-Flight Validation — Checks token accounts, rent exemptions, fee lamports, and required state before any on-chain action.
- Progressive / Token-Efficient Loading — Only relevant knowledge and schemas are loaded into context when needed, reducing token usage and hallucination risk.
- Deep Composability — Works as a safety wrapper around existing tools (Jupiter, Meteora, etc.) without requiring changes to the underlying skills.
The skill acts as an intelligent safety layer between the agent's reasoning and the Solana network.
graph TD
A[Agent Intent / LLM] -->|Proposes Action| B(Safety Middleware)
B --> C{Pre-flight Checks}
C -- Pass --> D[Transaction Simulation]
C -- Fail --> E[Self-Healing & Feedback]
D -- Success --> F[Scoped On-Chain Execution]
D -- Error / Slippage --> E
F --> G[State Validation & Receipt]
E -.->|Context Update| A
classDef secure fill:#e6f3ff,stroke:#0066cc,stroke-width:2px;
classDef execute fill:#e6ffe6,stroke:#00cc00,stroke-width:2px;
classDef error fill:#ffe6e6,stroke:#cc0000,stroke-width:2px;
class B,C,D secure;
class F,G execute;
class E error;
Clone the skill and add it to your project following the standard pattern used by other skills in the kit:
git clone https://github.com/Cryptojigi/safe-onchain-agent-skill.git
cd safe-onchain-agent-skill
# Run the installer (follow prompts)
./install.shOr manually add it as a git submodule / skill in your .claude/skills/ directory for progressive loading.
git clone https://github.com/Cryptojigi/safe-onchain-agent-skill.git
cd safe-onchain-agent-skillWhen the skill is loaded, Claude will automatically:
- Simulate the swap before suggesting any transaction
- Validate slippage against current market conditions
- Suggest corrected parameters or retry logic if simulation fails
- Provide clear reasoning for any adjustments
Example prompt you can use:
“Perform a Jupiter swap of 25 USDC to SOL with 0.5% slippage. Use safe execution.”
Claude will now simulate first, check for realistic slippage, and only then provide the final transaction instructions.
The skill enables agents to run monitoring loops that recover gracefully from common failures (expired blockhash, RPC issues, minor price movements). Claude can now suggest safe rebalancing logic with built-in simulation and error recovery patterns.
The skill is designed for efficient context usage. Safety modules (simulation rules, error maps, permission patterns) are loaded only when the conversation involves on-chain actions.
Contributions that improve on-chain agent safety are welcome.
- Fork the repository
- Create a feature branch
- Make your changes
- Open a Pull Request
Please keep changes focused, well-documented, and aligned with production-grade standards.
Safe On-Chain Solana Agent Skill is built to help the Solana ecosystem move toward trustworthy autonomous agents.
MIT License © 2026