-
Notifications
You must be signed in to change notification settings - Fork 0
Research Forum
The AI Triad Forum is an optional research-enhanced debate component that augments the main Dissensus engine with real-time web research.
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
| 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) |
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")
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'
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]
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
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} "
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
- Python 3.8 or higher
- pip package manager
- Navigate to the forum directory:
cd /path/to/tri-ai/forum- Install dependencies:
pip install flask flask-cors
- Start the server:
python server.py
The server will start on port 80 by default (or the PORT environment variable).
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
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..."
]
}
}Health check endpoint.
Response:
{
"status": "ok"
}The forum includes a complete JavaScript frontend in engine.js that:
- Displays progress with a visual progress bar
- Shows research findings before the debate begins
- Animates agent responses with typing indicators
- Highlights phases as they complete
- Renders consensus with formatted HTML
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?"
| 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 |
- 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
- 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
Edit analyze_topic() in server.py:
elif re.search(r'healthcare|medical|medicine', lower): analysis['domain'] = 'healthcare'
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")
Edit the response generators:
-
generate_cipher_opening()— Skeptical perspective -
generate_nova_opening()— Optimistic perspective -
generate_prism_opening()— Analytical perspective