Skip to content

About

Chrome extension that uses built-in AI (Gemini Nano) to analyse comment tone in real time and suggest kinder rewrites — 100% on-device

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Comment Vibe

A browser extension that uses on-device AI (Chrome's Gemini Nano, or Firefox's AI runtime) to analyse the tone of your comments in real time — before you hit post.

Chrome Firefox Edge Manifest V3 On-device AI I Ship This

▶ Install from the Chrome Web Store · Install from Firefox Add-ons · Website · API playground

Comment Vibe in action — tone badge and kinder rewrite tooltip

What it does

Type a comment on LinkedIn, Twitter/X, YouTube, or any other site. A small badge appears near your text box showing the detected tone. Click it to see why — and if your comment sounds harsh or toxic, get an instant kinder rewrite suggestion you can copy in one click.

Choose focused writing actions to fix grammar, make a comment shorter, clearer, friendlier or more professional. Turn off automatic checks and use the Alt+Shift+C shortcut (or the idle badge) to analyze on demand.

Badge Meaning
😊 Positive Constructive and friendly
😐 Neutral Balanced and factual
😕 Negative May come across as harsh or critical
🚫 Toxic Contains aggressive or harmful language

Privacy

By default all analysis runs locally — Chrome's on-device Gemini Nano model, or Firefox's on-device AI runtime. Your comments are never sent to any server.

