Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gram

Chrome extension. Select text anywhere → right-click → gram → corrected text lands in your clipboard.

How it works

  1. Primary — ChatGPT temporary chat. Opens chatgpt.com/?temporary-chat=true&q=<prompt + your text>. The q param pre-fills and auto-submits the prompt, so no DOM typing is needed. A content script waits for the reply to finish streaming, copies it to the clipboard, and the tab closes automatically.
  2. Fallback — on-device AI. If ChatGPT doesn't respond within ~90s (login wall, UI change, network), the extension runs Chrome's built-in Prompt API (Gemini Nano) on the same text and copies that result instead. The ChatGPT tab is left open so you can see what went wrong.
  3. Either way you get a desktop notification telling you which path ran.

The prompt used:

Grammar check the following text. Make minimal changes and output only the corrected text, nothing else.

Install

  1. Open chrome://extensions
  2. Enable Developer mode (top right)
  3. Load unpacked → select this folder

Requirements & caveats

  • Chrome 138+ (for the Prompt API fallback).
  • Primary path works best when you're already logged in to chatgpt.com (temporary chat, so no history is saved).
  • The fallback's on-device model downloads (~2 GB) on first use — until then a failed ChatGPT run may notify "on-device AI unavailable".
  • The content script depends on ChatGPT's DOM (data-message-author-role, data-testid="stop-button"). If OpenAI changes their UI, the primary path times out and the fallback takes over — the extension degrades, it doesn't break.
  • Very long selections can exceed URL length limits (~2k chars is safe).

Files

File Role
manifest.json MV3 manifest
background.js Context menu, job state, fallback AI, notifications, tab lifecycle
content.js Runs on chatgpt.com; scrapes the finished reply, copies it
offscreen.html/js Clipboard writes from the service worker (fallback path)

About

gram — right-click any selected text to fix it via ChatGPT (on-device AI fallback), corrected result straight to your clipboard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages