Skip to content

Latest commit

 

History

History
164 lines (111 loc) · 6.56 KB

File metadata and controls

164 lines (111 loc) · 6.56 KB

any-coding

Remote-control your terminal AI coding session from your phone. Run any-coding in any project directory on your Mac/Linux machine — the session is mirrored to the Android app in real time. Keep coding on the subway, on the couch, wherever.

Ships with claude (Claude Code) and codex (OpenAI Codex) built in. More agents (Gemini CLI, Aider, goose…) land via a declarative manifest system so contributors can add a new agent with a JSON file instead of a code PR. This package is evolving from a single-agent wrapper into the unified host-side launcher for any pty-based AI coding agent.

Open-source client, free forever. Two networking modes: managed relay (30-day free trial) or fully self-hosted cloudflared direct mode.

🌍 Language: English · 中文  ·  🏠 Project README  ·  💬 Discord


Install

npm install -g any-coding

The postinstall script auto-fixes the exec bit on node-pty's spawn-helper (long-standing quirk — without it, claude won't spawn).

Usage

Claude Code (default)

any-coding            # same as: any-coding claude

What it does:

  1. Starts a Claude Code session in the current directory
  2. Spawns a background hub (on 127.0.0.1:7321)
  3. Mirrors the session to any paired Android app
  4. The current terminal becomes a local TTY viewer — Ghostty / iTerm shows the normal Claude TUI

On first run it prints a 6-digit pair code + QR code. Scan or type it into the Android app to pair.

Codex / multi-agent

any-coding codex                 # start a Codex session
any-coding                       # no subcommand → interactive picker (1 claude / 2 codex)
any-coding claude --resume       # args after the subcommand pass through to the agent
any-coding codex --model gpt-5   # Codex flags work the same way

Multi-tab: run any-coding in multiple project directories — each session shows up as its own tab on the phone, with an agent-specific icon (rust-red starburst for claude, green ring for codex).

Roadmap: more terminal agents (Gemini CLI, Aider, goose…) via the agent manifest system. The subcommand style stays any-coding <agent> and pairing / tabs / hub behaviour stay identical.

Hub

The hub is a detached background service that hosts all active sessions and talks to the public tunnel (relay or cloudflared). It's spawned automatically on first any-coding run and usually needs no attention.

any-coding hub              # run hub in foreground (debug)
any-coding restart-hub      # kill + respawn — ⚠️ drops all active sessions

Direct mode (no account, no closed-source server)

any-coding hub --public

Starts a cloudflared quick tunnel and exposes the local hub to the public internet. Scan the printed QR code (anycode://connect?url=...&token=...) and the phone talks to your machine directly — no traffic goes through AnyCoding-operated infrastructure.

any-coding hub --public --tunnel=none           # LAN only (no tunnel, type the internal IP)
any-coding hub --public --tunnel=cloudflared    # default: cloudflared quick tunnel

Cloudflared quick tunnels get a new URL every restart — you'll need to re-scan. For a stable URL, use a named tunnel with your own domain (--tunnel=cloudflared-named is planned).

Install cloudflared first:

brew install cloudflared    # macOS

Pairing

any-coding pair             # regenerate a pair code manually
any-coding logout           # delete ~/.any-coding/device.json and disconnect

First-run pairing triggers automatically — you have 90 seconds to scan. After success, ~/.any-coding/device.json stores device_id + device_token + relay URL.

Direct mode uses a separate 32-byte token at ~/.any-coding/direct.json that survives restarts; only the tunnel URL changes each launch.

Commands

Command What it does
any-coding Interactive agent picker, then start a session
any-coding claude [args...] Start Claude session; args passthrough
any-coding codex [args...] Start Codex session; args passthrough
any-coding hub Run hub in foreground
any-coding hub --public Hub + cloudflared tunnel (direct mode)
any-coding restart-hub Kill and respawn hub (drops all sessions)
any-coding pair Manual pairing
any-coding logout Unregister this device

Advanced

Environment variables

Variable Purpose
ANYCODE_RELAY Self-hosted relay URL (default: https://anycode.novastellar-ai.com)
PORT Local hub port (default 7321, loopback only)
WRAPPED_CMD Override the agent binary path (debug)

Config files

Path Contents
~/.any-coding/device.json Cloud-mode pairing (device_id / device_token / relay)
~/.any-coding/direct.json Direct-mode token + latest tunnel URL
~/.any-coding/hub.log Detached hub log

Self-hosted relay

ANYCODE_RELAY=https://your.relay.example.com any-coding

Build from source

git clone https://github.com/gurudin/anycoding
cd anycoding/any-code-cli
npm install
npm link

Requirements

  • Node.js ≥ 18
  • At least one agent CLI installed and on $PATH:
    • Claude: npm install -g @anthropic-ai/claude-code
    • Codex: npm install -g @openai/codex
  • Optional: cloudflared (only required for --public)
  • Android app: build from the main repo or grab an APK release

Troubleshooting

ENOENT claude / ENOENT codex — agent CLI isn't installed or isn't on $PATH. Check with which claude.

Edited wrapper.js locally but changes don't take effectnpm i -g only rewrites the files on disk; the detached hub keeps its old code in memory. Run any-coding restart-hub (⚠️ drops sessions).

macOS spawn-helper: Operation not permittedpostinstall should handle this. Manual fix:

chmod +x $(npm root -g)/any-coding/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper

Phone sees the session but spins forever on open — check ~/.any-coding/hub.log for relay connection errors. Usually the device_token got revoked from the app — run any-coding pair to re-pair.

License

Apache License 2.0 — see the repo-root LICENSE and NOTICE. Dependencies (node-pty, ws, qrcode-terminal) retain their original licenses (MIT / Apache-2.0); full attributions in NOTICE.