[FEATURE] Battery-aware agent scheduling — detect low battery, warn before expensive operations, auto-checkpoint

Resolved 💬 3 comments Opened Apr 21, 2026 by pleasedodisturb Closed May 26, 2026

Problem

When running Claude Code on a laptop without a charger, there's no awareness of battery state. Long-running operations (parallel research agents, codebase mappers, background tasks) can drain the battery mid-execution, leaving work in an inconsistent state.

Real scenario: Running 4 parallel research agents + a synthesizer + background codebase mapping on a MacBook without a charger. Battery drops to critical levels. Options are: (1) go offline with no guarantee work is saved, or (2) sit anxiously watching the battery icon.

Proposed Solution

Claude Code should be battery-aware on laptop devices:

1. Pre-flight battery check before expensive operations

  • Before spawning parallel agents, long-running background tasks, or multi-step workflows, check battery level
  • If below threshold (e.g., 20%), warn the user:

``
⚠️ Battery at 15% — this operation typically takes 5-10 minutes with 4 parallel agents.
Continue anyway / Defer / Run minimal (sequential instead of parallel)
``

2. Graceful checkpoint on critical battery

  • If battery drops below critical threshold (e.g., 5%) during execution:
  • Auto-commit WIP changes (git add -A && git commit -m "WIP: auto-checkpoint (low battery)")
  • Push to remote if configured
  • Save conversation context for /resume
  • Notify user: "Battery critical — work checkpointed and pushed. Resume with /gsd-resume-work or /resume."

3. Battery-aware scheduling

  • Background agents and run_in_background tasks could be deferred or throttled on low battery
  • /loop dynamic mode could factor battery into delay calculations
  • Status line could show battery level when below 30%

4. Estimated cost display

  • Before expensive operations, show estimated time/tokens so user can make an informed decision:

``
◆ Spawning 4 researchers in parallel...
Estimated: ~5 min, ~200K tokens
Battery: 18% (~25 min remaining)
Proceed? [Y/n]
``

Platform Support

  • macOS: pmset -g batt gives battery percentage and charging status
  • Linux: /sys/class/power_supply/BAT0/capacity and status
  • Windows: WMIC Path Win32_Battery Get EstimatedChargeRemaining

Detection is straightforward on all platforms.

Alternatives Considered

  • User responsibility: Users can check battery themselves, but Claude Code already manages long-running operations and has the context to make smart decisions
  • OS-level low power mode: Doesn't help — OS throttles CPU but doesn't know about Claude's token economics or git state

Additional Context

This becomes more important as Claude Code gets more agentic — parallel agents, background tasks, autonomous loops, and multi-step workflows all increase the chance of battery death mid-execution. The auto-checkpoint feature alone would save significant anxiety and lost work.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