By charlescatta
Keeps your Mac awake while Claude is working; sleeps when it's done.
A Claude Code plugin that keeps your Mac awake while Claude is working and lets it
sleep again when Claude finishes its work or you quit. No more manually toggling
caffeinate before a long agentic task.
The plugin wires three Claude Code hooks to a tiny pair of scripts:
| Hook | Action | When |
|---|---|---|
UserPromptSubmit | caffeine-on.sh | You send a prompt (Claude starts) |
Stop | caffeine-off.sh | Claude finishes the turn |
SessionEnd | caffeine-off.sh | You quit Claude Code (safety net) |
Staying awake is done in two layers:
caffeinate -dimsu — keeps the system awake. No sudo needed. Works with the lid
open, or closed while on external power/display.pmset -a disablesleep 1 — true clamshell, stays awake even with the lid closed
on battery. This needs root, so it only runs if you install the one-time sudoers entry
below. Without it the plugin silently falls back to caffeinate-only.Concurrent Claude sessions are handled with a small reference count (one marker file per
session_id), so one session finishing won't yank coffee away from another that's still
working.
/plugin marketplace add charlescatta/claudeneedmorecoffee
/plugin install claudeneedmorecoffee@cc
That's it — the hooks are active on your next prompt. (The repo is both a plugin and a
single-plugin marketplace named cc.)
Local / dev install instead: clone the repo and launch with
claude --plugin-dir /path/to/claudeneedmorecoffee.
To stay awake with the lid closed on battery, authorize passwordless pmset once. Run this
in a real terminal (Terminal.app / iTerm — sudo needs a real terminal to ask for your
password):
sudo tee /etc/sudoers.d/claudeneedmorecoffee >/dev/null <<EOF
$(id -un) ALL=(root) NOPASSWD: /usr/bin/pmset -a disablesleep 0, /usr/bin/pmset -a disablesleep 1
EOF
sudo chmod 440 /etc/sudoers.d/claudeneedmorecoffee
It asks for your login password once and authorizes exactly the two pmset commands the plugin
uses. This is one-time — it never needs re-running, including after plugin updates. Undo it
with sudo rm /etc/sudoers.d/claudeneedmorecoffee.
Not sure if it's set up? Run /claudeneedmorecoffee:enable-clamshell inside Claude Code — it
checks and, if needed, hands you the block above.
Skip this entirely and everything still works — just caffeinate-only (awake with the lid open, or closed on external power/display).
# Simulate a prompt: Mac should now be kept awake
echo '{"session_id":"test"}' | ./scripts/caffeine-on.sh
pmset -g | grep -i disablesleep # -> 1 (if sudoers installed)
pgrep -fl "caffeinate -dimsu" # -> a running process
# Simulate finishing: Mac released
echo '{"session_id":"test"}' | ./scripts/caffeine-off.sh
pmset -g | grep -i disablesleep # -> 0
pgrep -fl "caffeinate -dimsu" # -> nothing
UserPromptSubmit to SessionStart in hooks/hooks.json.clamshell.sh is kept as a manual on/off override:
./clamshell.sh on / ./clamshell.sh off.sudo rm /etc/sudoers.d/claudeneedmorecoffee # if you installed it
# then disable/remove the plugin via /plugin, or drop the --plugin-dir flag
No model invocation
Executes directly as bash, bypassing the AI model
Runs pre-commands
Contains inline bash commands via ! syntax
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub charlescatta/claudeneedmorecoffee --plugin claudeneedmorecoffeeMulti-model consensus engine integrating OpenAI Codex CLI, Gemini CLI, and Claude CLI for collaborative code review and problem-solving.
Easily create hooks to prevent unwanted behaviors by analyzing conversation patterns
Harness-native ECC operator layer - 67 agents, 271 skills, 92 legacy command shims, reusable hooks, rules, selective install profiles, and production-ready workflows for Claude Code, Codex, OpenCode, Cursor, and related agent harnesses
Complete collection of battle-tested Claude Code configs from an Anthropic hackathon winner - agents, skills, hooks, and rules evolved over 10+ months of intensive daily use
Complete AI coding workflow system. Self-correcting memory + persistent FTS5-indexed research wikis + auto-research loop + multi-LLM council on a single SQLite store. 33 skills, 8 agents, 22 commands, 37 hook scripts across 24 events. Cross-agent via SkillKit.