# Caffeinate Computer

> Keep the Mac awake during long-running agents, builds, or commands via macOS caffeinate.

- **Type:** Skill
- **Install:** `agentstack add skill-jtsternberg-claude-plugins-caffeinate-computer`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [jtsternberg](https://agentstack.voostack.com/s/jtsternberg)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [jtsternberg](https://github.com/jtsternberg)
- **Source:** https://github.com/jtsternberg/claude-plugins/tree/main/plugins/mac-caffeinate/skills/caffeinate-computer

## Install

```sh
agentstack add skill-jtsternberg-claude-plugins-caffeinate-computer
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# caffeinate — keep the Mac awake

macOS ships `caffeinate`. Use it. No daemons, no apps, no half-open laptops in airports.

## Platform check

If `uname` is not `Darwin`, say so and stop:

> Not macOS — `caffeinate` is a macOS-only tool. On Linux, use `systemd-inhibit`, `caffeine`, or `xset s off -dpms` depending on environment.

## The three patterns

Pick based on what the user is doing.

### 1. Tie wakefulness to a running process (preferred)

When there's already a PID — a running `claude` session, build, sync, agent loop:

```bash
caffeinate -i -w  &
```

- `-i` prevents idle sleep
- `-w ` exits caffeinate when that PID exits
- `&` backgrounds it so the shell stays usable

Find the PID with `pgrep -f claude` or `echo $$` from inside the long-running shell.

### 2. Wrap a command

When launching the long task fresh:

```bash
caffeinate -i 
```

`caffeinate` exits the moment the wrapped command exits. Cleanest pattern — no orphan processes, no manual cleanup.

### 3. Time-bounded, full lockout (overnight runs, lid closed)

```bash
caffeinate -dimsu -t 28800   # 8 hours
```

- `-d` display sleep
- `-i` idle sleep
- `-m` disk sleep
- `-s` system sleep (only effective on AC power)
- `-u` declares user activity (resets idle timer for 5s, useful as a one-shot nudge)
- `-t ` auto-expire so it can't run forever

Use `-s` only when plugged in. On battery, drop it: `caffeinate -dim -t `.

## Lid-closed (clamshell) caveat

`caffeinate` alone does **not** keep a MacBook awake with the lid shut on battery. For true clamshell-while-unplugged you need external power + display + input, or a tool like `InsomniaX`/`Amphetamine`. Tell the user this if they ask about closing the lid.

## Picking the flag set

| Goal | Flags |
|---|---|
| Just stop idle sleep during a task | `-i` |
| Also keep the display on (watching output) | `-di` |
| Long unattended run, plugged in | `-dimsu -t ` |
| Tied to a specific PID | add `-w ` |

`man caffeinate` has the full list. Don't invent flags.

## What to do for the user

1. Confirm macOS (`uname` → `Darwin`).
2. Ask (or infer) whether there's a PID to attach to, a command to wrap, or just a time window.
3. Build the exact one-liner from the patterns above. Show it. Run it if they want, otherwise hand it over.
4. Mention how to stop it: `kill %1` for backgrounded `&`, or it self-exits when the PID/command/timer ends.

Keep it tight. One command, one line of explanation.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [jtsternberg](https://github.com/jtsternberg)
- **Source:** [jtsternberg/claude-plugins](https://github.com/jtsternberg/claude-plugins)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-jtsternberg-claude-plugins-caffeinate-computer
- Seller: https://agentstack.voostack.com/s/jtsternberg
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
