pi-caffeinate

Pi extension that keeps the machine awake while the agent is working (macOS, Linux, Windows)

Package details

extension

Install pi-caffeinate from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-caffeinate
Package
pi-caffeinate
Version
2.0.0
Published
Feb 20, 2026
Downloads
60/mo · 12/wk
Author
georgebashi
License
MIT
Types
extension
Size
6.5 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-caffeinate

A pi extension that keeps the machine awake while the agent is actively working.

Why

If you walk away while pi is working, the machine can idle-sleep mid-task. This extension keeps it awake until the agent finishes.

How

The extension keeps the machine awake when the agent starts processing and lets it sleep again when the agent finishes.

  • Display sleep is unaffected — your screen still dims and sleeps normally.
  • Lid-close sleep is unaffected — closing the lid still sleeps the machine.
  • Only idle sleep is affected, and only while the agent is actively running (not while waiting for your input).

Platform details

Platform Mechanism Requires
macOS Spawns caffeinate -i — creates a keep-awake assertion via IOKit Built-in, nothing extra needed
Linux Spawns systemd-inhibit --what=idle ... sleep infinity — takes an idle inhibitor lock via logind systemd-inhibit (present on all systemd-based distros). Silently no-ops if unavailable.
Windows Spawns a PowerShell process that calls SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED) via kernel32.dll PowerShell (included in all modern Windows).

Install

pi install npm:pi-caffeinate

Then restart pi or run /reload.