Skip to content

milind-soni/Decaf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☕ Decaf

Take the boil out of comment threads.

A Chrome extension that uses Gemini Nano via Chrome's Prompt API to rewrite any page live to whatever tone you ask for. No API keys. No backend. Nothing leaves your browser.

Works on Hacker News, X, Reddit, and most article/comment pages.

Use it

  1. Open HN or X.
  2. Click the floating coffee cup (bottom-right).
  3. Type a rule — "make every comment polite", "3-word summary", "pirate speak".
  4. Watch each comment / post stream a rewrite in real time.
  5. Click the next to any block to see the original.

What it preserves

Facts, stance, and voice. Only the tone changes. A pro-X take stays pro-X — Decaf defangs the delivery, not the position. Click ↺ to see the unfiltered original anytime.

Setup

Needs Chrome 138+ + ~22 GB disk / 4 GB VRAM / 16 GB RAM (Gemini Nano's hardware floor).

  1. chrome://flags/#optimization-guide-on-device-modelEnabled BypassPerfRequirement
  2. chrome://flags/#prompt-api-for-gemini-nanoEnabled, then relaunch
  3. git clone https://github.com/milind-soni/Decaf.git
  4. chrome://extensionsDeveloper modeLoad unpacked → pick the folder
  5. Click the toolbar icon → Download Gemini Nano (~4 GB, one time)

If anything's stuck: chrome://on-device-internals is the diagnostic page.

How it works

Vanilla JS, no build step. The service worker keeps one warm LanguageModel session and clones it per request. Each rewrite streams via promptStreaming with a JSON-schema-constrained response; a hand-rolled parser extracts the rewritten field character-by-character and pipes it over a chrome.runtime Port to the content script, which swaps element.textContent live. Original HTML is stashed on each element's dataset so the ↺ can put it back exactly.

Limits

  • English-strong only (en / es / ja).
  • First rewrite is slow (model warmup); subsequent ones are sub-second.
  • Nano-quality rewrites — fast, free, fully local. Not Claude-quality.

License

MIT.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors