To run a coding agent from your phone, run it somewhere else. The agent and the repository live on a server or desktop, inside tmux or an agent multiplexer, and the phone connects only to read output, answer prompts and review diffs. That split survives the phone sleeping in your pocket and keeps credentials off the device. What is left to decide is how the phone reaches the machine, what the agent may touch, and how you learn that it is waiting.
Where should the agent actually run?
On a machine that stays awake: a home server, a cloud VM, a build box, the desktop under your desk. A phone is the wrong host for two reasons. iOS suspends apps in the background, so anything running inside a phone app pauses whenever you lock the screen, as covered in keeping an SSH session alive on iPhone and iPad. And the repository, toolchain and test suite the agent needs are already on the server.
The agent's process must also outlive your connection. Claude Code's Remote Control documentation says it plainly for remote machines: start claude "inside tmux or screen to keep the session running after you disconnect from SSH." The same holds for every terminal agent. A terminal multiplexer on the server is not an optimization; it is what lets you close the phone without killing the job.
Which agent CLIs work this way?
Any agent that runs in a terminal can be driven over SSH. The common ones, described by their own documentation:
- Claude Code (Anthropic) is "an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools," with a full-featured CLI.
- Codex CLI (OpenAI) is "a coding agent from OpenAI that runs locally on your computer," open source under Apache-2.0.
- Gemini CLI (Google) is an open-source agent for the terminal. For unpaid-tier and Google One users it was replaced by Antigravity CLI on June 18, 2026; Google says it remains accessible with paid Gemini API keys.
- Aider is "AI pair programming in your terminal." It commits each change with a descriptive message, which turns reviewing from a phone into reading
git log.
What they share matters more than what separates them: each runs as a process in a terminal, and each can stop and ask before it acts. The phone's job is to see those questions and answer them.
Four ways to reach the agent from a phone
The choice is less about the terminal app than about where the session lives and what has to stay running.
| Setup | Where the agent runs | How the phone connects | What must keep running | What the phone shows |
|---|---|---|---|---|
| SSH plus tmux | Your machine | SSH, ideally over a private VPN | The tmux server | The raw terminal |
| Vendor relay, such as Claude Code Remote Control | Your machine | The vendor's app, through the vendor's servers | The local agent process | The vendor's conversation view |
| Agent multiplexer plus mobile client, such as Herdr with YoloShell | Your machine, inside the multiplexer's server | SSH | The multiplexer's server | Every workspace, pane and agent, with status |
| Cloud-hosted session, such as Claude Code on the web | The vendor's cloud | The vendor's app or browser | Nothing of yours | The vendor's interface |
The vendor relay is the least setup: Remote Control's local session "makes outbound HTTPS requests only and never opens inbound ports," but it is available on paid Claude plans rather than API keys, and it drives one vendor's agent. SSH is vendor-neutral and gives you the real shell, at the cost of securing the access yourself. Herdr, an Apache-2.0 multiplexer built for agents, sits between the two: agents run inside a background server that marks each one working, blocked or idle, and a client attaches over SSH.
How do you keep a phone-reachable agent from becoming a hole in your network?
Treat the phone as the least trustworthy device in the chain, because it is the easiest one to lose.
- Keep sshd off the public internet. Put the server and the phone on a mesh VPN instead. Tailscale builds "encrypted point-to-point connections using the open source WireGuard protocol" that work across NAT without port forwarding, and the WireGuard protocol is designed so that the server "does not even respond at all to an unauthorized client." An open port 22 answers anyone who scans for it.
- Give the phone its own key and fence it in. In
authorized_keys, OpenSSH'srestrictoption disables port, agent and X11 forwarding and PTY allocation;ptyturns the terminal back on;from=limits where the key may log in from;expiry-time=ends it on a date. A line such asrestrict,pty,from="100.64.0.0/10" ssh-ed25519 AAAA…lets the phone open a shell from tailnet addresses, which Tailscale assigns from 100.64.0.0/10, and nothing more. - Run the agent as its own user. Least privilege restricts the access of "users (or processes acting on behalf of users)" to what their task needs. An agent account that can reach the repositories it works on, but not your SSH keys, cloud credentials or production config, caps what a bad command can do.
- Check the host key once and keep it pinned. A client that warns when a known server presents a different key is your defense against connecting to the wrong machine from a café network.
What should a phone approval look like?
An approval is only as good as what you read before tapping. A narrow screen wraps or truncates a long command line, so scroll to its end; the dangerous part of rm -rf usually sits in the last argument. Prefer modes that ask before editing outside the working directory or running unrecognised commands.
The agents document the modes that remove that safety net. Claude Code's permissions page says its rules "are enforced by Claude Code, not by the model," and that bypassPermissions should be used "only in isolated environments like containers or VMs where Claude Code can't cause damage." Codex pairs sandbox modes with an approval policy, and its danger-full-access mode "removes the filesystem and network boundaries." Typing on glass is slow, which is exactly why switching off approvals feels tempting from a phone and exactly why not to.
How does the phone find out the agent is waiting?
An agent paused on a prompt is idle until someone answers, so the signal matters as much as the answer. Claude Code's terminal configuration guide explains that when it finishes or pauses for a permission prompt while you seem to be away, "it fires a notification event." Setting preferredNotifChannel to "terminal_bell" rings the terminal; inside tmux, set -g allow-passthrough on lets escape-sequence notifications reach the outer terminal; and a Notification hook can run any command, including a call to a push service you control.
Mind the iOS boundary. A terminal app hears a bell only while it is running, and iOS suspends it shortly after you leave it. Alerts meant for a phone in your pocket have to start on the server; the terminal app's job is to make the session readable once you open it.
What YoloShell adds for agents
YoloShell is an iOS client for the multiplexer row of the table. Over SSH it attaches to a Herdr server and lists every workspace, tab, pane and agent with its status, opens panes read-only by default, and takes control only after you confirm. It can also start a supported agent in a pane that is sitting at a shell prompt. The panel, its states and its reconnect behaviour are covered step by step in how YoloShell drives a coding agent on your server.
Two smaller pieces matter for agent work:
- Attachments land where the agent can read them. The attachment button uploads a photo or a file of up to 64 MB to a temporary inbox on the server, cleared after a day, and types the remote path into the terminal without pressing Return, ready for a prompt that says "look at this screenshot." It works on SSH and Herdr tabs while you have control, not on Mosh tabs.
- Bells and notifications become feedback. A terminal bell, or an OSC 9, 99 or 777 notification, turns into a haptic or a toast while you are looking at the session, with Off, Haptic and Sound settings.
The limits are firm. YoloShell includes no AI service, so the agent CLI and Herdr must already be installed on the server, and the integration was verified against Herdr 0.9.3. Like any iOS terminal it receives nothing while suspended. The free tier runs one concurrent session; a second agent session at the same time is part of the YoloShell Pro subscription.
When a phone is the wrong place to drive an agent
Use the phone to supervise, not to author. It is well suited to answering a prompt, reading a diff, restarting a stuck run or sending a screenshot of a bug. It is poorly suited to reviewing a large refactor line by line, resolving merge conflicts, or any session where you would approve without reading because the screen makes reading hard.
A workable rule: if an approval needs more context than fits on one scrolled screen, answer "no" or "wait" from the phone and finish the review at a keyboard. If the agent needs approvals so often that answering them from the phone is tiring, tighten the task, not the permission mode.