NeoSparkX
Automation

MarkItDown Companion (Chrome Extension)

A browser companion to sync markdown files, track real-time AI token usage, and locally export conversations from Claude, ChatGPT, Gemini, DeepSeek, and Grok.

Our Role

Lead Browser Extension Developer, Content Script Engineer, Security Architect

Technologies & Frameworks

Vanilla JavaScript (ES6+)Chrome Extension APIs (Manifest V3)TiktokenOffscreen Documentschrome.storageCSS3

Project Overview

The MarkItDown Companion is a browser extension (Manifest V3) designed to bridge the user's live AI web conversations with their local Markdown editing workspace. It injects a floating control overlay and status badges directly into the interfaces of Claude, ChatGPT, Gemini, DeepSeek, and Grok. Users can track their session token usage in real time, extract fully formatted chat logs as clean Markdown or high-quality PDFs locally, and queue document payloads. Through a secure cross-origin bridge, the extension syncs queued items directly into the user's active MarkItDown web app workspace without intermediate database storage.

The Challenge & Problem

  • Hard AI Platform Context Limits: Users frequently hit context windows mid-conversation on Claude or ChatGPT without warning, resulting in memory loss or sluggish responses.
  • Fragmented AI Chat Logs: Exporting conversations usually results in messy web scrapes containing avatars, timestamps, SVG buttons, and bad spacing.
  • Document Export Interruptions: Generating PDF blobs or handling massive file downloads in background scripts can crash Manifest V3 service workers due to memory isolation or lack of DOM access.

The Engineering Solution

  • Real-time Token Tracking & Warning Badges: Integrated the o200k_base Tiktoken tokenizer script into the injected content script context. It actively monitors DOM mutations in chat bubbles, counts active tokens, updates the browser action badge icon with color-coded alerts (Yellow at 70% capacity, Red at 90% capacity), and warns the user before limits are reached.
  • Semantic DOM Scraper Engine: Wrote platform-specific injectors (claude.js, chatgpt.js, etc.) that isolate chat container nodes, identify user prompts vs. assistant outputs, parse nested code blocks, and output structured Markdown.
  • Offscreen Documents & Background Sync: Utilized Chrome's offscreen API to spin up a temporary headless document context that generates PDF files. Used the chrome.downloads API to save files directly, and a postMessage-driven content bridge to transmit stored chunks securely to markitdown.neosparkx.com.

Key Architecture & Features

Multi-Platform Injection Support

  • Seamlessly attaches to Claude.ai, ChatGPT.com, Gemini.google.com, Chat.deepseek.com, and Grok.com.

Live Token Tracker Overlay

  • Injected floating badges displaying current session token consumption, weekly limits, and token efficiency.

Handoff & Resume Snapshot Generator

  • Generates automated markdown handoff prompts (Dev Projects, Study Sessions, Exam Prep) designed to catch a fresh AI session up on previous context with zero loss.

Local Storage File Queue

  • Stores up to 50 exported chat logs or text snippets locally in chrome.storage.local with automatic 7-day expiration cleanup.

Cross-Origin Web App Bridge

  • A secure communication script that establishes handshake channels between localhost/production web app and extension to sync queued files in one click.

Offscreen PDF Compilation

  • In-browser compilation of chat records into printable PDFs using headless offscreen contexts.
← View All Projects Start a Project Like This →