# AI use cases for Insomnia (krishhgg/Insomnia)

Repo: [krishhgg/Insomnia](https://github.com/krishhgg/Insomnia) | Use cases: 4 | Page: https://dedupedai.com/use-cases/krishhgg-insomnia/

Insomnia is a macOS menu bar app that keeps a MacBook awake for timed sessions, including with the lid closed, and undoes its power and lid changes when a session ends.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Keep a MacBook awake for a timed agent run: https://dedupedai.com/use-cases/krishhgg-insomnia/run-timed-lid-closed-agent-session/
- Test lid-close behavior before a long unattended run: https://dedupedai.com/use-cases/krishhgg-insomnia/test-lid-close-actions-before-long-run/
- Recover a Mac after a session that could not be undone: https://dedupedai.com/use-cases/krishhgg-insomnia/recover-after-session-that-could-not-be-undone/
- Keep a tmux coding agent going through a Wi-Fi drop: https://dedupedai.com/use-cases/krishhgg-insomnia/keep-tmux-coding-agent-alive-through-wifi-drop/

## How to keep a MacBook awake for a timed agent run with Insomnia

Repo: [krishhgg/Insomnia](https://github.com/krishhgg/Insomnia) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Install Insomnia, then start a timed awake session so a long agent job keeps running with the lid closed.

**Who it is for:** A developer who starts a long coding agent task on a MacBook and needs it to keep running after they close the lid and walk away.

**The problem:** macOS sleeps the laptop when the lid closes, which stops a long task and can leave work unfinished.

**The outcome:** The Mac stays awake until the session end time, the lid-close actions are applied, and the session's changes are undone when it ends.

### Steps

1. Paste the install prompt from the README into your coding agent, or follow docs/install.md, and enter your password in Terminal when asked.
2. Run `open "$HOME/Applications/Insomnia.app"` to start the app.
3. Click the eye in the menu bar, enter days, hours and minutes, and press Enter to start the session.
4. Check Settings, including the lid-close options, before you close the lid.
5. Read `~/Library/Logs/Insomnia/insomnia.log` after the first session to confirm what happened.

### Prompt to paste into your agent

```text
Using the repo https://github.com/krishhgg/Insomnia, install Insomnia on this Mac by following skills/install-insomnia/SKILL.md, and if a step needs my password, give me the exact Terminal command to run. Then start a session of <session-length> from the menu bar eye. Verify that ~/Applications/Insomnia.app exists and report the installed version from Settings > App.
```

### Caveat

Insomnia is described as experimental, the timer is not a safety guarantee, and the battery and heat rules only work while the app is running.

Risk, credentials: The installed sudoers rule lets any program running as your user account run the pmset power commands without a password, so review /etc/sudoers.d/insomnia before you install.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/krishhgg-insomnia/run-timed-lid-closed-agent-session/

## How to test lid-close behavior before a long unattended run with Insomnia

Repo: [krishhgg/Insomnia](https://github.com/krishhgg/Insomnia) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Run a short watched session and check the lid-close actions and log before trusting it overnight.

**Who it is for:** A user who has just installed Insomnia and wants to confirm how it treats the display, apps, audio and Low Power Mode before leaving a Mac unattended.

**The problem:** Lid-close actions such as freezing apps and muting audio change how the Mac behaves, and a first run without checking can surprise the user.

**The outcome:** The user knows which lid-close actions are on, has seen one short session end cleanly, and has read the log for any problems.

### Steps

1. Open Settings from the right-click menu on the eye and review the lid-close actions and the freeze list.
2. Follow the section in docs/lid-close.md on testing lid actions without closing the lid.
3. Start a short session from the eye, watch the countdown, then end it early by pressing and holding the end control.
4. Open `~/Library/Logs/Insomnia/insomnia.log` and check that each change was undone.
5. Check the menu for any recovery warning before you use the Mac for a long run.

### Prompt to paste into your agent

```text
In the repo https://github.com/krishhgg/Insomnia, read docs/lid-close.md and docs/recovery.md, then tell me which lid-close actions are on by default for this Mac. Output a short checklist for a test session of <test-minutes> minutes. Verify the checklist against the README before reporting.
```

### Caveat

The README says the built-in microphone disconnects in hardware when the lid is closed on Apple silicon or T2 Macs, so meeting recording with the lid closed needs AirPods or an external mic.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/krishhgg-insomnia/test-lid-close-actions-before-long-run/

## How to recover a Mac after a session that could not be undone with Insomnia

Repo: [krishhgg/Insomnia](https://github.com/krishhgg/Insomnia) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Find and clear the recovery warning, unfreeze processes and restore audio after a crash or quit.

**Who it is for:** A user who sees a recovery warning in the Insomnia menu after the app crashed, quit or lost track of a session.

**The problem:** Some changes, such as frozen processes or muted audio, may still be in place after a session ends, so the Mac may not behave normally.

**The outcome:** The user has reopened Insomnia to restore audio, checked frozen processes, and cleared or understood each recovery warning.

### Steps

1. Open Insomnia with `open "$HOME/Applications/Insomnia.app"` so the app can restore audio.
2. Read the recovery warning in the menu and find the matching case in docs/recovery.md.
3. Check any process Insomnia could not prove it froze, since it stays frozen until you check it.
4. Read `~/Library/Logs/Insomnia/insomnia.log` for the recorded changes.
5. Run `./scripts/uninstall.sh` only if you intend to remove Insomnia, because it undoes any open session first.

### Prompt to paste into your agent

```text
In the repo https://github.com/krishhgg/Insomnia, read docs/recovery.md and the log at ~/Library/Logs/Insomnia/insomnia.log on this Mac. Report each recovery warning and the step from docs/recovery.md that addresses it. Verify that you did not change any power setting while reporting.
```

### Caveat

The recovery agent cannot restore audio and does not watch the battery or temperature, so the user must reopen the app for audio and check those conditions directly.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/krishhgg-insomnia/recover-after-session-that-could-not-be-undone/

## How to keep a tmux coding agent going through a Wi-Fi drop with Insomnia

Repo: [krishhgg/Insomnia](https://github.com/krishhgg/Insomnia) | Difficulty: Advanced | Time: 1 hour | Basis: From the README

Set up iPhone hotspot handoff and a marked tmux pane so a coding agent can resume after the network drops.

**Who it is for:** A developer whose coding agent runs in tmux on a MacBook and who may lose Wi-Fi while the lid is closed or they are away.

**The problem:** A dropped network can stop a coding agent mid-task, and nobody is at the keyboard to restart it.

**The outcome:** After 90 seconds without a network, Insomnia can join the saved iPhone hotspot and type continue into the marked tmux pane.

### Steps

1. Set System Settings > Wi-Fi > Ask to join hotspots to Automatically.
2. Enter the hotspot's name and password in Insomnia's Settings, then approve the Location Services request.
3. Mark only the tmux pane that runs your agent with `tmux set-option -p -t <pane-target> @insomnia-nudge on`. (inferred, check the README)
4. Start a session from the menu bar eye so the nudge runs during the session.
5. Check the log afterward to confirm which panes were typed into.

### Prompt to paste into your agent

```text
In the repo https://github.com/krishhgg/Insomnia, read docs/extras.md and list the steps to enable the iPhone hotspot handoff and tmux nudge for a pane named <pane-target>. Verify that the nudge option is off by default and that Enter is not pressed unless enabled, then report the result.
```

### Caveat

The README says some web apps may still stop with the lid closed, so the tmux nudge cannot guarantee that an agent keeps working.

Risk, credentials: The hotspot password is stored in your login Keychain, and the logs can contain Wi-Fi names and tmux targets, so check logs before you share them.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/krishhgg-insomnia/keep-tmux-coding-agent-alive-through-wifi-drop/
