Windsurf's agent was still working.
Your Mac didn't care.

If macOS went to sleep mid-task, Windsurf's agent froze right where it was — it didn't fail, it just got paused along with your Mac. Here's why that happens, and how to stop it.

To keep your Mac awake while Windsurf's agent 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 Windsurf's agent working and lets your Mac sleep when it finishes.

The direct answer

Why your Mac sleeps while Windsurf's agent is still going

Windsurf's AI agent often spends most of a task waiting on a model response — which barely uses any CPU. macOS only looks at CPU and user input to decide whether to sleep, so an agent that's "thinking" hard but computing little looks idle to the OS. After your screen-sleep or system-sleep timer runs out, macOS suspends the Mac, and Windsurf's agent process is frozen along with everything else until you wake it back up.

The fix is to stop macOS from sleeping for as long as Windsurf's agent is actually running a task — then let it sleep normally again shortly after the agent 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 "agent working" and "agent idle" so you don't have to babysit it.

The free option

Free tools can keep your Mac awake too

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

  • The built-in caffeinate command. Open Terminal and run caffeinate -i before you kick off a long Windsurf task. It'll hold sleep off until you close the Terminal window or press Ctrl+C. Simple, free, already on your Mac.
  • Amphetamine (free, Mac App Store). Gives you a menu-bar toggle and basic process triggers, so you can set it to stay awake while specific apps are running.

Both are a fine choice if Windsurf runs for a few minutes here and there. The catch: neither one knows when Windsurf's agent actually finished. You either turn it off yourself, or it keeps your Mac awake — and your battery draining — long after the task is done.

The purpose-built option

What AgentBarista does differently for Windsurf

Windsurf is already in AgentBarista's supported-agent list out of the box — nothing to configure beyond turning it on.

Knows when Windsurf's agent is working

Watches Windsurf's process activity and on-screen status — not just raw CPU — so it stays awake through long "thinking" turns at 0% CPU, the exact case that trips up caffeinate's basic timers.

Lets go when it's done

When Windsurf's agent finishes, AgentBarista releases sleep prevention within your grace window — 90 seconds by default. No forgetting a Terminal window open, no battery held 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.

Windsurf Claude Code Cursor Codex Gemini CLI Copilot CLI OpenCode 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.

More agents

Also running Zed, OpenCode, or another agent?

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