Stop trusting AI blindly. Start verifying instantly.
Every AI β ChatGPT, Claude, Gemini, Copilot β confidently says things that are completely wrong.
- π₯ Doctors get wrong drug dosages
- π Students get fake citations
- βοΈ Lawyers get invented case law
- π¬ Researchers get fabricated statistics
Nobody knows when AI is lying until it's too late.
TruthLens is a Chrome extension that sits on top of any AI chatbot and automatically verifies every factual sentence in real time.
A coloured dot appears next to each sentence:
| Dot | Meaning | Example |
|---|---|---|
| π’ Green | Verified by trusted sources | "Water boils at 100Β°C at sea level" |
| π‘ Yellow | Could not verify β use caution | "About 70% of the ocean is unexplored" |
| π΄ Red (pulses) | Contradicts known facts β do not trust | "Aspirin is safe for children under 12" |
| βͺ Grey | Not a factual claim | "Hello, how are you?" |
- Real-Time Streaming Detection β Reads AI output as it streams, sentence by sentence
- Multi-Source Cross-Checking β Verifies against Wikipedia, PubMed (medical research), and Wikidata simultaneously
- AI-Powered Claim Detection β Uses Groq Llama 3.3 70B to classify claims and compare with sources
- Dual-Prompt System β Separate medical-expert and general fact-checker prompts for accurate verdicts
- PostgreSQL Caching β Previously verified claims return instantly from the database
- Intelligent PubMed Routing β Only queries PubMed for medical/scientific claims, saving API calls
- Source Relevance Filtering β Keyword and AI-based pre-checks prevent false verdicts from unrelated sources
- Request Queue & Rate Limiting β Handles Groq API limits gracefully with debounced processing
- Polished Click Popups β Click any dot to see the reason, sources, and a colour-coded top bar
- Red Dot Pulse Animation β Contradicted claims pulse to draw immediate attention
- Floating Sidebar Panel β Real-time stats (Checked / Verified / Uncertain / Contradicted) on every page
- Extension Popup β Professional popup with session stats, enable/disable toggle, and dot legend
- SPA-Resilient β WeakMap-based caching ensures dots persist across DOM re-renders (Gemini, Claude)
| Platform | Status |
|---|---|
ChatGPT (chatgpt.com) |
β Full Support |
Claude (claude.ai) |
β Full Support |
Gemini (gemini.google.com) |
β Full Support |
Copilot (copilot.microsoft.com) |
β Full Support |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CHROME EXTENSION β
β β
β content.ts βββΊ MutationObserver detects AI sentences β
β β β
β βΌ β
β background.ts βββΊ Forwards to backend via fetch β
β β (bypasses CSP restrictions) β
β βΌ β
β popup.ts βββΊ Stats display + enable/disable toggle β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ HTTPS
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BACKEND (Render) β
β β
β POST /api/check β
β β β
β ββββΊ PostgreSQL Cache βββΊ HIT? Return instantly β
β β β
β ββββΊ Groq Llama 3.3 βββΊ Is this a factual claim? β
β β β
β ββββΊ Wikipedia API βββ β
β ββββΊ PubMed API ββββββ€βββΊ Source Relevance Filter β
β β β β
β ββββΊ Groq Comparison ββββΊ Medical or General Prompt β
β β β
β ββββΊ Cache Result + Return Verdict β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Node.js 20+
- pnpm
- Chrome browser
- Groq API key (get one free)
cd backend
pnpm install
cp .env.example .env
# Edit .env: add GROQ_API_KEY and DATABASE_URL (optional)
pnpm run devcd extension
pnpm install
pnpm run buildThen:
- Open
chrome://extensions/in Chrome - Enable Developer Mode (top right toggle)
- Click Load unpacked
- Select the
extension/distfolder
truth-lens/
βββ extension/ # Chrome Extension (Manifest V3)
β βββ manifest.json # Extension configuration
β βββ popup.html # Popup UI with stats & toggle
β βββ popup.css # Popup styles
β βββ icons/ # Extension icons (16/48/128px)
β βββ src/
β β βββ content.ts # MutationObserver + dot injection + sidebar
β β βββ background.ts # Service worker + API routing + storage
β β βββ popup.ts # Popup logic + toggle state
β βββ store-assets/ # Chrome Web Store listing
β β βββ description.txt # Store description (short + full)
β βββ PRIVACY_POLICY.md # Privacy policy for store submission
β βββ package.json
β βββ tsconfig.json
β βββ vite.config.ts
βββ backend/ # Fact-checking Node.js API
β βββ src/
β β βββ index.ts # Express server + CORS + rate limiting
β β βββ routes/
β β β βββ check.ts # /api/check + /api/cache/clear endpoints
β β βββ services/
β β β βββ groq.ts # Claim detection + dual-prompt comparison
β β β βββ wikipedia.ts # Wikipedia REST API integration
β β β βββ pubmed.ts # PubMed NCBI API (medical claims only)
β β βββ db/
β β βββ cache.ts # PostgreSQL connection + MD5 caching
β βββ package.json
β βββ tsconfig.json
β βββ Procfile
β βββ .env.example
βββ README.md
Verify a factual claim.
// Request
{ "sentence": "The human body has 206 bones" }
// Response
{
"result": "green",
"reason": "Claim confirmed by Wikipedia source",
"sources": ["Wikipedia"],
"cached": false
}Clear cached verdict for a specific sentence.
// Request
{ "sentence": "The human body has 206 bones" }
// Response
{ "cleared": true }Health check endpoint.
{ "status": "ok", "timestamp": "2026-05-13T04:45:07.355Z" }TruthLens uses a 4-layer defense system to ensure correct facts never get red dots:
| Layer | Where | What It Does |
|---|---|---|
| 1. Smart Search | wikipedia.ts |
Extracts keywords from claims instead of raw sentence search |
| 2. Keyword Filter | check.ts |
Removes sources that don't share β₯2 key words with the claim |
| 3. AI Relevance Check | groq.ts |
Asks "is this source about the same topic?" before comparison |
| 4. Strict Prompts | groq.ts |
RED only for direct, explicit contradictions with evidence |
Medical claims bypass layers 2 & 3 β dangerous misinformation like "Aspirin is safe for children" must always reach the medical-expert prompt to get a proper RED verdict.
| Component | Technology |
|---|---|
| Extension | TypeScript, Vite, Chrome Manifest V3 |
| Backend | Node.js, Express, TypeScript |
| AI Model | Groq Llama 3.3 70B Versatile |
| Databases | PostgreSQL (claim caching) |
| APIs | Wikipedia REST, PubMed NCBI, Wikidata |
| Deployment | Render (backend), GitHub (source) |
| Security | CORS, express-rate-limit (30 req/min) |
TruthLens respects your privacy:
- β Only sentence text is sent for verification
- β No personal information collected
- β No browsing history tracked
- β No login credentials accessed
- β No cookies used
Full privacy policy: extension/PRIVACY_POLICY.md
| Week | Milestone | Status |
|---|---|---|
| 1 | Project setup, extension scaffold, backend API | β Complete |
| 2 | MutationObserver, Groq integration, Wikipedia/PubMed | β Complete |
| 3 | Request queue, rate limiting, streaming detection | β Complete |
| 4 | Railway deployment, CORS, CSP bypass via service worker | β Complete |
| 5 | PostgreSQL caching, smart PubMed routing, MD5 hashing | β Complete |
| 6 | UI polish, sidebar, popup stats, store assets, Render migration | β Complete |
Contributions are welcome! This is a student open-source project.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
Built with β€οΈ by Logesh Murugan
Powered by Groq Β· Wikipedia Β· PubMed Β· PostgreSQL