| name | cmux-backup |
| description | Backup all cmux workspaces, surfaces, and their current working directories via the socket API. Produces a timestamped JSON snapshot at ~/.cmux-backups/. |
| metadata | {"type":"skill"} |
cmux-backup
Snapshot all cmux workspaces + surfaces + per-workspace CWD/git state to
~/.cmux-backups/<timestamp>.json via the cmux Unix socket API.
Invoke
/cmux-backup
Or manually:
~/.claude/scripts/cmux-backup.sh
What it captures
| Field | Source |
|---|
| workspace id, title, index, selected | workspace.list JSON API |
| workspace current_directory | workspace.list .current_directory |
| workspace cwd (shell-reported) | sidebar_state --tab=<ws_uuid> → cwd= |
| workspace focused_cwd | sidebar_state → focused_cwd= |
| workspace git_branch | sidebar_state → git_branch= |
| workspace PR info | sidebar_state → pr=, pr_label= |
| surface id, title, type, pane_id | surface.list JSON API |
Output format
{
"timestamp": "2026-05-18T12:34:56",
"socket": "/Users/.../cmux.sock",
"workspace_count": 26,
"workspaces": [
{
"id": "8DAE7F5B-...",
"title": "worktree_level_choices",
"index": 0,
"selected": false,
"current_directory": "$HOME",
"cwd": "$HOME/projects/worktree_level_choices",
"focused_cwd": "$HOME/projects/worktree_level_choices",
"git_branch": "feat/level-choices",
"pr": "123",
"surfaces":
Protocol used
SOCK="$CMUX_SOCKET"
printf '{"method":"workspace.list","params":{}}\n' | nc -U "$SOCK"
printf '{"method":"surface.list","params":{"workspace_id":"<uuid>"}}\n' | nc -U "$SOCK"
printf "sidebar_state --tab=<workspace_uuid>\n" | nc -U "$SOCK"
Dev build sockets
cat ~/Library/Application\ Support/cmux/dev-may-18-last-socket-path
lsof -p $(pgrep -f "cmux DEV may-18") | grep -E "\.sock"
CMUX_SOCKET_PATH=/tmp/cmux-debug-may-18.sock cmux list-workspaces
CMUX_SOCKET_PATH=/tmp/cmux-debug-may-18.sock cmux tree
Companion restore skill
~/.claude/scripts/cmux-restore.sh [--backup <file>] [--dry-run] [--list]
- Skips workspaces already present by title
- Creates missing ones with
workspace.create + surface.send_text cd
- Headless — never calls
select_workspace
Rules
- Never call
select_workspace — read-only snapshot only.
- Use
$CMUX_SOCKET env var first; fall back to
~/Library/Application Support/cmux/cmux.sock.
- Write backup to
~/.cmux-backups/cmux-backup-<timestamp>.json.
- Print a summary table to stdout (workspace index, title, cwd, git branch).