I type terrible prompts at 1am. "write me a login feature, make it secure, handle errors" — then I act surprised when the model hands back something shallow.

The fix isn't a better prompt library. I know what a good prompt looks like: role, constraints, edge cases, acceptance criteria. I just don't type all that scaffolding for every throwaway request. Prompt quality, for me, turned out to be a typing-friction problem.

So I built Sena: a small Tauri app that lives on my desktop. In any text field — Claude Code, Cursor, ChatGPT in the browser, DeepSeek — I type my rough draft, press ⌥E (Alt+E on Windows), and the text is rewritten in place into a structured prompt:

Before: write me a login feature, make it secure, handle errors properly After: Implement a user login module: store passwords with bcrypt + per-user salt; session via JWT (15-min access token + rotating refresh token); unified API error handling distinguishing validation failures (400), bad credentials (401), and account lockout (423 after 5 failed attempts, 15-min lock). Add unit tests covering successful login, wrong password, and lockout. 

The interesting engineering bits

Writing back without wrecking your text. Sena snapshots the original, and before writing back it re-checks focus — if you switched windows mid-generation, it falls back to clipboard instead of injecting into the wrong app. There's an 8-second undo. Terminal windows are hard-excluded: injecting text into a shell is a footgun I refuse to ship.

A fidelity pipeline before the model call. Rewrites that silently drop a URL or change a number are worse than no rewrite. A local Rust pre-processor scores the draft, resolves spoken self-corrections ("no wait, I meant…"), and extracts must-keep tokens (URLs, paths, exact parameters). After the model streams its rewrite, every token is reconciled; missing ones get restored. Pure-code and proofreading inputs skip rewriting entirely.

Focus tracking without polling. AXObserver on macOS (hand-written FFI — Tauri has no binding), UI Automation on Windows. One hard-won lesson: set a messaging timeout on AX calls, or one hung app takes your thread down with it.

Zero keystroke capture, by architecture. Sena has a desktop pet that plays piano as you type (17 classical pieces, note-by-note chromatic playback). The rhythm sensing reads only the OS key-event counter (CGEventSourceCounterForEventType), sampled twice and diffed. It is physically impossible for the app to know which keys you pressed. No global keyboard hook, nothing to leak.

Cross-app is the whole point

Per-chat custom instructions don't travel. My architecture style should apply in Claude Code at work, Cursor at home, and a browser tab in between. Sena keeps one set of styles (9 built-in experts + unlimited custom) and applies them wherever the cursor is.

Try it

Free and open source (Apache-2.0), macOS (notarized) + Windows. BYO API key — DeepSeek by default, any OpenAI-compatible endpoint or local Ollama works; keys live in your OS keychain.

We're aiming for 50 GitHub stars to launch on Product Hunt — if Sena saves you a few prompt rewrites, a star genuinely helps. And I'd love failure cases: drafts where the rewrite mangled your intent are the most useful feedback I can get.