Show HN: Gemma Gem – AI model embedded in a browser – no API keys, no cloud
TL;DR Highlight
A Chrome extension that runs the Google Gemma 4 model completely locally within the browser using WebGPU, allowing it to read web pages and perform DOM manipulations such as clicks and input without requiring an API key or server.
Who Should Read
Frontend/full-stack developers who want to incorporate LLMs into projects where privacy is important, or developers who want to experiment with browser automation without external APIs.
Core Mechanics
- The Google Gemma 4 model is run within a browser extension using WebGPU (a standard API for directly using GPUs on the web). Data does not leave the device, and no API key is required.
- Model size is approximately 500MB for E2B (about 2B parameters) and ~1.5GB for E4B (about 4B parameters), and it is downloaded and cached only once upon first execution. The execution environment requires only Chrome with WebGPU support.
- The architecture is separated into three layers: Offscreen Document, Service Worker, and Content Script. The Offscreen Document loads the model and runs the agent loop using the @huggingface/transformers library, the Service Worker routes messages, and the Content Script manipulates the actual DOM.
- Built-in tools available to the agent include read_page_content (read page text/HTML), take_screenshot (capture page screenshot as PNG), click_element (click by CSS selector), type_text (enter text into input field), and scroll_page (scroll).
- The model supports a 'thinking mode' that displays the inference process (chain-of-thought, i.e., 'how it thought') directly in the UI. This allows for transparently checking how the model interprets the page.
- Installation involves pnpm install → pnpm build, followed by loading the .output/chrome-mv3-dev/ folder in developer mode at chrome://extensions. There is no separate server or backend setup.
- JavaScript execution permission (run_javascript) is also handled at the Service Worker level, allowing the agent to directly execute scripts on the page.
Evidence
- "There was mention that Chrome's Prompt API (developer.chrome.com/docs/ai/prompt-api) currently offered as an Origin Trial, uses a similar approach. One commenter confirmed that the model folder size was as large as 4,072MB (v3Nano model, GPU backend), and expressed the opinion that while it could eventually become a native browser feature, the model size is currently too large for the browser itself. \n\nThere was concern that granting full JS execution rights to a 2B model on a live page is risky from a security perspective. It was also suggested that using a local background daemon as a server and making the extension a 'thin client' would be more stable, as the agent's state would be lost if Chrome crashed or the tab was discarded.\n\nThere was an opinion that 'thinking mode' (exposing the inference process) is a killer feature of this extension. It's not just a curious demonstration, but actually useful for understanding how the model interprets the page.\n\nThere was a suggestion that it would be good to evolve into a local LLM plugin SDK for apps handling sensitive data. Previously, requiring users to set up a local LLM environment was a high barrier to entry, but this browser-integrated approach could solve that problem.\n\nThere was a question about whether the browser could natively embed local models and allow developers to query them via an API. Information was shared that Chrome's Prompt API Origin Trial is heading in that direction."
How to Apply
- If you need to analyze web pages containing personal information (internal intranet, medical records, etc.) with AI, but it is difficult to send data to an external API, you can use this extension as a base to add LLM functionality without the data leaving the device.
- If you want to prototype a browser-based automation agent (form auto-filling, page summarization, button click workflows) without relying on external services, you can install pnpm → pnpm build and then load it into Chrome developer mode to experiment immediately.
- If you want to offer local LLM functionality as an option in a SaaS app that handles sensitive data, you can refer to the Offscreen Document + @huggingface/transformers + WebGPU combination of this project to design a local inference module in the form of a Chrome extension.
- If you need a UX that shows the agent's reasoning process to the user, you can refer to the implementation of 'thinking mode' (chain-of-thought exposure) in the code of this project and apply it.
Code Example
# Installation and build
pnpm install
pnpm build
# Load in Chrome
# Go to chrome://extensions → Turn on Developer Mode
# 'Load unpacked' → Select .output/chrome-mv3-dev/
# Architecture summary
# Offscreen Document: @huggingface/transformers + WebGPU to run Gemma 4 model + agent loop
# Service Worker: Message routing, take_screenshot, run_javascript processing
# Content Script: Chat UI (Shadow DOM) injection, DOM tool execution
# List of available tools
# read_page_content - Read page text/HTML (Content Script)
# take_screenshot - Capture page PNG (Service Worker)
# click_element - Click by CSS selector (Content Script)
# type_text - Enter text into input field (Content Script)
# scroll_page - Page scroll (Content Script)
# run_javascript - Execute JS code (Service Worker)Terminology
Related Papers
Formal Verification Gates for AI Coding Loops
AI가 생성한 코드에서 보안 불변식(invariant)을 지키게 하려면 프롬프트 지시보다 타입 시스템 같은 구조적 제약이 훨씬 효과적이라는 주장과 구현 방법을 소개한다.
Learnings from 100K lines of Rust with AI (2025)
Azure RSL(분산 합의 라이브러리)을 Rust로 재구현하면서 AI 코딩 에이전트를 활용해 4주 만에 100K 라인을 작성한 경험담으로, Code Contracts와 Spec-Driven Development를 AI와 조합하는 실전 워크플로우를 공유한다.
A Methodology for Selecting and Composing Runtime Architecture Patterns for Production LLM Agents
LLM agent가 왜 터지는지 이름 붙이고, 어떤 아키텍처 패턴을 언제 써야 하는지 5단계로 정리한 실전 가이드
Show HN: Forge – Guardrails take an 8B model from 53% to 99% on agentic tasks
작은 로컬 LLM(8B)에 guardrails(구조적 안전망)를 씌워 멀티스텝 에이전트 작업 성공률을 53%에서 99%까지 올린 Python 프레임워크 Forge 공개. 모델 자체는 건드리지 않고 실행 환경을 강화하는 접근법이라 주목받고 있음.
Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised
2026년 5월 19일, npm 계정 하나가 탈취되어 22분 만에 637개 악성 버전이 배포됐고, echarts-for-react·size-sensor 등 월 수백만 다운로드 패키지들이 감염되어 AWS 자격증명·SSH 키·AI 코딩 에이전트까지 탈취하는 정교한 공급망 공격이 발생했다.
Code as Agent Harness
LLM 에이전트에서 코드를 단순 출력물이 아닌 추론·행동·환경 모델링의 실행 인프라로 재정의한 102페이지짜리 서베이