convez.ai
SkillAutomaçãoIntermediário
roscodetech

Claude Caffeinate

roscodetech/claude-caffeinate

Mantém a máquina acordada para agentes autônomos rodarem sem interrupção

Ver no GitHub
InicialPluginScore · de 0 a 100

Skill cross-plataforma que mantém seu computador acordado durante sessões longas do Claude Code. Funciona em Windows, macOS e Linux com um único comando, sem modificar configurações globais do sistema ou exigir privilégios administrativos.

Instalação

$npx convez-ai roscodetech/claude-caffeinate

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
50%
Último commit
há 6 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Sessões longas de Claude Code com loops autônomos ou pesquisa profunda
  • Execução de tarefas extensas sem que o computador durma no meio
  • Desenvolvimento multiplataforma que requer máquina sempre ligada

Veredito

Solução elegante e minimalista para um problema real em workflows de IA de longa duração. Implementação sólida com suporte nativo a três plataformas e mecanismo auto-limpante via PID, sem efeitos colaterais sistêmicos.

README

A tradução para o português deste README ainda está na fila.

claude-caffeinate

A cross-platform /caffeinate skill for Claude Code. Keeps your computer awake during long agent sessions — modeled on macOS's caffeinate(8), with a unified surface that works on Windows, macOS, and Linux.

Why

Long Claude Code sessions — autonomous loops, multi-phase plans, deep research runs — can outlast your OS's sleep timeout. When the machine sleeps, the agent stalls. Existing fixes (PowerToys Awake, third-party utilities, modifying the power plan) are either platform-specific, intrusive, or both. This skill is none of those: a single slash command, a single PID file, no globals touched.

Install

# User-level (recommended) — available across all your projects
git clone https://github.com/roscodetech/claude-caffeinate ~/.claude/skills/caffeinate

Or copy/symlink the directory into ~/.claude/skills/caffeinate/.

That's it — Claude Code auto-discovers skills under ~/.claude/skills/ on next session start.

Usage

CommandEffect
/caffeinateStart keep-awake; system only, indefinite.
/caffeinate 60Start keep-awake; system only, auto-stop after 60 min.
/caffeinate displayStart keep-awake; system + display, indefinite.
/caffeinate display 60Start keep-awake; system + display, 60 min.
/caffeinate stopStop the running keep-awake.
/caffeinate statusShow running state, uptime, remaining time, and mode.

Two modes:

  • System only (default): the system stays awake but the screen can dim and sleep normally. Mirrors macOS caffeinate with no flags. Best for walk-away "keep agent running while I'm in another room" scenarios.
  • System + display (display keyword): both stay on. Best for actively watching the agent work, presenting, or streaming.

Calling /caffeinate while it's already running is a no-op — the existing PID file is honored. To switch modes, /caffeinate stop then /caffeinate display.

How it works

OSSystem only (default)System + display (display mode)
WindowsSetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED) via P/Invoke from a hidden PowerShell process.Adds | ES_DISPLAY_REQUIRED.
macOScaffeinate -i (idle/system block, no display).caffeinate -di (also blocks display sleep).
Linuxsystemd-inhibit --what=idle:sleep:handle-lid-switch sleep <duration>.Prefers gnome-session-inhibit --inhibit idle:logout:suspend; falls back to systemd-inhibit + xset s off -dpms. On Wayland w/o GNOME and no xset, prints a warning and falls back to system-only behavior.

Per-thread flags / process-scoped inhibitors mean the wake-lock auto-clears when the worker process dies — Stop-Process -Force (Windows) / kill <pid> (Unix) are both safe.

State lives in a single JSON file at $TMPDIR/claude-caffeinate.json (Unix) or %TEMP%\claude-caffeinate.json (Windows). It tracks PID, start time, and optional expiry — used to enforce single-instance and to print status.

Requirements

  • Windows: PowerShell 5.1+ (ships with Windows 10/11) or PowerShell 7+ (pwsh). No admin rights needed.
  • macOS: built-in. No deps.
  • Linux: systemd-inhibit (ships with systemd, which is the default init on Ubuntu, Fedora, Debian, Arch). On non-systemd distros (Alpine, Void, Slackware), this skill won't work — open an issue with your preferred backend.

Why not just install PowerToys Awake / caffeine.exe / etc.?

  • No third-party dependency — works on a fresh Windows install with no extra software.
  • No globals touched — doesn't modify your power plan; nothing to revert if Claude crashes.
  • One PID, easy to reason about — Get-Process | Where-Object { $_.Id -eq <pid> } shows you exactly what's holding the wake-lock.
  • Per-platform-native — uses the OS-blessed API on each platform instead of a single least-common-denominator approach.

Layout

caffeinate/
├── SKILL.md             # Read by Claude Code; tells the agent how to invoke the right script
├── README.md            # You are here
├── LICENSE              # MIT
└── scripts/
    ├── caffeinate.ps1   # Windows backend (PowerShell 5.1+ / 7+)
    └── caffeinate.sh    # macOS / Linux backend (bash)

Direct script use (without Claude Code)

The scripts work fine standalone:

# Windows
powershell -NoProfile -File ~/.claude/skills/caffeinate/scripts/caffeinate.ps1 start -Minutes 60
powershell -NoProfile -File ~/.claude/skills/caffeinate/scripts/caffeinate.ps1 start -Minutes 60 -Display
powershell -NoProfile -File ~/.claude/skills/caffeinate/scripts/caffeinate.ps1 status
powershell -NoProfile -File ~/.claude/skills/caffeinate/scripts/caffeinate.ps1 stop
# macOS / Linux
bash ~/.claude/skills/caffeinate/scripts/caffeinate.sh start 60
bash ~/.claude/skills/caffeinate/scripts/caffeinate.sh start --display 60
bash ~/.claude/skills/caffeinate/scripts/caffeinate.sh status
bash ~/.claude/skills/caffeinate/scripts/caffeinate.sh stop

License

MIT — see LICENSE.

Contributing

PRs welcome. Especially interested in:

  • A non-systemd Linux backend (e.g. for Alpine, Gentoo, Void)
  • A native Windows binary alternative (no PowerShell dependency)
  • A lightweight tray indicator showing the current state
Ver o original no GitHub

Bom para

Relacionados