Browser Code
A coding agent for userscripts with its own loader.
Browser Code is a browser extension that gives Claude a virtual filesystem view of web pages. It generates, edits, and manages userscripts that persist to chrome.userScripts (the same API that Tampermonkey uses) and auto-run on matching URLs.
Think Claude Code, but for the DOM.
demo.mp4
How It Works
Agent sees the page as a filesystem - The DOM becomes page.html , console output is console.log , and you can create scripts in ./scripts/ and styles in ./styles/ Scripts persist via userScripts API - Saved scripts register with Chrome's userScripts API (Chrome 120+) or Firefox's equivalent, bypassing CSP restrictions Auto-runs on matching URLs - Scripts execute on page load for their saved URL patterns, including dynamic routes like /products/[id]
Architecture
┌─────────────────────────────────────────────────────────────────┐ │ Browser Extension │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────┐ │ │ │ Background Service Worker │ │ │ │ • Claude API client (agentic loop) │ │ │ │ • userScripts registration & CSP bypass │ │ │ │ • Conversation history per tab │ │ │ │ • VFS storage coordination │ │ │ └──────────────────────────────────────────────────────────┘ │ │ ↕ │ │ ┌──────────────────────────────────────────────────────────┐ │ │ │ Content Script │ │ │ │ • Virtual Filesystem (VFS) implementation │ │ │ │ • DOM ↔ HTML serialization with version tracking │ │ │ │ • Script execution in MAIN world │ │ │ │ • Console interception │ │ │ └──────────────────────────────────────────────────────────┘ │ │ ↕ │ │ ┌──────────────────────────────────────────────────────────┐ │ │ │ Sidebar Panel (React) │ │ │ │ • Chat UI with tool call visualization │ │ │ │ • Plan/Execute mode toggle │ │ │ │ • File browser & local sync │ │ │ └──────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────┘
Virtual Filesystem
... continue reading