Skip to content

tigee1311/TruthLayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TruthLayer – Real-Time AI News Intelligence Layer

TruthLayer is a Chrome extension plus AI backend that adds instant context to news articles while you browse. It scores political bias, explains framing, compares competing narratives, generates spoken summaries, and stores evolving topic history for later review.

Why it matters

News readers rarely get context at the moment they need it. TruthLayer turns any article page into an intelligence surface:

  • a live bias bar appears at the bottom of the page
  • a readable explanation shows why the article leans the way it does
  • a narrative comparison surfaces how the same story can be framed differently
  • a voice summary makes the article skimmable in seconds
  • a persistent timeline captures how coverage around a topic evolves over time

Core capabilities

  • Real-time bias scoring from -1 to +1 with confidence
  • Source-aware analysis blended with article-level framing cues
  • "Why this bias?" panel with highlighted language and concise explanation
  • Narrative clash cards across left, center, and right perspectives
  • ElevenLabs-powered audio summaries
  • InsForge-backed Truth Memory timeline for recent topic history

Demo flow

  1. Open any news article.
  2. TruthLayer injects a bottom intelligence bar.
  3. Click Why this bias? to inspect the article framing.
  4. Click Compare to see how the narrative shifts across perspectives.
  5. Click Listen to play a short spoken summary.
  6. Click Timeline to inspect recent saved coverage on the topic.

Architecture

Chrome extension

  • Manifest V3
  • Injected content script UI
  • On-page article extraction and phrase highlighting
  • One-click interactions for explanation, comparison, voice, and timeline

Backend

  • FastAPI service with clean route/service separation
  • Claude-powered narrative and explanation enrichment
  • ElevenLabs text-to-speech integration
  • InsForge persistence for article memory and timeline retrieval

Tech stack

  • Frontend: Chrome Extension, JavaScript, CSS
  • Backend: FastAPI, Pydantic, HTTPX
  • LLM: Claude
  • Voice: ElevenLabs Python SDK
  • Data layer: InsForge

Repository structure

.
├── backend/
│   ├── main.py
│   ├── routes/
│   └── services/
├── extension/
│   ├── manifest.json
│   ├── content.js
│   └── styles.css
├── .env.example
├── example_elevenlabs.py
├── README.md
└── requirements.txt

Environment setup

Create your local environment file:

cp .env.example .env

Required values:

  • ELEVENLABS_API_KEY
  • INSFORGE_URL
  • INSFORGE_API_KEY

Optional values:

  • ELEVENLABS_VOICE_ID
  • CLAUDE_API_KEY
  • TRUTHLAYER_ALLOWED_ORIGINS

InsForge setup

Create the truthlayer_articles table in InsForge:

create table if not exists truthlayer_articles (
  id bigserial primary key,
  url text not null,
  title text,
  topic text not null,
  source text not null,
  bias_score double precision not null,
  summary text not null,
  timestamp timestamptz not null default now()
);

create index if not exists idx_truthlayer_articles_topic_timestamp
on truthlayer_articles (topic, timestamp desc);

Reference docs:

ElevenLabs setup

TruthLayer uses the official ElevenLabs SDK for TTS.

Reference docs:

Optional verification script:

python example_elevenlabs.py

Running locally

1. Start the backend

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn backend.main:app --reload

Backend URL:

http://127.0.0.1:8000

Health check:

curl http://127.0.0.1:8000/health

2. Load the extension

  1. Open chrome://extensions
  2. Enable Developer mode
  3. Click Load unpacked
  4. Select the extension/ folder

API surface

  • POST /analyze
  • POST /compare
  • POST /voice
  • POST /store
  • GET /timeline
  • GET /health

Submission notes

  • Built for a fast, judge-friendly live demo
  • Works as a lightweight local prototype with a clean repo structure
  • Designed for a clear two-minute walkthrough with visible user value in each interaction

About

Chrome extension and FastAPI backend for real-time AI news context, bias scoring, narrative comparison, voice summaries, and topic memory.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors