betting-brain-v3
CLAUDE.md8 starsChanged 14 months agoMITView on GitHub
Note: This project uses Bun as the runtime. Package.json scripts use standard command patterns, but the project is Bun-native. Betting-Brain v3 is an enterprise-grade betting intelligence platform running on Cloudflare Edge with MCP (Model Context Protocol) server integration for AI assistants. Queue Consumers: - line-ingress queue (batch: 10, timeout: 5s) - steam-webhook queue (batch: 5, timeout: 10s) **Scheduled Tasks:
- Reads credentials
- Sends data out
In this repository27 other files it gives its agents.
- .cursor/rules/99-floor.mdcCursor rule
- .cursor/rules/ai-friendly-testing.mdcCursor rule
- .cursor/rules/analytics-stub-api.mdcCursor rule
- .cursor/rules/analytics-testing.mdcCursor rule
- .cursor/rules/api-patterns.mdcCursor rule
- .cursor/rules/browser-extension.mdcCursor rule
- .cursor/rules/bun-runtime.mdcCursor rule
- .cursor/rules/cache-optimization.mdcCursor rule
- .cursor/rules/ci-integration.mdcCursor rule
- .cursor/rules/ci-patterns.mdcCursor rule
- .cursor/rules/cloudflare-infrastructure.mdcCursor rule
- .cursor/rules/cloudflare-workers.mdcCursor rule
- .cursor/rules/code-searchability.mdcCursor rule
- .cursor/rules/coverage-thresholds.mdcCursor rule
- .cursor/rules/database-patterns.mdcCursor rule
- .cursor/rules/documentation.mdcCursor rule
- .cursor/rules/endpoint-routing.mdcCursor rule
- .cursor/rules/file-naming.mdcCursor rule
- .cursor/rules/mcp-integration.mdcCursor rule
- .cursor/rules/process-management.mdcCursor rule
- .cursor/rules/production-security.mdcCursor rule
- .cursor/rules/quality-standards.mdcCursor rule
- .cursor/rules/root-organization.mdcCursor rule
- .cursor/rules/security-patterns.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/testing-patterns.mdcCursor rule
- .cursor/rules/test-setup-patterns.mdcCursor rule
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Test suite needs review (1 hanging test identified)
- Distinctive: line 117
Every minute: Exposure calculation (30s cron not supported)
- Distinctive: line 373
No build step for dev (Bun executes TS directly)
- Distinctive: line 379
All external inputs validated with Zod:
- Very specific: line 460
Extension Testing: Use tools/testing/extension-injection-tester.html.
- Very specific: line 462
Type Safety: Always run bun run type-check before deploying.
- Very specific: line 466
MCP Testing: Use direct handler tests (scripts/test-handlers-direct.ts) for fastest validation without server.
- Very specific: line 468
Database Schema: Check migrations/0003_mcp_tables.sql for MCP-specific tables (bet_history, hold_tracking).
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
🎯 Current Project Status (2025-10-07)
✅ Production Ready
- CI/CD: ✅ All security gates passing (0 blocking violations)
- Tests: ⚠️ Test infrastructure fixed (1 test skipped temporarily)
- Documentation: ✅ 103 broken links fixed (91→66 remaining in archive)
- Security: ✅ ast-grep enforcement with 20 rules (99 hints, 0 errors)
- Type Safety: ⚠️ 154 TypeScript errors remaining (non-blocking)
Recent Recovery (Last 2 Hours)
- Killed 27 zombie test processes eating 600%+ CPU
- Fixed security violations from 606→0 blocking (hints only)
- Added test timeout (bunfig.toml with 10s default)
- Hardened CI (pinned Bun 1.2.23, ast-grep 0.39.5, added caching)
- Fixed doc links (automated script fixed 103 links across 30 files)
- Tagged rollback point:
security-gate-v1
Quick Wins Available
- TypeScript errors can be fixed in ~2 hours (D1 result types)
- Remaining archive doc links low priority (old content)
- Test suite needs review (1 hanging test identified)
Essential Commands
Note: This project uses Bun as the runtime. Package.json scripts use standard command patterns, but the project is Bun-native.
Development
bun run dev # Start development server with hot reload
bun run start # Run without hot reload
wrangler dev --local # Start with full Cloudflare Workers environment
bun run build # Build for Cloudflare Workers (bun target)
bun run build:worker # Build with minificationTesting
bun test # Run all tests
bun test:watch # Watch mode
bun test:coverage # Generate coverage report
bun scripts/test-handlers-direct.ts # Test MCP handlers directly (bypasses server)Code Quality & Security
bun run lint # Run linter
bun run format # Format code
bun run format:check # Check formatting without changes
bun run type-check # TypeScript type checking (tsc --noEmit)
sg scan src/ # Security scan (99 hints, 0 errors) ✅
bun scripts/fix-doc-links.ts # Fix broken documentation linksDatabase
# List migrations
wrangler d1 migrations list betting-analytics --local
# Apply migrations locally
wrangler d1 migrations apply betting-analytics --local
# Apply to production
wrangler d1 migrations apply betting-analytics --remote
# Query database
wrangler d1 execute betting-analytics --local --command "SELECT * FROM sharp_indicators LIMIT 5"Deployment
bun run deploy # Deploy to default environment
wrangler deploy # Direct Wrangler deploymentMonitoring & Debugging
bun run health:check # Check worker health
curl -s https://YOUR-WORKER.workers.dev/health
curl -s https://YOUR-WORKER.workers.dev/mcp # MCP endpointHigh-Level Architecture
🏗️ Edge-Native Cloudflare Worker with MCP Integration
Betting-Brain v3 is an enterprise-grade betting intelligence platform running on Cloudflare Edge with MCP (Model Context Protocol) server integration for AI assistants.
Core Components
1. Main Worker (src/index.ts)
Central fetch handler routing requests to:
/health- System health checks/mcp- MCP Protocol endpoint (JSON-RPC 2.0) ✨ NEW/tools/*- Intelligence APIs (exposure, sharp scores, CLV, hold %)/cloud/api/Manager/getBetTicker- BetTicker interception/interceptor/*- Historical data analysis/logs- Extension log collection/diagnostics- System diagnostics/system-status- Detailed status
Queue Consumers:
line-ingressqueue (batch: 10, timeout: 5s)steam-webhookqueue (batch: 5, timeout: 10s)
Scheduled Tasks:
- Hourly: Sharp customer calculation
- Every minute: Exposure calculation (30s cron not supported)
2. MCP Server (src/mcp/) ✨ NEW
JSON-RPC 2.0 server exposing 13 working tools for AI assistants:
Files:
server.ts- MCP request router (initialize, tools/list, tools/call)types.ts- MCP protocol types (JSONRPCRequest, MCPToolResult)tools.ts- Tool definitions (schemas, descriptions, parameters)toolRegistry.ts- Handler registry (maps tool names → functions)
Intelligence Tools (4):
getBettingExposure- Current exposure by event/marketgetCLV- Customer lifetime valuegetHoldPercentage- Hold percentage analysisgetSharpScore- Basic sharp score calculation
Live Betting Tools (3):
5. getSteamMoves - 3-sigma steam detection with severity (CRITICAL/HIGH/MEDIUM/LOW)
6. getRiskConcentration - Risk clustering by event/customer/market
7. getSharpActivity - Sharp customer tracking with composite scoring
Analytics Tools (6):
8. getTimeSeriesCLV - CLV trend analysis with rolling metrics
9. getEnhancedSharpScore - ML-like 7-feature customer profiling (0-100 score)
10. getHoldForecast - Predictive hold % with linear regression + 95% CI
11. getHandleAndHold - Revenue analytics with trend detection
12. getCustomerVolume - Customer segmentation (WHALE/HIGH_ROLLER/REGULAR/CASUAL/OCCASIONAL)
13. getTimeSeriesAnalytics - Flexible time-series with anomaly detection (2σ threshold)
MCP Handlers (src/mcp/handlers/):
steamMoves.ts- 3-sigma line movement detectionriskConcentration.ts- Exposure clustering analysissharpActivity.ts- Sharp customer trackingtimeSeriesCLV.ts- Historical CLV trendsenhancedSharpScore.ts- Multi-dimensional profiling (steam correlation, timing, sizing, diversity)holdForecast.ts- Linear regression forecastinghandleAndHold.ts- Handle and hold trackingcustomerVolume.ts- Percentile-based segmentationtimeSeriesAnalytics.ts- General time-series analysis
Testing:
# Test MCP handlers directly (no server needed)
bun scripts/test-handlers-direct.ts
# Test via HTTP (requires server)
curl -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'See docs/MCP_TESTING_GUIDE.md for comprehensive testing guide.
3. BetTicker Sniffer (src/interceptors/bet-ticker-sniffer.ts)
Transparent API interceptor:
- Captures
POST /cloud/api/Manager/getBetTickerrequests - Stores raw responses in KV storage (7-day retention)
- Returns original response (zero client impact)
- Provides history and analysis endpoints
- Zod validation for metadata
4. Intelligence Tools (src/tools/intelligence/)
Auto-generated, typed APIs with Zod validation:
getBettingExposure.ts- Real-time exposure trackinggetSharpScore.ts- Sharp customer identificationgetHoldPercentage.ts- Hold percentage calculationgetCLV.ts- Customer lifetime value analysis
5. Queue Consumers (src/queues/)
lineIngress.ts- Line movement ingestion (batch: 10, timeout: 5s)steamWebhook.ts- Steam move notifications (batch: 5, timeout: 10s)
6. Scheduled Jobs (src/schedules/)
sharpCalc.ts- Hourly sharp customer calculationexposureCalc.ts- Every minute exposure updates
7. Guards (src/guards/)
rateLimit.ts- 10 req/s per IP (in-memory, per-instance)costCap.ts- Hard cost limits with graceful degradation
8. Browser Extension (browser-extension/)
Chrome extension (v1.0.9):
- Injects content scripts on target domains (world: MAIN)
- Routes data via background service worker (bypasses CORS)
- Captures Fantasy402 API calls in real-time
- Forwards to worker
/api/fantasy402/ingestendpoint - Circuit breaker pattern with health monitoring
- Popup UI for statistics and configuration
Key Files:
fantasy402-interceptor.js- Main interception logic (fetch/XHR hijacking)background.js- Service worker with network privilegesmanifest.json- v3 with alarms, notifications, storage permissionspopup.html/js- Extension statistics UI
Data Flow:
Fantasy402.com API call
→ fantasy402-interceptor.js intercepts
→ chrome.runtime.sendMessage (CORS-safe)
→ background.js forwards
→ POST http://localhost:8787/api/fantasy402/ingest
→ Worker queues data
→ Dashboard displays live metrics9. Mission Control Dashboard (dashboards/floor-control.html)
Unified real-time dashboard with 13 monitoring cards:
System Health (3 cards):
- 🤖 Floor Health - Version, test pass rate (239/299), coverage (81%)
- 🌲 Forest Grove - Worker/Database/Queue health status
- 🛠️ MCP Tools - 6 available tools list
Live Data (5 cards): 4. 📊 Live Odds (NBA) - Real-time odds movements (Chart.js) 5. 🏀 Live Scores - Active game count and details 6. 💾 Database Metrics - Line movements, sharp indicators, exposure tracking 7. ⚡ System Performance - API latency chart (rolling 20 requests) 8. 📡 Recent Activity - Last 10 events log
Fantasy402 Integration (5 cards): 9. 🎲 Live Bets - In-flight wagers + volume chart (last 5 min buckets) 10. 🤖 Agent Performance - Total PNL + top 3 agents leaderboard 11. 👥 Customer Pulse - Active customers (30 min) + total staked today 12. 💸 Transaction Ticker - Last 10 transactions stream 13. 🔍 DNS Resolve - fantasy402.com IP + DoH latency
Configuration:
- Auto-detects localhost (
http://localhost:8787) vs production - Editable worker URL in header
- Real-time updates every 5 seconds
- Performance tracking with Chart.js visualizations
Access:
# Serve dashboard (requires separate web server)
# Example with Python:
cd dashboards && python3 -m http.server 8080
# Access: http://localhost:8080/floor-control.html
# Or use any static file server:
npx serve dashboards -p 8080Unified Endpoint:
# Dashboard calls single endpoint for all Fantasy402 data:
curl -s http://localhost:8787/api/f402/mission-control | jq '.'Returns:
floor- Floor health metricsgrove- Worker/DB/Queue statusmcp- MCP tools count and listliveBets- Count, volume, 5-min bucketsagents- Total PNL, top performerscustomers- Active count, total stakedtransactions- Last 10 transaction streamtimestamp,requestId,dataSource(kv/mock)
Data Layer
D1 Database (SQLite, serverless)
Tables:
line_movements- Line changes with volume (7-day TTL)sharp_indicators- Customer profiling (hourly refresh)exposure_tracking- Real-time exposure (30s refresh)steam_dedupe- Deduplication (5-min TTL)bet_history- Historical bets for analytics ✨ NEWhold_tracking- Hold % history for forecasting ✨ NEW
Migrations: migrations/*.sql (auto-applied via wrangler.toml)
See migrations/ for detailed schema.
KV Storage
BET_TICKER_RAW- Intercepted API responses (7-day retention)TOKEN_STORE- MCP authentication tokensUSER_STORE- User dataSESSION_STORE- Session managementREFRESH_STORE- Refresh tokensLIVEBETS_STORE- Live betting data
Queues
line-ingress- Batch: 10 messages, Timeout: 5ssteam-webhook- Batch: 5 messages, Timeout: 10ssteam-processor- MCP event processing ✨ NEWexposure-calculator- MCP exposure calc ✨ NEW
Analytics Engine
ANALYTICS_ENGINE- Metrics collection (seemonitoring/grafana/)
Configuration
Environment Files:
wrangler.toml- Base configuration.env.local- Local environment variables (git-ignored)
Key Bindings:
[[d1_databases]]- D1 with migrations[[queues.producers]]/[[queues.consumers]]- Queue config[[kv_namespaces]]- KV bindings[[analytics_engine_datasets]]- Analytics[triggers]- Cron schedules[limits]- Resource limits (50ms CPU)
Testing Architecture
Test Runner: Bun Test (not Jest/Vitest)
Structure:
tests/unit/*.test.ts- Core metrics unit teststests/integration/*.test.ts- Queue, schedule, trigger testsscripts/test-handlers-direct.ts- Direct MCP handler testing ✨ NEW
Status:
- ✅ All unit/integration tests passing
- ✅ All 9 MCP handlers tested and working
- ⚠️ ~89 TypeScript errors in non-critical code (see archived docs)
Running Tests:
bun test # All tests
bun test tests/unit/clv.test.ts # Single file
bun scripts/test-handlers-direct.ts # MCP handlers (bypasses server)Important Patterns
1. TypeScript with Cloudflare Workers
- No build step for dev (Bun executes TS directly)
- Production builds target
bunruntime - Uses
@cloudflare/workers-types tsconfig.jsonusesmoduleResolution: "bundler"
2. Zod Validation
All external inputs validated with Zod:
- API parameters
- BetTicker metadata
- Tool inputs/outputs
- MCP protocol messages
3. CORS Handling
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type',
};4. Request ID Tracking
const requestId = Date.now().toString(36);
console.log(`[${requestId}] ...`);5. Async Storage
Worker uses ctx.waitUntil() to avoid blocking responses
6. Cost Cap Guardrails
Hard limits enforced with graceful degradation (see src/guards/costCap.ts)
Development Workflow
Quick Start
bun install # Install dependencies
bun run dev # Start dev serverTesting Workflow
# Unit/integration tests
bun test
# MCP handler direct testing (recommended)
bun scripts/test-handlers-direct.ts
# Or test via HTTP (requires server running)
wrangler dev --local
curl -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'Deployment
# Apply database migrations first
wrangler d1 migrations apply betting-analytics --remote
# Deploy worker
wrangler deploy
# Verify
curl -s https://YOUR-WORKER.workers.dev/health
curl -X POST https://YOUR-WORKER.workers.dev/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'Important Notes
- Bun Runtime: This is Bun-native. Use
buncommands, notnpm. - MCP Integration: 13 working tools accessible via
/mcpendpoint. Test with direct handler script for faster iteration. - Database Migrations: Located in
migrations/. Auto-applied on deployment. Usewrangler d1 migrations applyfor manual application. - Rate Limiting: In-memory per worker instance. For multi-instance, consider Durable Objects.
- Cron Limitations: 30s exposure calc runs every minute (closest possible).
- Extension Testing: Use
tools/testing/extension-injection-tester.html. - Type Safety: Always run
bun run type-checkbefore deploying. - Target Origin: BetTicker sniffer proxies to
fantasy402.com. - MCP Testing: Use direct handler tests (
scripts/test-handlers-direct.ts) for fastest validation without server. - Database Schema: Check
migrations/0003_mcp_tables.sqlfor MCP-specific tables (bet_history, hold_tracking).
Key Documentation
Essential Docs (Current)
- README.md - Main project documentation
- docs/INDEX.md - Documentation map
- docs/QUICKSTART.md - Quick setup
- docs/DEPLOYMENT.md - Deployment guide
- docs/AUTOMATION_GUIDE.md - Testing workflows
- docs/IMPLEMENTATION_SUMMARY.md - Technical deep-dive
- docs/BET_TICKER_SNIFFER.md - API interception
- docs/MCP_TESTING_GUIDE.md - MCP testing guide ✨ NEW
- docs/DASHBOARD_API_STATUS.md - Dashboard endpoint status & fixes ✨ NEW
MCP Integration Docs (Current) ✨ NEW
- docs/MCP_INTEGRATION_STATUS.md - Current MCP status
- docs/TESTING_STATUS.md - Testing status and next steps
- docs/ERROR_PATH_TESTING.md - Error path test suite (299 tests, 81% coverage) ✨ NEW
- docs/MCP_TESTING_GUIDE.md - Comprehensive testing guide
Code Organization & Rules ✨
- docs/CURSOR_RULES.md - AI assistant rules guide (10 rules)
- docs/ROOT_STRUCTURE.md - Root directory reference
- docs/CODEBASE_REVIEW.md - Comprehensive codebase review
- docs/MCP_ENDPOINTS.md - Complete MCP API reference (13 tools)
- .ast-grep.yml - Code searchability patterns (15+ rules) ✨ NEW
- dashboards/README.md - Dashboard organization (1,350+ shared lines) ✨ NEW
- .cursor/rules/ - Active Cursor rules (2,200+ lines):
root-organization.mdc- Root directory policy (CRITICAL)bun-runtime.mdc- Bun usage requirementsdocumentation.mdc- Documentation placementtesting.mdc- Bun Test patternsmcp-integration.mdc- MCP server patternscloudflare-workers.mdc- Workers-specific rulesfile-naming.mdc- Naming conventionsendpoint-routing.mdc- Endpoint routing patternsapi-patterns.mdc- API validation & error handlingcode-searchability.mdc- ast-grep & code search patterns ✨ NEW
Archived Documentation
- docs/archive/ - Historical docs, migration reports, obsolete guides
🔍 Code Searchability & Navigation
Quick File Finder Patterns
MCP Integration:
# Find MCP handlers
find src/mcp/handlers -name "*.ts"
# Search MCP types
grep -r "MCPToolResult" src/mcp/
# Find tool definitions
cat src/mcp/tools.tsTesting:
# Find all test files
find tests -name "*.test.ts"
# Search for specific test
grep -r "describe.*CLV" tests/
# Find mocks
ls tests/mocks/Documentation:
# Find all markdown docs
find docs -name "*.md"
# Search docs for topic
grep -r "MCP" docs/
# List guides
ls docs/guides/Key Code Locations
| Feature | Location | Key Files |
| MCP Server | src/mcp/ | server.ts, toolRegistry.ts, tools.ts, types.ts |
| MCP Handlers | src/mcp/handlers/ | 9 handler files (steamMoves.ts, etc.) |
| Intelligence APIs | src/tools/intelligence/ | getBettingExposure.ts, getCLV.ts, etc. |
| BetTicker Sniffer | src/interceptors/ | bet-ticker-sniffer.ts |
| Queue Consumers | src/queues/ | lineIngress.ts, steamWebhook.ts |
| Scheduled Jobs | src/schedules/ | sharpCalc.ts, exposureCalc.ts |
| Guards | src/guards/ | rateLimit.ts, costCap.ts |
| Types | src/types/ | api.ts (all interfaces) |
| Tests | tests/unit/, tests/integration/ | *.test.ts files |
| Cursor Rules | .cursor/rules/ | 7 .mdc rule files |
MCP Endpoint Map
POST /mcp → handleMCPRequest() [src/mcp/server.ts]
├── initialize → capabilities
├── tools/list → tool definitions [src/mcp/tools.ts]
└── tools/call → [src/mcp/toolRegistry.ts]
├── getBettingExposure → [src/tools/intelligence/getBettingExposure.ts]
├── getCLV → [src/tools/intelligence/getCLV.ts]
├── getHoldPercentage → [src/tools/intelligence/getHoldPercentage.ts]
├── getSharpScore → [src/tools/intelligence/getSharpScore.ts]
├── getSteamMoves → [src/mcp/handlers/steamMoves.ts]
├── getRiskConcentration → [src/mcp/handlers/riskConcentration.ts]
├── getSharpActivity → [src/mcp/handlers/sharpActivity.ts]
├── getTimeSeriesCLV → [src/mcp/handlers/timeSeriesCLV.ts]
├── getEnhancedSharpScore → [src/mcp/handlers/enhancedSharpScore.ts]
├── getHoldForecast → [src/mcp/handlers/holdForecast.ts]
├── getHandleAndHold → [src/mcp/handlers/handleAndHold.ts]
├── getCustomerVolume → [src/mcp/handlers/customerVolume.ts]
└── getTimeSeriesAnalytics → [src/mcp/handlers/timeSeriesAnalytics.ts]Database Schema Reference
D1 Database: betting-analytics (ANALYTICS binding)
├── line_movements # [migrations/0001_initial_schema.sql]
├── sharp_indicators # [migrations/0001_initial_schema.sql]
├── exposure_tracking # [migrations/0001_initial_schema.sql]
├── steam_dedupe # [migrations/0002_add_ttl.sql]
├── bet_history # [migrations/0003_mcp_tables.sql] ✨ NEW
└── hold_tracking # [migrations/0003_mcp_tables.sql] ✨ NEW
Test Data: [migrations/0004_test_data.sql]MCP Quick Reference ✨ NEW
Testing MCP Tools
# Direct handler testing (fastest, no server needed)
bun scripts/test-handlers-direct.ts
# HTTP testing (requires server)
curl -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "getEnhancedSharpScore",
"arguments": {
"cid": "test-customer-1",
"lookbackDays": 30,
"includeFeatures": true
}
}
}'MCP Tool Categories
Intelligence (4 tools):
- getBettingExposure, getCLV, getHoldPercentage, getSharpScore
Live Betting (3 tools):
- getSteamMoves, getRiskConcentration, getSharpActivity
Analytics (6 tools):
- getTimeSeriesCLV, getEnhancedSharpScore, getHoldForecast, getHandleAndHold, getCustomerVolume, getTimeSeriesAnalytics
MCP Algorithms
3-Sigma Steam Detection:
CRITICAL: Δline ≥ 2.0 AND Δvolume > 1000
HIGH: Δline ≥ 1.0 AND Δvolume > 500
MEDIUM: Δline ≥ 0.5 AND Δvolume > 100Enhanced Sharp Score (0-100):
Core (40pts): CLV (0-20) + Win Rate (0-15) + Volume (0-5)
Advanced (60pts): Steam Correlation + Timing + Sizing + Diversity (0-15 each)
Classifications:
75-100: PROFESSIONAL_SHARP (CRITICAL risk)
60-74: ADVANCED_SHARP (HIGH risk)
45-59: INTERMEDIATE_SHARP (MEDIUM risk)
30-44: CASUAL_SHARP (LOW-MEDIUM risk)
0-29: RECREATIONAL (LOW risk)Hold Forecasting:
Linear Regression: y = mx + b
Confidence Interval: ±1.96σ (95%)
Anomaly Detection: |value - μ| > 2σ🚀 Quick Start Guide
Local Development Setup
# 1. Start the worker
wrangler dev --local
# Worker available at: http://localhost:8787
# 2. Serve the dashboard (separate terminal)
cd dashboards && python3 -m http.server 8080
# Dashboard available at: http://localhost:8080/floor-control.html
# 3. Install browser extension
# - Open chrome://extensions/
# - Enable "Developer mode"
# - Click "Load unpacked"
# - Select browser-extension/ folder
# - Extension v1.0.9 will intercept Fantasy402 API calls
# 4. Test the flow
curl http://localhost:8787/health
curl -s http://localhost:8787/api/f402/mission-control | jq '.liveBets'Extension Testing
# 1. Visit https://fantasy402.com/
# 2. Check browser console (F12) for:
[Fantasy402] 🚀 Interceptor initialized
[Fantasy402] 🔍 Intercepting: /cloud/api/Manager/getBetTicker
[Fantasy402] ✅ Forwarded to worker: /cloud/api/... (200)
# 3. Check background console (chrome://extensions → Inspect):
POST http://localhost:8787/api/fantasy402/ingest 200 OK
# 4. Dashboard should show live data populatingCommon URLs
| Service | URL | Purpose |
| Worker Health | http://localhost:8787/health | Check worker status |
| MCP Endpoint | http://localhost:8787/mcp | JSON-RPC 2.0 tools |
| Mission Control | http://localhost:8787/api/f402/mission-control | Unified dashboard API |
| Dashboard | http://localhost:8080/floor-control.html | Real-time monitoring UI |
| Extension | chrome://extensions/ | Manage browser extension |
Troubleshooting
# Worker not responding?
lsof -i :8787 # Check if port is in use
wrangler dev --local # Restart worker
# Dashboard shows zeros?
# → No data intercepted yet (extension needs real Fantasy402 traffic)
# Extension CORS errors?
# → Make sure background.js has forwardToWorker handler (v1.0.9+)
# → Reload extension after manifest changes
# KV data not persisting?
# → wrangler dev --local uses ephemeral storage
# → Data flows through but doesn't persist between restartsLast Updated: 2025-10-08 Betting-Brain v3 - Production-Ready Edge-Native Betting Intelligence with MCP Integration Extension v1.0.9 - Mission Control Dashboard - 13 Live Cards
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
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.

