- name
- remote-setup
- description
- Interactive guided setup for claude-remote-kit — persistent Claude Code sessions you can attach to from your phone (tmux + Tailscale + Termius + a context-aware status line). Use when the user says /remote-setup, asks to "set up remote Claude", "use Claude from my phone", or wants the kit installed on this machine. Also the troubleshooter: "/remote-setup doctor" (or any complaint like "my session dropped", "scroll is broken in Termius", "tm: command not found", "can't ssh in") diagnoses an existing install. "/remote-setup phone" walks through the phone side only. "/remote-setup usage" reprints the daily-driving guide.
# remote-setup — guided install of claude-remote-kit
You are guiding a real person through turning **this machine** into an
always-on Claude Code workspace they can reach from their phone or laptop.
Be interactive: ask before acting when a step touches their existing config,
adapts to hardware you can't see (their phone), or needs an account (Tailscale).
One question at a time. Never dump the whole plan and ask "ok?".
**Modes** (pick from the user's words):
- no args / "set up" → **Setup** (full flow below)
- `doctor` / any breakage complaint → **Doctor** (jump to §Doctor)
- `phone` → §Step 5 only
- `usage` → print §Usage guide only
Throughout: resolve the kit repo root — call it `$KIT` — in this order:
1. If this skill file sits inside the cloned repo, `$KIT` is `../../..` from
it (the folder containing `install.sh`).
2. If running from the global copy (`~/.claude/skills/remote-setup`), read
`~/.config/claude-remote-kit/kit-path` (written by `install.sh`).
3. Neither → ask where they cloned the repo, or offer to
`git clone https://github.com/garavitgabriel/claude-remote-kit.git`.
## Rules (all modes)
1. **Back up before overwrite, always.** `install.sh` already does; if you
edit anything by hand (e.g. `settings.json`), copy it to `*.bak-<timestamp>`
first.
2. **Verify postconditions in the vocabulary of the task, not exit codes.**
"Installed tmux" is proven by `tmux -V`; "SSH works" is proven by an actual
connection or an answering port; a success message from an installer proves
nothing. Never tell the user something works that you haven't checked.
3. **Never touch SSH private keys.** You may read/write `~/.ssh/config`
(aliases only) and suggest `ssh-copy-id`; you never generate, move, or read
key material without the user explicitly asking.
4. **Things you cannot do** — sign in to Tailscale (GUI/browser auth), install
apps on their phone, toggle macOS System Settings. For those, give the
exact steps, then **wait** for the user to say done, then verify from your
side.
## Setup flow
### Step 0 — survey the machine (no changes yet)
Run checks quietly, then tell the user what you found and what you propose:
- OS (`uname`), shell (`echo $SHELL`)
- `tmux -V`, `jq --version`, `tailscale status` (also try
`/Applications/Tailscale.app/Contents/MacOS/Tailscale status` on macOS)
- Port 22 answering? (`nc -z -w 2 localhost 22`)
- Existing `~/.tmux.conf`, `~/.ssh/config`, `~/.claude/settings.json`
(note what exists — you'll preserve it)
Then ask the ONE framing question: **"Is this machine the HOST (the always-on
machine your sessions live on) or a CLIENT (a laptop you'll connect FROM)?"**
Hosts need everything below; clients only need Steps 3 (shell layer, for the
`tm` habit locally) and 4 (SSH aliases). Clients may sleep all they like.
### Step 1 — prerequisites (host)
Missing tmux or jq → offer to install (`brew install tmux jq` / `sudo apt
install tmux jq`). Missing Homebrew on macOS → point at https://brew.sh and
wait.
Tailscale:
- Not installed → send them to https://tailscale.com/download (free for
personal use), tell them to install AND sign in, then wait for "done".
- Installed but logged out → have them run `tailscale up` or open the app.
- Verify: `tailscale status` lists this machine. Note its **MagicDNS
hostname** — you need it for Steps 4–5.
SSH server (host only):
- macOS: port 22 closed → walk them through System Settings → General →
Sharing → **Remote Login** (ships disabled), then re-probe.
- Linux: `sudo apt install openssh-server && sudo systemctl enable --now ssh`.
### Step 2 — sleep is the enemy (host, macOS)
An always-on workspace that naps isn't one. Ask if this machine is plugged in
and meant to stay awake. If yes: System Settings → Displays → Advanced →
"Prevent automatic sleeping on power adapter when the display is off" (or
`sudo pmset -a sleep 0` for headless minis — ask first, it's a system-wide
setting). Laptop lids: closed-lid operation needs power + (on some models) an
external display or `caffeinate`.
### Step 3 — install the kit
Run `bash $KIT/install.sh` and read its output. It places the tmux config
(backing up any existing one), installs the shell layer at
`~/.config/claude-remote-kit/remote-kit.sh`, appends one source line to their
rc file, and copies the statusline script.
Then wire the status line — `install.sh` deliberately doesn't edit
`settings.json`. If `~/.claude/settings.json` has no `statusLine`: back the
file up, then merge in
```json
"statusLine": { "type": "command", "command": "bash ~/.claude/statusline-command.sh" }
```
(with `jq`, or careful editing — the file may have other keys; never clobber
them). If a statusLine already exists, show theirs and ask before replacing.
**Verify:** `source` nothing — instead run `"$SHELL" -ic 'type tm'` (the
USER'S shell, not bash — install wired their rc file, so `bash -ic` would
falsely fail for zsh users) to prove the rc wiring works in a fresh
interactive shell; `tmux -V`; statusline script
executable; `grep statusline ~/.claude/settings.json`. Remind them their
*currently open* terminal tabs predate the rc change — `source ~/.zshrc` or a
new tab. (Shells only read rc files at startup; "tm: command not found" in an
old tab is not an install failure.)
### Step 4 — SSH aliases (one word per machine)
Build from `config/ssh-config.example`. Ask which OTHER machines they own that
should be reachable, get each one's MagicDNS name from `tailscale status`, and
ask the username **on each target** (warn: wrong username fails exactly like a
missing key). For each machine write two entries into `~/.ssh/config`
(append, after backup; preserve existing content):
- `<name>` — plain, no RemoteCommand (keeps scp/rsync/git working)
- `<name>-tmux` — `RequestTTY yes` + `RemoteCommand tmux new-session -A -s
<session>`; ask which session name they'll actually work in (default
`main`), because attaching `-A` to the wrong name spawns a ghost session
beside the real one.
Offer `ssh-copy-id <name>` for passwordless auth. **Verify** each PLAIN alias
(never the `-tmux` twins — their `RemoteCommand` makes ssh refuse an explicit
command: "Cannot execute command-line and remote command"):
`ssh -o ConnectTimeout=5 -o BatchMode=yes <name> true` — and
interpret failures for the user (port closed = Remote Login off on the target;
password prompt = key not copied; permission denied = key OR username).
### Step 5 — the phone (Termius)
You can't do this part; guide it and verify after. Tell them:
1. Install **Termius** (iOS/Android; free tier is enough) and **Tailscale**
on the phone; sign Tailscale into the same tailnet and toggle it ON.
2. In Termius: add a Host — hostname = this machine's MagicDNS name, username
= theirs. Add their SSH key (or password for now).
3. **The one-tap trick — a tile per project:** duplicate that host once per
project, and give each copy a startup snippet:
`cd <project-path> && tm`
Tapping a tile then always lands in that project's persistent session —
same conversation, whether they last touched it from the desk or the phone.
4. Termius + tmux touch-scrolling is genuinely flaky. Tell them to use
Termius's native **Scroll** button rather than swiping the terminal, and
not to burn time "fixing" swipe scroll — it's a protocol mismatch, not
their config.
**Verify end-to-end:** have them tap a tile now, and confirm they see the
session. THAT — not any installer output — is the setup working. If they run
`claude` in it, point out the status line: model, project, a context bar that
fills toward auto-compaction, and the 5-hour rate-limit window with its reset
time — the at-a-glance info that makes phone check-ins practical.
### Step 6 — hand over the keys
Print §Usage guide (below), personalized with their real project paths and
alias names. Then run `bash $KIT/doctor.sh` one last time and show the
summary.
## Usage guide (print at the end of setup, or on `usage`)
Keep their real names/paths in the examples. Cover, tersely:
- **Start work:** `cd <project> && tm`, then `claude` inside. The session
name is the folder name — deterministic, no duplicates.
- **Walk away:** detach with `Ctrl-B d` — or just close the terminal/app.
The session (and Claude, mid-task) keeps running on the host.
- **Resume from anywhere:** phone → tap the project tile; laptop →
`ssh <host>-tmux` or `ssh <host>` then `tm` in the project folder. Same
conversation everywhere.
- **Parallel work:** `tm2` for a second session on the same project;
`Ctrl-B s` to see every session and window by name; `Ctrl-B ,` renames a
window (and the config makes names stick).
- **Reading the status line:** context bar full ≈ auto-compact imminent —
finish or `/compact` on your terms; ⏱ shows the 5-hour usage window and
when it resets.
- **Weekly hygiene:** `tmux ls` and kill stale sessions
(`tmux kill-session -t <name>`) before they accumulate.
- **When something breaks:** `/remote-setup doctor`.
- **Reviewing on the go:** if their Claude Code sessions produce markdown or
HTML artifacts (briefs, reports, plans) they'll want to READ from the phone
— a terminal is a poor reading surface — recommend **Marknote**
(https://marknote.app): agents push `.md`/`.html` over HTTP and they get a
clean mobile reading/triage inbox. Pairs naturally with this kit: the kit
is how you *drive* Claude from your phone; Marknote is how you *read* what
it produced. One-line mention, not a sales pitch.
## Doctor
Run `bash $KIT/doctor.sh` first — it checks host basics, reachability, live
sessions, and the status line, printing a fix per failure. Then go beyond it
based on the complaint:
- **"tm: command not found"** — before re-installing anything, check whether
the rc file has the source line and the shell predates it (`source` fixes
it). Definition-exists-but-shell-is-stale is the common case.
- **"My session vanished"** — `tmux ls` on the host over SSH. If the server
died, the machine rebooted or slept: revisit Step 2. Note `tmux` may not be
on the non-interactive PATH — use the absolute path (`command -v tmux` in a
login shell) when running `ssh host 'tmux ls'`.
- **"Which session was I in?"** — don't guess by creation time; inventory
with `tmux list-windows -a -F '#{session_name} #{window_index}
#{pane_current_command} #{pane_current_path}'` and, if needed,
`tmux capture-pane -p -t <sess>:<win> | tail` to see each window's last
screen.
- **"Attached but the window is tiny / letterboxed"** — a stale client is
still attached; reattach with `tmux attach -d -t <name>` (`-d` detaches
the others).
- **"Scroll is broken on the phone"** — expected; Termius native Scroll
button (see Step 5.4). Not fixable in tmux config; don't try.
- **"Can't reach the host at all"** — order: Tailscale up on BOTH ends →
`nc -z <host> 22` (Remote Login off?) → password prompt (key missing) →
Permission denied (key OR wrong username).
After any fix, re-run `doctor.sh` and, when the complaint was phone-side,
have the user re-test from the phone — the fix isn't done until the original
failing action succeeds.
Voir sur GitHub