Enhance Your Text with LLM Spoon for Hammerspoon


If you’re a Hammerspoon user and often find yourself rewriting, summarizing, or translating text, this little spoon might come in handy.
LLM Spoon for Hammerspoon is a simple tool I created that connects Hammerspoon with Cohere’s large language model. It lets you trigger useful text transformations — like rewriting, summarizing, or translating — with a hotkey.
It’s not a polished product, just a small helper I use myself. Maybe it’s useful to someone else too, or maybe you’ll want to tweak it to better suit your own needs.
✨ Why I Built This
As someone who’s dyslexic, I often find large language models incredibly useful when I need to clean up or clarify my writing.
That’s why I built this simple spoon for Hammerspoon: so I can quickly improve selected text with a single hotkey, right when I need it.
If you’re like me and occasionally need a little help tightening up your writing, this tool can make that process a lot smoother.
🛠 What It Can Do
The LLM Spoon includes a few basic actions:
- Rewrite – Improves grammar, spelling, and sentence structure
- Summarize – Condenses long passages into a shorter summary
- Translate (EN ⇄ DA) – Translates between English and Danish
- (It’s easy to add more prompt types if you like)
I use Cohere because it offers a free option that allows me to use its API. Other LLM's maybe superior. The Python code used to call the API is straightforward and can be easily modified to work with other LLMs.
🚀 Installation
- Clone or download the repository
- Double-click
AiHelper.spoon
— Hammerspoon will install it for you
⚙️ Configuration
Before using the spoon, you’ll need a Cohere API key. You can get one at Cohere API Keys.
Then, add this to your Hammerspoon init.lua
file:
1hs.settings.set("AiHelper.apiKey", "<COHERE_API_KEY>") 2 3-- Load the spoon 4hs.loadSpoon("AiHelper") 5 6-- Initialize the helper 7spoon.AiHelper:init() 8 9-- Set up hotkeys 10spoon.AiHelper:bindHotkeys({ 11 rewrite = {{"cmd", "alt", "ctrl"}, "R"} 12})
lua
Now you can select some text, press your hotkey, and let the language model help out.
It’s just a small utility I built for myself — shared in case others find it helpful or want to modify it for their own workflows.
Let me know if you end up using it or improving it — I’d love to hear how you make it your own.
The source code can be found here.
The Spoon has been updated to integrate ChatGPT from OpenAI as the LLM provider. Additionally, prompts are now separated into individual files to facilitate easy customization.