The Five Layers of a Remote Mac Agent Setup

· 9 min read

The previous post in this series was a hands-on tutorial: install Tailscale, install Mosh, fix the PATH, unlock the keychain, connect. If you followed it, you have a working setup. But you might also be wondering why there were so many moving parts for something that should be simple.

I had the same reaction. After getting everything working, I stepped back and realized there’s a structure to this that isn’t obvious when you’re in the middle of troubleshooting. Every tool I installed was solving a problem at a specific layer. Once I saw those layers, debugging got easier, decisions about what to install became obvious, and I stopped confusing problems in one layer with solutions from another.

This post is that framework. If you’ve already read the tutorial, this will make sense of what you built. If you haven’t, this will help you understand what you need before you start.

The five layers

There are five distinct problems to solve when controlling AI agents on your Mac from your phone. Each layer addresses exactly one problem. Skip a layer and the setup breaks. Mix up which layer a problem belongs to and you’ll waste time applying the wrong fix.

Here’s the stack, from top to bottom:

  1. The work layer: which app runs your AI tasks
  2. The bridge layer: how your phone talks to that app
  3. The power layer: keeping your Mac awake when the lid is closed
  4. The fallback layer: direct access to your Mac for troubleshooting and recovery
  5. The client layer: what you tap on your iPhone

Layer 1: The work layer

This is the simplest layer to understand. You have three options, and they serve different purposes.

Claude Code is the command-line tool. Terminal-based, text in and text out. Best for coding tasks, file manipulation, and anything where you need to see exactly what’s happening step by step.

Cowork is a mode inside the Claude Desktop app. It can access your local files, use connectors (Slack, Linear, Google Drive), and execute multi-step tasks autonomously. Best for tasks where you describe an outcome and walk away.

Claude Desktop (Chat/Code modes) is the graphical app for conversational use. Less relevant for remote work since it requires visual interaction.

The choice at this layer determines what you need at every other layer. Claude Code needs a terminal path to your Mac. Cowork needs the Desktop app running on your Mac. Both need your Mac to be awake.

Layer 2: The bridge layer

Each work app has a corresponding feature that connects it to your phone over the internet.

Remote Control bridges your phone to a Claude Code session. You run /remote in a terminal session on your Mac, scan a QR code with the Claude iOS app, and you can send messages to that session from anywhere. It works over Anthropic’s servers using outbound HTTPS connections from your Mac. No networking setup, no port forwarding, no VPN required.

Dispatch bridges your phone to a Cowork session. Same mechanism. You pair via QR code, then send tasks from the Claude iOS app. Claude runs the task on your Mac using local files and connectors, then messages you the result. Also routes through Anthropic’s servers, also requires no network configuration.

This is the primary way you interact with your Mac remotely. For many sessions, this is all you need. You type a task on your phone, the bridge relays it to your Mac, the work happens, you get the result.

The catch: these bridges aren’t perfectly reliable yet. Remote Control sometimes fails to transmit user input prompts (like permission approvals) to the mobile app. Sessions can go quiet and you can’t tell whether Claude is thinking or stuck. When Dispatch spawns a code task that needs confirmation, the prompt might not surface in the app. When this happens, you have no way to see what’s going on through the bridge alone. This is why Layer 4 exists.

Layer 3: The power layer

Close your MacBook lid and it sleeps. Sleep means the bridge has nothing to connect to.

The standard solution is clamshell mode: macOS keeps the Mac awake when it’s plugged into power and connected to an external display. The trick is that you don’t need a real display. An HDMI dummy plug (about Rs 300) fools macOS into thinking a monitor is connected. On a MacBook Air, you also need a USB-C to HDMI adapter (about Rs 800) since there’s no HDMI port.

Amphetamine (free, from the Mac App Store) adds flexibility on top of this. It lets you set rules like “stay awake whenever on power” or “stay awake while Terminal is running.” The terminal alternatives are caffeinate -s for a temporary hold and sudo pmset -a sleep 0 for a permanent setting.

This layer is purely about the Mac hardware. It has nothing to do with networking, apps, or your phone. If Remote Control or Dispatch aren’t responding, check this layer first: is the Mac actually awake?

For those who don’t want to deal with clamshell mode at all: a Mac Mini (M4, about Rs 56,000) has no lid, draws 5-7W idle, and has a built-in HDMI port. One-time setup with a monitor and keyboard, then it runs headless permanently.

Layer 4: The fallback layer

