Skip to content

Latest commit

Β 

History

History
302 lines (229 loc) Β· 14 KB

File metadata and controls

302 lines (229 loc) Β· 14 KB

Home > Commands

πŸ“– Commands

Command Reference

Command Alias Description
crex setup πŸ§™ First-run wizard β€” detect backend, create config
crex save [name] πŸ’Ύ Capture current layout to TOML
crex restore [name] [workspace] πŸ”„ Recreate tabs, pane arrangements, and commands (optionally a single workspace)
crex pop [name] ⚑ Quick-launch a layout (Ctrl+G picker, --last)
crex now πŸ‘€ Show current live workspaces
crex rename <old> <new> mv 🏷️ Rename a saved layout
crex list ls πŸ“‹ List saved layouts (--json, --alfred)
crex show <name> πŸ” Display layout details (--raw for TOML)
crex edit <name> ✏️ Open layout in $EDITOR
crex delete <name> rm πŸ—‘οΈ Delete a saved layout
crex import-from-md πŸ“₯ Create tabs from a Blueprint
crex export-to-md πŸ“€ Export live terminal state to a Blueprint
crex watch [name] ⏱️ Auto-save at interval (--daemon, --stop, --status, --shell-hook)
crex tui πŸ–₯️ Interactive shell (browse layouts, templates, live state)
crex blueprint add bp add βž• Add entry to the Blueprint
crex blueprint remove bp rm βž– Remove entry from the Blueprint
crex blueprint list bp ls πŸ“‹ List entries in the Blueprint
crex blueprint toggle bp toggle πŸ”˜ Enable/disable a Blueprint entry
crex settings <cmd> βš™οΈ Settings (restore-mode get|set|list)
crex update ⬆️ Check for and install the latest release
crex version ℹ️ Print version, commit, build date (also --version, -v)
crex template list tpl ls πŸ“¦ List available templates from the gallery
crex template show <name> tpl show πŸ” Preview a template with ASCII diagram
crex template use <template> [path] tpl use πŸš€ Create a workspace from a gallery template
crex template customize <name> tpl customize ✏️ Copy a gallery template into your Blueprint
crex skill install πŸ€– Install the agent skill for Claude Code (--codex for Codex)
crex skill show πŸ“„ Print the agent skill to stdout
crex completion πŸ”€ Generate shell completion scripts (bash, zsh, fish, powershell)

Key Flags

crex save -d "Friday standup layout"                   # πŸ’¬ attach a description
crex restore my-day --dry-run                          # πŸ‘οΈ preview without executing
crex watch autosave --interval 2m                      # ⏱️ custom interval
crex blueprint add api ~/projects/api -t dev --icon "βš™οΈ"  # βž• with template + icon
crex blueprint add notes ~/docs -t single --disabled      # βž• disabled by default
crex blueprint list --all                                 # πŸ“‹ include disabled entries
crex show my-day --raw                                 # πŸ” dump raw TOML
crex setup                                              # πŸ§™ run the first-time wizard
crex setup --defaults                                   # πŸ§™ accept all defaults (CI/scripting)
crex watch --daemon                                     # ⏱️ start background auto-persistence
crex watch --status                                     # ⏱️ check if daemon is running
crex watch --stop                                       # ⏱️ stop the daemon
crex watch --shell-hook                                 # ⏱️ print auto-start snippet for your shell

Try It: the Demo Layout

crex setup installs a portable example layout named demo β€” two workspaces (🏠 home, πŸ“ files with a split), every path home-relative (~, ~/Documents, ~/Downloads), no commands. It restores safely on any machine:

crex show demo                  # inspect it first
crex restore demo --mode add    # try it without touching your open workspaces

It's a real layout file (~/.config/crex/layouts/demo.toml) β€” edit it, re-save over it, or crex delete demo when done. Setup never overwrites your copy.

Layout cwd fields support ~ β€” expanded at restore time, so layouts written with home-relative paths are portable across machines.

Template Commands

The template command group (alias: tpl) lets you browse and use the built-in gallery.

