How rpanigrahi222/intruth-factcheck works
1. What this repo is
- This is a Chrome Manifest V3 extension called *InTruth* / *realtime-factcheck*.
- Its purpose is to listen to the active tab’s audio, transcribe speech in real time, detect check-worthy claims, and show verdicts and evidence back to the user while the event is still happening.
2. Top-level runtime split
- The architecture is split across the standard extension contexts:
- Popup UI for user control and configuration
- Background service worker for orchestration
- Content script for in-page overlay and page interaction
- Offscreen document for audio/transcription work that can’t live in the service worker
- manifest.json is the key boundary definition for permissions, injections, and context wiring.
3. Popup as the control plane
- src/popup/popup.html, popup.js, and popup.css implement the extension’s front door.
- This is where the user likely starts/stops a session, supplies their bring-your-own Anthropic API key, and sets session options.
- The popup is the only obvious user-facing configuration surface; it likely writes to extension-local storage and sends commands into the runtime.
4. Background service worker as orchestrator
- src/background/service-worker-ex.js is the central coordinator.
- In an MV3 extension, this is typically responsible for:
- receiving commands from the popup,
- managing session state,
- triggering tab audio capture,
- routing messages between popup, offscreen page, and content script,
- and handling lifecycle/event transitions.
- This is the main integration boundary between UI intent and the real-time processing pipeline.
5. Offscreen document for audio processing
- src/offscreen/offscreen.html and offscreen-ex.js implement the audio-processing worker surface.
- The README and permissions indicate this is where tab audio capture / transcription happens, since the extension uses offscreen plus tabCapture.
- Architecturally, this isolates long-running media work from the ephemeral service worker and keeps transcription alive as a separate browser context.
6. Content script for on-page presentation
- src/content/overlay.js, overlay.css, and related files inject the in-page UI shown during a live session.
- This overlay is the user’s real-time view of detected claims, verdicts, and explanations.
- Because it runs in the page context, it acts as the bridge from extension state to something visually anchored on the active tab.
7. Claim and transcript feature extraction
- src/content/lexical-features.js suggests a local feature layer for analyzing text patterns, likely used to detect or rank candidate claims.
- src/content/session-export.js indicates session data can be packaged out of the live flow, probably for review or research use.
- These files suggest a separation between raw transcript handling and higher-level claim selection / session reporting.
8. Real-time data flow
- The likely flow is:
1. User starts a session in the popup.
2. Background service worker requests active-tab audio capture.
3. Offscreen page receives audio and performs transcription.
4. Transcript chunks are analyzed for check-worthy claims.
5. Claim text and context are sent for AI/evidence evaluation.
6. Results are returned to the background/content layer.
7. The overlay displays verdicts and sources in real time.
- This is a streaming pipeline, not a batch workflow.
9. External AI/service boundary
- The README states users provide their own Anthropic API key.
- That means the extension has a hard trust boundary: transcript data may leave the browser and be sent to the user-configured AI service for fact-checking.
- The repo explicitly positions this as local control of credentials, with no operator-managed API key backend.
10. Local state and privacy boundary
- The storage permission and README indicate user preferences and API configuration are stored locally in the browser.
- There is no sign of a server-side component in this repo.
- Architecturally, this is a client-only extension with external API calls only to user-chosen services.
11. Permissions-driven architecture
- The extension depends on tabCapture, activeTab, scripting, storage, and offscreen.
- These permissions directly map to the main subsystems:
- tabCapture → audio ingestion
- activeTab / scripting → page targeting and injection
- offscreen → media/transcription worker
- storage → local config/session state
12. Assets and packaging
- assets/ likely contains icons or static resources used by the extension UI and store packaging.
- LICENSE and README indicate a standalone open-source extension project, not a multi-service app.
13. Diagram takeaway
- The cleanest architecture diagram should show a browser extension with four contexts:
- user popup,
- background orchestrator,
- offscreen audio/transcription worker,
- content overlay injected into the page.
- Around that, show two external dependencies:
- the active browser tab’s audio/video stream as the input source,
- and Anthropic / other AI services as the verdict-generation boundary.
Main entry points: service-worker-ex.js Orchestrator · manifest.json Manifest · overlay.js Overlay UI · popup.js Popup logic
Components 15
Extension
Core Manifest V3 extension contexts and shared configuration
- Manifest · Defines permissions, contexts, and extension wiring
realtime-factcheck/manifest.json - Popup UI · User-facing entry point for starting sessions and setting credentials
realtime-factcheck/src/popup/popup.html - Popup logic · Handles user actions and sends commands into the extension runtime
realtime-factcheck/src/popup/popup.js - Orchestrator · Central coordinator for session state, messaging, and lifecycle events
realtime-factcheck/src/background/service-worker-ex.js - Offscreen page · Hidden extension context used to keep audio and transcription work alive
realtime-factcheck/src/offscreen/offscreen.html - Audio worker · Processes captured audio and produces transcript output
realtime-factcheck/src/offscreen/offscreen-ex.js - Overlay UI · Injects the live verdict and claim display into the active tab
realtime-factcheck/src/content/overlay.js - Overlay style · Styles the injected live overlay
realtime-factcheck/src/content/overlay.css - Claim features · Local feature layer for spotting or ranking check-worthy claims
realtime-factcheck/src/content/lexical-features.js - Session export · Packages live-session data for later review or export
realtime-factcheck/src/content/session-export.js
Browser page
The active tab and injected in-page surface
- Tab audio · Audio stream captured from the active tab
- Active tab · Current page where audio is captured and overlay is injected
External boundary
Local browser state and remote AI/service dependencies
- Anthropic API · Remote model service used for verdict generation with user-provided credentials
- Local storage · Stores API key, preferences, and session state in the browser
- Assets · Extension icons and other packaged static files
realtime-factcheck/assets
Connections 19
- Manifest → Popup UI: defines UI · Registers the popup entry point and extension surface
- Manifest → Orchestrator: registers worker · Declares the background service worker and permissions
- Manifest → Offscreen page: enables offscreen · Allows hidden audio/transcription context
- Manifest → Overlay UI: injects content · Wires page scripting and content-script execution
- Popup UI → Popup logic: loads logic · Popup markup is driven by popup behavior
- Popup logic → Orchestrator: commands · User actions are sent to the orchestrator
- Orchestrator → Local storage: reads/writes · Persists configuration and session state locally
- Orchestrator → Tab audio: captures · Starts and manages audio ingestion from the active tab
- Orchestrator → Audio worker: routes audio · Delegates media processing to the offscreen worker
- Offscreen page → Audio worker: hosts · Hidden page loads the transcription worker logic
- Audio worker → Orchestrator: transcripts · Streams transcript chunks back to the orchestrator
- Orchestrator → Claim features: analyzes text · Uses text features to identify check-worthy claims
- Orchestrator → Anthropic API: verdict requests · Sends candidate claims for fact-checking and evidence retrieval
- Orchestrator → Overlay UI: pushes results · Delivers live verdicts and evidence to the page overlay
- Overlay UI → Overlay style: styles · Overlay behavior is rendered with its companion stylesheet
- Overlay UI → Active tab: renders in · Displays live results inside the current page
- Orchestrator → Session export: packages session · Prepares live session data for export or review
- Popup logic → Local storage: configures · Stores API key and user preferences locally
- Orchestrator → Assets: uses assets · Shared packaged resources for extension UI and branding