![]()
Remote Terminal and Agent Workspace for Claude Code, Codex, Gemini, and Copilot
Remotely control local AI terminals, Agent Workspace conversations, desktop sharing, and dev server previews from your phone
English | 中文
🌐 Website · 📦 Releases · 📖 Docs
|
|
|
Android APK is available from GitHub Releases. iOS version is available on the App Store.
# npm
npm install -g linkshell-cli
# Homebrew (macOS)
brew install LiuTianjie/linkshell/linkshell
# or curl
curl -fsSL https://liutianjie.github.io/LinkShell/install.sh | sh
linkshell start --daemon --provider claude
The CLI starts a built-in Gateway + terminal bridge in the background, then prints a pairing code and QR code. Scan to connect. Disconnecting the app does not affect the background process. On macOS, the bridge prevents idle system sleep by default so locking the screen does not usually drop the session.
Terminal providers currently include claude, codex, gemini, copilot, and custom. The Agent Workspace auto-detects ACP-capable Claude Code and Codex installations when --agent-ui is enabled.
linkshell start --daemon --provider claude # Start in background (built-in Gateway + bridge)
linkshell start --daemon --provider claude --no-keep-awake # macOS: allow idle sleep
linkshell start --provider claude # Start in foreground
linkshell start --daemon --provider gemini # Bridge Gemini CLI
linkshell start --daemon --provider copilot # Bridge GitHub Copilot CLI
linkshell start --daemon --agent-ui # Enable Agent Workspace (auto-detects Claude/Codex)
linkshell status # Check running status
linkshell stop # Stop all background processes
tail -f ~/.linkshell/bridge.log # View logs
linkshell gateway --daemon # Start Gateway separately in background (for server deployment)
linkshell gateway status # Check Gateway status
linkshell gateway stop # Stop Gateway
linkshell setup # Interactive configuration
linkshell doctor # Environment check
linkshell upgrade # Upgrade to latest version
linkshell login # Log in (enables premium gateway)
linkshell logout # Log out
Your Computer Your Phone
┌──────────────────────┐ WebSocket ┌──────────┐
│ CLI + Built-in GW │ ◄───────────► │ App │
│ (PTY + Relay) │ │ (xterm) │
└──────────────────────┘ └──────────┘
By default, the CLI includes a built-in Gateway — one command does it all. You can also deploy the Gateway separately on a public server:
Your Computer Public Server Your Phone
┌──────────┐ WebSocket ┌──────────┐ WebSocket ┌──────────┐
│ CLI │ ────────────►│ Gateway │◄──────────── │ App │
│ (PTY) │ │ (Relay) │ │ (xterm) │
└──────────┘ └──────────┘ └──────────┘
linkshell start --daemon --provider claude
With your phone and computer on the same WiFi, the CLI auto-detects the LAN IP and generates a QR code.
linkshell start enables macOS keep-awake by default while the bridge is running. This uses caffeinate -i -w <bridge-pid> to prevent idle system sleep without keeping the display on or unlocking the screen.
linkshell start --daemon --provider claude
To favor battery life and allow idle sleep:
linkshell start --daemon --provider claude --no-keep-awake
# or
LINKSHELL_KEEP_AWAKE=0 linkshell start --daemon --provider claude
linkshell start --daemon --provider claude --screen
With --screen, the app can switch to the Desktop tab to view your computer screen. Supports WebRTC (30fps) and screenshot streaming (fallback), automatically selecting the best option.
Prerequisite: ffmpeg must be installed.
```bash
macOS
brew install ffmpeg
Ubuntu / Debian
sudo apt install ffmpeg
Windows (Chocolatey)
choco install ffmpeg ```
Once installed, the CLI auto-detects screen devices and starts H.264 encoding. If werift is also installed (
npm i -g werift), WebRTC low-latency transport is preferred; otherwise it falls back to screenshot streaming.
LinkShell exposes an Agent tab alongside Terminal, Desktop, and Browser. It auto-detects installed agent providers (Claude Code, Codex CLI), starts available providers, and reports provider capabilities to the app.
# Auto-detects Claude Code and/or Codex CLI — both available to the mobile app
linkshell start --daemon --agent-ui
# Explicit provider override (if needed)
linkshell start --daemon --agent-ui --agent-provider codex
The current Agent Workspace v2 supports provider selection, dynamic model lists from CLI capabilities, reasoning effort and permission mode controls, image/text input blocks, structured input prompts, permission approval, plan/timeline events, command/file-change cards, subagent activity, reconnect snapshots, and local conversation history. Claude Code is supported through the Claude Agent SDK when available, with stream-json fallback; Codex uses codex app-server --listen stdio://.
If no local agent provider is available, the app shows an unavailable Agent state and the terminal session continues normally.
After starting a dev server in the remote terminal, you can preview pages directly on your phone:
npm run dev (listening on port 3000)Supports: - Full loading of static assets, CSS, JS, images, etc. - HMR / WebSocket hot reload (Vite, Next.js, etc.) - PC / mobile view switching - Fullscreen preview mode
Requires
linkshell-cli >= 0.2.53,@linkshell/gateway >= 0.2.17
On the server:
npm install -g linkshell-cli
linkshell gateway --daemon --port 8787
On your computer:
linkshell start --daemon --gateway wss://your-server.com:8787/ws --provider claude
You can also deploy the Gateway with Docker:
# From Docker Hub (recommended)
docker pull nickname4th/linkshell-gateway:latest
docker run -d -p 8787:8787 --name linkshell-gateway nickname4th/linkshell-gateway:latest
# Apple Silicon / arm64 hosts: current Docker Hub images are linux/amd64.
docker pull --platform linux/amd64 nickname4th/linkshell-gateway:latest
# Or build from source
git clone https://github.com/LiuTianjie/LinkShell
cd LinkShell
docker compose up -d
See docs/deploy.md for detailed deployment instructions.
linkshell status # Check Bridge and Gateway status
linkshell stop # Stop all background processes
In the app: - Scan the QR code printed by the CLI (recommended) - Or manually enter the Gateway address + 6-digit pairing code - Or select from the session list
Reconnecting after disconnection does not affect background processes — just scan or enter the pairing code to resume.
pnpm install
pnpm dev:gateway # Start gateway (localhost:8787)
pnpm dev:web # Web debug client (localhost:5173)
pnpm dev:app # Expo App
# CLI local development
pnpm --filter linkshell-cli dev start --provider custom --command bash
├── packages/
│ ├── shared-protocol/ # Shared protocol (Zod schema, message types, version negotiation)
│ ├── cli/ # CLI (PTY, providers, Agent Workspace, built-in Gateway, daemon)
│ └── gateway/ # Cloud gateway (pairing, sessions, routing, control, auth, rate limiting)
│ └── Dockerfile
├── apps/
│ ├── mobile/ # Expo App (xterm.js WebView, Agent Workspace, desktop/browser tabs)
│ ├── web-dashboard/ # Web dashboard (Vite + React + Tailwind, login, subscription, devices)
│ └── web-debug/ # Web debug client (Vite + xterm.js + debug panel)
├── docs/
│ ├── site/ # Landing page + install script
│ ├── brew/ # Homebrew formula
│ ├── ai-handoff.md # Handoff guide
│ ├── deploy.md # Gateway deployment docs
│ └── user-guide.md # End-user documentation
├── docker-compose.yml
├── .env.example
└── PRD.md
| Method | Path | Description |
|---|---|---|
GET |
/healthz |
Health check |
POST |
/pairings |
Create pairing (6-digit code, valid for 10 minutes) |
POST |
/pairings/claim |
Exchange code for sessionId |
GET |
/pairings/:code/status |
Query pairing status |
GET |
/sessions |
List active sessions |
GET |
/sessions/:id |
Session details |
WS |
/ws?sessionId=&role= |
Real-time connection |
GET/POST |
/tunnel/:sessionId/:port/** |
HTTP port forwarding |
WS |
/tunnel/:sessionId/:port/** |
WebSocket port forwarding (HMR) |
If LinkShell has been helpful to you, consider buying the author a coffee:

MIT
$ claude mcp add LinkShell \
-- python -m otcore.mcp_server <graph>