crex template list

crex template list                    # all templates
crex template list --layout           # layout templates only
crex template list --workflow         # workflow templates only
crex template list --tag monitoring   # filter by tag
Flag Description
--layout Show only layout templates
--workflow Show only workflow templates
--tag <tag> Filter templates by tag

crex template list output showing all 16 templates

crex template show <name>

crex template show claude             # preview with ASCII diagram
crex template show ide                # see pane layout and metadata

Displays the template's icon, description, ASCII diagram, category, pane count, split sequence, and tags.

crex template use <template> [path]

Shortcut: crex template <name> is equivalent to crex template use <name>.

crex template use claude ~/project    # create workspace at path
crex template use ide                 # create workspace in current dir
crex template use cols --name "notes" # custom workspace title
crex template use claude --dry-run    # preview commands
Flag Description
--name <title> Workspace title (default: directory name)
--icon <icon> Workspace icon (default: template icon for workflows)
--dry-run Show commands without executing
--pin Pin the workspace after creation

crex template customize <name>

crex template customize claude        # fork to your Blueprint
crex template customize ide           # then edit with: crex edit

Copies the built-in template into your Blueprint. Your copy takes priority over the built-in version.

crex setup

crex setup                # interactive wizard
crex setup --defaults     # accept defaults (CI-friendly)
Flag Description
--defaults Accept all defaults without prompts

Steps: (1) detect backend, (2) create config, (3) ensure layouts dir, (4) offer first save.

crex tui

crex tui                  # launch the interactive shell
crex                      # also launches the shell when config exists

An inline REPL with a crex β†’ prompt. Type commands, browse listings with arrow keys, and manage your workspaces without leaving the shell.

Command Description
help Show all commands
now Show live terminal state
ls List saved layouts (browse with ↑/↓)
save [name] Save current layout
restore <name|#> Restore a layout
delete <name|#> Delete a layout
templates Browse gallery templates
use <name|#> Create workspace from template
bp list List Blueprint entries
bp add <name> <path> Add Blueprint entry
bp remove <name|#> Remove Blueprint entry
bp toggle <name|#> Enable/disable entry
settings banner set <style> Set banner style (flame, classic, plain)
settings banner get Show current banner style
settings banner list List all available banner styles
watch start|stop|status Daemon controls
skill install [codex] Install the agent skill
skill show Print the agent skill
exit Quit

Listings show numbered items ([1], [2], …) β€” use the number instead of the name in any command.

Tab completion β€” inside the TUI, press Tab or Shift-Tab to cycle through available commands and subcommands. Use Up/Down arrows to navigate history or listings. Press Escape to go back to the parent level.

Bare group commands β€” typing a group name alone (bp, settings) and pressing Enter shows its available subcommands without executing anything.

Command header β€” after a command is dispatched, the TUI displays a header identifying the command that ran. If a command is entered with incorrect usage, the prompt retains the input so you can correct it without retyping.

Watch Daemon Mode

crex watch --daemon                 # start daemon β€” saves as "autosave"
crex watch my-project --daemon      # start daemon β€” saves as "my-project"
crex watch --stop                   # stop running daemon
crex watch --status                 # check daemon status
crex watch --shell-hook             # print shell auto-start snippet
crex watch --shell-hook >> ~/.zshrc # install the hook

Default name: When no name is given, watch saves under autosave. To recover: crex restore autosave.

Flag Description
--daemon Run in background with PID file and log rotation
--stop Kill the running daemon
--status Check if the daemon is alive
--shell-hook Print a shell snippet that auto-starts the daemon
-i, --interval Save interval (default: 5m)

crex skill β€” teach your AI agents to drive crex

crex ships an agent skill: a reference document that teaches AI coding agents (Claude Code, Codex, and compatible tools) how to drive crex safely β€” non-interactive restore flags, snapshot-before-risk, AI-session resume semantics, and programmatic layout queries.

crex skill install           # β†’ ~/.claude/skills/crex/SKILL.md (Claude Code)
crex skill install --codex   # β†’ ~/.agents/skills/crex/SKILL.md
crex skill show              # print it (pipe anywhere you like)

