Sulat.com / Writing on AIFriday, November 27, 2026
Agents/27 November 2026

Rex now resumes programs after a server restart, using a new open terminal protocol, OSC 7577

Mitchell Hashimoto says Rex can now bring programs back after a server restart. Claude Code resumes out of the box, and OSC 7577, written with herdr, lets any program report how to resume it.

Glossy 3D Rex logo on a pedestal beside a server rack with a glowing restart arrow, dim terminal windows and one lit window with a chat bubble
Illustration: Sulat, featuring the Rex logo

At a glance

  • Mitchell Hashimoto said Rex can now resume programs through a server restart, built on OSC 7577, a terminal escape sequence he says was written with herdr and reviewed by terminal and program authors.
  • Claude Code is the only built-in program Rex resumes today, in the same pane and conversation, with flags such as --model opus, through a hook that rex skill setup installs.
  • A secret OSC7577_TOKEN the terminal gives each pseudo-terminal, a short time window and Rex's opt-in trust rules stop displayed text or remote output from planting commands.
  • Rex saves each reported command in plain text, which its docs say can hold a secret such as a system prompt; the files are readable only by the server's account, and encryption is planned.
  • The specification is at revision 0.5, five revisions since 18 November, and Hashimoto's post names no other terminal that implements it.

Mitchell Hashimoto says Rex, the terminal multiplexer from his company Superlogical, can now resume your programs through a server restart. It rests on OSC 7577, a new terminal escape sequence that Superlogical calls the Program Resume Protocol and published the same day.

Hashimoto, the HashiCorp co-founder and creator of Ghostty, posted about it late on 25 November UTC, which was the morning of 26 November in New Zealand. He says he wrote the protocol with herdr and had it reviewed by several terminal emulator and terminal program authors. Rex ships with built-in support for Claude Code, which comes back in the same pane and the same conversation.

Mitchell Hashimoto on X, 25 November UTC: Rex resume and the OSC 7577 announcement, with a 2 minute 21 second demo.

This means that ANY program can restart, not just agentic coding tools, and it doesn’t require any special integration with any specific terminal or out-of-band protocol. It’s plain old terminal escape sequences that are easily implemented by any program!

Mitchell Hashimoto, on X

What changes for a Rex user

When I covered Rex on 18 November, a server restart kept your window layouts but turned every pane back into a fresh shell. That’s the gap this closes. A restarted Rex server now restores sessions, tabs, panes and their labels. If a pane was running a program that had reported a resume command, Rex starts that program again. If not, you get your shell in the directory you were last in. My first piece on Rex has the background on what the product is.

Claude Code is the one program Rex resumes out of the box. It returns with the flags it was started with, such as --model opus. The resumed copy gets the environment of a new terminal, so a variable you exported by hand before starting it is gone. Rex needs three things for this, per its session restore docs: the hook that rex skill setup installs, a trust rule that covers the command, and a shell it can start a program through, such as bash, zsh or fish. Hashimoto says Rex emits OSC 7577 from a session start hook.

Rex restart: a dark terminal window cycles back to a lit one with a chat bubble, showing Claude Code resuming its conversation
After a Rex restart, Claude Code comes back in the same pane and the same conversation.

Quit a program yourself and its record disappears about two seconds later, so it doesn’t come back. Runs with no session to resume, such as claude -p, never come back, and neither does anything running under a wrapper that isn’t a shell, such as a sandbox. Rex also never tries to resume the same saved program twice, so a crash can’t trap it in a relaunch loop. Resume is off on Windows and when the server runs as root.

Hashimoto’s demo video runs 2 minutes 21 seconds. In it, the Rex sidebar lists several Claude Code sessions, including a tic-tac-toe game and a game of 20 questions, alongside the Rex server settings.

How a program asks to be brought back

A program asks by writing an OSC 7577 sequence to its terminal. The body is a list of key and value pairs: the process ID of the program to bring back, the time, the command as base64 arguments, an optional working directory, and a hash that proves the sender knows a secret. The spec’s own example is Neovim after it saves a session file. The command decodes to nvim -S /home/user/.local/state/nvim/sessions/8f2c1d.vim.

Code
ESC ] 7577 ; pid=74877:time=1795543200:argv=bnZpbQ==,LVM=,L2hvbWUvdXNlci8ubG9jYWwvc3RhdGUvbnZpbS9zZXNzaW9ucy84ZjJjMWQudmlt:mac=9dbb99bfb856749a87563839d7ce9062818d78cf25909db93f309e0cd3b1909b ESC \

The terminal sets that secret in an OSC7577_TOKEN environment variable for the first process in each pseudo-terminal. A program that doesn’t find the variable doesn’t send a report, and there’s no query and no reply. The hash is a plain SHA-256 of the body plus the token, rather than an HMAC, so a shell script with sha256sum can compute it without putting the token on a command line.

There is deliberately no way to send environment variables, because a saved environment goes stale and can hold secrets. A report can run to 2,048 bytes and 64 arguments. A program should report again whenever its resume command changes, such as a new session or a fork, and send a clear report when the user ends it. It must not send clear when it exits because of a hangup or the loss of its terminal, because that is exactly when the record is needed.

