Add setting to disable automatic caffeinate/sleep prevention

Open 💬 6 comments Opened Jan 28, 2026 by shyal

Summary

Claude Code spawns caffeinate -i -t 300 repeatedly during active sessions, preventing macOS sleep — including lid-close sleep. There is no setting to disable this behavior.

User Stories

Story 1: Disable sleep prevention
As a developer using Claude Code on a laptop, I want to disable the automatic caffeinate spawning so that my Mac sleeps when I close the lid, even during an active session.

Current Behavior

  • Claude Code spawns caffeinate -i -t 300 as a child process during active sessions
  • The process respawns after each 300s expiry, so killall caffeinate is ineffective
  • The source is shipped as a minified cli.js bundle so users cannot patch it
  • Community tools (cc-caffeine, cc-caffeinated) exist to add caffeinate support for headless/remote use cases, but none provide a way to disable the built-in behavior

Acceptance Criteria

  • [ ] A user-configurable setting (e.g. disableCaffeinate in ~/.claude/settings.json) disables automatic caffeinate spawning
  • [ ] When disabled, no caffeinate child processes are spawned during sessions
  • [ ] When enabled (default), current behavior is preserved

Edge Cases

  • [ ] Setting should be respected across session restarts
  • [ ] Existing community hooks that add their own caffeinate should not conflict

View original on GitHub ↗

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