Agents pick it up on their next session. Re-run install after upgrading crex to refresh it. Also available inside the TUI (skill install).

One Window Per Layout

A layout describes a single terminal window's worth of workspaces. With several windows open, crex save captures the window you ran the command in β€” not whichever happens to be frontmost β€” so saving from a background window stores what is actually in front of you there. To keep several windows, save each one under its own layout name.

Backend Differences

crex targets full parity between cmux and Ghostty; where the platform APIs differ, this is the honest map:

Capability cmux Ghostty
Per-tab working directory βœ… βœ…
Per-pane (split) working directory βœ… save + restore βœ… save + restoreΒΉ
Exact split arrangement (positions, sizes) βœ… pixel-exact ⚠️ splits recreated in order, geometry not capturedΒ²
Sub-tabs within a pane (multi-surface) βœ… ⚠️ restored as splits⁡
Browser panes βœ… opens URL in default browser
Browser profiles βœ… saved per pane, reapplied on restoreΒ³ β€” (no browser panes)
AI session resume βœ… per pane and per tab⁴ βœ… per pane

ΒΉ Ghostty reports each terminal's directory via OSC 7 (shell integration). When a shell doesn't emit OSC 7, crex falls back to the terminal title (user@host: ~/path), accepted only if the directory exists. Restore always sends each pane's cd.

Β² Ghostty's AppleScript API exposes no pane frames, so saved layouts restore their splits as a right-chain. Edit the layout's split = directions by hand (crex edit <name>) to customize β€” re-saves preserve your edits. Exact geometry lands with libghostty.

Β³ Each browser pane's profile is saved as profile = "<name>" in the layout β€” only the profile name, never cookies, logins, or any credential data (those stay in cmux's own per-profile storage). On restore, crex creates any missing profile as an empty bucket and asks cmux to open the pane with it; cmux applies the assignment from v0.64.21 (older cmux opens the pane on the default profile). Re-saves preserve the saved profile either way.

⁴ Every tab gets its own resume command, matched on that tab's working directory first β€” so a workspace holding one tab per git worktree, each with its own Claude Code session, comes back with each tab on its own conversation. Nothing to configure: run crex save <name> while the sessions are running. Each detected session is claimed exactly once, so tabs never steal each other's conversation.

⁡ Ghostty has no sub-tabs, so a cmux pane holding several tabs restores them as splits beside that pane β€” each keeps its own folder and its own session command. The arrangement differs from the original, but nothing you were working on is dropped. Saving on Ghostty never produces sub-tabs, so this only applies to restoring a cmux-saved layout there.

Common Recipes

Save before a reboot

crex save my-day
# reboot, then:
crex restore my-day

Set up a new machine from a Blueprint

# Copy your workspaces.md to the new machine, then:
crex import-from-md --workspace-file ~/workspaces.md

Preview before restoring

crex restore my-day --dry-run
# Review the output, then:
crex restore my-day

Auto-save every 2 minutes

crex watch --interval 2m            # saves as "autosave" (default name)
crex watch my-project --interval 2m # saves as "my-project"

Recover after a crash

crex restore autosave               # if using default watch name
crex restore my-project             # if using a custom name

Auto-start daemon on shell login

crex watch --shell-hook >> ~/.zshrc  # zsh
crex watch --shell-hook >> ~/.bashrc # bash

Set CREX_NO_WATCH=1 to disable auto-start.

Shell Completion

crex supports tab completion for commands, layout names, blueprint names, and flag values.

# Zsh (add to ~/.zshrc)
eval "$(crex completion zsh)"

# Bash (add to ~/.bashrc)
eval "$(crex completion bash)"

# Fish (run once)
crex completion fish > ~/.config/fish/completions/crex.fish

Homebrew users get completions automatically β€” no setup needed.

See Shell Completion for the full guide.


See also: Template Gallery | Workflows | Workspace Blueprints | Configuration | Shell Completion