Control Claude Code & Codex from your phone. From anywhere.
Send prompts, watch real-time progress, and get notified when tasks finish β from your phone browser or through AI assistants like OpenClaw.
You kick off a Claude Code or Codex task, step away from your desk, and wonder: "Is it done? Did it hit a permission prompt? Is it waiting for me?"
Anywhere Code gives you a full terminal for Claude Code or Codex on your phone. One command to start, open a URL, and you're in.
- Full terminal on your phone β real xterm.js, not a dumbed-down view
- Claude Code + Codex β switch between agents with a single tap
- Instant notifications β browser push when tasks finish or need attention
- One command setup β
npx anywhere-codeand you're running - Zero config β auto-generates auth token, auto-detects network IP
- Project switcher β jump between projects, remembers recent paths
- Claude Code Hooks β native integration for reliable task completion detection
- Control API β HTTP REST API + CLI for scripting and AI assistant integrations (OpenClaw, etc.)
- Secure β token-based auth, designed for use with Tailscale / ngrok / Cloudflare Tunnel
- Lightweight β single npm package, ~160 KB
npx anywhere-codeThat's it. First run auto-creates config + token. You'll see:
Anywhere Code is running
Local: http://localhost:8787
Network: http://192.168.x.x:8787
Open the URL on your phone to get started.
Open the Network URL on your phone, enter the token, and start coding remotely.
Prefer global install?
npm i -g anywhere-code && anywhere-code
anywhere-code setup-hooks --globalThis configures Claude Code's native Hooks so you get notified when any Claude Code instance finishes β even ones running in other terminals.
Phone Browser Your Machine
βββββββββββββββ WebSocket ββββββββββββββββββββ
β Web UI βββββββββββββββββΊβ Anywhere Code β
β (xterm.js) β wss://... β Server (Node.js)β
βββββββββββββββ β β
β ββββββββββββββ β
β βClaude Code /β β
β β Codex (PTY)β β
β ββββββββββββββ β
ββββββββββββββββββββ
- Server spawns Claude Code or Codex in a pseudo-terminal (PTY)
- WebSocket streams terminal I/O to the browser in real-time
- You type on your phone, it goes straight to the agent
- Hooks (Claude Code) / idle detection trigger notifications when tasks complete
Never expose the port directly to the public internet.
Tailscale (simplest β zero config VPN)
# Install Tailscale on computer + phone, use the Tailscale IP
http://100.x.x.x:8787ngrok / Cloudflare Tunnel (public URL with HTTPS)
ngrok http 8787
# Open the generated https://xxxx.ngrok.io URL on your phoneToken auth keeps it secure. Use HTTPS in production.
Config: ~/.anywhere-code/config.json (auto-generated on first run)
| Field | Description | Default |
|---|---|---|
port |
Listen port | 8787 |
token |
Auth token (auto-generated) | β |
agent |
Default agent ("claude" or "codex") |
"claude" |
cwd |
Default working directory | Current directory |
projects |
Pinned projects [{name, path}] |
[] |
claudeArgs |
Extra args for claude CLI |
[] |
codexArgs |
Extra args for codex CLI |
[] |
idleTimeoutMs |
Idle timeout before marking done (ms) | Disabled |
webhookUrls |
POST these URLs on task completion | [] |
anywhere-code # Start server (default)
anywhere-code serve -p 9090 # Custom port
anywhere-code init --force # Reset token
anywhere-code setup-hooks --global # Configure Claude Code hooks
anywhere-code setup-openclaw # Generate OpenClaw skill (auto-fills token)
anywhere-code print-token # Print current token
# Control API (interact with a running server)
anywhere-code api sessions # List active sessions
anywhere-code api start --cwd ~/proj # Create headless session
anywhere-code api send <id> "prompt" # Send input to session
anywhere-code api output <id> # Read terminal output
anywhere-code api status <id> # Get session details
anywhere-code api interrupt <id> # Send Ctrl+C
anywhere-code api kill <id> # Kill sessionControl coding sessions through your favorite messaging app using OpenClaw:
You (WhatsApp/Telegram) β OpenClaw β Anywhere Code API β Claude Code / Codex
β
Your phone (web UI) β real-time terminal view
Quick setup:
anywhere-code setup-openclaw # Auto-generates skill with your token pre-filledSee docs/openclaw-integration.md for full details.
git clone https://github.com/EgonexAI/anywhere-code.git
cd anywhere-code
npm run go # Install + build + start (one shot)
# Or for dev mode with hot reload:
npm run dev # Server (tsx watch, port 8787)
npm run dev:web # Web UI (vite, port 5173, proxied to server)Project Structure
βββ server/ # Node.js server (TypeScript)
β βββ src/
β β βββ cli.ts # CLI entry point
β β βββ server.ts # HTTP + WebSocket + PTY
β β βββ config.ts # Config loading & validation
β β βββ hooks.ts # Claude Code hooks generator
β βββ public/ # Built web UI (generated)
β βββ package.json
βββ web/ # React frontend (Vite + Tailwind)
β βββ src/
β β βββ App.tsx # App shell & auth
β β βββ components/
β β βββ Login.tsx
β β βββ Projects.tsx
β β βββ Session.tsx
β β βββ Terminal.tsx
β βββ package.json
βββ README.md
- The token grants remote terminal execution β treat it like a password
- Always use encrypted transports (Tailscale / HTTPS tunnels)
- Rotate token anytime:
anywhere-code init --force - Token is passed via WebSocket URL query param β be aware of proxy/access logs
| Problem | Fix |
|---|---|
claude / codex not found |
Make sure the CLI for your chosen agent is installed and in your $PATH |
macOS posix_spawnp failed |
Reinstall: cd server && npm i (fixes node-pty permissions) |
| Phone can't connect | Check firewall; use Tailscale or ngrok for remote access |
| Blank web UI | Run cd web && npm run build to generate static assets |
Contributions are welcome! Feel free to open issues and pull requests.