How I run my coding agents from anywhere, on any device
I do most of my real work through coding agents now. Claude Code, Codex, Kimi, Qwen, different models for different jobs. For a long time I ran all of it inside VS Code on my laptop. I liked it, and at first that was fine.
Then I started hitting walls. Five of them.
- Bandwidth. I travel a lot, often on a roaming SIM. A few minutes of an agent working in VS Code, or in the Claude web app, would eat hundreds of megabytes. Stretch that over a working day and you are into gigabytes. Paying by the megabyte on someone else's network, that adds up fast.
- The always-on tax. My agents never wanted to stop, so my laptop never could either. A good run goes for an hour or more. I did not want to close the lid and kill it halfway, so the machine had to stay open, awake, and plugged in, all the time. My main computer had turned into a server that I also carried around.
- Too many machines. I work from a lot of different screens. There is a Mac mini on a TV in front of the treadmill at my home gym. There is an iPad I like to use at home when I have not brought the work laptop. And there is my phone, for the quick change I want to make while I am out. The trouble was that my real work, the running agents and the open files, lived on whatever laptop I had used last. Walk over to a different screen and none of it was there.
- No real mobile. The official Claude and Codex phone apps looked fine in a demo. I could not actually work in them. No auto mode, no way past the permission prompts, no terminal, no real view of what the agent was doing. I would kick something off and have no idea if it was stuck, waiting on me, or already done. They have improved since, and I will get to the one thing I still use one of them for.
- Too many accounts. I have six Claude and Codex subscriptions, because my usage does not fit in a single 20x plan. When one ran out of usage, I logged out and logged into the next one. Several times a day, on every machine.
The setup that solved all of them at once
One always-on machine at home runs the agents. Everything else I own, my phone, the iPad, the treadmill Mac, a pocket PC, an old spare, is just a window into it.
Today that machine is a MacBook Pro with an M3 Max and 128 GB of RAM. It sits at home and never leaves. The Mac mini that did this job when I first wrote this post is now one of the windows, and it runs a few background agents on the side.
Four things make it work.
- mosh is a terminal connection that survives a dropped link, a sleep, or a jump from wifi to cellular, and carries on where it was.
- herdr keeps the real session alive on the host, so nothing is tied to the device in my hand. It replaced tmux. More on that below.
- Tailscale is the private network that links all of my devices to the host directly, with no ports opened to the public internet.
- CLIProxyAPI is a small gateway on the host that holds the logins for all six accounts and hands the agents whichever one has usage left.
Because the host does the real work over my home internet, the only thing crossing the roaming link is the text on the screen. A day that used to cost gigabytes now costs tens of megabytes. The agents keep running whether the machine in my bag is open or shut. And I can pick them up from anything: the Mac at the treadmill, the iPad on the couch, my phone in a queue somewhere, even by voice when I dictate into the terminal. Whichever device I open, the same live session is sitting there, already mid-task, because none of it lives on the thing in my hand. It all lives on the host.
There is a flip side. The host runs on my home internet, a symmetric gigabit line, so every download, install, and build happens at full speed no matter how slow the connection in my hand is. I have sat on awful mobile data and pulled huge repos and run heavy jobs as if I were wired in at home, because in every way that mattered I was. The work rides my fast pipe, not the one on my phone.
On the road I lean on one more tool to keep the data down: TripMode. It is a small Mac app that lets you allow only the apps you choose onto a metered connection. I lock it to just the terminal and Chrome. Everything else, all the background sync and chatter that normally leaks data without you noticing, stays blocked, and my usage drops to almost nothing.
The machine I carry stopped being the computer. It became a window into the one that is always on.
herdr instead of tmux
The June version of this post ran on tmux. In August I switched to herdr and have not opened tmux since.
herdr is an open source terminal workspace manager built for coding agents. It sits exactly where tmux sat: one persistent server on the host, a client in whatever terminal I happen to open, over mosh, same ctrl+b prefix. Detaching costs nothing. I can shut a laptop while an agent is writing code, open my phone twenty minutes later, and see everything it did while I was out walking around doing errands.
What it adds is the part tmux could never do.
- One workspace per project, each with its own tabs and panes. I have a dozen or so open at any time, and switching between projects is one click or one key.
- It knows what the agents are doing. herdr recognises the agent in each pane and marks it working, blocked, done, or idle. The sidebar rolls that up per project, so at a glance I see which project is waiting on me and which are still busy. With tmux I had to go and look in every window.
- The mouse works properly. Click a pane, drag a border to resize, right-click for a menu. That matters more than it sounds when the screen is a phone.
- It comes back from a reboot with the conversations intact. It restores the workspaces, tabs, panes, working directories, and focus, then resumes every Claude Code and Codex conversation by its own session id. After the last macOS update, every conversation was back by the time I reconnected.
- Agents can drive it. It has a CLI and a socket API, so an agent can open a pane, read what another pane is doing, or post a notification. The screenshot and file keys below are built on that.
One gateway for six accounts
This is the change that gets the most questions from friends.
CLIProxyAPI runs on the host and speaks the same API as Anthropic and OpenAI. My agents point at it instead of at the vendors, and it holds the logins for all six accounts. It fills the highest priority account first, keeps a conversation on the same account for a day so it does not bounce around, and when an account hits its five-hour or weekly limit it moves on to the next one that has room. A small dashboard on a private Tailscale address shows every account's limits and when they reset.
I have not logged out of an account since I set it up. From the agent's side nothing changed. From my side, the usage from six subscriptions is one pool.
One trade-off: a Claude Code session that goes through the gateway does not get the Claude.ai connectors or Remote Control. I keep a plain profile for the rare time I want those.
What the host looks like
The MacBook behaves like a server, not a laptop. A small system-level power guard keeps it from sleeping, it logs itself in after a reboot, herdr starts at login, and the agents resume. It comes back on its own from an OS update, a power cut, or a closed lid. That last part matters more than it sounds. The whole point is that I never need to be in the room.
Because it has the RAM and the cores, it does more than run agents. It builds my iOS apps, runs the simulators, and holds the local databases for the projects I am working on. The old Mac mini could not do all of that at once.
Screenshots and files
This is the part that makes working from a text-only terminal feel like working on a desktop.
Any image I copy on one of the client machines uploads itself to an inbox on the host in the background, deduplicated by checksum. In herdr I press ctrl+b then v, and the latest one is attached to the Claude Code or Codex pane as a real image, the same as pasting on a desktop. The agent shows it as an image attachment, not a file path. Two more keys cover the rest: ctrl+b then i pastes the paths of the latest screenshots, and ctrl+b then f pastes the paths of files I have sent over.
Files stay manual on purpose. I drop them on a droplet on the desktop, or use Send To on the Windows handheld, and they land in the inbox. Anything over 100 MB asks first, so a big video never goes over a roaming connection by accident. From the phone, Moshi pastes images straight in.
On the host itself none of this is needed, since that is where the agents run. My Obsidian vault syncs between every machine with Syncthing, and a read-only mirror goes to iCloud so I can read it on the phone.
All of it is built on herdr's shell keybindings and its CLI, and I had my coding agents build it. It sounds small until you are debugging something visual from your phone, or handing the agent a file from the couch, and it works.
The windows
Every window is a cheap or spare machine, because the expensive one stays home.
- The Mac mini at my desk. An iTerm2 profile that runs mosh to the host and attaches herdr. iTerm2 over the built-in Terminal because Command-click opens links, even inside the agent's own interface, and Option-drag selects text cleanly. Nothing else special.
- A GPD Pocket 4. A Windows 11 handheld about the size of a paperback. WezTerm into WSL, mosh to the host, and the full rig is in a jacket pocket.
- iPhone and iPad. Moshi, a mobile terminal built for this. Native mosh, connects over Tailscale, and it understands herdr directly, so I can jump between tabs and paste images. A small hook on the host sends a notification and a Live Activity when a run finishes, so I get a nudge on my watch. Dictation runs on the phone itself, so even talking to the agent costs no data. Dictating a ten-minute prompt on one bar of 3G and having it kick off a huge job on a gigabit machine at home is still my favourite trick.
- Anything with a terminal. A cheap Linux laptop, an old spare from a drawer, a borrowed computer in a hotel lobby. Nothing to install beyond mosh.
The one thing I still use a native app for is voice. Codex remote lets the ChatGPT app on my phone drive the native Codex app on the MacBook, and its voice mode is a real-time conversation, not dictation. It understands pauses. It can tell the difference between me stopping to think and me stopping because I want an answer, and I have been impressed by how rarely it gets that wrong. I spent three hours walking in the forest with AirPods in and got a full day of work done: invoices sent, bookkeeping done, emails written, the CRM updated. All by voice. It feels like the future.
It does not even have to be at home
Because Tailscale makes the distance irrelevant, the always-on box does not have to be in your house. It could be a cheap Hetzner server, or a Mac sitting in another country. Tailscale joins it to your devices the same way no matter where it physically lives.
I did not plan any of this, by the way. I set it up as a temporary travel hack, because my mobile data abroad was slow and capped and I needed a way around it. Then I liked it so much that it just became how I work, at home and away.
And I have pushed it hard. I did two weeks of work over this setup while more than four thousand kilometres from home, and it behaved exactly as if I were on my own sofa. Same speed, same sessions, nothing to think about. So if you would rather run this on a server on the other side of the world than on a box in your hallway, you can, and you will not feel the difference.
Tailscale deserves its own mention. It is the most secure and least annoying way I have found to reach all of my machines. Nothing is exposed to the open internet, every device authenticates properly, and it works. I liked it enough that I put all of my devices and servers on it, and turned my home node into an exit node. That last bit means that when I travel I also get a private VPN back into my home network. One toggle and my traffic comes out of my house, on my own trusted connection, wherever I am. That alone would be worth it.
It pays off in smaller ways too. When the host runs a dev server or a staging build, I can open it from my laptop or my phone anywhere in the world, just by visiting its Tailscale address. No tunnel, no deploy, no port opened to the internet. A localhost on the host behaves like a localhost on whatever I am holding, so I review work in progress from a train the same way I would at my desk. I told my agents to always hand me the Tailscale link for anything they spin up, so the preview is one tap away wherever I am, even on mobile while walking around.
It made me a better developer
There is a side effect I did not expect. Living in a terminal like this, over mosh and herdr and Tailscale, pushed me to understand the tools properly instead of hiding behind a friendly GUI. I got comfortable with the shell, with how remote machines really talk to each other, with how a proper network like Tailscale is put together. None of that was the goal, but all of it stuck.
You set the thing up once, and somewhere in the process you stop being someone who just uses a code editor and start being someone who is comfortable on a real machine over a real network. I did not expect a bandwidth problem to make me better at my job, but it did.
If you want the same rig
I have written the whole thing up as a playbook you can hand straight to your own coding agent: the remote agent rig playbook. It covers the always-on host, Tailscale, mosh, herdr and its restore, the account gateway, the screenshot and file keys, the clients, the exit-node VPN, and the handful of gotchas that cost me real time so they will not cost you any.
If you are doing serious work through agents and still tied to a single open laptop, you do not have to be.
One note if you want to try this yourself. I did not build the setup by hand, I had my coding agents do it. It is exactly the kind of fiddly, many-small-pieces job an agent is good at. Point a capable one at the playbook and let it handle the plumbing.