
Make AI Coding 24/7: Remote Server + VS Code SSH + tmux, Step by Step
Move your projects to a remote Linux box, manage dozens of tmux sessions from one VS Code window, and take over from your phone so AI keeps working in the background.
Make AI Coding 24/7: Remote Server + VS Code SSH + tmux, Step by Step
If AI only works while you're sitting at your desk, the bottleneck isn't the model. It's the host machine. Put your projects on an always-on server and AI moves into the server room — on shift 24 hours a day.
This is a practical build, not theory: run projects on a server, keep sessions alive with tmux, manage everything from VS Code, and take over from your phone anytime.
You only need: a Linux server, VS Code + Remote-SSH, an SSH key, tmux, and a terminal-based AI tool (Codex/Claude Code works fine).
First, make SSH a stable entry point
If you can already log in, don't rush to launch AI. Stabilize your SSH connection first. The easiest path is key-based auth plus keep-alive, so VS Code and your phone share one clean entry.
Generate a key (skip if you already have one):
ssh-keygen -t ed25519 -C "your@email.com"Copy your public key to the server:
ssh-copy-id user@YOUR_SERVER_IPThen add a host alias to ~/.ssh/config so everything uses ai-server:
Host ai-server
HostName YOUR_SERVER_IP
User user
IdentityFile ~/.ssh/id_ed25519
ServerAliveInterval 60
ServerAliveCountMax 3Test with ssh ai-server. If it still asks for a password, your key is probably not in ~/.ssh/authorized_keys.
Install tmux and split projects into sessions
tmux is the "power layer" for persistence. You can drop your network, close your laptop, or sleep — the processes keep running.
Install tmux (apt for Ubuntu/Debian, yum for CentOS/Rocky):
sudo apt-get update && sudo apt-get install -y tmuxsudo yum install -y tmuxNo root? Ask your admin to install it. tmux -V should print a version when it's ready.
Create one session per project:
cd ~/projects
tmux new -s project-aThe three shortcuts you use daily:
Ctrl+bthend: detach without stoppingtmux ls: list sessionstmux attach -t project-a: return to a session
Use VS Code to control tmux remotely
Now VS Code becomes your remote control. Install Remote - SSH, connect to ai-server, open the project directory, then attach in the VS Code terminal:
tmux attach -t project-aYou'll land inside the tmux session. Close VS Code if you want — when you come back, attach again and everything is still there.
If VS Code hangs on connect, test with ssh ai-server in a system terminal. If SSH works, the issue is usually VS Code SSH config or permissions.
Keep AI running in each window
Now start the AI. In a tmux session, open multiple windows and run one AI task per window. The rule is simple: one task per window, don't mix everything in a single chat.
Drop a prompt.md in each project so you can copy and edit quickly:
You are my project assistant.
Goal: finish the task and output a result file.
Requirements:
1. Print what you're doing at each step
2. When done, generate result.json with done: true/false
Task:
- TODO: describe the taskIf you're using Codex/Claude Code, start it in the window:
codexIf it stalls, check CPU and memory first. AI can run in parallel, but your server still has limits.
Take over from your phone (optional but highly recommended)
This is the fun part. Install Termius, add the same ai-server, then:
tmux ls
tmux attach -t project-aYou see the exact same session as in VS Code. Restart a window or tweak a task while you're on the go.
No Ctrl key on mobile? Termius has a function key panel — use it to send Ctrl+b.
The habit that keeps it running all day
Once the system is built, habit decides output. This is my rhythm:
- Morning: run
tmux ls, check which projects are alive - Noon: see if any task is stuck, restart a window if needed
- Night: write key outputs to
result.jsonor logs, harvest the results the next day
When that rhythm sticks, AI becomes a real background worker, not a chat box.
The pitfalls you will hit
- Server disconnects: usually SSH keep-alive isn't configured, or your network is restrictive.
- Too many windows: don't brute-force; start with 3-5 concurrent tasks.
- Messy prompts: without a template you keep rewriting;
prompt.mdsaves real energy.
Author
Categories
More Posts

tmux Complete Guide for Beginners: Sessions, Windows, Panes, Copy, Restore
From install to advanced usage: sessions/windows/panes, copy mode, sync input, config, and recovery. Covers macOS, Linux, and WSL with plenty of SVG diagrams.

杨振宁:发现宇宙的不对称之美
杨振宁:发现宇宙的不对称之美

复制的尽头
复制的尽头
Need a Custom Solution?
Still stuck or want someone to handle the heavy lifting? Send me a quick message. I reply to every inquiry within 24 hours—and yes, simple advice is always free.
Newsletter
Join the community
Subscribe to our newsletter for the latest news and updates