anti-sleep – skill Agent & Tự động hóa cho agent AI
Giữ Mac luôn thức bằng caffeinate trong các bản build dài, tải xuống, hoặc các lần chạy tự động hóa có giám sát.
Cài skill anti-sleep bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/anti-sleep-4d1a8.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /anti-sleep – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/anti-sleep-4d1a8.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $anti-sleep – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/anti-sleep-4d1a8.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /anti-sleep – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/anti-sleep-4d1a8.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /anti-sleep – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Anti-Sleep (macOS caffeinate)
When to Use
- Use when the user wants the Mac to stay awake during a long supervised task.
- Use when a build, download, or automation run should not be interrupted by sleep.
Keep the Mac awake using the built-in caffeinate command. No install needed.
Quick start — the standard command
caffeinate -i -t 7200 # prevent idle system sleep for 2 hoursDuration is -t <seconds>: 2h = 7200, 7h = 25200, overnight (9h) = 32400.
Aggressiveness levels
| Flags | Effect |
|---|---|
| -i | prevents idle system sleep only (screen may still dim/lock) |
| -d | prevents display sleep (screen stays on) |
| -d -i | screen on + system awake, when the task needs a visible display |
| -d -i -s | adds -s: prevents system sleep while on AC power; valid only when plugged in |
| -u -t 1 | simulates user activity — wakes the display right now |
Default to -i -t <seconds>; add -d only when the task needs the display awake. These assertions do not guarantee continued execution through lid closure, shutdown or loss of power, and do not replace the lock-screen policy.
Tie to a process instead of a timer
caffeinate -d -i -w <PID> # stays awake until that process exits (great for builds)
caffeinate -i npm run build # wraps a command; exits when the command finishesRun it in a visible terminal (cmux pane)
Prefer running it in the user's own terminal pane so it's visible and easy to Ctrl+C. In cmux (read the cmux skill first if interacting with panes):
cmux send --surface surface:<N> "caffeinate -d -i -t 25200\n"Otherwise run it as a background Bash task. Never block your own foreground shell with it.
Verify and monitor
pgrep -fl caffeinate # is it running? shows exact flags
ps -o etime= -p <PID> # how long it's been running
pmset -g assertions # inspect PreventUserIdleSystemSleep / PreventUserIdleDisplaySleep # confirm sleep assertions are activeGotcha: caffeinate prints nothing and holds the prompt — it looks "stuck" or like Enter wasn't pressed. It isn't stuck. Verify with pgrep, not by looking at the terminal.
Expiry: with -t it exits silently when time runs out — no notification. If the user asks "is it still on?" after hours, check pgrep first; it may simply have expired.
Keyboard backlight
caffeinate cannot keep the keyboard backlight on — it has its own inactivity timer with no CLI/API on Apple Silicon (researched 2026-07). Fix is manual, one-time: System Settings > Keyboard > "Turn keyboard backlight off after inactivity" > Never.
Stop early
kill <recorded-caffeinate-PID> # or Ctrl+C in the pane running this taskRecord the PID of the process started for this task; verify its command before stopping it. Do not stop unrelated caffeinate sessions by a broad pattern.
After starting: confirm to the user the PID, the flags, and the wall-clock time it will expire.
Limitations
- Adapted from
davidondrej/skills; verify local paths, tools, credentials, and agent features before acting. - For commands, remote access, scheduling, browser automation, or file-changing workflows, get explicit user approval and confirm the target environment first.
Skill liên quan
- openai-docs – Dùng khi người dùng hỏi cách xây dựng với sản phẩm hoặc API của OpenAI, hỏi về chính…
- antigravity-agent-manager – Cấu hình và điều phối các agent song song bằng Antigravity 2.0 Agent Manager độc lập và…
- antigravity-skill-orchestrator – Meta-skill hiểu yêu cầu của tác vụ, tự động chọn các skill phù hợp, theo dõi các tổ hợp…
- aomi-transact – Xây dựng agent crypto/DeFi bằng ngôn ngữ tự nhiên và plugin EVM MCP (Claude Code…
- c-level-agents – Đội ngũ điều hành theo tư duy founder. 13 agent cs-* C-suite (CFO, CMO, CRO, CPO, COO…
- c-level-skills – Mục lục và bộ định tuyến cho bundle tư vấn C-level: 33 skill bao phủ 14 vai trò C-suite…
- openai-docs – Dùng khi người dùng hỏi cách xây dựng với sản phẩm hoặc API của OpenAI, hỏi về chính…
- directory-submissions – Khi người dùng muốn gửi sản phẩm lên các thư mục startup, SaaS, AI, agent, MCP, no-code…