DEV Community

Shriraj Patil
Shriraj Patil

Posted on

Cross Context: I Built a Universal AI Context Bridge for My Best Friend Who Kept Hitting Model Rate Limits.

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🀝

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

Every developer has been there: it is 1:30 AM, you are deep in the zone debugging a complex race condition across four microservices, and suddenly your screen freezes with:

"You've reached your usage limit until 4:00 AM."

My close friend and hackathon teammate, Rohan, was hitting this wall almost every night. Like thousands of developers, Rohan relies on multiple AI tools: he uses Claude for architectural refactoring, ChatGPT for quick scripting, Gemini for reading massive API documentation, and local models when working offline.

Whenever he hit a rate limit or a context window cap, all of his hard-won state vanished into a closed silo. Switching over to another AI meant spending 20 minutes manually copying code snippets, re-explaining the system architecture, and re-pasting terminal stack traces β€” burning through context tokens on repetitive conversational fluff before even getting to the actual bug. He was paying for multiple subscriptions and still getting locked out.

I built Cross Context for him.

Cross Context is an open-source, privacy-first browser extension (Manifest V3) that acts as a universal context bridge and portability layer for Large Language Models. With a single click from the extension popup, Cross Context:

  1. Scrapes active session state cleanly from Claude, ChatGPT, Gemini, Grok, or Perplexity with zero layout thrashing.
  2. Applies context engineering heuristics (Jaccard similarity deduplication, technical priority weighting, and boundary-safe truncation) to condense noisy chat threads into a high-density Markdown brief.
  3. Instantly injects the context into destination AI platforms by attaching an in-memory context-con_01.md file directly via the HTML5 DataTransfer API, accompanied by a companion handoff prompt.

When I sent Rohan the unpacked extension build to test on his laptop, he imported an active 22-message debugging thread from Claude directly into ChatGPT in under 3 seconds β€” complete with active errors and file paths intact. His immediate reaction:

"Dude, you just saved me 40 minutes of re-prompting every night. This is staying pinned in my browser bar forever."


Demo

Here is the high-level workflow of Cross Context in action:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. Active Chat         β”‚  ──>  β”‚ 2. Scrape Context      β”‚  ──>  β”‚ 3. One-Click Injection β”‚
β”‚ (e.g. Claude at limit) β”‚       β”‚ (Local Deduplication)  β”‚       β”‚ (ChatGPT / Gemini /...)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                                               β”‚
                                                                               β–Ό
                                                                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                                                 β”‚ Attached: context-con_01.mdβ”‚
                                                                 β”‚ + Companion Handoff Promptβ”‚
                                                                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Enter fullscreen mode Exit fullscreen mode
  • Live Website: cross-context.vercel.app
  • GitHub Repository & Releases: Shriraj888/Cross-Context
  • Local Quick-Start:
    1. Clone https://github.com/Shriraj888/Cross-Context.git.
    2. Open chrome://extensions/ in Chrome, Brave, Edge, or Opera.
    3. Enable Developer Mode (top-right toggle).
    4. Click Load unpacked and select the Cross-Context folder.
    5. Open any chat on Claude, ChatGPT, or Gemini, click the extension icon, and hit Scrape Context -> Transfer!

Code

Cross Context is 100% open-source under the permissive MIT License:

GitHub logo Shriraj888 / Cross-Context

A local-first LLM context bridge for seamless cross-platform AI conversation transfer.

Cross Context Logo

Cross Context

The Universal Context Bridge & Portability Layer for Large Language Models

License: MIT Version Manifest Version Zero Cloud

ChatGPT Claude Gemini Grok Perplexity


πŸ“– What is Cross Context?

Cross Context is an open-source browser extension that eliminates AI vendor lock-in and context fragmentation. When you hit rate limits, context window caps, or want to leverage a different model's strengths, Cross Context captures your active session state and transfers it seamlessly into your target AI platform.

Everything runs 100% locally in your browser sandbox without remote servers, subscription fees, or data collection.


✨ Key Features

  • πŸ”„ Cross-LLM Continuity: Instantly migrate conversations between Claude, ChatGPT, Gemini, Grok, and Perplexity.
  • πŸ“„ File-Based Context Injection: Generates in-memory context.md files attached directly to target uploaders via the HTML5 DataTransfer API, avoiding bloated chat prompts.
  • 🧠 Optional AI Distillation: Two-pass Gemini synthesis extracts technical facts, active bugs, and architectural decisions, appending the verbatim transcript underneath.
  • ⚑ Zero-Thrashing Scraping: Parses single-page chat UIs with scoped CSS hiding…

How I Built It

Cross Context is engineered strictly around Chrome Extension Manifest V3 (MV3) with a three-layer decoupled architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                               UI Layer                                 β”‚
β”‚          Popup Window (popup.html, popup.js, popup.css)                β”‚
β”‚   β€’ Active platform detection & radar scan console                     β”‚
β”‚   β€’ Saved contexts list, search, multi-session merger                  β”‚
β”‚   β€’ In-memory Markdown preview (`context.md`) & token estimator       β”‚
β”‚   β€’ Settings modal (Gemini API configuration & model selector)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚ (chrome.runtime.sendMessage)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           Background Layer                             β”‚
β”‚               Service Worker Orchestrator (background.js)              β”‚
β”‚   β€’ Central message router & transaction coordinator                   β”‚
β”‚   β€’ Storage management & auto-recovery eviction engine                 β”‚
β”‚   β€’ Two-pass Gemini API enhancement & distillation pipeline            β”‚
β”‚   β€’ Cross-tab injection lifecycle coordinator (`pollAndInject`)        β”‚
β”‚   β€’ Secure CORS image fetch proxy with SSRF validation                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚ (chrome.scripting / chrome.tabs)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                            Content Layer                               β”‚
β”‚             Single-File Content Script (content/content.js)            β”‚
β”‚   β€’ Platform detection (Claude, ChatGPT, Gemini, Grok, Perplexity)    β”‚
β”‚   β€’ Resilient scraping engine (DOM mutation settling & sanitization)   β”‚
β”‚   β€’ Dual-mode injection engine (file drop & fallback text input)       β”‚
β”‚   β€’ Shadow DOM floating preview confirmation card                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Enter fullscreen mode Exit fullscreen mode

