Map

Gemma Gem

Toolbox toolboxtypescriptchrome-extensionllmwebgpubrowser-automationTypeScriptApache-2.0 โ†ณ show in map Markdown
title
Gemma Gem
type
toolbox
summary
Chrome extension running Gemma 4 on-device over WebGPU to read, click and script web pages
tags
typescript, chrome-extension, llm, webgpu, browser-automation
language
TypeScript
license
Apache-2.0
created
2026-04-06
updated
2026-04-06

A Chrome extension that runs Google's Gemma 4 model entirely on-device via WebGPU. No API keys, no cloud, no data leaving your machine. It acts as a browser AI assistant that can read pages, take screenshots, click elements, type into fields, and run arbitrary JavaScript.

How it works: three components coordinate inside the extension. An offscreen document hosts the model (loaded via @huggingface/transformers + WebGPU). A service worker routes messages, captures screenshots, and runs JS. A content script injects a chat UI as a shadow DOM widget (the gem icon in the bottom-right) and handles DOM manipulation tools.

Available tools the model can call:

  • read_page_content โ€” extract text/HTML via CSS selector
  • take_screenshot โ€” capture visible page as PNG
  • click_element โ€” click by CSS selector
  • type_text โ€” fill in form fields
  • scroll_page โ€” scroll by pixel amount
  • run_javascript โ€” execute arbitrary code with full DOM access

Model options: Gemma 4 E2B (~500MB) or E4B (~1.5GB), ONNX-quantized (q4f16), 128K context window. Cached after first download. Supports Gemma 4's native "thinking mode" for extended reasoning.

Config: model selection, thinking mode toggle, max tool call iterations per request, per-site disable list.

Interesting detail: the agent/ directory has zero external dependencies and defines reusable interfaces (ModelBackend, ToolExecutor), so the agent loop could be extracted as a standalone library.

Limitations: Chrome-only (needs WebGPU). Gemma 4 2B/4B are small models โ€” don't expect Claude-level output. Needs a decent GPU for reasonable speed.

Repo: https://github.com/kessler/gemma-gem โ€” 79 stars, Apache-2.0.