Insomnia prevents Windows from sleeping — automatically when AI coding tools are working, when specific apps are running, or manually on demand. No more broken sessions.
You're running Claude Code or Aider on a long task. You step away.
Your PC falls asleep, kills the process, and you come back to a broken session and lost work.
Setting your sleep timeout to "Never" works — but then your PC never sleeps when you actually want it to.
Insomnia fixes this. It stays awake only while something needs it, then gets out of the way.
For Claude Code and Cursor, Insomnia hooks directly into the tool's event system — awake while the AI is working, asleep the moment it stops. Precise to the second.
Add any app as a trigger. Insomnia auto-discovers every installed app on your system. When it's running, you stay awake. When it closes, you don't.
Need to stay awake right now? One switch. No timers, no fuss. Toggle it off when you're done. Perfect for presentations.
A purple owl means awake. A grey owl means inactive. The hover tooltip tells you exactly why. Close the window — it keeps running.
Plain HTML, CSS, and JS. No React. No bundler. Zero external runtime dependencies. Installs in seconds and uses almost no resources.
Nothing leaves your machine. No telemetry, no accounts, no cloud. Settings are stored locally and that's it.
| Tool | Type | How it works |
|---|---|---|
| ✨ Claude Code | Smart | Hook-based — awake only while Claude is actively running tools. Idle for 3 min = asleep. |
| ✏️ Cursor | Smart | Agent transcript polling — awake while Cursor Agent is actively working. Idle for 3 min = asleep. |
| 🤖 Aider | Process | Awake while Aider is running. 30s grace after it closes. |
| 💻 OpenAI Codex | Smart | Hook + session-activity based — awake while Codex is actively working in CLI, VS Code, or the standalone app. |
| 🧠 Ollama | Process | Awake during local model inference. 30s grace after Ollama stops. |
Download the installer and run it. Or use a package manager:
Windows 10/11 · Free · Open Source (MIT)
Install Insomnia and add a trigger. Use the manual Keep Awake toggle for immediate effect, enable an AI integration to stay awake only during active AI work, or add any application as a watched trigger. Insomnia uses Electron's powerSaveBlocker API to prevent Windows from sleeping.
Yes. Enable the Claude Code integration and Insomnia installs hooks in ~/.claude/settings.json. Your PC wakes the moment Claude starts working and sleeps within 3 minutes after the session goes idle.
Yes. Insomnia polls ~/.cursor/projects/*/agent-transcripts/**/*.jsonl every 5 seconds — files only written during active Cursor Agent sessions. The PC stays awake only while the Agent is working, not just because Cursor is open.
Setting power settings to "Never" keeps your PC awake permanently, wasting power and battery. Insomnia keeps it awake only while a trigger is active — the moment all triggers go inactive, normal sleep behavior resumes automatically.
Completely free, MIT licensed, open source. No accounts, no subscriptions, no telemetry. Nothing leaves your machine.