Orchestrated Reasoning for Accurate Calibrated Likelihood Estimation
ORACLE is an advanced AI-powered forecasting system that generates well-calibrated probability estimates for future events. It uses a multi-layered pipeline with multiple AI agents that research, deliberate, debate, and synthesize their estimates to produce accurate and reliable forecasts.
- 5-Layer Forecasting Pipeline: Systematic approach combining research, estimation, debate, risk analysis, and calibration
- Multi-Agent Architecture: 8 diverse AI agents with different analytical perspectives
- Real-Time Web Research: Perplexity and OpenAI deep research integration for up-to-date information
- Adversarial Debate: Agents argue opposing positions to stress-test forecasts
- Black Swan Detection: Identifies low-probability, high-impact tail risks (optional)
- Calibrated Confidence Intervals: Statistical methods for reliable uncertainty quantification
- Multiple Model Support: Choose from Claude, GPT-4, Gemini, DeepSeek, and more via OpenRouter
- Modern Web Interface: Real-time progress tracking, interactive visualizations, dark mode
- Node.js 18+
- npm or yarn
- OpenRouter API key (get one at openrouter.ai)
# Clone the repository git clone <repository-url> cd oracle # Install dependencies npm install # Set up environment variables cp .env.example .env.local # Edit .env.local and add your OPENROUTER_API_KEY # Initialize the database npx prisma db push # Start the development server npm run devOpen http://localhost:3000 to use the application.
Create a .env.local file with:
# Required OPENROUTER_API_KEY=your_openrouter_api_key_here # Optional DATABASE_URL="file:./dev.db" DEBUG=falseORACLE processes forecasting questions through 5 specialized layers:
- Parses the forecasting question into key components
- Identifies relevant reference classes and historical precedents
- Conducts web research to gather current information
- Synthesizes a base rate estimate from historical data
8 diverse AI agents independently analyze the question:
- Base Analyst: Neutral, balanced analysis
- Skeptical Analyst: Focuses on why predictions fail
- Constructive Analyst: Focuses on theories of change
- Historical Analyst: Heavy emphasis on base rates
- Quantitative Analyst: Explicit probability calculations
- Plus 3 additional specialized perspectives
- Agents are paired to argue opposing positions
- Multi-round debates stress-test assumptions
- Convergence analysis measures agreement
- Post-debate estimates incorporate new insights
- Generates tail risk scenarios
- Researches each scenario for plausibility
- Calculates aggregate tail risk adjustments
- Identifies high-impact scenarios that could invalidate forecasts
- Applies temperature scaling for calibration
- Uses extremization based on agent agreement
- Generates final probability distribution
- Produces confidence intervals (50% and 90%)
- Creates quality metrics and methodology summary
oracle/ βββ app/ # Next.js App Router pages β βββ api/ # API routes β β βββ forecast/ # Forecast CRUD endpoints β βββ forecast/[id]/ # Forecast detail page β βββ history/ # Forecast history page β βββ guide/ # User guide page β βββ methodology/ # Methodology documentation β βββ settings/ # User settings page βββ components/ # React components β βββ forecast/ # Forecast-specific components β βββ ui/ # Reusable UI components β βββ layout/ # Layout components β βββ settings/ # Settings components βββ lib/ # Core libraries β βββ oracle/ # Forecasting pipeline β β βββ pipeline.ts # Main orchestration β β βββ layer1-decomposition.ts β β βββ layer2-swarm.ts β β βββ layer3-debate.ts β β βββ layer4-blackswan.ts β β βββ layer5-calibration.ts β β βββ prompts.ts # AI prompts β β βββ config.ts # Runtime configuration β β βββ cache.ts # Response caching β β βββ error-recovery.ts β βββ openrouter.ts # OpenRouter API client β βββ models.ts # Model configurations β βββ types.ts # TypeScript types β βββ validations.ts # Zod schemas β βββ db.ts # Database client β βββ store.ts # Zustand store βββ prisma/ # Database schema β βββ schema.prisma βββ hooks/ # Custom React hooks βββ docs/ # Documentation | Model | Provider | Description | Speed | Cost |
|---|---|---|---|---|
perplexity/sonar-reasoning-pro | Perplexity | Search with reasoning (Default) | Medium | High |
perplexity/sonar-deep-research | Perplexity | Deep research | Slow | High |
perplexity/sonar-pro-search | Perplexity | Fast professional search | Fast | Medium |
openai/o3-deep-research | OpenAI | Most comprehensive research | Slow | High |
| Model | Provider | Description | Speed | Cost |
|---|---|---|---|---|
google/gemini-3-flash-preview | Fast, cost-effective (Default) | Fast | Low | |
anthropic/claude-opus-4.5 | Anthropic | Highest capability | Medium | High |
google/gemini-3-pro-preview | Excellent quantitative analysis | Fast | Medium | |
deepseek/deepseek-v3.2-speciale | DeepSeek | Strong reasoning, low cost | Fast | Low |
POST /api/forecast Content-Type: application/json { "statusQuo": "Current state description (50-5000 chars)", "resolutionConditions": "How the question resolves (20-2000 chars)", "webResearchModel": "perplexity/sonar-reasoning-pro", "reasoningModel": "google/gemini-3-flash-preview", "enableBlackSwan": true }GET /api/forecast/{id}POST /api/forecast/{id}/runGET /api/forecast?limit=10&offset=0&status=COMPLETEDDELETE /api/forecast/{id}See docs/API.md for complete API documentation.
The pipeline can be configured via lib/oracle/config.ts:
// Search limits layer1MaxSearches: 24, // Max searches in Layer 1 layer4MaxSearches: 40, // Max searches in Layer 4 // Caching enableWebSearchCache: true, enableLLMCache: true, // Timeouts webSearchTimeoutMs: 30000, llmCallTimeoutMs: 120000, forecastTimeoutMs: 600000, // Retry configuration maxRetries: 3, retryBaseDelayMs: 1000,import { applyFastPreset, applyThoroughPreset, applyBalancedPreset } from '@/lib/oracle/config'; applyFastPreset(); // Faster, fewer searches applyThoroughPreset(); // More comprehensive, slower applyBalancedPreset(); // Default configurationnpm run dev # Start development server npm run build # Build for production npm run start # Start production server npm run lint # Run ESLint npm run db:push # Push schema to database npm run db:studio # Open Prisma Studio npm run db:generate # Generate Prisma clientORACLE uses SQLite by default with Prisma ORM. To use PostgreSQL:
- Update
prisma/schema.prisma:
datasource db { provider = "postgresql" url = env("DATABASE_URL") }- Update
.env.local:
DATABASE_URL="postgresql://user:password@localhost:5432/oracle"- Run migrations:
npx prisma migrate dev- Specific, time-bound, and objectively verifiable
- Clear resolution criteria
- Sufficient context for research
Examples:
- "Will the Federal Reserve cut interest rates before June 2025?"
- "Will SpaceX successfully launch Starship to orbit by Q2 2025?"
- Vague questions without timeframes
- Subjective or opinion-based questions
- Questions that can't be verified
Examples to avoid:
- "Will the stock market go up?" (no timeframe)
- "Is AI good for society?" (subjective)
- Typical forecast time: 3-8 minutes depending on models
- Token usage: ~50,000-100,000 tokens per forecast
- Caching: Web searches and LLM calls are cached to reduce costs
- Black Swan toggle: Disable to reduce time by ~20%
"OPENROUTER_API_KEY not set"
- Ensure
.env.localexists with your API key - Restart the development server after adding the key
"Forecast stuck in RUNNING"
- Check server logs for errors
- The forecast may have timed out (10 min limit)
- Delete and retry the forecast
"Rate limit exceeded"
- OpenRouter has rate limits per API key
- Wait a few minutes before retrying
- Consider using a paid plan for higher limits
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Next.js and React
- AI models via OpenRouter
- UI components from shadcn/ui
- Inspired by forecasting research from Metaculus and Good Judgment Project