Five steps: program reports its resume command, terminal checks token and clock, Rex checks trust rule, server restarts, program returns
A report has to pass the terminal’s checks and your own rule before anything restarts.

Why a restart is risky, and what stops it

Hashimoto is blunt about the risk.

Program restart in terminals is fundamentally unsafe, so a lot of effort was put into making this as safe as possible. Ultimately, the security of this lies in the terminal emulator.

Mitchell Hashimoto, on X

A saved record is a command the terminal may run later, as you, without you typing it. So the spec is built around who can create one. Text you display, such as a file you cat, a log you tail or anything a remote machine prints over ssh, can’t plant a record because it doesn’t know the token. A recording of a terminal doesn’t contain the token either, and a report older than the terminal’s time window, which the spec says should be 60 seconds, is ignored, so a recorded report can’t be replayed later. Programs running as you are trusted, which is why a program that reports should strip the token from what it starts. So should an agent that runs tools in a sandbox, or a restricted child could register a command that runs with your full rights. A terminal running as root shouldn’t accept reports without an explicit opt-in.

OSC 7577 token: a "cat file" scrap bounces off a locked terminal while a small program holding a key walks in
Only a program holding the terminal’s token can plant a resume command.

Rex adds a second lock. Its resume rules are opt-in, one per program, and each names a command, the flags that may come back and the directories it may resume in. Rex doesn’t take a program’s word for it. It cross-checks the report against your rules and treats your rules as the truth. It also checks that the process really is the program the command starts. Rex ships built-in rules for three agents. The Claude Code rule keeps 44 flags, including --model, --permission-mode and --dangerously-skip-permissions, and drops 12, such as --continue, because --resume does that job. A Claude Code started with a flag the rule doesn’t list isn’t resumed.

Code
-- Resume Claude Code only under ~/code
rex.set("resume.trust.claude.dir", "~/code")

-- Don't resume a Claude Code started without permission checks
rex.set("resume.trust.claude.flags.--dangerously-skip-permissions", false)

-- Turn off every rule Rex ships
rex.set("resume.defaults", false)

Those three lines are from Rex’s docs. The last switches off every built-in rule, and sessions still restore as plain shells in their saved directories. rex config check lists the rules in force, and a record that isn’t trusted carries a reason such as no_rule or flag_not_listed. Hashimoto says the filters cover program name, path, working directory and command-line flags, and that you can disable the whole thing with one line.

One catch is in the docs. Rex saves the whole command a program reported in plain text, and the docs warn that a saved command can hold a secret, such as a system prompt passed to Claude Code. On Linux, macOS and FreeBSD only the account the server runs as can read the files. Superlogical says it plans to encrypt them where a source for keys is available.

How it sits next to the alternatives

Resuming programs after a restart isn’t new. What’s new is who holds the knowledge. The spec compares OSC 7577 with four existing approaches.

ApproachWho knows the commandThe spec’s objection
OSC 88, an earlier resume protocolThe program reports itReports aren’t authenticated, so a terminal has to inspect processes, and arguments are one string with no defined split.
tmux-resurrect, kitty sessionsThe terminal reads the running processThat’s how the program started, often with no session ID, and it may be unsafe to repeat.
Zellij, herdr, cmuxThe program calls each tool’s own commandEvery program needs separate work for every terminal.
OSC 7577The program reports it, with a tokenTrust is left to each terminal.
Source: the OSC 7577 specification, “Relationship to other approaches”. The last row is my summary of its threat model.
Comparison of resume approaches: process detection re-runs the start command, per-terminal tools need wiring, OSC 7577 lets the program say it
OSC 7577 moves the knowledge of how to resume from the terminal to the program itself.

This is Hashimoto’s second protocol of this kind. On 6 October he published OSC 7501, the Program Status Protocol, which lets a program tell the terminal whether it’s idle, working, blocked or done. Both specs live in Rex’s docs, and both say they hold nothing specific to Superlogical. Herdr, which helped write this one, already reads OSC 7501 reports too, and its own docs list session restore for more than a dozen agents, each through its own integration. That’s the per-terminal model the spec describes.

Rex users had been filling the gap themselves. A plugin called rex-resume reopens Claude Code conversations in their panes after a restart, using a hook and a zsh integration. Another project, rex-agent-resume, does the same for several agents. KahWee Teng, who uses Rex as his main terminal, wrote on 25 November that he’d missed herdr’s session restore, adding: “I like that Rex and herdr agreed on a way to do it that both can use.”

What it doesn’t do yet

Rex’s docs list Claude Code as the only built-in program that resumes today. Rex ships rules for two more agents, but nothing reports for them yet, and a fourth agent, Pi, has no rule. Neovim doesn’t report on its own either. The docs show about 20 lines of Lua in Neovim’s config that make it report nvim -S each time a session is saved, plus one Rex rule that trusts session files in a single directory.

The protocol is at revision 0.5, dated 25 November. The first draft was on 18 November. The spec calls resume “a hint, not a guarantee” and says terminals may ignore or reject any report. Hashimoto’s post names no other terminal that implements OSC 7577, and he writes that he hopes other programs will adopt it. The specification and the Rex docs are where to watch for which programs and terminals start reporting.


Discover more from Sulat AI & Tech News

Subscribe to get the latest posts sent to your email.