<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: fangjie-hu</title>
    <description>The latest articles on DEV Community by fangjie-hu (@tomatohug).</description>
    <link>https://dev.to/tomatohug</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4286006%2Ff0aade51-b388-441d-8dda-ab33c153904b.png</url>
      <title>DEV Community: fangjie-hu</title>
      <link>https://dev.to/tomatohug</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tomatohug"/>
    <language>en</language>
    <item>
      <title>I press E in any text field and my sloppy prompt becomes a structured one</title>
      <dc:creator>fangjie-hu</dc:creator>
      <pubDate>Sun, 06 Dec 2026 08:23:26 +0000</pubDate>
      <link>https://dev.to/tomatohug/i-press-e-in-any-text-field-and-my-sloppy-prompt-becomes-a-structured-one-5j7</link>
      <guid>https://dev.to/tomatohug/i-press-e-in-any-text-field-and-my-sloppy-prompt-becomes-a-structured-one-5j7</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;The fix isn't a better prompt library. I &lt;em&gt;know&lt;/em&gt; 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.&lt;/p&gt;

&lt;p&gt;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:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;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.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The interesting engineering bits
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Writing back without wrecking your text.&lt;/strong&gt; 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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A fidelity pipeline before the model call.&lt;/strong&gt; 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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Focus tracking without polling.&lt;/strong&gt; 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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Zero keystroke capture, by architecture.&lt;/strong&gt; 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 &lt;em&gt;counter&lt;/em&gt; (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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cross-app is the whole point
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Try it
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download: &lt;a href="https://tomato-hug.github.io/sena-prompt-pet/en/" rel="noopener noreferrer"&gt;https://tomato-hug.github.io/sena-prompt-pet/en/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/tomato-hug/sena-prompt-pet" rel="noopener noreferrer"&gt;https://github.com/tomato-hug/sena-prompt-pet&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;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.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>rust</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
