Install rz
brew tap marianposaceanu/tap
brew install rz
The dotfiles Brewfile includes the same native Rust formula.
Source and tagged versions live in the standalone
rz repository.
Daily shortcuts
| ⌘ F | Search native scrollback |
| ⌘ G | Move to the next search result |
| ⌘ ⇧ G | Move to the previous search result |
| ⌘ ⇧ P | Find a terminal by title or working directory |
| ⌘ ⇧ ` | Toggle the scratch terminal while Ghostty is focused |
| ⌘ ⇧ E | Open a complete scrollback export for saving |
| ⌘ Z | Restore a recently closed tab or split |
One-shot split navigation
Press ⌘ ⇧ Space, then one key. Use h, j, k, or l to move; n for a tab; v to split right; or s to split down. Ghostty exits the mode after the action.
Save before quitting
rz --save work # full snapshot with scrollback
rz --save work --no-scrollback # faster snapshot
rz --save work --current-window # only the front Ghostty window
rz --save personal # a separate named workspace
| Measured time | Snapshot |
|---|---|
| about 2.21s | Full snapshot, 8 tabs and 14 surfaces |
| about 1.06s | Fast snapshot without scrollback capture |
Restore after reopening Ghostty
rz # replace current windows with newest snapshot
rz --session work # replace them with newest snapshot named work
rz --keep-existing # restore without closing current windows
rz --list # inspect available snapshots
rz --list 3 # inspect snapshot number 3 from the list
rz --session work --dry-run
rz restores window position and size, tabs, terminal counts,
focus, working directories, exact Codex conversation IDs, exact Amp
thread IDs, exact Claude Code session IDs, and any captured scrollback.
The save confirmation lists each captured tab title with its window and
tab position, such as TAB 1.3.
rz records the existing Ghostty window IDs, creates the full
restored workspace, and only then closes the recorded windows with
Ghostty's supported close_window action. When Ghostty protects
a running process with its Close Window? sheet, rz
confirms that exact prompt through macOS Accessibility. Restored terminals
wait until closure finishes before resuming Codex conversations, Amp
threads, or Claude Code sessions.
rz considers only supported Codex, Amp, and Claude Code processes
launched under Ghostty. It matches an exact working directory first, then
uses a unique project title or the same agent session's unique title from a
previous snapshot when Ghostty reports a blank directory. Restored terminals
report their directory back to Ghostty before the agent starts. Ambiguous
matches are left as shells and the warning includes the exact ID and TTY.
Remove old snapshots
rz --clean # purge snapshots older than 7 days
rz --clean 30d # keep the last 30 days
rz --clean 2.weeks # friendly long-form duration
Cleanup uses the recorded saved_at time and permanently
removes the complete snapshot directory, including captured scrollback.
Ages accept seconds, minutes, hours, days, or weeks in forms such as
12h, 7d, 7.days, and
2.weeks. The result lists every purged snapshot. Malformed
or unsafe entries are kept and reported as warnings.
Automatic, without a global service
Start a watcher from the shell that should own it. It saves immediately, then repeats at the requested interval. The watcher uses fast snapshots without scrollback and stops when its owning shell or Ghostty tab exits.
rz --watch backup --every 15m
rz --watch-status
rz --watch-stop
--all-windows only when that broader scope is intentional.
rz --watch backup --every 30m --all-windows
Intervals accept seconds, minutes, or hours, such as 30s,
15m, or 1h, with a ten-second minimum. Watcher
state and logs live in ~/.local/state/ghostty-rz/watchers.
Snapshots accumulate until you remove them; the watcher does not prune
previous backups automatically.
Inspect or repair the live workspace
The launcher claims existing tabs by working directory and creates only missing ones. It does not inject commands into an existing terminal.
Guaranteed read-only preview
osascript ~/dot-files/ghostty/scripts/workspace-open.applescript --dry-run
Ensure declared tabs and print the inventory
osascript ~/dot-files/ghostty/scripts/workspace-open.applescript
osascript ~/dot-files/ghostty/scripts/workspace-inventory.applescript
macOS choices
- Native titlebar tabs and restored window state.
- AppleScript support for inspection and snapshots.
- Exact pixel resizing instead of cell-step resizing.
- Secure-input indication during password entry.
- macOS shortcuts denied so configured Ghostty bindings win.
- An instant scratch terminal at 35% of screen height.
Honest restoration limits
- Ghostty exposes terminal surfaces, not split trees or pane proportions.
- Additional surfaces therefore restore as right-hand splits.
- Scrollback replays as plain text, not as a running process.
- Codex, Amp, and Claude Code resume from their exact IDs; arbitrary programs cannot be reconstructed.
- Window geometry and automatic close confirmation need macOS Accessibility permission for the shell that runs
rz. - A window-scoped snapshot restores that saved window into one new Ghostty window.
--keep-existing for the previous additive behavior.
Source files
- ghostty/config - commented Ghostty configuration
- rz/src - native Rust snapshot, restore, agent, watcher, and UI implementation
- rz/libexec/snapshot-capture.applescript - live Ghostty and scrollback capture
- workspace-open.applescript - idempotent workspace repair
- workspace-inventory.applescript - read-only TSV inventory