Run Codex CLI remotely with WebMux
WebMux runs Codex CLI in a persistent terminal on the server, so you can close your laptop and continue the same process from a phone or another computer's browser.
1. Install and sign in to Codex CLI
On the machine running WebMux, follow the official Codex CLI docs (external link) to install it, and sign in as the same user that runs the WebMux service. WebMux does not install or sign in to CLIs and does not manage model keys.
For the chat view, also install the third-party ACP connector codex-acp on the server:
npm install -g @agentclientprotocol/codex-acp 2. Use the preset launch configuration
- Interactive command
codex- Preset arguments
--dangerously-bypass-approvals-and-sandbox
In “New session → Pre-type”, pick this launch configuration, choose a directory or worktree and create the session. You can also start it from a terminal on the server, detach with Ctrl+] and continue on your phone:
webmux run -- codex --dangerously-bypass-approvals-and-sandbox Upgrades never rewrite an existing launch-configs.json; if this CLI is missing, add it in “Settings → Launch configurations → New” with the command above. Presets use the “load shell startup files” wrapper so the CLI sees the PATH from ~/.bashrc or ~/.zshrc. Existing installs (Chinese)
3. Terminal, hybrid sessions and alerts
- Terminal
- Persistent PTY terminal: a browser disconnect does not end the process, and you can reconnect and replay the buffer; a service restart ends the session.
- Hybrid session (chat ↔ terminal)
- Supported. The preset has hybrid mode enabled, so the same conversation switches between terminal and chat views; Codex CLI keeps the history itself. Requirements (Chinese)
- “Needs you” alerts
- 0.164.0+ works without setup (OSC 7501); older versions need notifications = true under [tui] in ~/.codex/config.toml. Alert setup (Chinese)
4. Known limits
- The chat side needs the third-party adapter codex-acp (requires Node): npm install -g @agentclientprotocol/codex-acp; WebMux never installs it.
- The preset --dangerously-bypass-approvals-and-sandbox auto-approves tool calls and turns off the Codex sandbox; remove it in settings if you want to approve each step.
- Verified with Codex CLI 0.165.0 and codex-acp 2.3.0; Codex refuses to open a session held by the Codex app, an IDE or an outside terminal.
WebMux exposes a shell to the network as your user, listening on 0.0.0.0:7681 by default. For local use, listen on 127.0.0.1; for remote access, bind to a trusted VPN such as Tailscale or WireGuard. Do not expose it to the internet unless you deliberately use a tunnel and accept that the token is the only barrier. It is not a process sandbox, and restarting the service ends every terminal session. Read the security model
Command checked upstream against official docs on 2026-10-31; page verified on 2026-11-03. All agents