Skip to main content
Glama
SquadSentinel AI

SquadSentinel AI

README.md
# SquadSentinel AI

**Grounded Solana Treasury & Squads v4 Multisig Policy Agent + Zero-Dependency `stdio` MCP Server** powered live by **CoinGecko API**, **GeckoTerminal Solana Pools**, and **Solana Mainnet JSON-RPC**.

Built fresh in December 2026 for the **CoinGecko × Superteam Long Tail Hackathon (`AI Agents` Track)**.

- **Live Web Agent Workbench:** https://trantai2911-ai.github.io/squadsentinel-ai/
- **License:** MIT (`zero dependencies`, Node `>=18`)

## Why Grounded Treasury Agents Matter

Generic LLM bots hallucinate token balances, invent runway figures, and size single swaps larger than pool liquidity allows. **SquadSentinel AI** enforces deterministic tool grounding:
1. **`inspect_solana_treasury`** (`src/solana.mjs`) — Queries live `api.mainnet-beta.solana.com` (`getEpochInfo`, `getBalance`, `getTokenAccountsByOwner`), aggregating duplicate SPL token accounts sharing the same mint and anchoring the audit to the exact Solana Mainnet **Epoch & Slot**.
2. **`fetch_batched_token_prices`** (`src/coingecko.mjs`) — Prices all held SPL mints in **one batched request** via CoinGecko `/simple/token_price/solana` (with optional user-provided Pro/Analyst key header `x-cg-pro-api-key`) or GeckoTerminal fallback, with `HTTP 429` exponential backoff.
3. **`check_treasury_policy`** (`src/policy.mjs`) — Evaluates runway months, stablecoin floor %, single-token concentration %, and optional `solShockPct` drawdown stress tests.
4. **`size_rebalance_tranches` & `draft_squads_proposal`** (`src/agent.mjs`) — Queries deepest Solana DEX pool reserves (`/networks/solana/tokens/{mint}/pools`), splits oversized swaps into **TWAP tranches** capped at `<= maxPoolImpactPct%` of pool TVL into USDC (`EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`), outputs a **`squads-v4-rebalance-proposal/1.0`** JSON payload + Markdown governance memo, and binds every number to `[E1..En]` citations.

## CLI & Verification

```bash
# Run automated test suite (policy math, TWAP splits, citations, Squads JSON, stdio MCP, live RPC + CoinGecko)
npm test

# Audit live Solana Mainnet preset vault & print grounded governance memo
node cli/squadsentinel.mjs --preset startup_runway_12m --format memo

# Export raw Squads v4 rebalance proposal JSON with -25% SOL stress test
node cli/squadsentinel.mjs --shock -25 --format squads

# Run end-to-end stdio MCP server smoke verification
node cli/squadsentinel.mjs --mcp-smoke
```

## Model Context Protocol (`mcp/server.mjs`) Usage

Add SquadSentinel AI directly to Claude Desktop, Cursor, or any MCP client supporting `stdio`:

```json
{
  "mcpServers": {
    "squadsentinel": {
      "command": "node",
      "args": ["mcp/server.mjs"]
    }
  }
}
```

### Exposed MCP Tools
- `inspect_solana_treasury`
- `check_treasury_policy`
- `size_rebalance_tranches`
- `draft_squads_proposal`