Transform social signals into profitable trades on Polymarket and Kalshi.
Musashi is a complete prediction market intelligence platform with:
- 🎯 Chrome Extension - Overlay market odds on Twitter/X in real-time
- 🤖 Agent SDK - Build automated trading bots in TypeScript/JavaScript
- 🔌 MCP Server - Connect prediction market intelligence directly to Claude AI (claude.ai & Claude Desktop)
- 📡 REST API - Analyze text, detect arbitrage, track market movers
- ⚡ Live Data - Real Polymarket + Kalshi integration with 5-min refresh
- MCP Integration Guide - Connect to Claude AI (LIVE NOW)
- Agent SDK Documentation - Build trading bots
- REST API Reference - API endpoints and examples
- Changelog - Version history and updates
🚀 NEW: MCP Server now live at https://musashi-production.up.railway.app - Connect prediction market intelligence directly to Claude!
- Automatic Detection: Scans tweets for prediction market topics
- Smart Matching: AI-powered matching with entity extraction (people, tickers, organizations)
- Trading Signals: Sentiment analysis, edge calculation, urgency levels
- Arbitrage Alerts: Cross-platform price discrepancies (Polymarket vs Kalshi)
- Market Movers: Track markets with significant price changes
- Beautiful Sidebar: Clean UI with matched markets and live odds
import { MusashiAgent } from './src/sdk/musashi-agent';
const agent = new MusashiAgent();
// Analyze text for trading signals
const signal = await agent.analyzeText('Bitcoin just hit $100k!');
if (signal.urgency === 'critical') {
console.log('TRADE NOW:', signal.suggested_action);
}
// Monitor arbitrage opportunities
agent.onArbitrage((opps) => {
for (const arb of opps) {
if (arb.spread > 0.05) {
executeTrade(arb); // 5%+ spread!
}
}
}, { minSpread: 0.03 }, 60000); // Check every minuteSee README-AGENT.md for full SDK documentation.
Base URL: https://musashi-api.vercel.app
# Analyze text
curl -X POST https://musashi-api.vercel.app/api/analyze-text \
-H "Content-Type: application/json" \
-d '{"text": "Fed announces rate cut!"}'
# Get arbitrage opportunities
curl https://musashi-api.vercel.app/api/markets/arbitrage?minSpread=0.05
# Get market movers
curl https://musashi-api.vercel.app/api/markets/movers?minChange=0.10See API-REFERENCE.md for full API documentation.
-
Download the extension:
- Navigate to
C:\Users\rotciv\Desktop\Musashi ai\dist
- Navigate to
-
Open Chrome Extensions:
- Go to
chrome://extensions - Enable "Developer mode" (toggle in top-right)
- Go to
-
Load the extension:
- Click "Load unpacked"
- Select the
distfolder - Musashi should appear in your extensions list
-
Start using:
- Visit Twitter/X (twitter.com or x.com)
- The sidebar will appear automatically
- Scroll through your timeline to detect markets
# Clone repository
git clone https://github.com/VittorioC13/Musashi.git
cd Musashi
# Copy SDK into your project
cp src/sdk/musashi-agent.ts your-project/
# Or use the REST API directly
curl https://musashi-api.vercel.app/api/analyze-textSee README-AGENT.md for bot developer guide.
Tweet Text → Keyword Extraction → Entity Recognition → Market Matching → Sentiment Analysis → Edge Calculation → Trading Signal
- Keyword Extraction: Extract meaningful keywords from text
- Entity Recognition: Identify people, organizations, tickers, dates (2x weight boost)
- Market Matching: Jaccard similarity + keyword overlap across 1000+ markets
- Sentiment Analysis: Bullish/bearish/neutral classification with confidence
- Edge Calculation: Compare implied probability vs market price
- Trading Signal: Direction (YES/NO/HOLD), confidence, urgency, reasoning
Polymarket Markets → Match with Kalshi Markets → Calculate Spread → Confidence Filtering → Arbitrage Opportunities
- Matches markets across platforms using title similarity + keyword overlap
- Detects price discrepancies (e.g., BTC $100k: 63% on Poly, 70% on Kalshi = 7% spread)
- Returns actionable opportunities with profit potential
Price Snapshots (hourly) → Historical Comparison → Price Change Detection → Significant Movers
- Tracks price history for 7 days (Chrome extension) or 24 hours (API)
- Detects markets with >5% price change in last hour
- Useful for momentum trading and alert systems
- 🏛️ US Politics - Elections, Congress, Presidential actions
- 💰 Economics - Fed policy, inflation, unemployment, recession
- 💻 Technology - AI regulation, tech earnings, market caps
- ₿ Crypto - Bitcoin, Ethereum, ETFs, price predictions
- ⚽ Sports - Super Bowl, NBA, major championships
- 🌍 Geopolitics - International conflicts, peace deals
- 🎬 Entertainment - Oscars, major cultural events
- 🌡️ Climate - Temperature records, climate policy
Total Markets: 1000+ markets from Polymarket (500+) and Kalshi (400+)
Musashi/
├── manifest.json # Chrome extension config
├── package.json # Dependencies
├── webpack.config.js # Build configuration
├── vercel.json # Vercel API deployment
│
├── README.md # This file (project overview)
├── README-AGENT.md # Agent SDK documentation
├── API-REFERENCE.md # REST API documentation
├── CHANGELOG.md # Version history
│
├── public/
│ ├── icons/ # Extension icons
│ └── popup.html # Extension popup
│
├── src/
│ ├── sdk/
│ │ └── musashi-agent.ts # Agent SDK (TypeScript/JavaScript client)
│ │
│ ├── api/
│ │ ├── polymarket-client.ts # Polymarket Gamma API client
│ │ ├── kalshi-client.ts # Kalshi REST API client
│ │ ├── arbitrage-detector.ts # Cross-platform arbitrage detection
│ │ └── price-tracker.ts # Market movers tracking (Chrome storage)
│ │
│ ├── analysis/
│ │ ├── keyword-matcher.ts # Keyword extraction and matching
│ │ ├── entity-extractor.ts # Named entity recognition
│ │ ├── sentiment-analyzer.ts # Sentiment classification
│ │ ├── signal-generator.ts # Trading signal generation
│ │ └── analyze-text.ts # Full analysis pipeline
│ │
│ ├── content/
│ │ ├── content-script.tsx # Twitter/X content script
│ │ ├── twitter-extractor.ts # Tweet extraction logic
│ │ └── inject-sidebar.tsx # Sidebar injection
│ │
│ ├── sidebar/
│ │ ├── Sidebar.tsx # Main sidebar UI (React)
│ │ └── MarketCard.tsx # Market card component
│ │
│ ├── background/
│ │ └── service-worker.ts # Service worker (messaging, caching, price polling)
│ │
│ └── types/
│ └── market.ts # TypeScript type definitions
│
├── api/ # Vercel serverless functions
│ ├── lib/
│ │ └── market-cache.ts # Shared market cache (5-min TTL)
│ │
│ ├── analyze-text.ts # POST /api/analyze-text
│ ├── health.ts # GET /api/health
│ │
│ └── markets/
│ ├── arbitrage.ts # GET /api/markets/arbitrage
│ └── movers.ts # GET /api/markets/movers
│
└── dist/ # Built extension (generated)
- Node.js 20+ and pnpm
- Google Chrome
- Git
# Install dependencies
pnpm install
# Build Chrome extension for production
pnpm run build
# Build and watch for changes (development)
pnpm run dev
# Clean build folder
pnpm run clean- Edit source files in
src/ - Run
pnpm run buildto rebuild - Go to
chrome://extensions - Click reload icon on Musashi card
- Refresh Twitter/X tab to see changes
# Run local development server
pnpm exec vercel dev
# Endpoints available at:
# http://localhost:3000/api/analyze-text
# http://localhost:3000/api/markets/arbitrage
# http://localhost:3000/api/markets/movers
# http://localhost:3000/api/health# Login to Vercel
pnpm exec vercel login
# Deploy to production
pnpm exec vercel --prod- Frontend: React 18, TypeScript, TailwindCSS
- Build: Webpack 5
- Extension: Chrome Manifest V3
- API: Vercel Serverless Functions
- Data Sources: Polymarket Gamma API, Kalshi REST API
- Caching: In-memory (5-min TTL), Chrome storage (7-day history)
- Tweet Extraction: <50ms
- Text Analysis: <200ms (keyword matching + entity extraction + sentiment)
- Market Matching: <100ms (1000+ markets)
- API Latency: <500ms (includes market fetching + analysis)
- Cache Hit Rate: ~90% (5-min TTL on markets)
- Price Polling: ~10 seconds for top 50 markets (5 concurrent requests)
- Entity Extraction: 2x weight for people/orgs/tickers/dates
- Sentiment Analysis: Bullish/bearish/neutral with confidence scoring
- Edge Calculation: Implied probability vs market price
- Urgency Levels: Critical/high/medium/low based on edge + volume + expiry
- HOLD Threshold: Requires 10%+ edge to suggest trades (reduces false signals)
- Matches markets across platforms using title similarity (Jaccard) + keyword overlap
- Configurable thresholds:
minSpread(default 3%),minConfidence(default 50%) - Returns profit potential and trading direction
- Lightweight Updates: Fetches only price data via Polymarket CLOB API (not full market objects)
- Top Markets: Polls top 50 markets by volume every 60 seconds
- Parallel Fetching: 5 concurrent requests for fast updates (~10 seconds total)
- Cache Integration: Updates cached markets with fresh prices
- Price History: Snapshots stored in chrome.storage for 7 days
- Movers Detection: Real-time detection with actual price changes
CLOB API: GET https://clob.polymarket.com/price?token_id={numericId}
- Market Fetching: Shared cache across API endpoints (5-min TTL)
- Arbitrage Matching: O(n×m) currently, future: category-based filtering for 5-10x speedup
- Price History: Chrome storage (7 days), Vercel KV (7 days)
- Rate Limiting: None currently, future: Vercel Edge Config
- Sentiment Accuracy: Naive linear formula (future: scale by source credibility)
- Arbitrage Speed: O(n×m) matching (future: pre-index by category)
- No Rate Limiting: Open API with
Access-Control-Allow-Origin: *(future: API keys) - Vercel KV Required: Movers endpoint requires Vercel KV setup (see VERCEL_KV_SETUP.md)
Extension not appearing
- Ensure Developer mode is enabled
- Load the
distfolder, not the root folder - Check for errors in
chrome://extensions
Sidebar not showing
- Open browser console (F12) for errors
- Verify you're on twitter.com or x.com
- Try reloading the extension
No matches found
- Tweets must contain relevant keywords
- Try searching for "Bitcoin", "Trump election", or "Fed rates"
- Check console logs to see detection status
Empty movers response
- First request after deployment (no price history yet)
- Need 2+ snapshots at least 1 hour apart for movers detection
- Ensure Vercel KV is configured (see VERCEL_KV_SETUP.md)
- Lower
minChangethreshold:?minChange=0.01
Slow arbitrage detection
- First request fetches markets from Polymarket/Kalshi (~500ms)
- Subsequent requests use cache (<100ms)
KV connection errors
- Verify
KV_REST_API_URLandKV_REST_API_TOKENare set in Vercel dashboard - Check Vercel logs for detailed error messages
- Cross-platform arbitrage detection
- Trading signal generation with sentiment analysis
- Entity extraction (people, orgs, tickers, dates)
- Price tracking and movers detection
- REST API for bot developers
- Agent SDK with polling callbacks
- Real Polymarket + Kalshi integration
- Vercel KV for movers persistence (7-day persistent storage)
- Polymarket CLOB price polling (real-time price updates every 60s)
- Category-based arbitrage filtering (5-10x speedup)
- API rate limiting (Vercel Edge Config or API keys)
- Sentiment credibility scaling (verified accounts, follower count)
- Browser notifications for critical signals
- Multi-platform support (Reddit, news sites, Discord)
Currently a solo project by rotciv. Contributions welcome!
MIT License
- Markets: Polymarket (https://polymarket.com), Kalshi (https://kalshi.com)
- Built by: rotciv + Claude Code
- Tech: React, TypeScript, TailwindCSS, Webpack, Vercel
Version: 2.0.0 Last Updated: March 1, 2026 Status: ✅ Production Ready
Get Started: Agent SDK Docs | API Reference