Remote Control and Dispatch route through Anthropic’s servers and don’t need any direct network path to your Mac. But when they can’t relay a prompt, when a session becomes unresponsive, or when you need to see the actual terminal state, you need a way to connect to your Mac directly. That’s what this layer provides.

Tailscale creates a private encrypted network between your devices using WireGuard. Install it on your Mac and iPhone, sign in with the same account, and both devices get stable IPs on a 100.x.x.x network that works regardless of which Wi-Fi or cellular network either device is on. This gives your phone a direct path to your Mac from anywhere.

With Tailscale in place, you have three protocols for direct access:

SSH gives you a text terminal. The basics: enable Remote Login in System Settings on the Mac, connect from your phone using the Tailscale IP.

Mosh is the iOS-friendly version of SSH. It uses UDP with server-side session state, so it survives app switches and network changes. Post 1 walks through the full setup: installation, the PATH fix for Homebrew on Apple Silicon, and the .zshenv configuration.

VNC (Screen Sharing) gives you the full Mac desktop on your phone. Built into macOS as “Screen Sharing” under System Settings. You need this for initial Dispatch pairing (to see the QR code on the Mac), for approving GUI prompts in Claude Desktop, and for any troubleshooting that requires seeing the desktop. The next post in this series covers the Dispatch workflow where VNC plays a bigger role.

None of these are required for the happy path. When Remote Control and Dispatch are working well, you won’t open Termius or a VNC app at all. But when something goes wrong (and it will, periodically), having this layer already set up is the difference between recovering in 30 seconds and being locked out until you get back to your desk.

Layer 5: The client layer

This is what you tap on your iPhone. Each app maps to a specific access pattern:

Claude iOS app for Remote Control and Dispatch. This is your primary interface. Send a message or task, get a result.

Termius for SSH and Mosh. Full terminal access. Your fallback when Remote Control can’t relay something. Post 1 covered this in depth, including the Mosh connection type, keychain unlock, and the combo workflow.

Screens 5 (paid) or Apple Remote Desktop (free) for VNC. Full desktop access. Your fallback for anything that requires the GUI.

Most of the time, you’ll only use the Claude iOS app. Termius and VNC apps are there for when you need them.

How this framework helps in practice

When something breaks, the layers tell you where to look.

“Remote Control stopped relaying my messages.” That’s a Layer 2 issue. The fix is at Layer 4 and 5: Mosh into the Mac via Termius and check the terminal. You’ll usually find a prompt waiting for input that the bridge didn’t surface.

“Dispatch task didn’t run.” Check Layer 1 first (is Claude Desktop open in Cowork mode?), then Layer 3 (is the Mac awake?). If both are fine, it might be a Layer 2 issue (Dispatch session expired, needs re-pairing via VNC).

“I can SSH but Claude Code says not authenticated.” That’s a Layer 1 configuration issue (keychain not unlocked), not a networking problem. The fix is the .zshrc keychain block from Post 1.

“Can’t SSH from my phone.” That’s Layer 3 (Mac asleep?) or Layer 4 (Tailscale running on both devices?). It’s not a Layer 5 problem, so don’t waste time reconfiguring Termius.

Choosing what to set up

Not everyone needs all five layers fully configured. Here’s how to decide.

Just exploring (zero spend): Leave the MacBook open on your desk, install Amphetamine to prevent sleep. Pair Remote Control or Dispatch and try it. You don’t need Layer 4 at all to get started.

Reliable remote Claude Code: Add the fallback layer. Set up Tailscale, Mosh, and the keychain unlock from Post 1 so you can recover when Remote Control drops a prompt. Add the dummy plug and USB-C adapter (Rs 1,100 total) if you want to close the lid.

Cowork and Dispatch remotely: Everything above, plus Claude Desktop running in Cowork mode, and a VNC app on your phone for pairing and occasional GUI access. The next post in this series covers this setup.

Dedicated always-on agent hub: A Mac Mini replaces the MacBook. No dummy plug needed, no clamshell mode. Everything else is the same.

What comes next

The previous post gave you Layer 4 and 5 in depth for the Claude Code path. The next post covers the Cowork and Dispatch path: how to send autonomous tasks to your Mac from your phone without touching a terminal, and what that workflow actually looks like day to day.


This is post 2 in the Remote Agent Engineering series. Previous: Running Claude Code on Your Mac from Your iPhone. Next: Dispatch and Cowork (coming soon).

Subscribe to the Newsletter

Get notified when new posts are published. No spam, unsubscribe anytime.

You'll be taken to Substack to complete your subscription.