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.
brew install drolosoft/tap/crex # preferred
brew install drolosoft/tap/cmux-resurrect # legacy alias β same formulaBoth 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).
go install github.com/drolosoft/cmux-resurrect/cmd/crex@latestFor building from source, see docs/building.md.
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 onceNow 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.
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 shellcrex 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 backEvery tab, pane arrangement, CWD, pinned state, and startup command β captured and restored. Layouts are saved to ~/.config/crex/layouts/.
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.
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.
Define your terminal layout in Obsidian-compatible Markdown. Import creates only what's missing β it's idempotent.
## 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 BlueprintFor the full Blueprint format and CLI management (
bp add,bp list,bp toggle), see docs/blueprint.md.
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 BlueprintTemplates 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.
| 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 backendAll 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.
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) |
| 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 |
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.
If crex saved you time or made your workflow easier, consider buying me a coffee β it keeps the next one coming!
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







