Skip to content

πŸ“± Control Claude Code remotely from your phone β€” send prompts, watch progress, and get notified from anywhere.

License

Notifications You must be signed in to change notification settings

EgonexAI/anywhere-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Anywhere Code

Control Claude Code & Codex from your phone. From anywhere.

npm version node

Send prompts, watch real-time progress, and get notified when tasks finish β€” from your phone browser or through AI assistants like OpenClaw.

Anywhere Code

Why?

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.

Features

  • 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-code and 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

Quick Start

npx anywhere-code

That'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

Set up Hooks (recommended)

anywhere-code setup-hooks --global

This configures Claude Code's native Hooks so you get notified when any Claude Code instance finishes β€” even ones running in other terminals.

How It Works

Phone Browser                    Your Machine
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    WebSocket    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Web UI      │◄──────────────►│  Anywhere Code   β”‚
β”‚  (xterm.js)  β”‚    wss://...   β”‚  Server (Node.js)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β”‚                  β”‚
                                β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                                β”‚  β”‚Claude Code /β”‚  β”‚
                                β”‚  β”‚  Codex (PTY)β”‚  β”‚
                                β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. Server spawns Claude Code or Codex in a pseudo-terminal (PTY)
  2. WebSocket streams terminal I/O to the browser in real-time
  3. You type on your phone, it goes straight to the agent
  4. Hooks (Claude Code) / idle detection trigger notifications when tasks complete

Remote Access

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:8787

ngrok / Cloudflare Tunnel (public URL with HTTPS)

ngrok http 8787
# Open the generated https://xxxx.ngrok.io URL on your phone

Token auth keeps it secure. Use HTTPS in production.

Configuration

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 []

CLI

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 session

AI Assistant Integration (OpenClaw)

Control 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-filled

See docs/openclaw-integration.md for full details.

Development

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

Security

  • 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

Troubleshooting

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

Contributing

Contributions are welcome! Feel free to open issues and pull requests.

License

MIT

About

πŸ“± Control Claude Code remotely from your phone β€” send prompts, watch progress, and get notified from anywhere.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published