ZCode was still working.
Your Mac didn’t care.

If macOS went to sleep mid-task, ZCode froze right where it was. It didn’t fail; it got paused along with your Mac. Here’s why that happens, the free fix for whichever ZCode you have, and the thing about ZCode that makes it harder to detect than most agents: what z.ai ships you today is a Mac app, not a command, and the usual command-line fix does not reach it.

To keep your Mac awake while ZCode runs: what z.ai publishes today is the ZCode Mac app, and a windowed app can’t be wrapped in caffeinate — there is no command to launch and wait on. For the app, the free answer is a menu-bar tool such as Amphetamine set to keep the Mac awake while ZCode is running. There is also a zcode terminal command in ZCode’s source repository, and if you have built and installed that yourself, caffeinate -i zcode is the cleanest fix there is. ZCode is not in AgentBarista’s built-in agent list yet — its public repository was created on 20 September 2026 and we add a product only after watching it work on a real Mac.

The direct answer

Why your Mac sleeps while ZCode is still going

ZCode spends most of a task waiting on a model response — which barely uses any CPU. But macOS doesn’t decide from CPU at all — it goes by your idle time, how long since real keyboard or mouse input, plus the power assertions running processes hold. So working hard doesn’t protect the machine: a Mac mid-refactor sleeps on exactly the same schedule as one doing nothing. After your system-sleep timer runs out, macOS suspends the Mac, and ZCode is frozen along with everything else until you wake it back up.

This bites hardest on the runs worth walking away from — a long plan-then-edit pass across a repo, a big test-and-fix loop, anything you kicked off and left alone. The fix is to stop macOS from sleeping for as long as the agent is actually running, then let it sleep normally again once the run is done.

The free option

Free tools can keep your Mac awake too

Which free fix applies depends on which ZCode you have — and for almost everyone that is the Mac app, so start there:

  • For the Mac app: Amphetamine (free, Mac App Store). A menu-bar toggle that can keep the Mac awake on a timer or while a chosen app is running. A windowed app can’t be wrapped in caffeinate, so a menu-bar tool is the free answer for the shape z.ai actually ships.
  • If you built the zcode command: the built-in caffeinate. Launch your session as caffeinate -i zcode instead of zcode. The Mac can’t idle-sleep while it runs, and the moment it exits, normal sleep is allowed again — nothing to remember to undo. Already on your Mac, free, and the cleanest fix there is.
  • If you built it and already started a run. You don’t have to restart it. Find the process first, and read the output before you act on it — see the next section for why the name you get back may not be the one you expect: ps -Awwo pid,comm,args | grep -i zcode | grep -v grep. Take the PID you want, then hold sleep off until that exact process exits with caffeinate -i -w <pid>.

All of these are a fine choice if ZCode runs for a few minutes here and there. The catch: none of them knows when the agent actually finished a task versus when it’s just sitting at an idle prompt — or, for the app, just sitting open. You either stop it yourself, or it keeps your Mac awake — and your battery draining — long after the work is done.

Which is the failure people forget to plan for. The obvious one is the machine sleeping and killing the run. The other one costs just as much: a laptop held awake all night, coming back at 1% or hot enough to have throttled itself hours ago — and worse with the lid shut, which caffeinate cannot cover on an undocked laptop. Whatever you pick, find its battery floor before you trust it overnight.

The part that trips tools up

ZCode is a Mac app, and there is a command hiding behind it

Most coding agents are one shape. ZCode is one shape in practice and two in its source, and the difference decides which keep-awake fix is even available to you. Worth two minutes even if you never buy anything.

  • The Mac app — this is what you have. z.ai publishes DMG installers for Apple silicon and Intel, and you drag ZCode into /Applications like any other app. A windowed app can’t be wrapped in caffeinate the way a command can — there is no process to launch and wait on. So your options are a timer, an app-presence rule, or a tool that reads the app’s own on-screen status text.
  • The terminal agent — real, but z.ai does not ship an installer for it. ZCode’s repository contains a command-line distribution you build and host yourself; the published downloads and install docs cover the GUI app only, and the one tagged release carries a .dmg and a .exe, no CLI archive. If you have built it, its installer puts a zcode command in ~/.local/bin with its runtime under ~/.zcode/runtime, both overridable by environment variables.

And if you have it, that zcode is not a binary — it is a two-line shell wrapper that execs Node. After the exec there is no process named zcode on your machine at all: what is running is node, with the script path sitting in its arguments. That matters more than it sounds. Any monitoring script, allowlist or keep-awake rule you write against the process name zcode matches nothing, and nothing tells you so — you just quietly get no coverage on the runs you meant to protect. Check what is actually running before you write a rule against a name you assumed:

ps -Awwo pid,comm,args | grep -i zcode | grep -v grep

Note which column the match lands in. If zcode appears only in the arguments and the command column says node, then any tool that matches only on the process name or its executable path cannot see it. Tools that read the full argument list can — that is how we detect other Node-hosted agents, and it is exactly what the custom-app feature described below does not do.

