Blog
rex clirex command terminalrex terminal for coding agents

What is the rex CLI and how do you use it?

The rex CLI is the command inside Rex terminals that lets you and coding agents run commands, capture output and script sessions. Here's how to use it.

Portrait of Luis Chavez-Mattos
Edited by Luis Chavez-Mattos, Director, Product··RSS

For Engineering, IT and Operations

A young woman in her late twenties holds a fanned stack of blank printed reference pages above her head with both arms and looks up at them.

What is the rex CLI?

The rex CLI is the rex command that comes with Rex, a terminal app from Superlogical, the company founded by Mitchell Hashimoto (the developer behind Ghostty, Vagrant and Terraform). You type it inside a Rex terminal to control that terminal from the command line: list sessions, open panes, send input, capture output and run commands. Coding agents like Claude Code can use the same commands, so an agent and a person can drive the same terminal.

TL;DR

  • The rex command belongs to the Rex terminal, not to a standalone tool you install separately, and it controls Rex's sessions and panes.
  • Commands named in coverage of Rex include rex ls, rex split, rex send, rex capture and rex run --wait, with JSON output on most commands for scripting.
  • A one-time rex skill setup installs integration hooks for supported coding agents (Claude Code, Codex, OpenCode and Pi).
  • Rex is not Rex the Perl tool, and it is not the rex-cli repository on GitHub. All three share a name, which is why search results are a mess.
  • Right now, Rex is an invite-only beta for macOS, so most readers will read about it before they use it.
  • The official docs have a CLI Commands reference. Use it for exact arguments, because this article covers what the commands are for, not every flag.

Which "Rex" are you looking for?

Searching "rex cli" returns at least three unrelated things. Sorting them out first saves you time.

NameWhat it isWhere it lives
Rex (Superlogical)A terminal and multiplexer for coding agents, with a built-in rex commandsuperlogical.com/rex
Rex (Perl, "Rexify")A long-running infrastructure automation framework written in Perl, used to run tasks across many serversrexify.org
homeboy445/rex-cliA separate open-source command line project on GitHubgithub.com/homeboy445/rex-cli

If you want to deploy configuration to a fleet of servers with a Rexfile, you want the Perl tool. If you found a small utility on GitHub, check that repository's README, because it has nothing to do with the terminal app. If you came here because you use AI coding agents, or want to, you are in the right place.

What is Rex, the terminal behind the command?

Rex combines two things that people usually run separately. One is a terminal emulator, the window where you type commands. The other is a multiplexer, the kind of job tmux usually handles: keeping several shells and panes organized in one place.

The key design choice is a background server. The server owns your shells and processes. The Rex app is just a window onto them. If you close or quit the app, what you were running keeps going, and reopening it puts you back where you left off.

Rex is built on Libghostty, the same MIT-licensed terminal library behind Ghostty. Ghostty itself remains a separate project. The Rex docs also cover server installs for Linux, FreeBSD and Windows, plus remote access, but the app itself is currently a macOS beta by invitation.

How does the rex command work?

Most terminals are built for a person at a keyboard. Rex adds a command line interface (CLI, a set of commands you type or call from scripts) so that something other than your fingers can drive the terminal.

The commands that have been publicly described fall into a few groups:

  • See what exists: rex ls lists what is running.
  • Arrange the workspace: rex split opens a new pane.
  • Talk to a pane: rex send sends input to it, and rex capture gets its output back.
  • Run and wait: rex run --wait runs a command and waits for it to finish.

The docs organize the CLI around a taxonomy of commands, command targets (how you say which pane or session you mean), machine-readable output and how rex ends up on your PATH. Most commands can return JSON, a structured text format that scripts and agents can parse without guessing at layout.

Here is an illustrative sequence. The commands are real, but arguments are left out on purpose, so check the CLI Commands reference for exact syntax.

rex ls
rex split
rex send
rex run --wait
rex capture

What do run, capture and forward do?

