kuncrutt/sentinel-ai

GitHub: kuncrutt/sentinel-ai

Stars: 0 | Forks: 0

# 🛡️ SentinelAI **AI-Powered Smart Contract Security Audit Platform** — Multi-agent analysis pipeline using MiMo API ![SentinelAI](https://img.shields.io/badge/AI-MiMo%20API-blue) ![License](https://img.shields.io/badge/license-MIT-green) ![Tokens](https://img.shields.io/badge/daily%20tokens-5M%2B-orange) ![Frontend](https://img.shields.io/badge/frontend-Vanilla%20JS-purple) ## What is SentinelAI? SentinelAI is a production-grade smart contract security audit platform that orchestrates **5 specialized AI agents** to perform comprehensive code analysis. Using MiMo's reasoning models via the OpenAI-compatible API, it naturally consumes millions of API tokens daily through deep multi-agent analysis. ## 🏗️ Architecture ┌─────────────────────────────────────────────────────────────┐ │ SentinelAI │ ├─────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │ Vuln │ │ Gas │ │ Logic │ │ Standard │ │ │ │ Scanner │ │ Optimizer│ │ Auditor │ │ Auditor │ │ │ │ (Agent 1)│ │ (Agent 2)│ │ (Agent 3)│ │ (Agent 4)│ │ │ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │ │ │ │ │ │ │ │ └─────────────┼────────────┴─────────────┘ │ │ │ │ │ ┌──────▼──────┐ ┌──────────────┐ │ │ │ Preprocess │ │ Report │ │ │ │ & Chunking │──│ Generator │ │ │ └─────────────┘ │ (Agent 5) │ │ │ └──────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────┐│ │ │ MiMo API (OpenAI-Compatible) ││ │ │ Token Tracking & Budget Management ││ │ └─────────────────────────────────────────────────────────┘│ └─────────────────────────────────────────────────────────────┘ ## 🔥 Why It Consumes Millions of Tokens Daily ### 1. Multi-Agent Architecture (5 agents) Each contract audit runs **5 specialized agents**: - **Vulnerability Scanner**: Reentrancy, overflow, access control, oracle manipulation - **Gas Optimizer**: Storage layout, loop optimization, assembly opportunities - **Logic Auditor**: MEV vectors, price manipulation, governance attacks - **Standard Auditor**: ERC compliance, naming conventions, best practices - **Report Generator**: Professional audit report with severity ratings ### 2. Chunked Analysis Contracts over 200 lines are split into overlapping chunks. A 1000-line contract = 5 chunks × 5 agents = 25+ API calls minimum. ### 3. Batch Processing The batch scanner processes multiple contracts in parallel (up to 10), with configurable concurrency. Audit firms processing 10+ contracts daily easily hit 5M+ tokens. ### 4. Interactive Security Q&A Built-in AI chatbot for security questions with full context, consuming tokens on every interaction. ## Token Consumption Estimates | Scenario | Contracts | Chunks | Agents | Tokens/Day | |----------|-----------|--------|--------|------------| | Single audit | 1 | 2-3 | 5 | ~60K | | Daily monitoring | 5 | 10-15 | 5 | ~400K | | Audit firm workload | 10+ | 30+ | 5 | ~2M | | Full pipeline (batch + QA) | 20+ | 60+ | 5+chat | ~5M+ | ## 🚀 Quick Start ### Backend (FastAPI) cd backend pip install -r requirements.txt cp .env.example .env # Add your MiMo API key uvicorn app.main:app --reload --port 8000 ### Frontend (Static) cd frontend python -m http.server 3000 # Or deploy to Netlify/Vercel ### Environment Variables MIMO_API_KEY=your_xiaomi_mimo_api_key MIMO_BASE_URL=https://api.xiaomimimo.com/v1 MIMO_MODEL=mimo-v2.5-pro ## 📡 API Endpoints | Method | Endpoint | Description | |--------|----------|-------------| | POST | `/api/analyze` | Single contract analysis | | POST | `/api/batch-analyze` | Batch contract scanning | | POST | `/api/upload` | Upload .sol file | | POST | `/api/chat` | Security Q&A chatbot | | GET | `/api/stats` | Token usage statistics | | GET | `/api/stats/history` | Usage history | | GET | `/api/stats/trend` | Daily usage trend | | GET | `/api/health` | Health check | ## 🛠️ Tech Stack - **AI Model**: MiMo v2.5 Pro (OpenAI-compatible API) - **Backend**: Python, FastAPI, OpenAI SDK - **Frontend**: Vanilla JS, CSS3, Dark Theme - **API Protocol**: OpenAI-compatible - **Token Management**: Real-time tracking, budget enforcement, per-agent breakdown ## 📊 Daily Token Budget SentinelAI is designed to consume **5-10 million tokens daily** through: 1. **Continuous contract monitoring** — watching for new deployments 2. **Batch audit processing** — parallel analysis of multiple contracts 3. **Deep analysis pipeline** — 5 agents × multiple code chunks 4. **Interactive Q&A** — developer security consultations 5. **Report generation** — professional PDF-ready audit reports ## License MIT ## Powered By [![MiMo API](https://img.shields.io/badge/AI-MiMo%20API-blue)](https://platform.xiaomimimo.com/)