Architecture
Overview
Browser Extension (Chrome)
├── content.js — article scanning, sidebar UI
├── background.js — service worker, pipeline orchestration
├── popup.js — scan trigger, popup UI
└── src/
├── llm.js — dual-model AI extraction
├── api.js — Congress.gov + GovTrack lookups
├── votesmart.js — VoteSmart client (via proxy)
├── lookup.js — politician name resolution
├── keywords.js — topic keyword extraction
└── topic-match.js — bill relevance matching
Backend Proxy (Node.js / Render)
└── server/
├── index.js — Express, CORS, rate limiting
└── providers/
├── claude.js — Anthropic Claude extraction
├── mistral.js — Mistral extraction
├── _shared.js — shared prompt + parser (single source of truth)
├── congress.js — Congress.gov proxy
└── votesmart.js — VoteSmart JWT auth + proxy
Pipeline
When you click Scan This Page:
content.jsextracts article text and politician names via regexpopup.jssends ananalyzemessage to the service workerbackground.jscallsextractArticleAnalysis()insrc/llm.jssrc/llm.jssends{ articleText }to two proxy endpoints in parallel:POST api.liarsledger.com/api/claude/extractPOST api.liarsledger.com/api/mistral/extract
- Both models return
{ summary, main_topics, figures[] }— claims are compared via Jaccard similarity background.jsresolves politician names against a 3,606-key dictionarysrc/api.jsfetches sponsored/cosponsored legislation and GovTrack roll-call votes viaapi.liarsledger.com/api/congress/*src/votesmart.jsfetches interest group ratings and vote history viaapi.liarsledger.com/api/votesmart/*- Results are stored in
browser.storage.sessionand displayed in the sidebar
Key design decisions
Why a backend proxy? All API keys (Claude, Mistral, Congress.gov, VoteSmart) live server-side. The extension ships with zero secrets. This also enables rate limiting and future freemium tier enforcement.
Why two AI models? Two independent models from different companies with different training data reduces systematic bias. Agreement = higher confidence. Disagreement = both interpretations surfaced.
Why GovTrack instead of Congress.gov for votes?
The Congress.gov senate-vote and house-vote endpoints return 404 for the 119th Congress — they are in beta and not yet available. GovTrack provides complete roll-call vote history at no cost.
Why session storage for caching?
browser.storage.session clears when the browser closes, preventing stale legislative data from persisting. Cache hits are logged in the debug panel.