Run. rex run --wait is the one to learn first. Instead of firing off a command and hoping, you run it and wait until it finishes. That is how an agent can start a test suite and only move on once it has a result.

Capture. rex capture gets what a pane has printed. Without this, an agent would have to screenshot or scrape a window. With it, an error message from a failed build becomes plain text the agent can read and act on.

Forward. Forwarding is part of Rex's remote access story, and Rex's remote access is built on Tailscale and is off by default. I could not confirm the exact forward syntax from the sources I reviewed, so I won't guess at it. The CLI Commands reference in the docs is the place to check.

How do coding agents use the rex CLI?

Rex has no built-in AI assistant, and that is deliberate. Instead it gives outside agents two things.

  1. A CLI they can call. After you run rex skill setup once, Rex installs integration hooks for supported agents: Claude Code, Codex, OpenCode and Pi. An agent can then open a diff, run tests or start a dev server in a new pane through the rex command.
  2. A status protocol. Rex uses an escape sequence called OSC 7501 so an agent can report whether it is idle, working, blocked or done. The terminal can show that state, so you can tell at a glance which of several agents needs you.

The practical effect is that the work an agent does becomes visible. A dev server it starts sits in a pane you can look at, not in a hidden process.

How do you get started with the rex CLI?

  1. Get access. Rex is an invite-only macOS beta right now. The installation page in the docs is the starting point.
  2. Open a Rex terminal and try rex ls to see your sessions.
  3. Run rex skill setup once if you use Claude Code, Codex, OpenCode or Pi.
  4. Ask your agent to run your tests or start your dev server and watch where it opens the pane.
  5. Read the references. The docs include CLI Commands, Shell Scripting and Agents pages for the details.

If you cannot get an invite yet, the docs are public and worth a skim. They show what a terminal designed for agents looks like.

What does this mean for you?

If you write code with an AI agent, the benefit is control and visibility. Long-running work survives a closed window, and you can see what the agent started. The CLI means your own scripts can do the same things the agent does.

If you manage people who use agents, this is a sign of where tooling is heading. Terminals are being redesigned with agents as a second kind of user. It is worth asking your engineers how they supervise agent work today.

If you are not technical, you do not need Rex. The takeaway is simpler: agents work better when tools give them structured commands and readable output instead of screens meant for humans. That is true well beyond terminals.

One caution. This is a beta, and details can change. Treat any command syntax in blog posts, including this one, as secondary to the current docs.

Could you build your own tracker for agent work?

If you start running several agents, the results tend to end up scattered across terminal panes and a spreadsheet someone keeps by hand. A small internal app can hold that instead: a request form for tasks, a table of which jobs finished, and a dashboard of what is blocked. Remy builds this kind of tool from a plain-English description and deploys it, with a database and sign-in included. You own the code in a git repo. It does not replace a terminal like Rex. It gives the people around the terminal a place to track what the agents are doing.

Frequently Asked Questions

4 questions

Is the rex CLI the same as Rex for Perl?

No. Perl's Rex (Rexify) is an infrastructure automation framework that runs tasks across servers. The rex command discussed here comes with Superlogical's Rex terminal and controls terminal sessions and panes. They only share a name.

Do I need Rex to use the rex command?

Yes. The rex command ships with the Rex terminal and talks to its background server. Rex is currently an invite-only beta for macOS, so access is limited for now.

Does Rex include its own AI assistant?

No. That is intentional. Rex gives outside coding agents a CLI and a status protocol, and a one-time rex skill setup installs hooks for Claude Code, Codex, OpenCode and Pi.

Where can I find the full list of rex commands?

The official docs at superlogical.com/rex/docs have a CLI Commands reference, plus pages on the CLI, agents and shell scripting. Use those for exact arguments, since this article covers only the commands described in public coverage.

How we source, write, and correct our articles. Editorial standards

Related articles

Straight to your inbox.
New pieces as they publish. No noise.