majorwiki/02-selfhosting/services/claude-code-remote-control.md
MajorLinux f9c61fbac3 wiki: publish 3 unpushed articles and catch nav up
Articles from prior sessions that were written locally but never shipped:
- 02-selfhosting/cloud/aws-s3-cost-management.md — lifecycle rules, storage class selection, bucket inventory, unexpected-growth investigation
- 02-selfhosting/dns-networking/wake-on-lan-router-ssh.md — WOL magic packets via Asus router SSH + ether-wake, Ansible vault integration
- 02-selfhosting/services/claude-code-remote-control.md — mobile access to a persistent host Claude Code session

Nav updated (index.md + SUMMARY.md):
- Added Cloud subsection under Self-Hosting for aws-s3
- Added wake-on-lan and aws-s3 entries to SUMMARY
- Added claude-code-remote-control to index's Services section
- Added ansible-ssh-host-alias-bypass nav entry (article shipped in 2dbeb22)
- Article count 87 → 89, self-hosting 30 → 32, troubleshooting 33 → 34
2026-04-21 09:17:31 -04:00

93 lines
4.3 KiB
Markdown

---
title: "Claude Code Remote Control — Mobile Access to a Persistent Host Session"
domain: selfhosting
category: services
tags: [claude-code, anthropic, remote-control, tmux, tailscale, mobile, workflow]
status: published
created: 2026-04-20
updated: 2026-04-20
---
# Claude Code Remote Control
Anthropic released **Remote Control** for Claude Code in February 2026. It bridges a locally-running Claude Code CLI process with Claude Mobile (iOS/Android) and `claude.ai/code` in any browser. The local session stays running on the host with full filesystem, environment, and MCP access; the phone or browser is just a thin front-end that attaches to it.
This article covers the setup pattern used at MajorsHouse — running Remote Control on an always-on host inside a `tmux` session over Tailscale SSH so the mobile connection survives client disconnects.
## How Remote Control Works
- All traffic flows through Anthropic's API over outbound HTTPS. No inbound ports on the host, no port forwarding, no reverse proxy.
- The mobile/web client **attaches to the existing session** — same transcript, same context, same MCP servers, same working directory.
- Terminal and mobile can be active at the same time; input is interchangeable and both views stay in sync.
- Only one remote client per session is supported.
- The session ends when the local `claude` process stops.
- Must be started with `claude remote-control` from the beginning — a plain `claude` session already in flight cannot be retrofitted.
- Requires Claude Pro or Max.
## Why MajorRig Hosts the Session
The vault is Obsidian-synced across MajorAir, MajorMac, and MajorRig. Native Linux servers like `majorlab` or `majorhome` would be architecturally cleaner (true always-on, no Windows Update reboots) but have no vault sync — adding them would require another Obsidian Sync device slot, or an SMB/NFS mount, or git-only access to the MajorWiki subset. Until that's solved, MajorRig is the de facto primary.
WSL2's `/mnt/c` I/O is slow for heavy workloads (node_modules, fsync-heavy DBs) but not a practical issue for markdown reads/writes and FTS5 search across the vault.
## Setup on MajorRig
### 1. Enable Remote Control by default
Inside any Claude Code session:
```
/config
```
Toggle **"Enable Remote Control for all sessions"**. This means future `claude` invocations automatically expose a Remote Control endpoint — no need to remember the subcommand.
### 2. Install the mobile app
Inside Claude Code:
```
/mobile
```
A QR code appears for iOS and Android download links.
### 3. Start a persistent session via Tailscale SSH + tmux
From any fleet machine:
```bash
ssh majorrig
tmux new -s claude
claude remote-control
```
Detach with `Ctrl+b d`. The `claude` process survives SSH disconnect because it's owned by the tmux server, not the SSH session.
To reattach from the host later:
```bash
ssh majorrig
tmux attach -t claude
```
### 4. Connect from the phone
Open Claude Mobile → select the session from the list, or scan the QR code the host prints on start. The app connects over outbound HTTPS through Anthropic; no Tailscale required on the phone.
## Alternatives
- **SSH + tmux directly from a mobile terminal app** (Blink Shell, Termius) — works without Pro/Max, survives client drops, full shell access. UX on a phone screen is rough; no native paste/share affordances.
- **`JessyTsui/Claude-Code-Remote`** (community) — routes Claude Code task output via email/Discord/Telegram. Not interactive; useful for notifications.
## Constraints and Gotchas
- **Process death kills the session.** If the `claude` process exits (crash, `tmux kill-session`, host reboot), the mobile connection drops and the transcript is lost. For true resilience, pair with a systemd user service that auto-restarts.
- **One remote per session.** Phone and laptop browser cannot both attach at the same time.
- **Windows Update reboots on WSL2.** MajorRig's uptime is gated by the Windows host. A scheduled-restart-free maintenance window is worth configuring if this pattern becomes primary.
- **Session must start with Remote Control.** Restart `claude` if you realize mid-session you want phone access (unless `/config` toggle is already set).
## See Also
- [Tailscale for Homelab Remote Access](../dns-networking/tailscale-homelab-remote-access.md)
- Anthropic docs: `https://code.claude.com/docs/en/remote-control`