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.