<?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: Stanley</title>
    <description>The latest articles on DEV Community by Stanley (@stanleyprojects).</description>
    <link>https://dev.to/stanleyprojects</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3852483%2Fbce47b7f-147d-4c05-a8b6-9bc9c2ec7a32.png</url>
      <title>DEV Community: Stanley</title>
      <link>https://dev.to/stanleyprojects</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stanleyprojects"/>
    <language>en</language>
    <item>
      <title>I Built a Tiny Electron App to Stop Windows From Killing My Claude Code Sessions</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Tue, 31 Mar 2026 01:03:50 +0000</pubDate>
      <link>https://dev.to/stanleyprojects/i-built-a-tiny-electron-app-to-stop-windows-from-killing-my-claude-code-sessions-55le</link>
      <guid>https://dev.to/stanleyprojects/i-built-a-tiny-electron-app-to-stop-windows-from-killing-my-claude-code-sessions-55le</guid>
      <description>&lt;p&gt;You know that feeling when you come back to your desk and your Claude Code session is just gone?&lt;/p&gt;

&lt;p&gt;Not crashed. Not errored. Just a blank terminal because Windows put the machine to sleep while you were away.&lt;/p&gt;

&lt;p&gt;It happened to me too many times. So I built something to fix it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;br&gt;
Windows has a sleep timer. By default it kicks in after 10 or 15 minutes of no user input. The problem is that AI coding agents don't count as user input. You're not moving the mouse or typing. Claude Code is reading files, writing code, running tools in the background, and Windows has no idea anything is happening.&lt;/p&gt;

&lt;p&gt;You lose your session, your context, sometimes your terminal state. If you kicked off a long agentic run and stepped away, that's genuinely painful.&lt;/p&gt;

&lt;p&gt;The obvious fix is to disable sleep in Power Settings. But then you have to remember to turn it back on, and I never do. Laptop running hot at 3am for no reason.&lt;/p&gt;

&lt;p&gt;What I wanted was something that keeps the machine awake while work is happening and backs off when it isn't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I Built&lt;/strong&gt;&lt;br&gt;
Insomnia is a small Windows tray app. It watches for AI coding activity and prevents Windows from sleeping. When activity stops, it releases. That's it.&lt;/p&gt;

&lt;p&gt;No scheduled tasks. No registry edits. No "set sleep to Never."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How It Works&lt;/strong&gt;&lt;br&gt;
Three modes, all running at the same time if you want:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Claude Code Hook Integration&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Claude Code has a hooks system that fires shell commands on lifecycle events. Insomnia registers as a hook handler for:&lt;/p&gt;

&lt;p&gt;PreToolUse and PostToolUse — Claude is using a tool&lt;br&gt;
UserPromptSubmit — you sent a message&lt;br&gt;
PermissionRequest — Claude is waiting for your approval&lt;br&gt;
Notification — Claude is surfacing something&lt;br&gt;
When any of these fire, Insomnia activates. When they stop, it releases. No polling, no guessing, responds to the actual lifecycle of the agent.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Process Watching&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For tools without a hooks API, Insomnia watches the process list. Cursor, Aider, Ollama, OpenAI Codex — if any of them are running, your PC stays awake. When they close, it backs off.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Manual Toggle&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One switch for when you just need the PC awake right now. Toggle it off when you're done.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Tray Icon&lt;/strong&gt;&lt;br&gt;
Purple owl means awake. Grey owl means idle. Hover and it tells you why: "Staying awake for Claude Code." You always know what state you're in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stack&lt;/strong&gt;&lt;br&gt;
Electron, zero npm dependencies. Free, MIT licensed, Windows only.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install&lt;/strong&gt;&lt;br&gt;
Direct download: Releases page &lt;a href="https://github.com/stanley-projects/Insomnia/releases" rel="noopener noreferrer"&gt;Releases page&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scoop:&lt;/p&gt;

&lt;p&gt;scoop bucket add stanley-projects &lt;a href="https://github.com/stanley-projects/scoop-stanley" rel="noopener noreferrer"&gt;https://github.com/stanley-projects/scoop-stanley&lt;/a&gt;&lt;br&gt;
scoop install stanley-projects/insomnia&lt;br&gt;
winget: winget install StanleyProjects.Insomnia&lt;/p&gt;

&lt;p&gt;Enable the Claude Code integration inside the app and it wires up the hooks automatically. No manual config needed.&lt;/p&gt;

&lt;p&gt;It also works for Cursor, Codex.. etc&lt;/p&gt;

&lt;p&gt;Links&lt;br&gt;
GitHub: github.com/stanley-projects/Insomnia&lt;br&gt;
Landing page: stanley-projects.github.io/Insomnia&lt;br&gt;
Stars and feedback welcome.&lt;/p&gt;

</description>
      <category>windows</category>
      <category>productivity</category>
      <category>ai</category>
      <category>electron</category>
    </item>
  </channel>
</rss>
