{"id":51129998,"url":"https://github.com/iceraj/claude-code-remote-control-restart","last_synced_at":"2026-06-25T11:30:25.868Z","repository":{"id":348608176,"uuid":"1198888680","full_name":"iceraj/claude-code-remote-control-restart","owner":"iceraj","description":"Keep a Claude Code remote control (/rc) session alive automatically. And restart if needed.","archived":false,"fork":false,"pushed_at":"2026-04-21T21:07:37.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-21T23:16:52.302Z","etag":null,"topics":["claude-code","python","tmux","utility"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iceraj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-01T21:23:42.000Z","updated_at":"2026-04-21T21:07:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/iceraj/claude-code-remote-control-restart","commit_stats":null,"previous_names":["iceraj/cloude-code-remote-control-restart","iceraj/claude-code-remote-control-restart"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iceraj/claude-code-remote-control-restart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iceraj%2Fclaude-code-remote-control-restart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iceraj%2Fclaude-code-remote-control-restart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iceraj%2Fclaude-code-remote-control-restart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iceraj%2Fclaude-code-remote-control-restart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iceraj","download_url":"https://codeload.github.com/iceraj/claude-code-remote-control-restart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iceraj%2Fclaude-code-remote-control-restart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34773841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-code","python","tmux","utility"],"created_at":"2026-06-25T11:30:23.182Z","updated_at":"2026-06-25T11:30:25.860Z","avatar_url":"https://github.com/iceraj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# claude-code-rc-monitor\n\nKeep a [Claude Code](https://docs.anthropic.com/en/docs/claude-code) remote control (`/rc`) session alive automatically.\n\nClaude Code's [Remote Control](https://code.claude.com/docs/en/remote-control) feature lets you access a local CLI session from `claude.ai/code` or a mobile device. However, RC sessions frequently disconnect — sometimes every few minutes — with no reliable way to reconnect. This is a [known server-side issue](#why-this-exists) affecting all platforms. This utility works around it by monitoring a Claude Code session inside tmux and automatically reconnecting `/rc` with the same session name.\n\n## Requirements\n\n- **Python 3** (standard library only — no pip installs)\n- **tmux** (the Claude Code session must be running inside a tmux pane)\n- **Claude Code CLI** (`claude` binary on PATH)\n- **macOS or Linux**\n\n## Installation\n\n### One-liner (curl)\n\nDownload and run directly — no clone needed:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/iceraj/cloude-code-remote-control-restart/main/claude-code-rc-monitor -o claude-code-rc-monitor \u0026\u0026 chmod +x claude-code-rc-monitor\n```\n\nOr install to your PATH in one step:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/iceraj/cloude-code-remote-control-restart/main/claude-code-rc-monitor -o ~/.local/bin/claude-code-rc-monitor \u0026\u0026 chmod +x ~/.local/bin/claude-code-rc-monitor\n```\n\n### Clone the repo\n\n```bash\ngit clone https://github.com/iceraj/cloude-code-remote-control-restart.git\ncd cloude-code-remote-control-restart\n\n# Make it executable (already set, but just in case)\nchmod +x claude-code-rc-monitor\n\n# Optionally symlink to a directory on your PATH\nln -s \"$(pwd)/claude-code-rc-monitor\" ~/.local/bin/claude-code-rc-monitor\n```\n\n## Usage\n\n### Quick start\n\n1. Start a tmux session and launch Claude Code in one pane:\n   ```bash\n   tmux new-session -s myproject\n   claude --permission-mode acceptEdits\n   ```\n\n2. Open a second pane in the same tmux session and run the monitor:\n   ```bash\n   # Ctrl+B % (split pane), then:\n   ./claude-code-rc-monitor my-session-name\n   ```\n\n3. The monitor will:\n   - Find the Claude Code instance in the tmux session\n   - Disconnect any existing `/rc` session\n   - Start `/rc my-session-name`\n   - Sleep for 1 hour, then repeat\n\n### Refreshing on demand\n\nWhile the monitor is running:\n\n| Trigger | How |\n|---------|-----|\n| **Enter** | Press Enter in the monitor's terminal |\n| **SIGUSR1** | `kill -USR1 \u003cmonitor-pid\u003e` |\n| **SIGHUP** | `kill -HUP \u003cmonitor-pid\u003e` |\n| **Timeout** | Automatic after 1 hour |\n\nAny trigger disconnects the current `/rc` session and reconnects with the same name.\n\n### Stopping\n\nPress `Ctrl+C` in the monitor's terminal.\n\n## How it works\n\n```\n┌─────────────────────────────────────────────┐\n│ tmux session                                │\n│                                             │\n│  ┌─────────────────┐  ┌──────────────────┐  │\n│  │ Pane 0          │  │ Pane 1           │  │\n│  │ claude           │  │ rc-monitor       │  │\n│  │ (interactive)   │◄─│ (sends /rc via   │  │\n│  │                 │  │  tmux send-keys) │  │\n│  └─────────────────┘  └──────────────────┘  │\n└─────────────────────────────────────────────┘\n```\n\n1. **Detect** — Enumerates all panes in the current tmux session and matches shell child processes against `claude` using `ps`.\n2. **Validate** — Exits with an error if zero or more than one Claude instance is found.\n3. **Wait for idle** — Reads the pane via `tmux capture-pane` and polls until Claude is not actively thinking (checks for absence of \"esc to interrupt\" in the status bar). Times out after 5 minutes.\n4. **Disconnect** — Sends `/remote-control` to the Claude pane and reads the pane output via `tmux capture-pane` to determine state:\n   - **RC was active** → Menu appears with \"Disconnect this session\" — navigates Up+Up+Enter to disconnect, then verifies \"Remote Control disconnected\" in pane output.\n   - **RC was not active** → `/remote-control` auto-starts a session (\"Remote Control connecting\") — detects this, disconnects the auto-started session, then proceeds.\n   - Logs warnings if expected output is not found.\n5. **Connect** — Sends `/rc \u003csession-name\u003e` to start a fresh remote control session, then reads the pane to verify \"Remote Control connecting\" or \"Remote Control active\".\n6. **Wait** — Sleeps up to 1 hour, waking on Enter, SIGUSR1, or SIGHUP.\n7. **Loop** — Returns to step 1.\n\n## Constraints\n\n- **One Claude per tmux session** — The monitor expects exactly one `claude` process in the tmux session. If you have multiple, it exits with an error listing them.\n- **tmux required** — The monitor uses `tmux send-keys` to interact with Claude's TUI. It cannot operate outside tmux.\n- **No code execution** — The monitor only sends slash commands (`/remote-control`, `/rc`). It never executes code or modifies files in your project.\n\n## Examples\n\n### Dedicated remote control session\n\n```bash\n# Terminal 1: Start Claude in tmux\ntmux new-session -s rc-server -d\ntmux send-keys -t rc-server 'claude --permission-mode acceptEdits' Enter\n\n# Terminal 2: Monitor from another pane\ntmux split-window -t rc-server\ntmux send-keys -t rc-server './claude-code-rc-monitor my-project' Enter\n```\n\n### Refresh from a cron job or script\n\n```bash\n# Find the monitor PID and signal it\npkill -USR1 -f 'claude-code-rc-monitor'\n```\n\n## Why this exists\n\nClaude Code's Remote Control feature has a known reliability problem: sessions disconnect frequently and unpredictably, with no built-in auto-reconnect. This has been confirmed across macOS, Linux, and Windows/WSL2 — users have ruled out client-side causes (TCP keepalive tuning, DNS, VPN, different ISPs) and the consensus is that this is a server-side issue requiring a fix from Anthropic.\n\nMaking matters worse, after a disconnect the session often vanishes from the session list entirely, so there is no way to reconnect — only a full restart of `/rc` works. This tool automates that restart.\n\n### Related issues\n\n- [anthropics/claude-code#33041](https://github.com/anthropics/claude-code/issues/33041) — **\"Remote Control disconnects frequently\"** — Detailed bug report with 16+ upvotes. Confirmed across all platforms. Users tried TCP keepalive, DNS changes, VPNs — none helped.\n- [anthropics/claude-code#28402](https://github.com/anthropics/claude-code/issues/28402) — **\"Remote Control session not visible in session list, cannot reconnect\"** — 22+ upvotes. After disconnect, sessions vanish from the list with no way to reconnect.\n- [anthropics/claude-code#32819](https://github.com/anthropics/claude-code/issues/32819) — **\"Remote Control keeps disconnecting unexpectedly\"** — Same pattern on Linux: connection drops intermittently, reconnects briefly, then drops again.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficeraj%2Fclaude-code-remote-control-restart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficeraj%2Fclaude-code-remote-control-restart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficeraj%2Fclaude-code-remote-control-restart/lists"}