Run OpenCode remotely with WebMux
WebMux runs OpenCode 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 OpenCode
On the machine running WebMux, follow the official OpenCode 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.
2. Use the preset launch configuration
- Interactive command
opencode- Preset arguments
--auto
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 -- opencode --auto 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; OpenCode keeps the history itself. Requirements (Chinese)
- “Needs you” alerts
- According to its source, OpenCode 2.x reports OSC 7501 directly; no setup needed. Alert setup (Chinese)
4. Known limits
- The preset --auto auto-approves tool calls; in hybrid sessions the TUI runs with --standalone and cannot see live events from other clients of a background server.
- Verified with OpenCode 2.1.4 (2.2.0 has the same arguments).
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