anti-sleep
Keep a Mac awake for a set duration or while a process runs. Use only when the user explicitly invokes /anti-sleep.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 4.3k
- Forks
- 626
01 前言 Front Matter
- name
- anti-sleep
- description
- Keep a Mac awake for a set duration or while a process runs. Use only when the user explicitly invokes /anti-sleep.
- disable-model-invocation
- true
02 资源文件 2
- 参考文档agents/openai.yaml43 B
- 脚本scripts/anti-sleep.sh7.6 KB
03 SKILL.md 正文
Anti-Sleep (macOS caffeinate)
Use the bundled launcher from this skill directory. It creates a one-shot user LaunchAgent using only built-in macOS tools.
Required workflow
Never launch caffeinate with raw &, nohup, disown, or launchctl submit. Temporary execution shells can kill their descendants, and launchctl submit can restart a timed job.
Resolve scripts/anti-sleep.sh relative to this SKILL.md; never assume the user's current directory. Run:
- Inspect current state:
scripts/anti-sleep.sh status
- If
statusreports an active session and the user requested a new duration, automatically stop the old session. Never ask for confirmation.
scripts/anti-sleep.sh stop
- Start the new timer for the requested duration:
scripts/anti-sleep.sh start 10800 # 3 hours
For a specific process, use start-pid. Apply the same automatic replacement rule if another session is active.
scripts/anti-sleep.sh start-pid <PID>
- In a separate tool/shell call after the start command has returned, verify:
scripts/anti-sleep.sh verify
Only report success when verification returns STATUS=running and ASSERTIONS=active. Confirm the PID, flags, and wall-clock expiry. If verification fails, run stop and do not claim the Mac is protected.
Assertion flags
The default is -d -i: keep the display on and prevent idle system sleep. Pass explicit flags after the duration or PID when needed:
| Flags | Effect |
|---|---|
-i |
Prevent idle system sleep; display may dim |
-d |
Prevent display sleep |
-d -i -s |
Also prevent system sleep while on AC power |
None of these stop sleep when the lid closes. For agent runs that must survive a closed lid, see Keep Claude Code running when your laptop is closed.
Example:
scripts/anti-sleep.sh start 10800 -i
Status and stop
scripts/anti-sleep.sh status
scripts/anti-sleep.sh stop
The launcher tracks one exact LaunchAgent label, PID, start time, and expiry under ~/Library/Caches. It never uses broad pkill.
Fallback
If launchctl bootstrap fails, use a visible persistent terminal or cmux pane. Read the cmux skill before interacting with cmux. If no persistent surface is available, tell the user instead of starting an unreliable background job.
caffeinate cannot keep the keyboard backlight on. That setting is manual: System Settings → Keyboard → “Turn keyboard backlight off after inactivity” → Never.
04 同仓库更多 Skills
varied-search
Research a topic across the web, GitHub, and X/Twitter with DeepAPI and produce a concise Markdown report. Use for varied-search or requests to compare web coverage, relevant repositories, and social discussion.
total-review
Run five independent max-effort reviews (Fable 5.1, Opus 5.5, GPT-6 Astra, GPT-6.1 Sol, Muse Wonder), merge their findings, and fix only what the user approves. Use for /total-review, or when the user or another agent asks for a total review.
stop-overthinking
Manually-invoked skill that stops overthinking and forces a short, practical decision. Use only when the user explicitly invokes stop-overthinking.
state
Manually-invoked skill that recaps what the current thread is doing and how far along it is. Use when the user says "state", "where are we", or "what % are we done".
setup-help
Guide setup one step at a time and show what remains. Use only when the user explicitly asks for it by name.
self-archive
Archive the current Cloudroom thread and release its runtime. Use only when the user explicitly asks to self-archive, archive yourself, or archive this thread.