audit-energy
Scan the codebase for battery-drain anti-patterns and energy-inefficient APIs.
What This Command Does
Launches the energy-auditor agent to flag patterns that quietly burn battery — timers that never fire usefully, polling where push would do, continuous location requests, and background modes used where a one-shot suffices.
What It Checks
- Timer abuse — high-frequency
Timer.scheduledTimercalls andRunLooppolling - Polling instead of push — repeated network fetches where a server-push or
URLSessionlistener would suffice - Continuous location —
startUpdatingLocationwithoutstop, ordesiredAccuracyset higher than the use-case needs - Animation leaks — running animations on hidden views, infinite repeats not cancelled in
viewWillDisappear - Background mode misuse — declared background modes that aren't actually needed for the feature
Related Agent
- energy-auditor — The agent that powers this command
- energy-ref — Energy optimization reference