
crex (cmux-resurrect)
Save, restore, and template your terminal workspaces β for cmux and Ghostty.
Inspired by tmux-resurrect, crex was born to do for cmux what tmux-resurrect does for tmux β and then went further. With an interactive shell, a template gallery, Blueprints, and a watch daemon, crex saves your entire layout and brings it back: all your tabs, pane arrangements, working directories, pinned state, and startup commands. Named after the corncrake (Crex crex), a bird that returns to the same ground year after year β your terminal's own phoenix.

π Quick Start
Install with Homebrew (recommended)
brew install drolosoft/tap/crex # preferred
brew install drolosoft/tap/cmux-resurrect # legacy alias β same formula
Both crex and cmux-resurrect commands are ready to use (cmux-resurrect is the legacy name), with shell completions installed automatically. No Go toolchain required. macOS only (both cmux and Ghostty's AppleScript API are macOS-native).
Install with go install
go install github.com/drolosoft/cmux-resurrect/cmd/crex@latest
For building from source, see docs/building.md.
Enable Shell Completion
Homebrew users get completions automatically. For manual installs, add one line to your shell config:
eval "$(crex completion zsh)" # zsh β add to ~/.zshrc
eval "$(crex completion bash)" # bash β add to ~/.bashrc
crex completion fish | source # fish β run once
Now crex <TAB> shows all commands, crex restore <TAB> completes your saved layout names, and flags like --mode complete their values. See docs/shell-completion.md for the full guide.
Try it
crex setup # guided first-run configuration
crex save my-day # snapshot your current layout
crex save my-day -d "Friday deep work" # with a description
crex tui # interactive shell

πΎ Save & Restore
crex save my-day # snapshot your layout
crex save my-day -d "Friday deep work" # add a description (preserved across re-saves)
crex restore my-day # bring it all back
Every tab, pane arrangement, CWD, pinned state, and startup command β captured and restored. Layouts are saved to ~/.config/crex/layouts/.

π§ Setup Wizard
First time? crex setup walks you through everything:
crex setup # interactive guided configuration
crex setup --defaults # accept all defaults (CI/scripting)
The wizard auto-detects your terminal backend (cmux or Ghostty), creates a default config.toml if missing, and sets up the layouts directory. One command and you're ready to go.
π₯οΈ Interactive Shell
Run crex tui β or just crex when config exists β to drop into the interactive shell. A crexβ― prompt gives you full access to all commands without leaving your terminal.
crexβ― ls list saved layouts
crexβ― restore 2 restore by number
crexβ― now show live terminal state
crexβ― templates browse the gallery
crexβ― use claude create workspace from template
crexβ― bp list list Blueprint entries
crexβ― help show all commands
Listings show numbered items β use the number in any follow-up command. Arrow keys browse listings inline. The shell adapts to your terminal's dark or light theme automatically.

π₯ Blueprints
Define your terminal layout in Obsidian-compatible Markdown. Import creates only what's missing β it's idempotent.
Resume AI coding sessions across restarts β Claude Code, OpenCode, and Codex all persist conversations locally. crex restores the terminals and tells each tool to continue where you left off:
## Projects
**Icon | Name | Template | Pin | Path**
- [x] | π€ | Claude Code | claude-resume | yes | ~/projects/myapp
- [x] | π’ | OpenCode | opencode-resume | yes | ~/projects/api
- [x] | π΅ | Codex | codex-resume | yes | ~/projects/frontend
## Templates
### claude-resume
- [x] main terminal: `claude --continue --dangerously-skip-permissions` (focused)
### opencode-resume
- [x] main terminal: `opencode --continue` (focused)
### codex-resume
- [x] main terminal: `codex resume --last` (focused)
Works with any command β dev servers, test watchers, git UIs, or AI pair-programming sessions:
## Projects
**Icon | Name | Template | Pin | Path**
- [x] | π | webapp | dev | yes | ~/projects/webapp
- [x] | βοΈ | api | dev | yes | ~/projects/api-server
- [x] | π§ͺ | tests | go | yes | ~/projects/testing
## Templates
### dev
- [x] main terminal (focused)
- [x] split right: `npm run dev`
- [x] split right: `lazygit`
crex import-from-md # create tabs/workspaces from Blueprint
crex export-to-md # capture live state to Blueprint

For the full Blueprint format and CLI management (bp add, bp list, bp toggle), see docs/blueprint.md.
π€ AI Session Auto-Detection
crex save automatically detects running AI coding sessions and captures their session IDs. On restore, each session resumes exactly where you left off β no manual configuration needed.
Supported tools:
| Tool |
Detection |
Resume command |
| Claude Code |
Process + terminal title |
claude --resume <session-id> |
| OpenCode |
Process + terminal title |
opencode --session <session-id> |
| Codex |
Process + terminal title |
codex resume <session-id> |
How it works:
crex save my-layout β detects AI processes, matches them to panes by CWD and terminal title, writes the exact session ID into the layout
crex restore my-layout β each pane resumes its specific session, not just "the last one"
crex save my-day # AI sessions captured automatically
crex restore my-day # Claude/OpenCode/Codex resume mid-conversation
Limitations:
- In multi-pane (split) workspaces, AI sessions are detected when the pane shares the workspace's working directory. If a split pane has
cd'd to a different project, detection cannot match it. For reliable detection, use one project directory per workspace.
- Ghostty: Multi-pane detection relies on CWD matching only. Ghostty's AppleScript API does not expose terminal titles (set by ANSI escape codes), so title-confirmed matching is unavailable. Single-pane workspaces are unaffected. This will improve when Ghostty exposes terminal titles in a future API update.
π¦ Template Gallery
crex ships with 16 ready-to-use templates for common developer workflows.
|
Layout Templates |
|
Workflow Templates |
| β₯ |
cols β side-by-side |
π€ |
claude β Claude Code pair-programming |
| β€ |
rows β stacked |
π» |
code β general coding |
| β§ |
sidebar β main + side |
π |
explore β navigate codebase |
| β€ |
shelf β big top, 2 bottom |
π |
system β monitor health |
| β’ |
aside β big left, 2 right |
π |
logs β tail streams |
| β
’ |
triple β three columns |
π |
network β debug connectivity |
| β |
quad β 2Γ2 grid |
π |
single β minimal terminal |
| β± |
dashboard β top + 3 bottom |
|
|
| β§ |
ide β full IDE layout |
|
|
crex template list # browse all templates
crex template show claude # preview with ASCII diagram
crex template claude ~/project # create workspace instantly (shortcut)
crex template customize claude # fork to your Blueprint

Templates are starting points. Run crex template customize <name> to fork any template and make it yours.
See docs/templates.md for the full gallery with diagrams.
Supported Backends
| Backend |
Status |
Platform |
Tested versions |
Detection |
| cmux |
Full support (original backend) |
macOS |
0.62.1, 0.63.2 |
Auto-detected via CMUX_SOCKET_PATH |
| Ghostty |
Full support (AppleScript API) |
macOS |
1.3 |
Auto-detected when Ghostty is running |
macOS only. Both backends rely on macOS-native APIs (cmux is a macOS terminal multiplexer; the Ghostty backend uses AppleScript). Linux support will follow once Ghostty ships a cross-platform scripting API (ghostty-org/ghostty#2353).
crex auto-detects your terminal backend β no flags needed. Just run your commands and crex figures out the rest:
crex save my-day # works in cmux or Ghostty
crex restore my-day # recreates layout in whichever backend you're in
crex template use dev # same templates, any backend
All features β save, restore, import, export, templates, Blueprints β work identically across backends. The template gallery is 100% backend-agnostic.
Adaptive Themes β crex auto-detects your terminal's dark/light background and adjusts banner colors. Three styles available: flame (gradient, default), classic (solid green), plain (gray). Set banner_style in config.toml or use CREX_BANNER; override detection with CREX_THEME=dark|light. See Configuration.
β¨ Why crex?
tmux-resurrect proved that session persistence is essential for any serious terminal multiplexer workflow. Every multiplexer eventually gets one β crex started as that tool for cmux, and now brings the same power to Ghostty.
|
tmux-resurrect |
crex |
| π₯οΈ |
CLI commands only |
Interactive shell β crexβ― REPL with browse mode, number refs, history |
| π |
Plugin configuration |
Blueprints β Markdown files, Obsidian-compatible |
| π§© |
Manual pane recreation |
16 built-in templates + custom Blueprints |
| π₯ |
One-way restore |
Bidirectional β import from and export to Markdown |
| ποΈ |
Execute immediately |
Dry-run mode β preview every command first |
| β±οΈ |
Manual saves |
Watch daemon β background auto-save, deduped, shell hooks, zero-maintenance |
| π |
Edit config files |
CLI blueprint management β add, remove, toggle from terminal |
| π€ |
Basic tab completion |
Dynamic completions β layout names, blueprint names, flag values (bash/zsh/fish) |
π Documentation
| Doc |
Description |
| Commands |
Full command reference, flags, and recipes |
| Blueprints |
Blueprint format, templates, CLI management |
| Workflows |
Save/Restore vs Import, dry-run, side-by-side comparison |
| Configuration |
config.toml reference and defaults |
| Auto-Save & Daemon |
launchd, daemon mode, shell hooks |
| Template Gallery |
Built-in templates, ASCII previews, customization |
| Template Authoring |
Create and contribute custom templates |
| Shell Completion |
Setup, troubleshooting, what gets completed |
| Building from Source |
Makefile targets, cross-compilation, platform support |
| Architecture |
Internal design for contributors |
π Contributing
Contributions are welcome β bug fixes, new templates, feature ideas. Open an issue or submit a PR.
If crex saves your sessions, consider giving it a β on GitHub β it helps others discover the project.
β Support
If crex saved you time or made your workflow easier, consider buying me a coffee β it keeps the next one coming!

π License
MIT License β free to use, modify, and distribute.
Born from a real need: a crashed cmux session took an hour of carefully arranged workspaces with it. crex now protects your workspaces across both cmux and Ghostty β so that never happens again.
Forged by Drolosoft Β· Tools we wish existed