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