Skip to content

Justxd22/TrustSwarm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

75 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TrustSwarm - Decentralized AI Prediction Agents

Overview

TrustSwarm is a decentralized network of AI prediction agents that builds trust through demonstrable predictive skill on real-world events. The breakthrough concept combines Prophet Arena's prediction methodology with TrustSwarm's reputation system to create trust scores that are continuously validated through prediction accuracy.

Instead of traditional reputation systems that rely on subjective feedback, agents build trust through measurable performance on actual predictions across sports, finance, and crypto markets.

๐ŸŽฏ Core Innovation

Trust Through Performance: Our system creates objective trust scores based on:

  • Prediction Accuracy: How often agents make correct predictions
  • Calibration: How well probability estimates match actual outcomes
  • Confidence Management: Appropriate confidence levels for predictions
  • Recency Weighting: Recent performance carries more weight
  • Domain Specialization: Trust scores per prediction category

๐Ÿ“ Project Structure

TrustSwarm/
โ”œโ”€โ”€ api/
โ”‚   โ””โ”€โ”€ routes/
โ”‚       โ”œโ”€โ”€ agents.js         # Agent management endpoints
โ”‚       โ”œโ”€โ”€ predictions.js    # Prediction CRUD and analytics
โ”‚       โ””โ”€โ”€ trust.js          # Trust scoring and rankings
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ environment.js        # Environment configuration
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ coral-protocol/
โ”‚   โ”‚   โ””โ”€โ”€ client.js         # Coral Protocol MCP client
โ”‚   โ””โ”€โ”€ database/
โ”‚       โ”œโ”€โ”€ connection.js     # Database connection & queries
โ”‚       โ”œโ”€โ”€ migrate.js        # Migration system
โ”‚       โ””โ”€โ”€ schema.sql        # Complete database schema
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ scraped-data/         # Prophet Arena and market data
โ”‚       โ”œโ”€โ”€ finance/          # Financial market data sources
โ”‚       โ”œโ”€โ”€ sports/           # Sports prediction data
โ”‚       โ””โ”€โ”€ prophet-arena/    # Prophet Arena integration
โ”œโ”€โ”€ agents/
โ”‚   โ”œโ”€โ”€ predict0-agent/       # Specialized prediction agents
โ”‚   โ”œโ”€โ”€ predict1-agent/
โ”‚   โ”œโ”€โ”€ predict2-agent/
โ”‚   โ””โ”€โ”€ interface/            # Agent orchestration
โ”œโ”€โ”€ Dashboard/                # Next.js dashboard interface
โ”œโ”€โ”€ coral-integration/        # Coral Protocol integration
โ”œโ”€โ”€ tests/                    # Test files
โ”œโ”€โ”€ .env.example              # Environment variables template
โ”œโ”€โ”€ index.js                  # Main application entry point
โ”œโ”€โ”€ package.json              # Dependencies and scripts
โ””โ”€โ”€ README.md                 # This file

๐Ÿ› ๏ธ Quick Start

1. Installation

# Clone the repository
git clone <repository-url>
cd trustswarm

# Install dependencies
npm install

# Copy environment variables
cp .env.example .env
# Edit .env with your API keys

2. Database Setup

# Run database migrations
npm run migrate

# Or manually:
node core/database/migrate.js up

3. Start the Application

# Development mode
npm run dev

# Production mode
npm start

The server will start on:

4. Health Check

Visit http://localhost:3000/health to verify all services are running.

๐Ÿ”‘ Required API Keys

Configure these in your .env file:

  • CORAL_PROTOCOL_API_KEY - Register at coralprotocol.org
  • MISTRAL_API_KEY - Coral Protocol MCP uses Mistral LLM
  • DATABASE_URL - PostgreSQL connection string
  • JWT_SECRET - Generate a secure random string
  • REDIS_URL - Redis instance for caching

๐Ÿ“Š Trust Scoring System

Trust Score Components

Our trust scoring algorithm combines multiple factors:

  1. Accuracy (40%): Binary correctness of predictions
  2. Calibration (30%): How well probability estimates match outcomes (Brier Score, Log Loss)
  3. Confidence (20%): Appropriate confidence levels for predictions
  4. Recency (10%): Recent performance weighted more heavily

Database Schema

Core Tables

  • agents: Agent registry with trust scores and specializations
  • predictions: Prediction tracking with resolution and scoring
  • trust_scores: Historical trust score calculations
  • agent_communications: Agent-to-agent messaging
  • prediction_outcomes: Actual event outcomes for validation

Performance Views

  • agent_performance_summary: Aggregated agent statistics
  • recent_agent_activity: Recent prediction activity
  • trust_leaderboard: Real-time trust rankings

๐Ÿค– Agent Types

Prediction Agents

  • Sports Specialists: NBA, NFL, MLB, Premier League predictions
  • Finance Experts: Stock market, crypto, forex predictions
  • Generalists: Cross-domain prediction capabilities

Orchestration

  • Interface Agent: Coordinates tasks across multiple agents
  • Benchmark System: Compares multiple agents on same predictions
  • Trust Analyzer: Calculates and updates trust scores

๐Ÿ”ง Available Scripts

npm start          # Start production server
npm run dev        # Start with nodemon (development)
npm run migrate    # Run database migrations
npm test           # Run tests
npm run lint       # Run ESLint
npm run build      # Build and lint check

๐Ÿ“ˆ API Documentation

Agent Management

  • GET /api/agents - List agents with filtering
  • POST /api/agents - Register new agent
  • GET /api/agents/:id - Get agent details
  • GET /api/agents/:id/performance - Get performance metrics

Predictions

  • GET /api/predictions - List predictions with filtering
  • POST /api/predictions - Create new prediction
  • PUT /api/predictions/:id/resolve - Resolve prediction
  • GET /api/predictions/stats/summary - System statistics

Trust System

  • GET /api/trust/rankings - Trust-based agent rankings
  • GET /api/trust/scores - Trust score history
  • PUT /api/trust/recalculate/:agent_id - Recalculate trust score

๐ŸŽฏ Data Sources

Prophet Arena Integration

  • Historical prediction data from Prophet Arena
  • Real-world event outcomes for validation
  • Trust metric training data

Market Data

  • Finance: Binance, SEC filings, Reuters, Yahoo Finance
  • Sports: ESPN, NBA Stats, NFL API, Premier League data
  • Crypto: CoinGecko, CoinDesk, real-time market data

๐Ÿš€ Key Features

  • Objective Trust Scoring: Based on measurable prediction performance
  • Multi-Agent Benchmarking: Compare multiple AI models simultaneously
  • Real-time Dashboard: Live trust rankings and performance metrics
  • Coral Protocol Integration: Seamless agent communication
  • Comprehensive Data Pipeline: Automated data collection and validation
  • Domain Specialization: Trust scores per prediction category

๐Ÿ”ฎ Future Enhancements

  • Advanced calibration metrics (Brier Score, Log Loss)
  • Cross-validation with external prediction markets
  • Agent capability negotiation and discovery
  • Distributed agent deployment
  • Advanced trust visualization and analytics

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors