Gemma Gem - A Chrome Extension That Runs Google Gemma 4 Fully On-Device in the Browser
Key point
A Chrome extension that runs Gemma 4 on-device inside the browser.
Details
This is a Chrome extension that runs Google's Gemma 4 model fully on-device in the browser using WebGPU, functioning like a personal AI assistant.
- No API key, no cloud transmission — no data leaves the device.
- It supports agentic behavior, reading the page you're visiting and performing button clicks, form input, scrolling, and even JavaScript execution.
- You can choose between Gemma 4 E2B (about 500MB) and E4B (about 1.5GB) models, which are cached and reused after the first run.
- It supports q4f16 quantization and a 128K context.
There are 6 built-in tools.
read_page_content: reads page text, HTML, based on CSS selectortake_screenshot: captures the visible page as PNGclick_element/type_text/scroll_page: DOM manipulation based on CSS selectorrun_javascript: executes JS in the page context with full DOM access
The architecture consists of 3 layers: Offscreen Document + Service Worker + Content Script.
- The Offscreen document hosts the model and agent loop using
@huggingface/transformers+ WebGPU. - The Service worker handles message routing and screenshot/JS execution.
- The Content script injects the gem icon and shadow DOM chat overlay.
The settings support model switching, Thinking toggle, tool call loop limit, conversation history reset, and per-site disabling.
The agent/ directory is separated based on ModelBackend and ToolExecutor interfaces without dependencies, so it can also be used as a standalone library.
The requirement is Chrome with WebGPU support, the license is Apache-2.0, and it's implemented in TypeScript.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.