Read from ZCode’s published README, its installer script and its download page at zcode.z.ai, not measured on a Mac of ours. The public repository was created on 20 September 2026 and is moving fast, so verify the paths on your own machine rather than trusting a page — including this one.

The purpose-built option — honest status

What AgentBarista does today for ZCode

Straight answer: ZCode is not in AgentBarista’s built-in agent list, and we would rather say that here than let you find out after paying. Its public repository was created on 20 September 2026. Our rule for adding a product is that we run it on a real Mac and watch the detection work before we ship it, and we have not done that yet.

For the Mac app. For the products in our built-in list, the on-screen-text signal resolves an app by its exact bundle identifier, and ZCode has no entry, so out of the box it is invisible to us. You can add it as a custom app. Two things then happen, and neither is what people assume. Its on-screen text does get read — if you have granted macOS Accessibility — but matched against your own phrase lists, not any we ship for ZCode, so you are writing that detection yourself. And merely having ZCode open does not hold sleep: that registers as presence, which is not enough on its own. What holds sleep is one of two things: an active phrase you wrote matching ZCode’s on-screen text, which needs no CPU at all, or the app and its children crossing a CPU threshold, 8% by default. An idle phrase holds nothing. So the custom route can cover an agent that is waiting on a model — but only as well as the phrases you write, and we have not written any for ZCode.

For the terminal agent, the honest answer is that we cannot see it, and the reason is worth stating exactly. A custom-app entry is matched loosely — in both directions — against the process name and its executable path. It is never matched against the rest of the command line. Because ZCode’s zcode wrapper execs Node, the executable path is Node’s, and the only ZCode-specific string — the script path — lives in the arguments, where our matcher does not look. So there is nothing for a custom entry to match on. An entry of node would match, but user-added apps are CPU-trusted, so that one entry would hold your Mac awake for every Node process on the machine — every dev server, every Node-based CLI, anything whose path merely contains node — and their CPU is summed into a single total, so one busy process is enough. That is not a usable answer and we are not going to dress it up as one. For the terminal agent, use caffeinate -i zcode.

So a custom entry is a reasonable convenience for interactive use and the wrong tool for an unattended overnight run. We have not run ZCode on a Mac of ours; treat this section as reasoned from how our matching works, which we can read, rather than from something we have measured. One scope worth being exact about: our battery and thermal cutoffs release the hold we placed. If you run caffeinate -i zcode yourself, that assertion is yours, not ours, and we will not drop it at your battery floor or at thermal critical. On battery overnight, stay on power — or give the hold a hard ceiling: caffeinate -i -t 28800 zcode drops the assertion after eight hours even if the run is still going, and releases it early when zcode exits. (caffeinate’s man page claims -t is ignored when a utility is invoked. On current macOS it is not — we measured it.) Plugged in, the battery half stops mattering; the thermal risk does not — a MacBook running docked with the lid shut is where heat bites hardest — and the same ceiling helps there too.

Not in the built-in list

Its public repository was created on 20 September 2026. We add a product after watching it work on a real Mac, not before — and ZCode’s two shapes need measuring separately.

The app is invisible out of the box

We hold no bundle id for ZCode. A custom entry works, but you supply the status phrases, and CPU — 8% by default — is the only fallback, which a cloud model barely moves. For the terminal agent there is nothing to match at all: use caffeinate.

Has a safety net regardless

A battery cutoff, plus a one-click restore — it asks for your password once — for the rare case a crash leaves sleep disabled. True for every app AgentBarista watches, built-in or not.

ZCode (not built in — see above) Claude Code Cursor Codex Gemini CLI Copilot CLI OpenCode Zed Claude ChatGPT + more

Worth saying plainly: there are a lot of tools in this category now, including free and open-source ones like Keepresso and adrafinil that read agent hooks — a more accurate signal than guessing from CPU. If you’re a solo dev running one agent, either is a reasonable choice. Where we put our effort is being straight about which agents we have actually measured — which is why this page tells you ZCode isn’t one of them yet, and why it just told you the custom-app route won’t work for the command.

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 network calls are two: 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 — and an update check that fetches the new-version list from agentbarista.com, sends no personal data, and can be turned off in Settings.

Getting it

$19/year per Mac. Cancel any time.

AgentBarista Personal License — one Mac, $19/year
  • Runs as a menu-bar app — pick a mode, get back to work
  • Battery cutoff on by default (20%), plus a one-click emergency restore
  • Claude Code, Cursor, Codex CLI and more in the built-in list — ZCode not yet
Subscribe — $19/yr

$19/year per Mac. It auto-renews annually until you cancel, and you can cancel any time. 30-day money-back guarantee — one email, full refund.

Download free 14-day trial

The download is the trial — the full app, free for 14 days, no card needed. Need more Macs? 5-Mac Pack — $129/year, flat.

Running agents across a team instead? See the teams page.

More agents

Also running Claude Code, Codex CLI, or another agent?

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