Keep your laptop awake while an AI agent finishes its task
Project description
🦍 ApeAwake
Intelligent wrapper for Claude Code. ApeAwake launches Claude, keeps your laptop awake for the full session, auto-approves permission prompts based on your preference, and presents a PR-style diff review when Claude finishes.
Works on macOS and Linux. Windows supports legacy watch mode only.
Prerequisites
- Python 3.9+
- Claude Code installed and available on your PATH (
claude --versionshould succeed)
Install
pipx install apeawake
Or install directly from source:
pipx install git+https://github.com/RobinDFeder/apeawake
For local development:
git clone https://github.com/RobinDFeder/apeawake
cd apeawake
pip install -e .
Usage
Default — TUI session mode
apeawake
Launches a three-phase session:
- Config screen — pick an approval mode (see below)
- Claude session — Claude Code runs in a PTY relay; sleep lock is held; prompts are auto-approved per your chosen mode
- Diff review — when Claude goes idle, a side-by-side diff lets you keep or revert changes file by file
Skip the config screen
apeawake --mode all # auto-approve every Claude prompt
apeawake --mode edits # auto-approve file edits; pause on shell commands
apeawake --mode ask # never auto-approve; you handle every prompt
Legacy watch mode (headless)
Attach to an already-running process by PID and hold the sleep lock until it exits. No TUI, no diff review. Works on Windows.
apeawake --watch <PID>
Approval modes
| Mode | Behavior |
|---|---|
all |
Auto-answers every Claude permission prompt with yes |
edits |
Auto-approves file edits; pauses on bash/shell commands |
ask |
Never auto-approves; every prompt requires your input |
Options
| Flag | Description | Default |
|---|---|---|
--mode / -m |
Skip config TUI; use all, edits, or ask |
— |
--idle SECONDS |
CPU-idle seconds before declaring Claude done | 60 |
--watch PID / -w |
(Legacy) watch an existing process by PID | — |
--interval SECONDS / -i |
Poll interval in seconds | 2.0 |
Diff review keys
After Claude finishes, the diff screen shows each changed file:
| Key | Action |
|---|---|
K |
Keep current file |
R |
Revert current file |
A |
Keep all files |
D |
Discard all files |
Q |
Quit |
If you don't interact with the diff screen for 10 minutes, the sleep lock is released so your laptop can sleep normally. The screen stays open — interacting with it re-acquires the lock.
How it works
Sleep backends
| OS | Mechanism |
|---|---|
| macOS | caffeinate -dims -s + pmset power settings (requires sudo) |
| Linux | systemd-inhibit --what=sleep:idle:handle-lid-switch |
| Linux (fallback) | xdg-screensaver reset loop (screensaver only, no lid-close) |
| Windows | Legacy watch mode only — use apeawake --watch <PID> |
macOS power management
On macOS, ApeAwake uses sudo pmset to disable standby, hibernate, and battery sleep for the duration of the session — so closing the lid on battery won't interrupt Claude mid-task. Your original settings are restored automatically when the session ends. You'll be prompted for your password once at startup; ApeAwake keeps the sudo token alive in the background for the full session.
Contributing
Bug reports and pull requests are welcome. Please open an issue first for any significant change.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apeawake-0.5.1.tar.gz.
File metadata
- Download URL: apeawake-0.5.1.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a457671965e6c03355fc7d9414ad831987a7a94c50ce3aabf9e21416514f046
|
|
| MD5 |
a3eb729ab9659b073958d336cacc989d
|
|
| BLAKE2b-256 |
16fa9b8c7188e3c347c78984c44bbd1fbf4c0921be7a12f1771129424c88cbe6
|
File details
Details for the file apeawake-0.5.1-py3-none-any.whl.
File metadata
- Download URL: apeawake-0.5.1-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
476e8946f3a6dc8b149143454dedb7dda25bd193b8fcbb1098500c3fab12d57a
|
|
| MD5 |
3402995e0e14977d8c7dc052a2d9bd8d
|
|
| BLAKE2b-256 |
6218039b987cd1c9f8aab67972530ad3df304ce0ac4f3b2279f1ae1fad95a5d9
|