home / skills / a5c-ai / babysitter / power-management-monitor

This skill monitors system power state and autonomously manages sleep prevention, battery alerts, and power source changes to keep workflows uninterrupted.

npx playbooks add skill a5c-ai/babysitter --skill power-management-monitor

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.3 KB
---
name: power-management-monitor
description: Monitor system power state including battery, AC, sleep, and wake events
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
tags: [power, battery, system, cross-platform, monitoring]
---

# power-management-monitor

Monitor system power state including battery level, AC/battery status, and sleep/wake events.

## Capabilities

- Monitor battery level and charging
- Detect AC/battery power source
- Handle sleep/wake events
- Prevent system sleep
- Low battery notifications
- Power-aware feature toggling

## Input Schema

```json
{
  "type": "object",
  "properties": {
    "projectPath": { "type": "string" },
    "framework": { "enum": ["electron", "native"] },
    "events": { "type": "array" }
  },
  "required": ["projectPath"]
}
```

## Electron Example

```javascript
const { powerMonitor, powerSaveBlocker } = require('electron');

powerMonitor.on('suspend', () => console.log('System suspending'));
powerMonitor.on('resume', () => console.log('System resumed'));
powerMonitor.on('on-battery', () => console.log('On battery'));
powerMonitor.on('on-ac', () => console.log('On AC power'));

// Prevent sleep during important tasks
const id = powerSaveBlocker.start('prevent-app-suspension');
// ... do work ...
powerSaveBlocker.stop(id);
```

## Related Skills

- `screen-capture-api`
- `system-services-integration` process

Overview

This skill monitors system power state including battery level, AC vs battery source, and sleep/wake events. It provides hooks for low-battery alerts, prevents system sleep during critical tasks, and toggles features based on power conditions. The implementation targets Electron and native JS environments and integrates into agentic workflows to make power-aware decisions.

How this skill works

The monitor listens to OS power events (suspend, resume, on-battery, on-ac) and queries battery state and charge level. It exposes APIs to start/stop sleep prevention and to register event handlers for low-battery or source-change events. It can emit structured events for orchestration engines to pause/resume tasks or adjust feature flags when power conditions change.

When to use it

  • Protect long-running tasks from interruption during critical operations
  • Adjust app features or quality settings when running on battery
  • Send low-battery alerts to users or automated agents
  • Pause nonessential background jobs during suspend or low-power states
  • Integrate into CI or agent workflows that must respond to host power changes

Best practices

  • Register simple, idempotent event handlers to avoid duplicate actions on repeated events
  • Use sleep prevention sparingly and release it as soon as critical work is done
  • Combine battery level checks with time estimates before canceling heavy tasks
  • Emit concise, machine-friendly events so orchestration layers can make deterministic decisions
  • Log power events with timestamps to help debug workflow interruptions

Example use cases

  • Prevent a long build or deployment step from being interrupted by system sleep
  • Automatically lower processing quality when laptop switches to battery to conserve power
  • Notify a remote orchestration controller when host resumes after suspend so jobs can resume deterministically
  • Trigger a safe shutdown of noncritical agents when battery falls below a threshold
  • Disable high-power sensors or background scans while on battery to extend runtime

FAQ

Which platforms are supported?

The skill is designed for Electron and native JavaScript environments that expose OS power APIs; behavior may vary by operating system.

How do I avoid preventing sleep indefinitely?

Start the sleep blocker only for the duration of the critical operation and always call the corresponding stop method in finally/cleanup code to ensure it is released.