xAI Hackathon 2025
A Chrome extension powered by Grok AI that provides real-time content moderation on X.com, detecting scams, impersonators, and misinformation through instant analysis and multi-agent debate systems.
- Node.js 18+
- Chrome/Chromium browser
- Grok API key (set in
.env.local)
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Add your GROK_API_KEY to .env.local# Terminal 1: Start the API server
npx tsx api/server.ts
# Terminal 2: Start the dashboard (optional)
npm run dashboard
# Terminal 3: Load the Chrome extension
# 1. Open Chrome → chrome://extensions/
# 2. Enable "Developer mode"
# 3. Click "Load unpacked"
# 4. Select the `extension/` folderGrokGuard monitors your X.com feed in real time and:
- ⚡ Instant Analysis: Uses
grok-3-minito analyze posts as you scroll - 🛡️ Scam Detection: Collapses dangerous posts with smooth animations
⚠️ Misinformation Labeling: Flags false claims with fact-check badges- 📊 Live Dashboard: Track stats (Scanned, Blocked, Flagged, Fact-Checked, Misinfo)
- 🤖 Multi-Agent Debate: Deep profile analysis using Prosecutor/Defender/Arbiter agents
- 🔍 Fact-Checking: Autonomous investigation with source credibility checks
X.com Feed → Chrome Extension → API Server → Grok AI
↓
Instant Analysis (grok-3-mini)
↓
[Scam] → Collapse Post
[Suspicious] → Flag Badge
[Clean] → Continue Monitoring
Username Input → Investigator Agent (plans investigation)
↓
[Fetches X API Data]
↓
Prosecutor ⚖️ Defender (Multi-turn debate)
↓ ↓
Round 1, Round 2, Round 3...
↓
[Consensus Reached]
↓
Final Verdict
All agents powered by grok-4-1-fast-reasoning
- ✅ Real-time feed monitoring with
MutationObserverandIntersectionObserver - ✅ Pre-scanning posts 2000px ahead for better UX
- ✅ Post state persistence using IndexedDB
- ✅ Smooth collapse animations for blocked posts
- ✅ Misinformation badges with confidence scores
- ✅ Clickable stats sidebar to view filtered posts
- ✅ Auto-scroll to posts when clicking from dashboard
- ✅ Instant post analysis endpoint (
/api/analyze-post) - ✅ Fact-checking endpoint (
/api/fact-check) with claim detection - ✅ Stats endpoint (
/api/stats) for dashboard data - ✅ Multi-agent debate for profile analysis (
/api/analyze) - ✅ Feedback endpoint (
/api/feedback) for learning
- ✅ Real-time stats (Scanned, Blocked, Flagged, Fact-Checked, Misinfo)
- ✅ Post filtering by category (All, Blocked, Flagged, Fact-Checked, Misinfo)
- ✅ Activity logs with timestamps
- ✅ Black & white theme with glass-morphism effects
- ✅ Direct links to original X.com posts
- Autonomous Tool Use: Investigator agent decides which X API endpoints to call
- Multi-Turn Debate: Prosecutor and Defender iterate until consensus
- Investigation Planning: AI plans its own data gathering strategy
- Consensus Detection: Stops debating when agents converge (cost optimization)
- Adaptive Reasoning: Agents adjust confidence based on new evidence
- Investigator: Plans investigation and fetches X API data
- Prosecutor: Builds case that content is harmful
- Defender: Protects free speech, argues for legitimacy
- Arbiter: Makes final decision after reviewing debate
Uses grok-3-mini with conservative prompt:
- SCAM: Crypto giveaways, phishing links, impersonation, "verify account" scams
- SUSPICIOUS: Unverified financial claims, suspicious URLs, too-good-to-be-true offers
- CLEAN: Normal tweets, opinions, news, legitimate promotions
Blocked if: classification === "scam" || classification === "suspicious"
Uses grok-4-1-fast-reasoning for:
- Claim detection
- Source credibility verification
- Community context search
- Confidence scoring
Skipped for: Verified accounts, credible sources (Forbes, BBC, etc.)
- Collapse Animation: Blocked posts smoothly collapse with 1.2s animation
- Badge System:
- 🟢 Clean badge for legitimate posts
⚠️ Warning badge for suspicious posts- 🔴 Misinformation badge for false claims
- Stats Banner: Fixed position showing real-time counts
- Sidebar: Click stats to view filtered posts
- Toast Messages: User feedback for actions
Instant analysis for feed posts.
Request:
{
"username": "example_user",
"text": "Post content here"
}Response:
{
"verdict": {
"classification": "scam" | "suspicious" | "legitimate",
"confidence": 0-100,
"recommendedAction": "quarantine" | "flag" | "no_action",
"reasoning": "Brief explanation"
}
}Fact-checking with claim detection.
Request:
{
"username": "example_user",
"text": "Post content here",
"tweetUrl": "https://x.com/user/status/123"
}Response:
{
"hasClaim": true,
"claim": "Detected claim text",
"verdict": "true" | "false" | "unverifiable",
"confidence": 0-100,
"reasoning": "Explanation",
"sources": ["source1", "source2"]
}Real-time dashboard statistics.
Response:
{
"stats": {
"scanned": 100,
"blocked": 5,
"flagged": 3,
"factChecked": 10,
"misinformation": 2
},
"recentPosts": [...],
"activityLog": [...]
}.
├── extension/ # Chrome extension (Manifest V3)
│ ├── manifest.json
│ ├── background.js # Service worker
│ ├── feed-monitor.js # Content script
│ └── content.css # Extension styles
├── api/ # Express.js API server
│ └── server.ts
├── lib/ # Core libraries
│ ├── agents/ # AI agents
│ │ ├── instant-analyzer.ts
│ │ ├── fact-checker.ts
│ │ ├── investigator.ts
│ │ ├── prosecutor.ts
│ │ ├── defender.ts
│ │ ├── arbiter.ts
│ │ └── debate-orchestrator.ts
│ ├── grok/ # Grok API client
│ └── x-api/ # X API client
├── app/ # Next.js dashboard
│ ├── page.tsx # Main dashboard
│ ├── layout.tsx
│ └── globals.css
└── SUBMISSION.md # Hackathon submission doc
# Start API server
npx tsx api/server.ts
# Start dashboard
npm run dashboard
# Test agentic system
npx tsx test-agentic-real.ts
# Test instant analyzer
npx tsx test-apis.ts- Problem: AI flagging legitimate accounts
- Solution: Multi-factor legitimacy scoring, source credibility checks, conservative prompts
- Problem: Need fast analysis for feed scrolling
- Solution: Hybrid approach -
grok-3-minifor instant,grok-4-1-fast-reasoningfor deep analysis
- Problem: UI disappearing after page navigation
- Solution: Heartbeat checks, state recovery,
MutationObserverfor navigation detection
- ✅ Truly agentic: Autonomous investigation + multi-turn debate
- ✅ Zero false positives on verified accounts
- ✅ Real-time feed protection with instant AI analysis
- ✅ Production-ready Chrome extension with smooth UX
- ✅ Comprehensive dashboard for monitoring and analytics
- Grok AI (
grok-3-mini,grok-4-1-fast-reasoning) - Chrome Extension API (Manifest V3)
- TypeScript
- Express.js
- Next.js
- React
- Human-in-the-loop learning from feedback
- Supabase integration for persistent analytics
- Web search integration for advanced fact-checking
- Mobile browser support
- Community notes integration
- Advanced source credibility database
Powered by Grok AI | Real-time protection for X.com