Blogs / Running 15 Claude Code Sessions Across Three Machines From My Phone
Running 15 Claude Code Sessions Across Three Machines From My Phone
November 29, 2026 • Matthew Duong • Software Engineering;Self Hosting • 8 min read
I work on four or five repos most days, each with a few Claude Code sessions, so up to 15 run at once. They’re spread across a Windows machine running WSL, a Linux machine and a Mac, mostly because the dev servers they start are spiky and can use up to 12 GB at peak. I’m also a new dad and away from a keyboard for much of the day, so I added a server and web app to my fork of claude-squad to answer sessions from my phone.
How I worked before
Each repo had its own cs window. After an interruption, which with a young daughter is often, I’d lose track of which window was which and cycle through them to find the session waiting on me. Moving to another room meant switching to my laptop, without the context and tooling from the other machine. Now every session is in one browser list, grouped by repo with the waiting ones at the top, and I pick up from any device without restarting anything.
Claude Code’s Remote Control
Claude Code’s Remote Control lets you follow a local session from claude.ai or the Claude app, with notifications. I turned it on per session, so any I forgot were invisible. After building the server I found the setting I’d missed: “Enable Remote Control for all sessions” in /config connects every interactive session. It still wouldn’t have given me what I needed: its docs describe finding each session by name, not one list across machines grouped by repo.

Forking claude-squad
claude-squad (cs) runs each agent in its own tmux session and git worktree. It looked abandoned when I started on 5 November: the last merge was on 20 August, one pull request has merged since, and 39 were open at the end of November. My fork has had more than 50 merged since.
Fixing the TUI’s lag and CPU use
The TUI lagged with a handful of sessions open, and I suspected bugs. Measuring showed the work itself was cheap: about 1.5 ms per tmux capture-pane, 2 to 10 ms per git status or git diff, and 1.5 ms per render. The lag came from the polling intervals and from pause, resume, kill and push blocking the UI goroutine. Moving those into the background and halving the status poll to 250 ms got new output into the preview about 26 ms after it was written.
CPU use was a separate problem. With four idle sessions, cs used about 14% of a core, and a profile put two thirds of that in View(). Bubble Tea redraws after every message, and cs sent more than 50 a second, most of which changed nothing. Caching rendered panes, merging each preview tick and capture into one message, and diffing once a second instead of every 250 ms gave, as a share of one core over 15 seconds:
cs | tmux and git commands it runs | tmux server | |
|---|---|---|---|
| Before, one session printing | 13.8% | 9.5% | 1.5% |
| After, one session printing | 5.4% | 6.8% | 1.6% |
| Before, nothing printing | 13.7% | 9.4% | 1.2% |
| After, nothing printing | 4.1% | 6.7% | 1.5% |
The same change fixed 175 zombie processes in a running cs: no tmux attach-session client or tmux new-session -d launcher it started had ever been reaped.
Running one cs per repo also exposed a state bug: every process loaded every session from one shared state.json, and the last window to save wiped the others’. Each process now loads only its own repo and saves with a read-modify-write.
The remote server
Each cs process is a node. It keeps a WebSocket open to cs-server on my homeserver cluster and sends a snapshot of its sessions when they change, at most every 250 ms. The hub holds every node’s state in memory, SQLite holds only device tokens and push settings, and nodes resend everything when they reconnect. There’s nothing to keep in sync, but:
- It runs as one replica. A restart drops live state until the nodes reconnect a few seconds later, and commands in flight fail.
- An offline machine’s sessions stay listed as last seen until it reconnects or I remove it.
- There’s no history beyond five minutes of CPU and memory in the browser.
Opening a session subscribes its node, which captures the pane every 250 ms (50 ms just after typing) and sends the whole screen with its colour codes when it changes. Full frames cost more than diffs, but a viewer never needs an earlier frame. Each viewer gets a one-slot buffer, so a slow phone skips frames rather than queueing them, and the browser renders the colour codes as text spans, never HTML.
Bubble Tea’s event loop stops while attached
Session state in cs is only safe to read in Bubble Tea’s Update. Attaching to a session hands the terminal to tmux and blocks until you detach, so Update doesn’t run while you’re attached, sometimes for hours.
The remote features first ran from Update, and they broke one at a time. A session opened in the web app while cs was attached showed no screen until I detached, because screen capture only had functions for sessions subscribed at the last Update. Typing from the web app was dropped after five seconds. Moving it to a background goroutine meant putting a mutex around the session’s PTY, which detaching replaces. Then the Send and Approve buttons hung for 60 seconds and timed out, and cs discarded the stale command.
The fix for all three: at the end of each Update, build functions for every live session that capture only the tmux session or worktree they need, never the session object, and swap them in under a mutex for background goroutines to call.
type paneHandles struct {
capturers map[string]func() (string, error) // screen
senders map[string]func(string) error // typing
prompters map[string]func(string) error // prompts and approvals
scrollbacks map[string]func() (string, error) // scrollback
differs map[string]func(path string) (string, error) // one file's diff
panePIDs map[string]func() (int, error) // CPU and memory
}
While I’m attached, the goroutines use the set from the last Update, which is fine because the sessions that were running still are.
Security
The web app can type into shells on three machines. For this single-user setup:
- Browsers sign in through authentik and the server checks for one owner. It trusts authentik’s username header, so a NetworkPolicy lets only the ingress controllers reach the pod.
- The agent port is outside authentik. Nodes use device tokens that are shown once, stored hashed, bound to the first machine that uses them and revocable.
- Requests that change something need an
X-CS-Requestheader, which another origin can’t send without a CORS preflight the server never approves (OWASP describes the same defence). - Web commands run through the TUI’s own key handlers, and new sessions can only start configured programs.
Using it from a phone
The server sends a Web Push notification when a session starts waiting for input, or finishes after running for at least 15 seconds.
Typing was the hardest part. Phone keyboards send key events as the legacy keyCode 229, so the screen reads from a hidden text field. My first version cleared the field after each change, which confused autocorrect into typing every word twice: one of my messages to Claude came through as “WhatWhat areare phasephrase zerozero questionsquestions ?”. The field now keeps its text and sends each change as backspaces plus the new letters. Safari on iPhone can only make a video full screen (WebKit bug 206854 has been open since 2020), so full screen there is an overlay.

Limitations and next steps
- Commands other than prompts and approvals, like pausing a session, still wait while
csis attached. - The race detector found existing races in attach and detach that I haven’t fixed.
cscan now update itself from the server, and a new machine can be set up from the web app, but both have only been tried on Linux.