On Chrome with the Decisions API developer trial (chrome://flags/#decisions-api, Chrome 158 Dev/Canary) and its model downloaded, friendly and neutral comments get their verdict from that on-device classifier without running the language model at all; harsher ones still get an explanation and a rewrite from the Prompt API.

Optional Fast mode (cloud). If you turn on Fast tone check in the cloud in the popup and paste your own SubQ or TypeSafe API key, the text being checked is sent to that provider's decision model (typically well under a second). It is off by default, the extension asks for access to the provider's host only when you enable it, and the key is kept in this browser's local storage (never synced). Fast mode only powers the tone badge — writing actions and rewrites still run on-device — and if a cloud call fails, Comment Vibe falls back to the on-device model. Fast mode checks as you type only on LinkedIn, X/Twitter and YouTube; on every other site nothing is sent until you click the badge or press Alt+Shift+C.

Uninstall survey. After uninstalling, your browser opens an optional Google Form. The extension sends no data with it, and the link has no identifiers. Answers are anonymous and covered by Google's Privacy Policy. This is separate from on-device processing and optional Fast mode; no comment text, results or API key are sent with the link.

Microsoft Edge support

Edge runs the Chrome build unchanged. Install it from Edge Add-ons.

  • On-device (preview): Edge's Prompt API is a developer preview — in Edge 158 or later, enable Prompt API in edge://flags and restart. Everything, rewrites included, then runs on Edge's built-in language model. Since November 2026 that model is Aion Instruct (2.3B parameters), which replaced Phi-4-mini. Requirements: Windows 10/11, macOS 13.3+, or 64-bit Linux with Vulkan drivers (Edge 159+); 3 GB VRAM, 20 GB free disk, unmetered network (hardware requirements), Device performance class Medium or higher in edge://on-device-internals. On-device AI under Settings → Copilot and AI must be on, and orgs can turn the model off by policy.
  • Everywhere else on Edge: turn on Fast mode in the popup with your SubQ or TypeSafe key for the tone badge.

Firefox support

Firefox has no Prompt API. Instead, Comment Vibe uses the experimental WebExtensions AI API (browser.trial.ml, Firefox 134+), which exposes on-device Transformers.js pipelines to extensions. Since that API offers classification pipelines rather than a conversational model, the Firefox build runs a multilingual zero-shot tone classifier (Xenova/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7, ~340 MB q8, downloaded once, ~100 languages) in the extension's background script — content scripts delegate to it via runtime messaging because the API is not available to content scripts.

What differs from the Chrome experience:

Feature Chrome (Gemini Nano) Firefox (browser.trial.ml)
Tone badge (positive/neutral/negative/toxic) ✅ ✅
"Why" explanation ✅ model-written sentence ✅ classifier label + confidence
Kinder rewrite suggestion ✅ ❌ (no generation pipeline used)
Streaming (badge colors in early) ✅ ❌ (result arrives at once)
Output translated to the comment's language ✅ ❌

Setup on Firefox:

  1. Firefox 134+. On Firefox 134–139 set browser.ml.enable and extensions.ml.enabled to true in about:config (both are on by default since Firefox 140)
  2. Install Comment Vibe from Firefox Add-ons, open the popup, and click Enable on-device AI (grants the optional trialML permission and downloads the model once)

If AI features are blocked in Firefox Settings → AI controls (Firefox 148+), the add-on AI API is switched off too: blocking sets extensions.ml.enabled to false, and browser.trial.ml rejects with "Trial ML API is disabled". Allow AI features there to use the on-device classifier.

⚠️ browser.trial.ml is explicitly experimental — Mozilla may change it between major Firefox versions. The extension feature-detects it and fails quietly (no badge) when it's unavailable.

Store assets

Chrome Web Store listing text and promo images (screenshots + tiles) live in store-assets/. The PNGs are rendered from the HTML sources in store-assets/src/ — edit those and run store-assets/render.sh (headless Chrome) to regenerate. See store-assets/listing.md for the description text and the asset → store-slot mapping.

Firefox (addons.mozilla.org) assets live in store-assets/firefox/: Firefox-accurate listing text in store-assets/firefox/listing.md and four screenshots rendered from store-assets/firefox/src/ via store-assets/firefox/render-firefox.sh. The copy and images deliberately drop the rewrite/multilingual claims, which the Firefox build does not have.

Microsoft Edge Add-ons copy and Partner Center answers live in store-assets/edge/listing.md. Edge reuses the Chrome zip and the Chrome PNGs.


Playground — try every built-in AI API

The playground/ folder is a standalone static site for exploring all of Chrome's built-in AI APIs (Prompt, Summarizer, Translator, Language Detector, Writer, Rewriter, Proofreader) in one place: status, version history, links, a live "will it work for you?" check, and an interactive demo per API.

Live: https://dzienko.dev/comment-vibe/playground/  (deployed from playground/ via GitHub Pages; the site root serves the product landing page from site/)

Run it locally:

cd playground && python3 -m http.server 8000   # → http://localhost:8000

Note: the Prompt API is stable on the open web since Chrome 148, so on Chrome 148+ it works with no token or flag. Writer, Rewriter, and Proofreader are still in trial and may not be available.

Edge and Firefox

The sidebar's Other browsers section has an Edge tab (playground/#edge): Edge exposes the same globals, so the demos run there once an API is enabled. As of Edge 158, Translator and Language Detector are on by default; Prompt, Summarizer, Writer, Rewriter, Proofreader and Decisions need a flag in edge://flags (developer preview, model: Aion Instruct).

Firefox exposes none of these APIs to web pages. Its on-device AI is extension-only (browser.trial.ml), so the website has a Firefox tab (playground/#firefox) with the current status and Mozilla's standards positions, and live demos live in a separate add-on: playground-firefox/. Load it via about:debugging#/runtime/this-firefox → Load Temporary Add-on… → playground-firefox/manifest.json. It is not part of either store zip.


Chrome AI availability — what you need to know

TL;DR — the Prompt API is now stable for Chrome Extensions (Chrome 138+). Most users need no flags; Chrome just downloads the Gemini Nano model on first use.

Current status

The Prompt API (the LanguageModel API that powers this extension) reached stable for Chrome Extensions in Chrome 138, and stable on the open web in Chrome 148. Inside an extension it is no longer behind a flag — the previous chrome://flags dance was only needed during the origin-trial period (Chrome 127–137). As of Chrome 149 (current stable) the API works for everyone on supported hardware without tokens or flags.

What a user needs today:

  1. Chrome 138 or later, desktop only (Windows 10/11, macOS 13+, or Linux)
  2. Hardware that meets the Gemini Nano minimums (see below)
  3. The model downloaded — Chrome fetches it automatically the first time the API is used; no flags required
Built-in AI API Status (Chrome 149, June 2026) Used here
Prompt API (LanguageModel) ✅ Stable — extensions (Chrome 138), open web (Chrome 148) ✅ Yes — core sentiment/rewrite engine
Summarizer ✅ Stable (Chrome 138) ⏳ Roadmap (thread context)
Translator ✅ Stable (Chrome 138) ✅ Yes — translates output to the comment's language
Language Detector ✅ Stable (Chrome 138) ✅ Yes — detects the comment's language
Rewriter 🧪 Developer trial ⏳ Roadmap (better rewrites)
Writer 🧪 Developer trial — Not needed
Proofreader 🧪 Origin trial ⏳ Roadmap (grammar layer)

Note on namespaces: the legacy window.ai.languageModel namespace is deprecated in favour of the global LanguageModel. This extension still probes both (content.js, popup.js) so it keeps working on older builds that only expose the legacy path — see CLAUDE.md.

Hardware requirements

Gemini Nano runs on your device. Chrome enforces these minimums:

Requirement Minimum
Operating system Windows 10/11 · macOS 13 (Ventura)+ · Linux
Free disk space 22 GB (model is removed if space drops below 10 GB)
GPU VRAM More than 4 GB
RAM 16 GB or more
CPU cores 4 or more
Mobile ❌ Not supported (Android / iOS)

Setup

On Chrome 138+ with eligible hardware, no setup is required — install the extension and Chrome handles the model download on first use. The steps below are only needed on older builds (Chrome 127–137) or if the popup reports the AI as unavailable.

Step 1 — Verify it worked

Click the Comment Vibe icon in the Chrome toolbar. The popup should show Chrome AI ready ✓. If so, you're done.

Step 2 — Check that on-device AI is turned on

Open chrome://settings/ai and make sure On-device AI is on. Chrome Stable turns it on by default; Chrome Beta, Dev and Canary 157+ start with it off on a fresh install, and an organization policy can lock it off. Turning it off also deletes the downloaded model. On Chrome 146–151 the same toggle is under chrome://settings/system. The popup's Open On-device AI settings button opens the page for you.

Step 3 — (Older builds only) Enable the flags

  1. Open chrome://flags
  2. Search for Prompt API for Gemini Nano → set to Enabled
  3. Search for Summarization API for Gemini Nano → set to Enabled (needed on some builds)
  4. Click Relaunch

Step 4 — Force the model download

  1. Open chrome://components
  2. Find Optimization Guide On Device Model
  3. Click Check for update and wait for the download to finish

The model is ~2–4 GB and downloads silently in the background. If the popup still shows "not available" afterward, restart Chrome fully (quit and reopen, not just close the tab) and try again.

Note on the on-device model: Chrome downloads Gemini Nano (the "Optimization Guide On Device Model" component) automatically on eligible hardware. In May 2026 this drew criticism for happening without a clear consent prompt; the On-device AI toggle in chrome://settings/ai now lets you disable and remove the model, and you can inspect its status at chrome://on-device-internals (a debug page: enable it in chrome://chrome-urls first). Comment Vibe uses this same model — it never downloads anything itself.


Roadmap

Near-term

  • Proofreader API (🧪 origin trial) — layer grammar and spelling fixes on top of tone analysis
  • Streaming (✅ shipped in 1.2.6) — promptStreaming() colors the badge as soon as the sentiment token arrives, before reason/rewrite finish
  • Keyboard shortcut — manually trigger analysis instead of waiting for the debounce

Medium-term

  • Language Detector + Translator API (✅ shipped in 1.1.0) — detects the comment's language and translates the badge label, reason, and rewrite into that language so the suggestion is directly pasteable. Falls back to English when a language pair is unavailable.
  • Context-aware analysis — read the post being replied to and factor it into the tone judgement ("measured reply to an aggressive post" vs "unprovoked attack")
  • Personal vibe stats — popup dashboard showing positive/neutral/negative breakdown over 7 and 30 days, stored locally via chrome.storage
  • Platform tone calibration — stricter system prompt on LinkedIn, more relaxed on Reddit, different norms per domain

Longer-term

  • Rewriter API — only if it reaches stable. It ran a full origin trial (Chrome 137–148) but reverted to a flag-only developer trial instead of graduating, and it overlaps heavily with what the Prompt API already does well. Not worth a dependency today; revisit behind a capability check if it ships stable, keeping the Prompt rewrite as the default.
  • Summarizer API (✅ stable since Chrome 138) — summarise a long comment thread before the user replies so the suggestion accounts for the full context
  • Proactive coaching — suggest how to phrase something before you start typing, based on the post topic and thread mood (Summarizer + Prompt working together)
  • Multimodal — once the Prompt API image/audio input stabilises: analyse screenshots pasted into comments, or audio in voice-to-text boxes

Development

Load the extension locally

  1. Clone or download this repo
  2. Open chrome://extensions
  3. Enable Developer mode (top-right toggle)
  4. Click Load unpacked → select the comment-vibe folder

Generate icons

Open icons/make-icons.html in Chrome and click Download all icons. Move the three downloaded PNG files into the icons/ folder.

Project structure

comment-vibe/
├── manifest.json       # Extension manifest (MV3)
├── CHANGELOG.md        # Versioned release notes
├── content.js          # Detects comment boxes, runs AI analysis, localises, renders badge
├── content.css         # Badge and tooltip styles
├── popup.html          # Toolbar popup
├── popup.js            # Popup — checks Chrome AI availability
├── popup.css           # Popup styles
└── icons/
    ├── icon16.png
    ├── icon48.png
    ├── icon128.png
    └── make-icons.html # Canvas-based icon generator

Build for the Chrome Web Store

Run the packaging script from the repo root. It builds the Chrome/Edge zip and the Firefox zip from an explicit file list and verifies their contents:

bash scripts/package.sh

Do not zip the folder by hand — a hand-rolled zip picks up local files that must not ship.

How it works

  1. A MutationObserver watches for comment boxes matching site-specific selectors (LinkedIn's Quill editor, Twitter's tweet textarea, YouTube's comment field) plus generic contenteditable and textarea fallbacks across all other sites
  2. Text changes are debounced (900 ms) to avoid calling the model on every keystroke
  3. The text is sent to a LanguageModel session (Chrome's Prompt API) using few-shot examples + prefix prompting to force structured JSON output from Gemini Nano
  4. The JSON response is parsed and normalised — the normalize() function maps any alternative key names the model invents back to the expected schema
  5. In parallel, the Language Detector API identifies the comment's language. If it isn't English, the Translator API translates the label, reason, and rewrite into that language (cached per language pair). This is best-effort — any failure falls back to the English result
  6. A fixed-position badge appears at the bottom-right corner of the input, coloured by sentiment. While you keep typing the last verdict stays on screen (dimmed, with a spinner) instead of flashing "Analyzing…" on every keystroke
  7. Clicking the badge opens a dark tooltip with the reason and (for negative/toxic results) a rewrite suggestion you can insert straight into the field with Use this rewrite, or copy with one click
  8. Don't want it somewhere? The tooltip's Hide on this site link or the popup's per-site/global toggles silence the badge — preferences sync via storage.sync and apply instantly, no reload needed

License

MIT

About

Chrome extension that uses built-in AI (Gemini Nano) to analyse comment tone in real time and suggest kinder rewrites — 100% on-device

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages