OpenCode was still working.
Your Mac didn't care.

You kicked off a long OpenCode run, stepped away, and came back to a sleeping Mac and a frozen TUI. The run didn't fail — it got paused along with everything else. Here's why that happens, and how to stop it.

To keep your Mac awake while OpenCode runs: the free way is macOS's built-in caffeinate -i — run it in Terminal before you start, and stop it yourself when the run ends. The automatic way is AgentBarista (14-day free trial, then $19 one-time), which detects OpenCode working and lets your Mac sleep when the run finishes.

The direct answer

Why your Mac sleeps while OpenCode is still going

OpenCode is a terminal agent, and like every coding agent it spends most of a task waiting on a model response — which uses almost no CPU. macOS decides whether to sleep by looking at CPU load and user input, so an agent that's mid-plan or mid-edit but waiting on the model looks completely idle to the OS. Your sleep timer runs out, macOS suspends the Mac, and the opencode process is frozen mid-run until you wake it back up.

A terminal window sitting open doesn't count as activity either — to macOS, a TUI waiting on tokens is indistinguishable from a shell prompt you walked away from. The fix is to hold sleep off for as long as OpenCode is actually working, then let the Mac sleep normally shortly after the run goes quiet — within your grace window, 90 seconds by default. You can do that for free in two minutes, or with a tool that knows the difference between "OpenCode working" and "OpenCode just open."

The free option

Free tools can keep your Mac awake too

If you only run OpenCode occasionally, you don't need to buy anything. Two solid free options:

  • The built-in caffeinate command. Run caffeinate -i opencode to launch OpenCode with sleep held off for as long as the process lives — or run caffeinate -i in another tab before a long task and Ctrl+C it when you're done. Free, already on your Mac.
  • Amphetamine (free, Mac App Store). A menu-bar toggle with basic process triggers, so it can stay awake while opencode is running.

Both are a fine choice for the occasional run. The catch: neither knows when OpenCode actually finished. An OpenCode TUI tends to sit open between prompts — so "keep awake while the process runs" quietly becomes "keep awake all day," and on a laptop that's your battery draining long after the work stopped.

The purpose-built option

What AgentBarista does differently for OpenCode

OpenCode is in AgentBarista's built-in agent list — nothing to configure beyond turning it on. And since OpenCode brings its own model, detection doesn't care which provider you've pointed it at.

Knows when OpenCode is working

Watches the opencode process and its children, plus OpenCode's local session activity — not just raw CPU. A long model wait at 0% CPU still counts as working; a TUI sitting idle at a prompt doesn't.

Lets go when it's done

When the run finishes, AgentBarista releases sleep prevention within your grace window — 90 seconds by default. No wrapper command to remember, no open-but-idle terminal holding your battery hostage overnight.

Has a safety net

A battery cutoff and an emergency restore mean it never gets permanently stuck keeping your Mac awake — the risk every manual keep-awake trick carries.

OpenCode Claude Code Cursor Codex Gemini CLI Copilot CLI Windsurf VS Code Zed Antigravity Claude ChatGPT + more

It runs on your Mac. AgentBarista never opens your files. To tell a working agent from a finished one it looks at process command lines and CPU, at the names and modification times of your agents' session files, and — only if you grant macOS Accessibility permission — at the on-screen text of the agent apps you enable and of the terminals we support. Two of those can contain your own words: a command line includes any prompt you pass on it, and on-screen text includes whatever is visible in that window, your code included. Both are matched against status phrases on your Mac and discarded on the spot: never stored, never sent. Nothing about your work leaves your Mac — no file contents, no code, no prompts, no file names, no activity data. Your stats and settings stay on this Mac. The app contains no analytics or telemetry of any kind. Its one network call is license validation, sent to our payment provider, Lemon Squeezy: activating a license sends your license key and your Mac's name, and the routine check after that sends your license key and an anonymous instance id — nothing else.

Pricing

Try it free, then keep it. No subscription.

Pro, one-time
$19 once
  • 14-day free trial, no card needed
  • $15 founding price for the first 200 customers
  • Includes 1 year of updates
  • Lifetime option: $39 once, updates forever
Get notified at launch

Not live yet — leave your email and we'll ping you the moment it is.

Running agents across a team instead? See team pricing.

FAQ

Common questions

Does AgentBarista support OpenCode out of the box?

Yes — OpenCode ships in the built-in agent list. AgentBarista watches real activity signals: the CPU of the opencode process and its children, and OpenCode's local session activity, so it stays awake through model waits that show 0% CPU. If you run something it doesn't know yet, you can add any app as a watched target in Settings.

Isn't this just caffeinate with extra steps?

Pretty much, yeah — caffeinate or Amphetamine will do the basic job for free, and that's a fine choice if you're not running agents all day. AgentBarista adds the parts caffeinate doesn't: it knows the difference between OpenCode mid-task and an idle terminal, it won't keep your battery pinned overnight, and it shows you how much time it actually saved you.

Will it drain my battery?

That's the failure mode it's built to avoid. It only prevents sleep while there's real agent activity, releases the moment work stops, and has a battery cutoff that forces sleep at a level you set — plus an emergency restore if anything ever gets stuck.

Does it read my code or prompts?

No. AgentBarista never opens your files. To tell a working agent from a finished one it looks at process command lines and CPU, at the names and modification times of your agents' session files, and — only if you grant macOS Accessibility permission — at the on-screen text of the agent apps you enable and of the terminals we support. Two of those can contain your own words: a command line includes any prompt you pass on it, and on-screen text includes whatever is visible in that window, your code included. Both are matched against status phrases on your Mac and discarded on the spot: never stored, never sent. Nothing about your work leaves your Mac — no file contents, no code, no prompts, no file names, no activity data. Your stats and settings stay on this Mac. The app contains no analytics or telemetry of any kind. Its one network call is license validation, sent to our payment provider, Lemon Squeezy: activating a license sends your license key and your Mac's name, and the routine check after that sends your license key and an anonymous instance id — nothing else.

More agents

Also running Antigravity, Claude Desktop, or another agent?

Same Mac-goes-to-sleep problem, different tool. Each of these guides covers the fix for that agent specifically: