---
title: "How I orchestrate coding agents in Rex"
description: "One agent hands out the work, and the others do it, each in its own Rex tab and worktree. Here's the setup, with the prompts I use."
pubDate: "2026-12-02"
heroImage: "/blog/rex-agents/cover.png"
typora-root-url: ../../../public
---

In the last couple of weeks, coding agents merged more than 100 PRs for me, in code that **49 teams own and review**. I run several at a time, and I mostly talk to one.

It's for a big project at Miro (I'll say which one once it launches), made of hundreds of small fixes spread across the app and the board. I'm not the only one on it, and the numbers in this post are only my own PRs.

I track the work in a table on a Miro board, one row per fix, and the agents read that table through Miro's MCP server. Many rows don't depend on each other, so agents can work on them at the same time. Each agent runs in its own Rex tab. One more agent, the **Coordinator**, hands out the work and never writes code itself.

<figure>
  <img src="/blog/rex-agents/rex-window.gif" alt="A Rex window with nine agent tabs in the sidebar, each showing a working indicator, and the Coordinator reporting the state of each tab" width="2000" height="1256" loading="lazy" />
  <figcaption>My Rex window, redrawn with made-up names.</figcaption>
</figure>

A good part of this is possible because of [Rex](https://www.superlogical.com/rex/docs), Superlogical's terminal multiplexer. It's in beta and invite-only for now.

> I'm sharing this because it's a simple and effective way to tackle work that would have been impossible a few months ago. Setups like this don't stay special for long, either. The tools will absorb them, so I'd rather it be useful to someone now.

## Why Rex

<figure class="center">
  <img src="/blog/rex-agents/rex-logo.png" alt="The Rex logo, a dinosaur head in an orange to purple gradient" width="168" height="168" loading="lazy" />
</figure>

In Rex, a session holds tabs and a tab holds panes. The server keeps every session running whether or not the app is looking at it. Everything in this post goes through the [`rex` CLI](https://www.superlogical.com/rex/docs/automate/cli), which an agent can drive from a shell the same way I can.

The Coordinator gets by with four commands:

```sh
rex window new -s "$REX_BLOCK" "<tab>" -c <folder> \
  --interactive --keep-open --focus=false --json -- \
  claude --model <model> --effort <effort> --permission-mode auto -n "<tab>" \
  "Read ~/agent-briefs/<tab>.md and carry it out. It is your full brief."

rex capture -s "$REX_BLOCK" -b <block> --trim --unwrap
rex send -s "$REX_BLOCK" -b <block> '<text>'
rex send-key -s "$REX_BLOCK" -b <block> Enter
```

`window new` opens a tab and starts Claude Code in it. `capture` reads that tab's screen, and `send` and `send-key` type into it. With `--json`, Rex returns IDs that never change and are never reused, so the Coordinator saves the block ID of each tab it opens and keeps talking to the right one, even after the tab is renamed.

[`rex skill setup`](https://www.superlogical.com/rex/docs/automate/agent-skill) installs a skill that teaches the agent these commands, and a hook that tells every new session which Rex session and terminal it's in. When the server restarts, the tabs come back, and I wrote about [bringing the agents back with them](/blog/rex-agent-resume).

## Small PRs and a nightly build

Each change goes to main as a small PR, one per code-owner team where possible, so each PR waits on one team's review. With PRs this small, nobody would see the whole thing until the last one merged. So there's Nightly, a preview branch built from main plus every open PR for the project, drafts included. Anyone can try a change there before it's ready for review.

<figure>
  <div id="rex-flow"><img src="/blog/rex-agents/flow-poster.png" alt="Diagram of five pull requests moving from a tracking table through worktrees, a nightly preview branch and review, to main" width="2200" height="1300" loading="lazy" /></div>
  <figcaption>Five PRs, five outcomes.</figcaption>
</figure>
<script src="/blog/rex-agents/flow.js" defer></script>

The animation follows five PRs from the table to main, and plays on a loop. One goes back for changes, one is closed, one stays a draft, and the rest merge.

A sync loop keeps Nightly up to date. It's one more tab, running a Claude Code skill on repeat. Each cycle it checks CI on the Nightly head, picks up new or changed PRs, merges the open ones into Nightly and reverts the closed ones. Then it updates the table and a status page. It's the only agent allowed to write to the table.

## Why not 100 agents

**The limit is me.** I need to understand the system and what it's doing, and with around ten tabs I still can. More than that is too much, and I think this pace is already fast.

Other things would give out before 100 anyway. Every PR still waits for a person on the owning team, so more agents would mostly make a longer review queue. And GitHub's search and GraphQL APIs start rate-limiting when many agents call them at once.

## The Coordinator

The Coordinator is a Claude Code session in its own tab (Opus 5.5/medium). It plans, writes briefs, launches tabs and checks on them. Because it never touches code, its context stays small, and it answers me right away while the other tabs are busy.

Here's its prompt, cut down:

```md
Your job is to plan, brief, launch and check agent tabs. The tabs do the work.
Keep this session small and answer me right away. Never run a poll loop here.

Open a tab when the work owns a branch or worktree, ships something,
uses a browser, runs longer than about five minutes, or needs a
different model. Use an in-session subagent only for short read-only
lookups. When in doubt, open a tab.

Model and effort per tab:
- Haiku for simple read-only checks.
- Sonnet for mechanical work: merging main into a branch, CI reruns, page edits.
- Opus at high for app UI and CI debugging.
- Fable at high for canvas, rendering or performance work.

Launching a tab:
1. Write the brief to ~/agent-briefs/<name>.md. Write each brief fresh.
2. Launch it with rex window new. Name the tab after its task and save
   the block ID it returns.
3. Within 15 seconds, capture the tab. If it shows a trust or permission
   prompt, tell me in the first line of your reply. Never answer a
   prompt for me.
4. Add a row to the tab index: tab, folder, model, session ID, task, state.

Checking tabs:
- At the start of each turn, capture every running tab.
- A tab saying "pushed" isn't proof. Check git ls-remote, CI on the head
  commit and the PR's files before you tell me it's done.
- Two tabs never edit the same file or the same worktree at once.

Decide routine calls yourself: retries, which check to run, merging main
into a branch. Ask me only about a design call users would see or
anything irreversible.
```

Each tab starts from a brief, a markdown file it reads before anything else. The Coordinator writes every brief from scratch, because an edited old one carries stale lines over. A brief names the tab's rows and its worktree, then sets the rules for the work:

```md
Rows: <the items this tab owns, copied exactly from the tracking table>

Before each row, check that no PR covers it. Work only on these rows.

One PR at a time, easiest first, each green before the next.

Checks: typecheck one at a time, because other tabs may be typechecking
too. Then unit tests, lint and format on the touched files.

Open the PR ready for review and turn on auto-merge. Watch CI in the
foreground. Fix what the review bots flag. To update a branch, merge
main into it. Never rebase or force-push.

Write each PR (link, rows, CI state) to ~/agent-briefs/<name>.result.md
and report once at the end.
```

## The tab index

The Coordinator keeps one file with a row for every tab it has ever opened:

```md
| Tab  | Folder              | Model | Session ID   | Task                    | State  |
| ui-4 | ~/worktrees/slot-3  | Opus  | <session id> | App UI rows, first half | closed |
```

**Without it, a closed tab is gone for good.** Tabs get closed and the laptop restarts. Even the Coordinator gets replaced by a fresh session now and then. With the index, a new Coordinator knows what was running, and I can reopen any tab with its whole conversation:

```sh
rex window new -s "$REX_BLOCK" "<tab>" -c <folder> --interactive --keep-open --focus=false -- \
  claude --resume <session id> --permission-mode auto -n "<tab>"
```

A session can only be resumed from the folder it ran in, which is why the folder is in the row. More than 200 tabs have gone through the index so far.

## A quiet tab might be stuck

<figure style="max-width: 18rem; margin-inline: auto;">
  <img src="/blog/rex-agents/rex-phone.png" alt="Rex on a phone, showing an agent tab that has finished its work and written a recap" width="923" height="2000" loading="lazy" />
  <figcaption>One of the tabs in Rex on iOS. The screen is real, the text is replaced with made-up names.</figcaption>
</figure>

With this many tabs, the problem is silence. A tab waiting on a permission prompt looks the same as a tab that's working. Rex shows each agent's status in the app, and that's what I look at, on the Mac or on my phone. But the Coordinator only knows what it reads off a screen, so I have it capture every running tab at the start of each turn.

I also don't let it believe a tab. "Pushed" counts only after git and CI agree. A tab that says it's done while Claude Code still shows "1 shell still running" isn't done. And "done" can mean it stopped to ask me something, so the Coordinator reads a tab's last message before closing the tab.

When Claude Code's auto mode blocks a command, the tab stops and waits for me. I approve it in that tab, and I've told the Coordinator never to route the blocked step through another one.

## A pool of worktrees

<figure class="center">
  <img src="/blog/rex-agents/worktrunk-logo.png" alt="The Worktrunk logo, an orange hand-drawn tree of connected nodes" width="512" height="512" loading="lazy" />
</figure>

Each tab works in its own git worktree, so two agents never share a checkout. I manage them with [Worktrunk](https://worktrunk.dev)'s `wt`, never raw `git worktree`, and every brief tells the agents to do the same.

A new worktree in this repo means a long dependency install, and a few of those at once make the laptop hot. So I keep about ten worktrees installed and reuse them. A brief names a free one, and the tab leaves it clean for the next.

The repo uses yarn. I wouldn't pick it for a new project, but it's what's there, and one setting helps here. With `nmMode: hardlinks-global` in `~/.yarnrc.yml`, the slots share one copy of `node_modules` on disk.

The laptop sets other limits too. A full typecheck takes several GB of memory, so only one runs at a time. The same goes for the browser.

Once a day a Sonnet tab clears out the worktrees nobody needs anymore. It skips the pool and anything touched in the last three hours, and it never runs `rm -rf`.

## Chasing reviews

Review is the slow part, because every owning team still reviews its own PR. Agents fix or answer whatever the review bots flag before a person looks, so the human review starts on a cleaner diff.

Most days I post a round-up of open PRs. If a PR still has no owner review a day later, I find the teams it's waiting on and ask their on-call group directly.

Every review thread has to be resolved before a PR can merge, bot threads included. Auto mode doesn't let agents resolve them, so that part is mine.

## If you want to try it

Rex is in beta and invite-only, so [ask for an invite](https://www.superlogical.com/rex/docs/installation) first. The Mac app and the Linux, FreeBSD and Windows servers are open to every tester. For the iOS app you enroll on their Discord (they haven't heard about [slirc.org](https://slirc.org) yet).

- Run `rex skill setup`, so your agents know the `rex` commands and which tab they're in.
- Start one Claude Code session as the Coordinator. Give it the prompt above and tell it to stay out of the code.
- Keep briefs and results in a folder that survives a restart, not in `/tmp`.

## What one person can do now

I'm still a bit amazed by this. In a few weeks, my ten or so agents and I merged more than 100 PRs into code owned by about 50 teams, and more than 100 others are open as I write this. That's only my share of the project. A few months ago I couldn't have worked like this.

The setup behind it is small. It's a terminal that agents can drive and a handful of markdown files. This is one way to do it, and there's probably a cleaner one. I expect the tools to catch up soon.

My part is understanding what the system is doing and making the calls it can't. If your project is wide and made of small pieces, try this. You'll be surprised how far one person can get.
