Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fettle

fettle (v., British) — to put something in good order; to fix, tidy, or repair.

A tiny macOS utility that brings back the feature Grammarly quietly dropped: select nothing, just hit one hotkey and the text in the field you're typing in gets its typos, grammar, and tense fixed in place.

Press ⌥ Space (Option+Space) in any text field — a message, a document, an email — and fettle grabs what's there, cleans it up with an LLM, and pastes the corrected version straight back. No window to paste into, no leaving the app you're in.

It's deliberately small: no bundled AI model, no backend, no account. You bring your own API key and pick which provider/model to use, so the whole thing stays featherweight and costs you only fractions of a cent per fix — or nothing, on Groq's free tier.

fettle fixing a typo-ridden Slack message in place with one keypress

Requirements

  • macOS
  • Hammerspoon (free) — the runtime that hosts the script
  • An API key from at least one supported provider:
    • Anthropic — highest quality (Haiku / Sonnet / Opus)
    • Groq — much faster for short text, with a generous free tier (GPT-OSS models)

Quick install

git clone https://github.com/anothersmith/fettle.git
cd fettle
./install.sh

The script installs Hammerspoon (via Homebrew) if it's missing, links the init.lua, saves your API key(s), opens the Accessibility settings pane, and starts Hammerspoon. The only step it can't do for you is flick the Accessibility toggle on — macOS won't let software grant itself that.

Manual install

  1. Install Hammerspoon:
    brew install --cask hammerspoon
  2. Install the script. If you don't already use Hammerspoon, symlink this repo's init.lua into place:
    ln -sf "$(pwd)/init.lua" ~/.hammerspoon/init.lua
    Already have a ~/.hammerspoon/init.lua? Don't overwrite it — instead add dofile("/path/to/fettle/init.lua") to your existing config.
  3. Add at least one API key (kept outside this repo so it can never be committed):
    # Anthropic (optional)
    echo "sk-ant-your-key-here" > ~/.hammerspoon/fettle-key.txt
    # Groq (optional)
    echo "gsk_your-key-here"    > ~/.hammerspoon/fettle-groq-key.txt
    chmod 600 ~/.hammerspoon/fettle-*.txt
    Or launch it first and use the menu-bar Edit … key… items.
  4. Grant Accessibility permission. Launch Hammerspoon, then System Settings → Privacy & Security → Accessibility → enable Hammerspoon. (It needs this to read and replace text in other apps.)
  5. Click the Hammerspoon menu-bar icon → Reload Config. You should see a "fettle loaded" flash.

Usage

Type in any text field, then hit ⌥ Space. That's it.

⚠️ Don't use it in a terminal. Like any paste-based tool, fettle replaces the field by pasting — and at a shell prompt, pasted text containing a newline can execute. It's built for messages, documents, and email fields, not command lines.

The ✍️ menu-bar icon lets you:

  • Pick a provider + model — Anthropic (Haiku / Sonnet / Opus) or Groq (GPT-OSS 20B / 120B). Your choice is remembered.
  • Choose your spelling — match your own writing (auto), or force British or American. Remembered like the model choice.
  • Edit … key… — opens the relevant provider's key file.
  • Reload config.

Which model?

  • Groq · GPT-OSS 20B — fastest (~0.2s), free tier. Great default for quick messages.
  • Groq · GPT-OSS 120B — a little more quality, still faster than Anthropic.
  • Anthropic · Haiku / Sonnet / Opus — top quality; Haiku lands around ~0.7s.

Correction is an easy task, so the small fast models handle typos, tense, and British spelling well. Reach for Anthropic when you want the most careful touch.

Configuration

Everything tweakable lives at the top of init.lua:

  • HOTKEY_MODS / HOTKEY_KEY — change the shortcut.
  • PROVIDERS — add or remove providers/models, or update a model id if a provider retires one (e.g. a model_decommissioned error).
  • Spelling (auto / British / American) is a menu-bar setting now — no code edit needed. The correction wording itself lives in systemPrompt() and the DIALECTS table at the top of init.lua if you want to tweak it.

Privacy & cost

Each correction sends the text of the focused field to whichever provider you have selected (Anthropic or Groq) over HTTPS. Don't use it on anything you wouldn't send to a cloud service — switching provider is one menu click. Cost is pay-as-you-go on your own key — pennies a day, or free within Groq's free tier.

How it works

Hotkey → Cmd+A, Cmd+C to grab the field → send text to the model → paste the corrected result back → restore your previous clipboard. The "clipboard trick" is what lets it work system-wide without per-app integration.

Status

A working prototype. It does one thing well. Contributions and forks welcome.

About

Recreate Grammarlys dropped "tab to autocorrect": one hotkey fixes typos, grammar & tense in place, anywhere on macOS. A tiny Hammerspoon utility, bring-your-own LLM key.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages