Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Research Forum

dev-mondoshawan edited this page Apr 15, 2026 · 1 revision

Research Forum

The AI Triad Forum is an optional research-enhanced debate component that augments the main Dissensus engine with real-time web research.


Overview

While the main Dissensus Engine uses pure AI reasoning, the Research Forum adds a web research layer that grounds debates in current facts and data. This creates debates that are:

  • Evidence-based — Agents cite real sources and current data
  • Time-aware — Incorporates latest developments and market conditions
  • Domain-specific — Adapts research strategy based on topic category

Tech Stack

Component Technology
Backend Python 3.x + Flask
Frontend Vanilla JavaScript (ES6+)
Styling CSS3 with custom properties
Web Research DuckDuckGo HTML search
Server Flask development server (or WSGI for production)

How It Works

1. Web Research via DuckDuckGo

When a topic is submitted, the system conducts multi-angle searches:

def research_topic(topic):
 searches = {}
 topic_lower = topic.lower()
 
 # Always search the main topic
 searches['main'] = web_search(topic)
 
 # Domain-specific additional searches
 if is_crypto_topic(topic_lower):
 searches['market'] = web_search(f"{topic} market data 2024 2025")
 searches['criticism'] = web_search(f"{topic} risks problems criticism")
 searches['support'] = web_search(f"{topic} advantages benefits bullish case")
 elif is_ai_topic(topic_lower):
 searches['trends'] = web_search(f"{topic} latest developments 2024 2025")
 searches['criticism'] = web_search(f"{topic} risks concerns criticism")
 searches['support'] = web_search(f"{topic} benefits opportunities")

2. Topic Analysis and Domain Detection

The system analyzes the topic to determine:

  • Domain: crypto, ai, finance, energy, or general
  • Question type: comparison, prediction, exclusivity, normative
  • Specificity: whether it asks for ranked answers
def analyze_topic(topic):
 analysis = {
 'subject': topic,
 'is_question': '?' in topic,
 'is_comparison': bool(re.search(r'\bvs\.?\b|\bversus\b', lower)),
 'is_prediction': bool(re.search(r'\bwill\b|\bfuture\b|\breplace\b', lower)),
 'domain': 'general',
 'wants_specific_answer': bool(re.search(r'\bwhat\b|\bwhich\b|\brank\b', lower))
 }
 
 # Domain detection
 if re.search(r'crypto|bitcoin|blockchain|ethereum', lower):
 analysis['domain'] = 'crypto'
 elif re.search(r'\bai\b|artificial intelligence|machine learning', lower):
 analysis['domain'] = 'ai'
 elif re.search(r'invest|stock|market|financ', lower):
 analysis['domain'] = 'finance'
 elif re.search(r'energy|nuclear|solar|climate', lower):
 analysis['domain'] = 'energy'

3. Fact Extraction

From the research results, the system extracts 10-15 key findings:

def build_research_summary(research_text, max_facts=15):
 lines = [l.strip() for l in research_text.split('\n') if l.strip().startswith('•')]
 facts = []
 seen = set()
 for line in lines:
 fact = line.lstrip('• ').strip()
 if len(fact) > 30 and fact[:50] not in seen:
 seen.add(fact[:50])
 facts.append(fact)
 return facts[:max_facts]

4. Research-Backed Agent Reasoning

Each agent generates their opening statement using the extracted facts:

CIPHER (The Skeptic):

  • Focuses on critical facts: risks, problems, concerns, declines
  • Challenges optimistic assumptions
  • Weights downside scenarios

NOVA (The Optimist):

  • Focuses on positive facts: growth, adoption, partnerships, billions
  • Emphasizes structural advantages
  • Highlights asymmetric upside

PRISM (The Analyst):

  • Balances both perspectives
  • Establishes analytical framework
  • Pushes for quantifiable claims

5. Cross-Examination with Evidence

Agents challenge each other using specific research findings:

def generate_cross_examination(topic, analysis, facts):
 cipher_to_nova = "NOVA, I need you to defend your claims..."
 if critical_facts:
 cipher_to_nova += "Here's what you're ignoring: "
 for fact in critical_facts[:2]:
 cipher_to_nova += f"{fact} "
 
 nova_to_cipher = "CIPHER, your skepticism is selectively applied..."
 if positive_facts:
 nova_to_cipher += "You haven't addressed this evidence: "
 for fact in positive_facts[:2]:
 nova_to_cipher += f"{fact} "

6. Consensus Generation with Rankings

