``` 随时随地的 Claude 代码 ```
Claude Code On-the-Go

原始链接: https://granda.org/en/2026/01/02/claude-code-on-the-go/

这种设置能够实现完全远程、异步的软件开发,直接通过智能手机进行。作者在0.29美元/小时的Vultr虚拟机上运行六个并行的Claude Code代理,通过Tailscale VPN安全访问,并使用Termius/mosh移动终端。 工作流程的关键在于一个定制的“poke”通知系统。当Claude需要用户输入时,脚本会触发推送通知到手机,允许开发者无需持续监控终端即可响应。会话持久性通过tmux实现,确保工作在网络中断和手机睡眠时得以保留。 该系统优先考虑安全性:虚拟机被隔离,仅通过Tailscale访问,并受到防火墙保护。成本通过按需付费进行控制。Git工作树促进了并行功能开发,每个功能都有自己的Claude代理和专用的tmux窗口。 这使得“碎片化”开发成为可能——在通勤、放松或等待时进行编码,从而最大限度地提高生产力,而无需专门的办公时间。整个设置最初是由一个Claude Code会话构建的。

相关文章

原文

I run six Claude Code agents in parallel from my phone. No laptop, no desktop—just Termius on iOS and a cloud VM.

The Setup

flowchart LR
    A[Phone] -->|Termius + mosh| B[Tailscale VPN]
    B --> C[Vultr VM]
    C --> D[Claude Code]
    D -->|PreToolUse hook| E[Poke webhook]
    E -->|Push notification| A

The loop is: kick off a task, pocket the phone, get notified when Claude needs input. Async development from anywhere.

Infrastructure

A Vultr VM in Silicon Valley:

SpecValue
Instancevhf-8c-32gb
Cost$0.29/hr (~$7/day when running)
AccessTailscale-only (no public SSH)

I pay only when working. Two scripts handle lifecycle:

vm-start   # Start VM, wait for Tailscale, connect via mosh
vm-stop    # Halt VM

I also have an iOS Shortcut that calls the Vultr API directly—start the VM from my phone before I even open Termius.

The VM’s public IP has no SSH listener. All access goes through Tailscale’s private network. Defense in depth: cloud firewall blocks everything except Tailscale coordination, local nftables as backup, fail2ban for good measure.

Mobile Terminal

Termius handles SSH and mosh on iOS/Android. Mosh is the key—it survives network transitions. Switch from WiFi to cellular, walk through a dead zone, put the phone to sleep. The connection persists.

One gotcha: mosh doesn’t forward SSH agent. For git operations that need GitHub auth, I use regular SSH inside tmux.

Session Persistence

The shell auto-attaches to tmux on login. Close Termius, reopen hours later, everything’s still there.

# In .zshrc
if [[ -z "$TMUX" ]]; then
    tmux attach -t main 2>/dev/null || tmux new -s main
fi

Multiple Claude agents run in parallel windows. C-a c for new window, C-a n to cycle. Works well on a phone keyboard.

Push Notifications

This is what makes mobile development practical. Without notifications, you’d constantly check the terminal. With them, you can walk away.

The hook in ~/.claude/settings.json:

{
  "hooks": {
    "PreToolUse": [{
      "matcher": "AskUserQuestion",
      "hooks": [{
        "type": "command",
        "command": "~/.claude/hooks/poke-notify.sh question"
      }]
    }]
  }
}

When Claude calls AskUserQuestion, the hook fires. A simple script extracts the question and POSTs to Poke’s webhook:

QUESTION=$(echo "$EVENT_DATA" | jq -r '.tool_input.questions[0].question')
MESSAGE="$PROJECT_NAME: Claude needs input - $QUESTION"
curl -X POST "$API_URL" -d "{\"message\": \"$MESSAGE\"}"

Phone buzzes. Notification shows the question. Tap, respond, continue.

Trust Model

I run Claude Code in permissive mode. The VM is isolated—no access to production systems, no secrets beyond what’s needed for development. Worst case: Claude does something unexpected on a disposable VM.

Cost control adds another layer. The VM costs $0.29/hr. Even if something runs away, the daily cap is bounded.

Parallel Development

Git worktrees let me run multiple features simultaneously:

~/Code/myproject/              # main
~/Code/myproject-sidebar/      # feature branch
~/Code/myproject-dark-mode/    # another feature

Each worktree gets its own tmux window with a Claude agent. Port allocation is hash-based—deterministic from branch name, no conflicts:

hash_val = sum(ord(c) for c in branch_name)
django_port = 8001 + (hash_val % 99)

Six agents, six features, one phone.

What This Enables

Review PRs while waiting for coffee. Kick off a refactor on the train. Fix a bug from the couch while watching TV.

The pattern: start a task that will take Claude 10-20 minutes, do something else, get notified, respond, repeat. Development fits into the gaps of the day instead of requiring dedicated desk time.

The Components

ToolPurpose
VultrCloud VM ($0.29/hr, pay-per-use)
TailscalePrivate network, secure access
TermiusiOS/Android SSH client
moshNetwork-resilient shell
tmuxSession persistence
PokePush notifications via webhook
Claude CodeThe actual work

The setup took one Claude Code session to build—gave it my Vultr API key and access to gh, asked for a secure dev VM. Now I code from my phone.

联系我们 contact @ memedata.com