Here are the key subsystems derived from our architectural documentation:

1. Zero-Thrashing Scraper Session (docs/scraping-engine.md)

Single-page chat applications are notorious for layout thrashing, virtualized off-screen nodes, and obfuscated CSS-in-JS classes. To scrape cleanly without locking up the browser:

  • We inject a scoped temporary stylesheet (.cc-scraping-active) that hides non-content chrome (copy buttons, thumbs-up SVGs, action bars, citations) in a single CSS pass.
  • Reading innerText on the message container extracts clean conversational prose with zero reflows.
  • The scraper implements a tiered selector fallback chain across all supported platforms (Claude, ChatGPT, Gemini, Grok, and Perplexity).

2. Context Engineering & Deduplication (docs/context-engineering.md)

Transferring 10 iterations of the same modified file wastes tokens and confuses the destination model. Cross Context features a specialized local context engine:

  • Heuristic Priority Scoring: Messages are scored based on technical signal. Code blocks (+2.5), stack traces (+2.0), architectural decisions (+2.0), and task lists (+1.5) are prioritized, while conversational fluff and greetings (-2.0) are dropped.
  • Jaccard Similarity Deduplication: Extracted code blocks are tokenized into word sets and evaluated via Jaccard distance: $$J(A, B) = \frac{|A \cap B|}{|A \cup B|}$$ If two code snippets share $J(A, B) > 0.45$ or one is a substring of another, only the newest, most complete iteration is preserved.
  • Boundary-Safe Truncation: To stay within an 80,000-character safety budget (~20,000 tokens), older messages are pruned message-by-message from the transcript head. We never slice raw substrings, preventing unclosed code fences ( ``` ) or malformed Markdown tables.
  • Sequential Context IDs: Snapshots are automatically tagged (con_01, con_02) so models never confuse separate project sessions.

3. Dual-Mode State Restoration (docs/injection-engine.md)

Pasting 5,000 words into a chat prompt triggers aggressive rate limits and degrades attention. Cross Context bypasses this with a two-tier injection strategy:

  • Mode 1 (File Attachment Injection): Generates an in-memory File object (context-con_01.md) and simulates an HTML5 DataTransfer drag-and-drop event onto the target platform's file uploader. It polls the DOM for the upload chip (e.g. [data-testid="file-chip"]) and then types a concise companion prompt referencing the Context ID.
  • Mode 2 (SPA Text Fallback): If file uploads are unavailable, it synchronizes with React and Angular Virtual DOMs using synthetic focus, document.execCommand('insertText'), and native prototype setter overrides.

4. Optional Two-Pass AI Distillation (docs/ai-enhancement-pipeline.md)

When enabled via user settings, Cross Context leverages Google's Gemini API in a structured two-pass pipeline:

  • Pass 1: Extracts objective facts (tech stack, architectural decisions, active errors, pending tasks) enforced with strict JSON schemas.
  • Pass 2: Synthesizes a grounded first-person handoff brief ("I was implementing OAuth login with Supabase when..."), appending the complete verbatim transcript underneath for 100% ground-truth verification.

Why Does Open Innovation Matter?

Open innovation is the entire reason Cross Context exists and why it works better than any proprietary alternative:

  1. Zero-Cloud Privacy & Data Sovereignty: Developer conversations contain sensitive codebases, proprietary API routes, staging URLs, and internal schema keys. Storing conversation histories on a closed third-party synchronization server introduces severe data leakage and compliance risks. Cross Context operates 100% locally in your browser sandbox. Your data never leaves your machine unless you explicitly choose to call an API with your own key.
  2. Defeating AI Vendor Lock-In: Closed commercial AI providers have every incentive to keep your session state locked inside their platforms. If you hit a rate limit, their only solution is to upsell you to a more expensive tier. Open tools give agency back to developers: your context belongs to you, and you should be able to move it freely between any AI model at will.
  3. Synergy with Open-Weight Models: The context snapshots generated by Cross Context (context-con_XX.md) are standard, well-structured Markdown files. They can be piped directly into local open-weight models (such as Gemma, Llama, or Mistral running via Ollama or LM Studio) on an air-gapped laptop with no internet connection at zero cost.
  4. Transparent & Auditable: Browser extensions run with elevated permissions. Because Cross Context is open-source under the MIT license, every developer can inspect the network requests, verify that no keystrokes are tracked, and contribute selector updates as web frontends change.

My Agent Session

This project was built, documented, and refined collaboratively with AI pair programming. You can inspect the development process and tool interactions preserved via DevRelay.


Prize Categories

  • Best Use of Gemma: Cross Context features a built-in two-pass AI distillation pipeline that transforms noisy conversation threads into dense, schema-enforced handoff briefs and structured JSON facts, supporting lightweight open-weight models and Google AI Studio endpoints.
  • Best Use of GitHub Copilot: Utilized for rapid generation of DOM selector fallback trees, Chrome Manifest V3 service worker event routing, and cross-platform SPA event dispatch simulations.

Top comments (0)