The final synthesis provides specific, ranked conclusions:

  • Ranked answers when the topic asks for them
  • Confidence scores (1-10) for each claim
  • Areas of agreement between agents
  • Remaining disagreements with reasoning
  • Research basis citation

Setup Instructions

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Installation

  1. Navigate to the forum directory:
cd /path/to/tri-ai/forum
  1. Install dependencies:
pip install flask flask-cors
  1. Start the server:
python server.py

The server will start on port 80 by default (or the PORT environment variable).

Production Deployment

For production, use a WSGI server like Gunicorn:

pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 server:app

Or use the provided start script:

chmod +x start.sh
./start.sh

API Endpoints

POST /api/discuss

Main endpoint to start a research-backed discussion.

Request:

{
 "topic": "What cryptocurrency will replace Bitcoin?"
}

Response:

{
 "topic": "What cryptocurrency will replace Bitcoin?",
 "research_facts": [
 "Ethereum processes 15-30 transactions per second with plans for sharding",
 "Bitcoin market cap remains above 1ドル trillion as of 2024",
 "Solana has experienced multiple network outages in the past year"
 ],
 "openingStatements": {
 "cipher": "<p>Let me apply rigorous scrutiny...</p>",
 "nova": "<p>I want to make the evidence-based case...</p>",
 "prism": "<p>Let me establish an analytical framework...</p>"
 },
 "crossExamination": {
 "cipherToNova": "<p>NOVA, I need you to defend...</p>",
 "novaToCipher": "<p>CIPHER, your skepticism...</p>",
 "prismToBoth": "<p>Both of you need to get more specific...</p>"
 },
 "rebuttals": {
 "cipher": "<p>Fair pushback. Let me recalibrate...</p>",
 "nova": "<p>I appreciate CIPHER's genuine recalibration...</p>",
 "prism": "<p>Good — we're converging on substance...</p>"
 },
 "synthesis": {
 "consensus": "<p><strong>📊 CONSENSUS RANKED ANSWERS:</strong>...</p>",
 "disagreements": [
 "NOVA ranks the top candidates with higher confidence...",
 "CIPHER believes the timeline for mainstream adoption is 7-10 years..."
 ]
 }
}

GET /api/health

Health check endpoint.

Response:

{
 "status": "ok"
}

Frontend Integration

The forum includes a complete JavaScript frontend in engine.js that:

  1. Displays progress with a visual progress bar
  2. Shows research findings before the debate begins
  3. Animates agent responses with typing indicators
  4. Highlights phases as they complete
  5. Renders consensus with formatted HTML

Example Topics

The frontend includes pre-configured example topics:

  • "What cryptocurrency is most likely to rival or replace Bitcoin's dominance in the next decade?"
  • "Is Solana a better long-term investment than Ethereum? Rank the top 5 Layer 1 blockchains."
  • "Is fully remote work sustainable long-term, or will hybrid models win?"
  • "What are the top 3 real-world use cases for blockchain that will drive mainstream adoption?"
  • "Should the world prioritize nuclear energy over solar and wind for climate change?"

Comparison with Main Debate Engine

Feature Main Debate Engine Research Forum
Reasoning Pure AI reasoning Research-backed reasoning
Data source Training data only Real-time web research
Speed ~3-5 minutes ~2-3 minutes (faster, no AI calls)
Cost ~0ドル.008-0.15 per debate Free (no AI API calls)
Streaming Real-time SSE Simulated with delays
Best for Deep analysis, nuance Quick facts, current events
Tech stack Node.js + Express Python + Flask

Use Cases

When to Use the Research Forum

  • Quick fact-checking — Get research-backed opinions fast
  • Current events — Topics that require recent data
  • Cost-sensitive deployments — No AI API costs
  • Demonstrations — Predictable, fast responses for demos

When to Use the Main Engine

  • Deep analysis — Multi-phase dialectical reasoning
  • Nuanced topics — Complex issues requiring extended consideration
  • Production debates — Full streaming experience
  • High-stakes decisions — More thorough agent reasoning

Customization

Adding New Domains

Edit analyze_topic() in server.py:

elif re.search(r'healthcare|medical|medicine', lower):
 analysis['domain'] = 'healthcare'

Custom Search Strategies

Add domain-specific searches in research_topic():

elif analysis['domain'] == 'healthcare':
 searches['clinical'] = web_search(f"{topic} clinical trials")
 searches['regulatory'] = web_search(f"{topic} FDA approval")

Modifying Agent Personalities

Edit the response generators:

  • generate_cipher_opening() — Skeptical perspective
  • generate_nova_opening() — Optimistic perspective
  • generate_prism_opening() — Analytical perspective

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /