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

The scheduler uses the Chrome Alarms API to periodically extract allowlisted domains:

  • Allowlist-first: only configured domains are auto-extracted
  • SHA-256 content hashing for deduplication
  • Configurable intervals (5min to 2hr)
  • Focused tab or all-allowed-tabs modes

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