Codex CLI Remote Control: Continue Work From Another Device

The Codex CLI runs as a terminal process on one machine. Here is how to reach it from another device, keep a session alive across a gap, and make sure progress is saved before you switch.

Updated 4 min read

Codex CLI remote control means reaching a running Codex CLI session from a second machine or device. The CLI is a terminal process, so remote access uses the same tools you would use for any shell session: SSH into the host machine, plus a terminal multiplexer like tmux to keep the session alive between connections. There is no separate "enable remote control" flag inside the CLI itself.

The bigger risk of a device switch is losing your place in the work, not losing the connection. A tool like fenbs keeps projects, tasks and Where we left off outside any one terminal session, so a new device picks up from the same point even when the original session has ended.

What remote control means for the CLI

Remote access means opening a terminal on a machine that is running, or can run, the Codex CLI. You connect to that machine and run the tool there; your phone or laptop provides the keyboard while the remote machine does the work.

True remote control, watching and directing a running session live from a second device, is a feature of the Codex app (the web and mobile interface), not of the terminal CLI. If you found a reference to a pairing code while searching for CLI remote control, that applies to the app interface. The two are separate products with different feature sets.

For the CLI, SSH plus a multiplexer gives you everything you need to continue work from another device. See the OpenAI Codex repository (opens in a new tab) for the latest notes on the CLI's own capabilities.

SSH into the machine running Codex CLI

SSH is the standard way to open a terminal on a remote machine. Once connected, you have a shell on that host and can run the Codex CLI just as you would locally.

  1. Confirm SSH is enabled on the remote machine and that you can reach it by address or hostname. On macOS: System Settings, Sharing, Remote Login.
  2. On your phone or tablet, install an SSH client app. iOS: Blink Shell or Termius. Android: similar options are in the Play Store.
  3. Connect: ssh user@your-machine-address. Use a key or password.
  4. Navigate to your project directory and run codex to start a session.

If the connection drops, the session ends. Use a terminal multiplexer to keep it alive.

Keep a session alive with tmux

A terminal multiplexer like tmux keeps a shell session running on the server even after you disconnect. You detach on one device and re-attach on another, picking up exactly where the session was.

  1. Install tmux on the remote machine if needed: brew install tmux on macOS, or your Linux package manager.
  2. Start a named session before you run Codex CLI: tmux new -s codex-work.
  3. Inside the session, navigate to your project and run codex.
  4. To leave without ending the session, press Ctrl+B then D.
  5. From your other device, SSH in and re-attach: tmux attach -t codex-work.

GNU Screen is an alternative with the same idea: screen -S codex-work to start, Ctrl+A D to detach, screen -r codex-work to re-attach. Either tool is reliable for longer Codex tasks that should survive a network gap.

Cloud development environments

A cloud IDE or remote development environment removes the need to maintain your own server. You open a browser or a supported app, and the terminal is already running in the cloud. Codex CLI works in any environment where Node.js is available and you can set your API key.

The same principle applies: the session lives on a remote machine. SSH-equivalent access is already built into the service. For codex cli on windows users, a cloud Linux environment can also sidestep local platform differences.

Save progress before you switch

The session state, what Codex CLI was last doing and what it found, lives in the terminal. A new session on a new machine starts from zero. Saving work to an outside record before you leave means the next session does not have to rediscover what the last one did.

Ask Codex CLI to save Where we left off to fenbs before you detach or close. The next session, on any device and in any model, reads the same project context: rules first, then current tasks, then the progress note. This is the same approach described in the guide to codex cli best practices.

How fenbs helps

Pick up from any device without losing the thread

fenbs keeps your project tasks, Decisions and rules, and Where we left off outside the terminal session. Ask Codex CLI to save progress before each session ends, then open a new device and read the same record. Create a free account, add your project, and connect Codex CLI from Integrations.

Create a free account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

How to do this with fenbs

  1. Create a free account and add your project. Give each active task a short plan and a current status note.
  2. Connect Codex CLI to fenbs over MCP from Integrations. Sign in with a browser; no token is pasted into a config file.
  3. At the start of each session, ask Codex CLI to read the project context: rules, Where we left off, and any in-progress tasks.
  4. Before you detach your tmux session or close the terminal, ask Codex CLI to save progress on each task it touched: what it completed, what it checked, and the next step.
  5. Open a new session on your other device, SSH in, re-attach the tmux session or start fresh, and ask it to read the same context. It continues from the saved point.

For parallel work across multiple branches, the codex cli worktree guide covers how to keep separate tasks isolated without losing track of any of them.

Questions people ask.

Can I control Codex CLI from my phone?

Yes, through an SSH client app such as Blink Shell or Termius. Connect to the machine running the CLI, and work from the phone's terminal. Pair SSH with a tmux session on the remote machine so the session survives a disconnection.

Does Codex CLI have a pairing code?

The pairing code is a feature of the Codex app, not the Codex CLI terminal tool. The two are separate products. To reach a CLI session from another device, use SSH to connect to the host machine.

How do I keep a Codex CLI session alive when I close my laptop?

Run the session inside tmux or GNU Screen on a remote machine. Detach before you close your laptop and re-attach later. The session keeps running on the server while you are away.

How do I pick up where Codex CLI left off on a new device?

Ask Codex CLI to save progress to fenbs before each session ends. On the new device, start a fresh session and ask it to read the project context from fenbs. It reads the same task plans, rules, and Where we left off that the previous session saved.

More in Agent harness (for developers)

All Agent harness (for developers) articles

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.