Skip to main content

Keep your laptop awake while an AI agent finishes its task

Project description

🦍 ApeAwake

Keep your laptop awake while an AI agent finishes its task. Close the lid, take a walk — ApeAwake holds the sleep lock until the job is done, then lets your machine sleep normally.

Works on macOS, Linux, and Windows with no external Python dependencies.


Install

pip install -e .

This registers the apeawake command globally.


Usage

Wrap mode — launch and own the process

apeawake -- claude --task "refactor the auth module"
apeawake -- aider --model gpt-4o --file src/main.py
apeawake -- python train.py

ApeAwake spawns your command, acquires the sleep lock, and releases it the moment the process exits.

Watch mode — attach to a running process

# Start your agent in one terminal
claude --task "build the dashboard" &
AGENT_PID=$!

# Attach ApeAwake in another (or the same)
apeawake --watch $AGENT_PID

Options

Flag Description Default
--watch PID Watch an existing process by PID
--interval N Poll interval in seconds 2.0

How it works

OS Mechanism
macOS caffeinate -dims (prevents display, idle, disk, and system sleep)
Linux systemd-inhibit --what=sleep:idle:handle-lid-switch
Linux (fallback) xdg-screensaver reset loop (screensaver only, no lid-close)
Windows SetThreadExecutionState with ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED

The sleep lock lifetime is tied directly to your process — no manual --stop needed. Ctrl+C also releases cleanly.


Example session

$ apeawake -- claude --task "write unit tests for billing.py"

🦍  ApeAwake — wrap mode
    Backend : caffeinate (macOS)
    Command : claude --task write unit tests for billing.py

✓  Sleep lock acquired (PID 48291). Laptop will stay awake.
   Close the lid freely — ApeAwake has you covered.

   ⏱  Running... 4m 12s
   ✓  Task finished in 4m 12s. Releasing sleep lock.
   Exit code: 0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apeawake-0.1.0.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apeawake-0.1.0-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file apeawake-0.1.0.tar.gz.

File metadata

  • Download URL: apeawake-0.1.0.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for apeawake-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a040fa0cd6e4f329a7eeb4443337b1b6692cd822659e7708fcfd7e7347e4fceb
MD5 e88623b0f374c263d0aafbf9ea6fd3fb
BLAKE2b-256 ce53f706be6b5a1100dd659d4c10af182716d32c462ccd4154b6dcc4f01b1b62

See more details on using hashes here.

File details

Details for the file apeawake-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: apeawake-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for apeawake-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 938cd3184021eaf11320a9ba4a5e276b696b466b9e16ab19fc243c8e85e8c31e
MD5 f864859400daa5f62db676e7105dc55e
BLAKE2b-256 899966a3015c7b148fd378c391c35eee2334524ae92f2443aab27895d786cc10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page