rexurrect
rexurrect restores local Rex sessions after a server restart or Mac reboot,
including tabs, splits, and working directories. The optional agent plugin also
resumes registered Claude Code, Codex, and Antigravity CLI conversations.
The project is experimental. Terminals without an agent receipt come back as
ordinary shells. With the optional shell hook, the command a pane was running
is typed back at its prompt (never run); with --scrollback, its earlier
output is replayed above the prompt.
Install
With Rex running on macOS:
brew install --cask blacktop/tap/rexurrect
rexurrect agent install --server "unix://$HOME/Library/Application Support/rex/server.sock" --state-dir "$HOME/Library/Application Support/rexurrect"
rexurrect agent status
The LaunchAgent saves changed sessions every minute and responds when the Rex
socket appears or disappears. After a server restart, it restores the saved
sessions and starts saving again. Snapshots live in
~/Library/Application Support/rexurrect; the current and last-known-good
generations are retained.
Rex preview.23 and later bring sessions back on their own, with the same IDs.
rexurrect keeps every session Rex restored and creates only the ones Rex did
not bring back, so nothing is duplicated. Panes Rex restores come back as plain
shells, unless Rex resumed a program there itself (see Rex's init.lua).
With the shell hook installed, fish runs a pane's resume command, and
the report marks it failed if it exits nonzero right away; recorded commands,
and every command in zsh, are typed and left for you to run. See
Sessions Rex restores itself.
For a source install, see Building from source.
Custom paths and other options are covered in the
CLI reference.
Resume agent conversations
Install jq with brew install jq, then add the plugin through the account
you use.
For Codex:
codex plugin marketplace add blacktop/rexurrect
codex plugin add rexurrect@rexurrect
For Claude Code:
claude plugin marketplace add blacktop/rexurrect
claude plugin install rexurrect@rexurrect --scope user
For the Antigravity CLI (agy), which installs plugins from a local folder:
git clone https://github.com/blacktop/rexurrect.git
agy plugin install "$PWD/rexurrect/plugins/rexurrect"
Finish the wrapper and hook setup,
then follow the receipt checks.
The wrapper identifies which account owns the pane, so installing the plugin
alone isn't enough. Codex runs with --no-daemon inside Rex so its hooks follow
the pane's lifetime.
Scrollback
save --scrollback and auto --scrollback also bring back each pane's earlier
output above its new prompt. It is off by default. The output is encrypted
before it reaches disk; the key lives in your login keychain, so a copied state
directory or a backup holds no readable terminal output, and a missing key
only costs the scrollback, never the layout or agent recovery. Full-screen
programs are skipped. Turn it on for the automatic job with
rexurrect agent install --scrollback (same --server and --state-dir as
before), or run rexurrect save --scrollback yourself; see
Encrypted scrollback.
Running commands
Add eval "$(rexurrect hook zsh)" to ~/.zshrc, or
rexurrect hook fish | source to ~/.config/fish/config.fish. The same hook
lets a pane that Rex restored itself take its saved command back: fish runs
an agent's resume command and types a recorded command, zsh types both and
leaves Enter to you, and either shell declines while you are typing.
While a command runs in a pane, the hook records the line you typed; when it
exits, the record goes away. After a restart, a pane that was running
something comes back with that line typed at its prompt, ready for Enter and
never run on its own. Agent panes still resume through their receipts. See
Foreground commands.
Rex's init.lua
Add the output of rexurrect hook lua to ~/.config/rex/init.lua, then run
rex config reload. The snippet does two things.
It turns off Rex's own claude and codex resume rules, which would restart
a wrapped agent as the plain command under the default account; rexurrect
resumes both from receipts that keep the wrapper. Rex keeps its other rules.