Why Local Development Fails for AI Agents

Local development is an architectural flaw for modern AI coding workflows. When you run an autonomous agent locally, you bind execution to physical hardware.

You create a synchronous blocking dependency. You cannot close the lid, sleep the machine, or switch contexts without killing the process. This localhost constraint kills productivity.

The Solution: A Persistent Cloud Dev Environment

The fix is a headless, persistent state machine. Your laptop becomes a dumb terminal. The compute lives in a cloud development environment.

This decouples interaction from execution.

1. Sandboxing & Isolation

Autonomous agents execute arbitrary code. They install dependencies. They manipulate filesystems.

Running this on your daily driver is reckless. A remote devbox provides a hard boundary. If the agent trashes the OS, you re-provision. Your local machine remains pristine.

2. Tmux Persistence

SSH is stateless at the network layer but stateful at the process layer. A network interrupt kills the pipe.

We use Tmux to trap the session. It detaches the process tree from the TTY. You can initiate a long-running compile or agent task, close your connection, and the process continues. The state lives in the server's RAM.

3. Mosh vs SSH: Fixing Mobile Latency

TCP enforces ordered delivery. On a mobile network, a single packet drop stalls the stream.

Mosh (Mobile Shell) uses UDP and synchronizes the screen state, not the byte stream.

  • Packet Loss: Irrelevant. The client renders the latest known state.
  • Roaming: The session survives IP changes. Switch from Wi-Fi to LTE without breaking the pipe.

The Stack: Hetzner, WireGuard, and LazyVim

  • Compute: Hetzner Cloud (Ampere Altra ARM64). High core count for parallel agent threads.
  • Network: WireGuard. Split-tunnel VPN to hide the SSH/Mosh ports.
  • Interface: Neovim + LazyVim. Low-bandwidth, high-performance editing.

The Asynchronous AI Workflow

  1. Inject: Connect via mobile. Pipe the context to the agent. cat spec.md | mods "Implement this interface"
  2. Detach: Close the client. The agent runs in the background.
  3. Sync: Reconnect later. Review the diffs.

You stop watching progress bars. You pipeline tasks. The server works while you move.

Implementation Guide: Setting Up Your VPS

1. Server Provisioning

Install the core protocol stack on your Ubuntu VPS:

# Core tools
sudo apt update && sudo apt install -y mosh tmux wireguard

# Firewall (Allow UDP for Mosh)
sudo ufw allow 60000:61000/udp
sudo ufw allow 51820/udp  # WireGuard

2. Auto-Persistence Script

Add this to your .bashrc or .zshrc. It ensures that every SSH connection lands in the same persistent session.

# ~/.bashrc
# If not inside Tmux AND connected via SSH/Mosh
if [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" || -n "$MOSH_CONNECTION" ]]; then
    # Attach to 'main' or create it
    exec tmux new-session -A -s main
fi

3. Mobile Optimization

To prevent "ghost artifacts" on mobile renderers:

  • Set TERM to screen-256color.
  • Avoid aliasing ls to eza --icons on the server.