Skip to content

Architecture

Context Bro is a standalone browser extension that turns your everyday browsing into structured context for AI agents. It extracts page content, compiles it through customizable templates, and delivers it to any API endpoint you configure.

Slogan: Help you bring your context to live.

Browser Tab → Content Script → Template Engine → POST to Your API
  1. Content Script extracts page data (title, content, meta, selection, schema.org)
  2. Template Engine compiles your template with extracted variables and filters
  3. API Client POSTs the compiled payload to your configured endpoint with custom headers
ComponentRole
Background Service WorkerOrchestrates extraction, message routing, scheduling, adapter management
Content ScriptInjected into pages to extract DOM content via Defuddle
PopupQuick share UI — endpoint/template selection, JSON preview
Options PageFull configuration — endpoints, templates, allowlist, schedule
Selection ButtonFloating CSUI button on text selection
Platform AdaptersTwitch and YouTube live chat observers

The template engine is AST-based:

  • TokenizerParserRenderer pipeline
  • 50+ built-in filters (truncate, replace, date, split, join, etc.)
  • CSS selector variables ({{selector:.class@attr}})
  • Schema.org structured data extraction

Context Bro has three content capture models, each designed for different content volatility:

Event-driven capture for pages you’re actively reading:

  • Triggers on tab focus/navigation to a matching domain
  • 10-second dwell before first extraction
  • Optional refetch at configurable intervals (10s–1hr) for slowly-changing pages (feeds, dashboards)
  • Stops when you switch away from the tab
  • Uses setInterval — no Chrome Alarm needed since the user is actively viewing

Periodic background capture using the Chrome Alarms API:

  • Scans all open tabs matching Site Rule patterns
  • Configurable polling interval (minutes to hours)
  • Runs even when tabs are in the background

Both modes use SHA-256 content hashing with a configurable per-rule dedup window to prevent sending unchanged content.

Live stream adapters use MutationObserver to capture chat in real-time:

  • Twitch: native + 7TV + FFZ DOM variants, bits, subs, raids
  • YouTube: live chat, Super Chat/Sticker, memberships, VOD transcript
  • 30-second batch aggregation with priority sampling (monetization > mod > random)
  • Sliding window dedup (10s) to prevent duplicates
LayerTechnology
Extension frameworkWXT (Vite-based)
UIReact 19 + TailwindCSS v4
Content extractionDefuddle
Template engineAST-based
FormattingBiome
LanguageTypeScript (strict)
TargetChrome MV3