Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

pi-caffeinate

A Pi extension that prevents macOS from entering idle system sleep while the agent is working.

It keeps the machine awake during model responses, tool calls, retries, compaction retries, queued continuations, and tools waiting for user input. The sleep assertion is released as soon as the agent fully settles.

Compatibility

This extension has been checked and verified on macOS. It requires:

  • Pi (@earendil-works/pi-coding-agent)
  • The caffeinate command available on PATH

caffeinate is supplied by macOS and is not bundled with this extension. Its location does not matter as long as the command is accessible. Verify it before installation:

command -v caffeinate

The repository also includes a dependency check:

node scripts/check-caffeinate.mjs

Git-based Pi installations run this check through the package installation hook. Because local policies can disable installation hooks, the extension checks again at runtime. If the command is unavailable, the extension disables itself and displays a warning instead of attempting to start a missing command.

Install

Install directly from this Git repository:

pi install git:github.com/forlorn-echo/pi-caffeinate

Install a tagged release for a reproducible version:

pi install git:github.com/forlorn-echo/pi-caffeinate@v1.0.0

Add -l for a project-local installation:

pi install git:github.com/forlorn-echo/pi-caffeinate -l

Start or restart Pi after installation. Use pi list to inspect installed packages and pi config to enable or disable the extension.

Try without installing

Load the extension from a clone of this repository:

pi -e ./pi-caffeinate.ts

Or load the Git package temporarily for one run:

pi -e git:github.com/forlorn-echo/pi-caffeinate

How it works

While the agent is active, the extension runs:

caffeinate -i -t 300

The -i flag prevents idle system sleep. Each assertion expires after five minutes as a fail-safe and is refreshed every four minutes while work continues. This ensures that a force-killed Pi process cannot leave a permanent sleep assertion behind.

The assertion is stopped on both agent_settled and session_shutdown.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages