Deploy VS Code Agent Host on an independent cloud Mac near your repository and Xcode toolchain, then connect through either SSH or a development tunnel and run each task in its own Git worktree. This is the fastest safe path for long-running AI Coding work.
This guide is for iOS and macOS developers running GitHub Copilot, Claude, or Codex tasks in Xcode projects; platform engineers managing remote sessions, worktrees, and credentials; and AI Coding leads evaluating elastic Mac capacity.
Operational rule: A persistent session can survive the loss of an editor window. It does not automatically isolate files, credentials, tools, or privileged macOS actions.
Last updated September 3, 2026. Feature status and procedures were checked against the Agent Host architecture documentation, the remote session documentation, and the current VS Code reference pages listed throughout this runbook.
Before deployment: separate the host, harness, model, client, and Mac
The first mistake is treating “Agent Host” as a complete remote AI platform. It is not.
The Agent Host is the long-lived process that preserves sessions and runs an agent harness. The harness is the execution layer selected for GitHub Copilot, Claude, Codex, or another supported workflow. The model provider supplies inference. VS Code is the client that lets you inspect or control a session. The cloud Mac is the execution environment where files, shell commands, Xcode, simulators, signing tools, and MCP-connected utilities may run.
The architecture description confirms that the host can run as a local process or as an independent remote service, with multiple clients connecting to the same session. Read the official Agent Host architecture explanation before choosing a production topology.
A cloud Mac is justified when the task needs macOS-specific behavior, Xcode, Simulator, Apple SDKs, signing tools, browser automation tied to macOS, or a reproducible Mac build environment. It is a poor default for repository edits that could run on an ordinary Linux or local development machine.
Write these boundaries down before provisioning:
- Repository location and approved branches.
- Directories the host may modify.
- Shell commands and tools each harness may call.
- Credentials available to the session.
- Operations requiring human approval.
- Artifacts that must survive the session.
- Cleanup responsibility after completion or failure.
The cloud Mac should be independent from your daily workstation. That separation limits accidental writes to local files and gives you a place to inspect, stop, snapshot, and rebuild the execution environment.
Decision table: choose the execution shape before you connect
| Execution shape | Best fit | Main benefit | Main risk | Default decision |
|---|---|---|---|---|
| Local Agent Host | Short edits and interactive debugging | Lowest setup overhead | Laptop sleep, network loss, local credential exposure | Keep for small tasks |
| Shared cloud Mac | Lightweight parallel work with controlled repositories | Better utilization and centralized access | Worktree, build-cache, and permission collisions | Use only with strict isolation |
| Independent cloud Mac | Long tasks, Xcode, signing, Simulator, or high-risk tools | Clear runtime ownership and easier recovery | Higher idle cost and capacity planning | Preferred for production pilots |
| Mac per task | Untrusted or highly independent agents | Strongest separation of files and credentials | More provisioning and teardown work | Use for sensitive workloads |
Score the candidate environment against four gates: macOS dependency, task duration, parallelism, and recovery requirement. If it fails the macOS dependency gate, do not rent a Mac merely to host a session. If it passes all four, an independent Mac is easier to reason about than a shared desktop.
First hour: create a managed remote entry point
Start by checking the VS Code release channel, Agent Host availability, harness support, and relevant AI settings. Do not copy a setting name from a preview build into a stable deployment without checking the AI settings reference. Agent Host Protocol is still under active development, and Claude, Codex, built-in credentials, and client-side tools may have experimental or conditional support.
Create a deployment record before launching the process:
| Record item | What to capture | Stop condition |
|---|---|---|
| Version state | VS Code channel, host build, harness revision, and date checked | The version cannot be reproduced |
| Process owner | User, service account, or automation identity | No accountable owner exists |
| Connection path | SSH or development tunnel, authentication method, and entry point | Access depends on an undocumented laptop |
| Workspace | Repository, branch, worktree path, and ignored directories | The host can write outside the approved scope |
| First proof | Connection log, session identifier, and harmless test diff | The test cannot be reversed |
Install or place the Agent Host on the remote Mac as an independent process. The exact launch command and supported flags must come from the current official documentation for your release. Keep the startup method explicit: a managed service, a controlled terminal session, or an approved automation wrapper. A command that works once in a personal shell is not a production process.
SSH versus development tunnel
SSH gives you a familiar operational model. You can manage keys, restrict users, apply network controls, and integrate access with existing audit procedures. It also creates an inbound network dependency. You must maintain host identity, firewall rules, key rotation, and connection logging.
A development tunnel avoids requiring an inbound port when the remote Mac can establish an outbound connection. The Remote Tunnels security documentation explains the access model and its security considerations. A tunnel still needs an accountable identity, revocation process, and lifecycle monitoring. “No open inbound port” does not mean “no access risk.”
| Decision dimension | SSH | Development tunnel |
|---|---|---|
| Network entry | Usually requires reachable SSH service | Remote host initiates the tunnel |
| Identity work | Keys, users, host verification, key rotation | Account or token lifecycle and tunnel ownership |
| Existing operations | Fits teams with SSH runbooks | Fits teams that cannot expose inbound access |
| Failure mode | Host unreachable, blocked port, expired key | Tunnel process stopped, identity expired, service unavailable |
| Best first test | Reconnect after closing the client | Reconnect after stopping and restarting the tunnel |
| Choose it when | Your team already audits SSH access | Outbound-only access is a deliberate policy choice |
Pick one path for the pilot. Running both “temporarily” often leaves an unmanaged back door. Save the connection method, responsible team, authentication scope, and first successful reconnect in the deployment record.
For a separate operational perspective, compare this setup with the remote development capacity guide for Mac environments before you decide whether several sessions should share one host.
Step 1: start with one isolated worktree and a reversible task
The first session should not upgrade dependencies, alter signing configuration, or rewrite a large application. Create a dedicated Git worktree and branch for a small change that can be tested and discarded.
A safe sequence is:
- Create a clean branch from the approved base revision.
- Create a separate worktree outside the primary checkout.
- Open that worktree through the remote Agent Host session.
- Ask the harness to inspect files before editing them.
- Permit one narrow, reversible change.
- Run the smallest relevant test.
- Review the diff from outside the agent’s narration.
- Commit, discard, or restore the worktree deliberately.
The worktree boundary matters because persistent sessions do not prevent two agents from writing to the same checkout. Parallel tasks need separate paths, branches, generated-output rules, and ownership. If two tasks must touch a shared lockfile or project file, serialize that operation instead of hoping the model will coordinate it.
Harness checks are not interchangeable
For GitHub Copilot, Claude, and Codex, verify the account, model entry point, repository permissions, approval mode, and experimental switches separately. Do not assume that a successful connection proves equivalent tool behavior across harnesses.
Record whether the harness:
- Writes directly into the worktree or stages proposed patches.
- Runs commands automatically or waits for approval.
- Preserves terminal state after reconnect.
- Stores session metadata remotely or in the client.
- Needs a client-side extension for browser or MCP tools.
- Can continue after an interactive command requests input.
A useful first score is not model quality. Score operational control instead:
| Acceptance area | Pass evidence | Failure response | Score |
|---|---|---|---|
| File boundary | Diff stays inside the assigned worktree | Stop the host and inspect paths | 0 or 1 |
| Command control | Every privileged command has an approval path | Remove the credential or narrow permissions | 0 or 1 |
| Reversibility | Change can be discarded and worktree restored | Rebuild from a clean checkout | 0 or 1 |
| Session state | Progress and output remain visible after reconnect | Treat the task as non-persistent | 0 or 1 |
| Delivery proof | Build or test artifact can be reproduced | Do not accept generated code as delivery | 0 or 1 |
A score below five is a pilot failure, not a reason to add more agents. Fix the missing control first.
Step 2: disconnect, reconnect, and test the failure you actually fear
Do not validate persistence by closing a VS Code window only. That proves little. Start a representative task, let it reach a known execution point, then disconnect the client while the remote process is active.
Use a second VS Code window or a supported browser entry point to reconnect. The session management documentation describes the supported session controls and state model. Compare the session identifier, terminal output, pending approval requests, changed files, and task progress.
Run these three independent failure tests:
- Client loss: close the local editor or disconnect the network while the host remains alive.
- Mac restart: reboot the remote environment and verify whether the host startup procedure restores service.
- Host exit: stop the Agent Host process and confirm that the session is marked unavailable rather than silently appearing active.
Each result needs evidence: timestamp, session identifier, last visible output, reconnect result, and resulting Git diff. The remote Agent session documentation should be the authority for supported remote behavior, not a community screenshot or a one-off successful reconnect.
Multiple clients can connect to the same session, but simultaneous control requires discipline. Use one window as the operator and a second as an observer during the first acceptance test. If both clients can issue commands, define ownership before approving a tool call. Otherwise, one window may approve or cancel a request while the other displays stale context.
Step 3: prove Xcode delivery instead of stopping at code generation
A generated patch is not an iOS or macOS deliverable. The remote Mac must install the declared dependencies, select the expected Xcode environment, build the project, run tests, and place artifacts where your delivery process can retrieve them.
Use a low-risk project or a disposable branch. The validation sequence should be:
- Confirm the repository revision and worktree path.
- Install dependencies using the project’s documented method.
- Check that the required Xcode command-line tools are available.
- Build the target without changing signing or release credentials.
- Run the project’s relevant test scheme.
- Save logs and generated artifacts outside the temporary worktree.
- Inspect the diff, test result, and artifact metadata.
- Remove credentials and clean temporary output.
Use Apple’s Xcode command-line tool reference for command and tool behavior, and its testing and result interpretation guidance for test evidence. Keep those references beside the environment record because Xcode behavior depends on the installed toolchain and project configuration.
Separate host capabilities from client extensions. Xcode command-line execution may continue after your editor disconnects if the process is running on the remote Mac. A browser tool, interactive approval prompt, or client-provided MCP integration may not. Test MCP in the exact connection mode you plan to operate.
The MCP configuration reference is the source for configuration behavior. Check whether configuration is local or remote, whether the server starts on the Mac, what credentials it inherits, and whether an interactive input is required. Keep high-privilege actions behind manual approval. Never give an experimental tool unrestricted access to signing assets, production repositories, or broad filesystem paths during the first week.
Step 4: turn the pilot into a capacity and recovery baseline
After the first successful task, collect operational records for at least the situations your team expects to run. Track runtime duration, tool calls, retries, human takeovers, build activity, worktree count, and Mac occupancy. These are capacity inputs, not proof that a faster model or larger machine will solve process failures.
Use this cost and ownership comparison:
| Operating model | Cost drivers | Recovery effort | Suitable workload |
|---|---|---|---|
| Shared Mac pool | Concurrent sessions, build contention, cleanup automation | High when one task damages shared state | Short, isolated tasks |
| Dedicated Mac per long task | Reserved runtime, storage, and idle time | Lower because ownership is clear | Long Agent sessions and Xcode builds |
| On-demand task Mac | Provisioning, startup delay, artifact transfer, teardown | Moderate if images are reproducible | Bursty workloads |
| Local development machine | Existing hardware and local tools | Poor after sleep, travel, or network loss | Interactive work with no persistence requirement |
Define a recovery runbook before expanding concurrency:
- Snapshot or record the repository revision.
- Preserve the agent transcript and command output.
- Remove the worktree after merge or abandonment.
- Revoke task-specific credentials.
- Archive build and test logs.
- Mark the host unavailable after an abnormal shutdown.
- Recreate the environment from documented setup rather than repairing it indefinitely.
If tasks cannot resume, changes cannot be reviewed, or the Mac cannot be restored to a known state, restrict the pilot to read-only analysis and small patches. Do not compensate for missing recovery with longer timeouts or broader permissions.
FAQ: remote Agent Host decisions
The most common deployment questions are about boundaries rather than model quality. The answers below separate session persistence from execution safety.
Will the agent keep running after I close my local computer?
Yes, it can, if the remote Agent Host process stays alive and the task uses tools available on the remote Mac. Closing the local computer does not necessarily stop the host. However, client-side extensions, browser tools, and interactive approvals may disappear. Test client loss separately from host exit and Mac restart, then compare the session state after reconnecting.
Should you use SSH or a development tunnel?
Use SSH if your team already manages keys, host verification, network policy, and access logs. Use a development tunnel when outbound-only connectivity is required and your team can still manage identity, expiration, and revocation. The choice is an operations decision, not a feature ranking. Document one supported path and remove the unowned alternative.
Can several VS Code windows take over one session?
The remote architecture supports multiple clients for a session, but concurrent control can create conflicting approvals and stale visual state. Start with one operator and one observer. Confirm that both windows show the same session status, terminal output, change set, and approval queue. Only allow concurrent control after your harness and team process define ownership.
What is the safest way to isolate parallel tasks?
Use one branch and Git worktree per task, with separate generated-output directories whenever possible. Never rely on the Agent Host to prevent collisions inside a shared checkout. Review and merge changes outside the session, then delete the worktree and revoke temporary access. Shared build caches should be treated as a separate source of cross-task contamination.
Can the remote host use Xcode and MCP?
It can use tools installed and permitted on the remote Mac, but each tool has its own dependency and connection boundary. Xcode command-line builds may run remotely, while a client extension or interactive MCP server may depend on the connected window. Validate both connected and disconnected states, and require manual approval for signing, filesystem-wide access, or external side effects.
Current setup versus a MacPull cloud Mac
A local laptop keeps setup simple, but sleep, travel, network changes, limited parallel worktrees, and competition with your daily tools make it a weak long-task host. A shared desktop adds contention and makes cleanup ownership unclear. A generic remote environment may also lack the exact Xcode, Simulator, signing, and macOS testing path your project requires.
Once your minimal session, reconnect test, worktree rollback, and Xcode delivery check pass, a MacPull cloud Mac gives you a cleaner place to keep the Agent Host near the Mac toolchain without tying execution to one editor window. Review the MacPull capacity planning guide and current MacPull plans against your measured runtime, concurrent worktrees, and Xcode build peaks.
Renting is not automatically the right answer for a stable, heavy workload that runs continuously or requires physical peripherals. For that case, buying and operating dedicated hardware may be easier to budget. For temporary AI Coding capacity, long sessions, controlled experiments, or a team that needs to validate Mac delivery before committing to hardware, the rented environment is usually easier to replace, isolate, and tear down.
FAQ
Will the agent keep running after I close my local computer?
It can, provided the Agent Host process remains active on the remote Mac and the task does not depend on a client-side extension or interactive prompt. Closing your laptop or editor is not the same as stopping the host. Test this with a small reversible change, reconnect from another client, and verify session state, terminal output, pending approvals, and the resulting diff.
Should I use SSH or a development tunnel for a remote Mac?
Choose SSH when your team already operates keys, network policy, host records, and session logging. Choose a development tunnel when you need an outbound connection without exposing an inbound port and can manage its identity and lifecycle. Neither path is automatically safer. Record who owns authentication, how access is revoked, and what happens when the tunnel or host disappears.
Can several VS Code windows take over one agent session?
The architecture supports multiple clients connecting to the same session, but that does not make simultaneous editing conflict-free. Use one window as the active operator, treat other windows as observers unless the client documents takeover behavior, and check that terminal output, change state, and approval requests agree. A second window should be part of acceptance testing, not an assumption.
How do I isolate parallel Agent tasks in one repository?
Give every task its own Git worktree and branch, then assign a separate working directory to the corresponding session. Do not let parallel agents share generated files, build outputs, or mutable environment state unless the project explicitly supports it. Before merging, inspect the diff, run the relevant tests, remove the worktree, and revoke temporary credentials associated with the task.
Can a remote Agent Host call Xcode and MCP tools directly?
It can use tools available on the remote Mac, including Xcode command-line workflows, but availability depends on the host environment, harness, client, permissions, and MCP configuration. A disconnected client may take away client-side tools or interactive approval flows. Validate dependency installation, builds, tests, MCP forwarding, browser requirements, and manual approval for privileged actions before accepting delivery.