A civic technology platform designed to bridge political divides through structured, respectful conversation.
The Problem
Political discourse has become increasingly polarized. People retreat into echo chambers, only engaging with those who already agree with them. Social media algorithms optimize for outrage, not understanding. We've lost the ability to have productive conversations with people who see the world differently.
The Solution
Social Compromise creates a space for genuine dialogue across the aisle. It's not about changing minds - it's about understanding why people believe what they believe.
Core Features
Anonymous Matching - Enter a topic (immigration, healthcare, climate change, etc.) and your general position. The system matches you with someone holding a different view. No profile pictures, no names - just ideas. Anonymity removes social pressure and encourages honesty.
Real-Time Chat - Have a live conversation with your match. A moderation system ensures civility - personal attacks and slurs are filtered, but strong disagreement is welcome. The goal is productive friction, not artificial harmony.
AI Practice Partners - Not ready to talk to a real person? Practice first with an AI opponent powered by Claude. The AI can argue any position convincingly, helping you understand opposing viewpoints and refine your own arguments. It'll push back on weak logic without getting emotional.
Perspectives Library - Browse well-researched arguments from multiple sides of contentious issues. Each perspective includes:
- Core beliefs and values driving the position
- Common arguments and evidence cited
- Acknowledgment of trade-offs and downsides
- Steelman (strongest) version of the argument
Media Framing Analysis - See how the same story gets covered differently across the political spectrum. Compare headlines, framing, and emphasis from outlets like Fox News, CNN, NPR, and others. Understanding media bias is the first step to seeing through it.
Conversation Guidelines
Every chat includes gentle reminders:
- Ask questions before making assumptions
- Attack arguments, not people
- Acknowledge good points, even from the other side
- It's okay to say 'I don't know' or 'I'll think about that'
Archived Discussions
With user consent, productive conversations are anonymized and archived. These serve as examples of how civil discourse can work - real people finding common ground (or respectfully disagreeing) on difficult topics.
A full-stack web application combining real-time communication, AI integration, and content management for civic discourse.
Architecture Overview
+-- Static Files (public/)
|
Client <---> Starlette Router --+-- API Routes (REST)
| +-- WebSocket Endpoints
| +-- SEO Templates (Jinja2)
|
+-- Services Layer
| +-- ChatService
| +-- MatchingService
| +-- ModerationService
| +-- ClaudeService
|
+-- Data Layer (DAOs)
+-- ChatDAO
+-- IssuesDAO
+-- ViewpointsDAO
+-- MediaFramingDAO
Real-Time Chat Implementation
WebSocket Protocol - Native Starlette WebSocket support. Each chat room is identified by a unique ID. Messages flow:
User A types -> WS to server -> Validate -> Moderate -> WS to User B
Message Schema:
class ChatMessage(AppModel):
id: str
room_id: str
sender: str # Anonymous ID like 'User-A'
content: str
timestamp: datetime
moderated: bool # True if content was filtered
Connection Management - In-memory dict of active WebSocket connections per room. Handles reconnection gracefully with message replay on rejoin.
AI Integration (Claude API)
Debate Partner Mode - When matched with AI, the system prompts Claude with:
- The topic and the position to argue
- Conversation history for context
- Instructions to be persuasive but civil
- Guidance to ask probing questions
Rate Limiting - Configurable daily cap on AI API calls per user. Tracked via user session cookies. Default: 50 messages/day to AI.
Cost Management - Claude Haiku for quick responses, Claude Sonnet for complex follow-ups. Average cost per conversation: ~$0.02.
Moderation System
Profanity Filter - better-profanity library catches obvious slurs and insults. Filtered content is replaced with asterisks but the message is still delivered (user knows they were filtered).
Pattern Detection - Regex patterns catch personal attacks even when no profanity is used ('you're an idiot' vs 'that argument is weak').
Manual Review Queue - Flagged conversations can be reviewed by moderators for pattern improvement.
Data Storage
File-Based JSON - Each data type stored in its own directory:
data/
chats/ # Archived conversations
issues/ # Topic definitions
viewpoints/ # Perspective library content
media_framing/ # News coverage comparisons
Why not a database? - Content is mostly static (curated perspectives, media examples). Chat archives are append-only. JSON files are human-readable, easy to version control, and require zero setup.
Background Tasks
APScheduler handles periodic tasks:
- Clean up abandoned chat rooms (no messages in 30 min)
- Refresh media framing examples (fetch new headlines daily)
- Aggregate usage statistics
Frontend Architecture
Vanilla JS SPA - Single page app without frameworks. Chat interface updates via WebSocket messages. Navigation via History API.
SEO Pages - Jinja2 templates for /issues/{topic} pages that search engines can index. These link to the interactive app but contain static content for discoverability.