From mjmendo-plugins
Re-attach Claude Code sessions to restored cmux panes after a reboot. Records cwd → session_id on Claude start and replays `claude --resume <id>` into each restored pane.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mjmendo-plugins:cmux-claude-resumeThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
cmux restores window layout, workspaces, and per-pane `cwd` after relaunch — but it does **not** restore the process running in each pane. After a reboot, panes come back empty: you lose the `claude` process and its session context, even though Claude Code itself keeps the session on disk and can be resumed.
cmux restores window layout, workspaces, and per-pane cwd after relaunch — but it does not restore the process running in each pane. After a reboot, panes come back empty: you lose the claude process and its session context, even though Claude Code itself keeps the session on disk and can be resumed.
This skill closes that gap by adding two pieces:
cwd → session_id to a small JSON state file.claude --resume <session_id> into every restored terminal pane whose cwd is known.Restore is anchored by directory, not by cmux pane UUID — robust to UUID churn and matches the one-worktree-per-directory mental model.
# Install everything (scripts → ~/.local/bin, hook → ~/.claude/settings.json,
# LaunchAgent → ~/Library/LaunchAgents)
bash "$(dirname "$0")/install.sh"
Re-run the installer at any time — it is idempotent.
# 1. Confirm the Claude hook is wired.
jq '.hooks.SessionStart' ~/.claude/settings.json
# 2. After opening a Claude Code session inside a cmux pane,
# confirm the state file got updated.
cat ~/.local/share/cmux-claude-resume/state.json
# 3. Preview what the restorer would do without sending anything.
cmux-claude-restore --dry-run
bash "$(dirname "$0")/uninstall.sh"
State file is preserved on uninstall — delete ~/.local/share/cmux-claude-resume/state.json manually if you want a clean slate.
| File | Path | Purpose |
|---|---|---|
cmux-claude-record | ~/.local/bin/ | Claude SessionStart hook handler |
cmux-claude-restore | ~/.local/bin/ | One-shot restorer (run by watcher or manually) |
cmux-claude-resume-watcher | ~/.local/bin/ | Polls for cmux up-transitions and fires the restorer |
com.mjmendo.cmux-claude-resume.plist | ~/Library/LaunchAgents/ | Keeps watcher running across login sessions |
| state | ~/.local/share/cmux-claude-resume/state.json | cwd → {session_id, ts} mapping |
| logs | ~/Library/Logs/cmux-claude-resume.log | Watcher & restore output |
cwd has a recorded session_id.read-screen).cwd, only the first one gets resumed. Open a worktree-per-pane for clean 1:1.htop open).# Tail the watcher log
tail -f ~/Library/Logs/cmux-claude-resume.log
# Re-load the LaunchAgent (after install changes)
launchctl unload ~/Library/LaunchAgents/com.mjmendo.cmux-claude-resume.plist
launchctl load ~/Library/LaunchAgents/com.mjmendo.cmux-claude-resume.plist
# See where Claude's session files live (so you know what's being resumed)
ls ~/.claude/projects/
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub mjmendo/claude-plugins --plugin mjmendo-plugins