If you run autonomous coding agents like Claude Code, Aider, or train local LLM pipelines overnight, you've likely faced this frustrating dilemma:
- You want to sleep, but the agent is mid-job.
- If you enable Windows default sleep, it might suspend your PC right in the middle of an API call.
- If you disable sleep, you have to stay awake until 2 AM to shut down the machine manually. Otherwise, your laptop runs full-blast until morning, wasting electricity and battery health.
- And if a zombie terminal process hangs at 15% CPU, Windows won't trigger idle sleep anyway.
To solve this for my own late-night workflow, I built PowerLockGuard — an ultra-lightweight (~90 KB) open-source power management tool.
The Two Core Engines
1. Work Watchdog (Autonomous Agent Sentinel)
Instead of relying on basic user idle timers, PowerLockGuard monitors the process trees of developer tools:
- Preset tracking for
claude,aider,node,python,cargo,git, and compiler tools. - Real-time CPU and RAM telemetry.
- Zombie Auto-Kill: Any pegged process that stays stuck after the main task finishes is automatically terminated.
- Safety Countdown: Once the monitored workload drops below threshold (e.g. 3.5% CPU) for the configured buffer (e.g. 3 minutes), a 30-second warning countdown starts before cleanly executing S3 Sleep, Hibernation, or Shutdown.
2. Charger Guard (Power Cut & Disconnect Sentinel)
In many regions, sudden power cuts kill home/office WiFi routers instantly. If Claude Code is awaiting an API stream, a sudden network drop causes connection exceptions, token waste, and corrupted half-written files.
Charger Guard hooks into Win32 power management events. The millisecond AC power is lost, it suspends Windows into S3 Deep Sleep in under 50ms. All terminal buffers, IDE states, and agent memories remain frozen in RAM. When electricity and WiFi return, press the power button to resume right where you left off.
Zero Bloat Philosophy
- ~90 KB executable: Built on .NET Framework 4.8 (present out-of-the-box on every Windows 10 & 11 machine).
- Zero Dependencies: No installer, no background services, no Node/Electron bloat.
- 100% Offline: Zero telemetry, zero analytics, zero network requests.
Try It Out
- 💻 GitHub (MIT): GMKamrussama/PowerLockGuard
- 🏪 Microsoft Store: Get PowerLockGuard
- 📦 Winget:
winget install PowerLockGuard
Pull requests, feature ideas, and process presets are warmly welcome!
Top comments (1)
The zombie process pegged at 15% CPU blocking idle sleep is the failure every agent runner hits. We run our fleet on a VPS, so our version of 'stuck' is a runaway loop quietly burning API tokens - CPU telemetry alone wouldn't catch it, so we key off output staleness instead of utilization.
How does the Work Watchdog tell 'thinking hard' apart from 'hung' without killing a legitimate long-running call?