A small tmux wrapper that hides numeric suffixes and collapses grouped sessions, so you see one logical name per session instead of a list of near-duplicates.
Why
I run a lot of parallel Claude Code sessions in tmux — one per project or experiment. Two things got annoying:
-
tmux attach -t <name>,tmux new -s <name>,tmux kill-session -t <name>is a lot of typing for something I do dozens of times a day. -
tmux lets multiple sessions share the same windows via session groups. If you're moving fast and run
tmux new -s frontendwhen afrontendsession already exists, tmux (or whatever wrapper your terminal uses) quietly creates a grouped duplicate with an auto-appended number —frontend-38,frontend-39, and so on. Some setups (iTerm's tmux integration, attach helpers) do the same thing onattach, which is more annoying because you weren't even trying to make a new session. Either way the list grows into something like:backend-5 backend-27 backend-28 frontend-37 frontend-38 frontend-39 frontend-40 frontend-41Every
frontend-*row is the same underlying workspace with independent focus. Finding the one you actually want to attach to is noise.
tmuxx collapses each group down to one logical name and gives you short
verbs — tmuxx, tmuxx frontend, tmuxx kill frontend. tmuxx <name>
attaches if the session exists and creates it if it doesn't, so you never
have to think about which one you need. kill removes every member of the
group, so you don't have to clean up stragglers by hand.
Install
Drop tmuxx somewhere on your PATH and make it executable:
curl -o ~/.local/bin/tmuxx https://raw.githubusercontent.com/timsayshey/tmuxx/HEAD/tmuxx chmod +x ~/.local/bin/tmuxx
Requires tmux and bash.
Usage
tmuxx list sessions (one per group)
tmuxx <name> attach to session (creates it if it doesn't exist)
tmuxx kill <name> kill a session (all members of its group)
tmuxx save snapshot all sessions (windows, panes, cwds, layouts)
tmuxx restore recreate saved sessions, e.g. after a reboot
tmuxx -h | help show help
tmuxx <name> resolves <name> to the attached session in that group, or
the most recent one if none are attached. If no session exists yet, it
creates one. tmuxx kill removes every session in the group, not just one
member.
If you're already inside tmux, tmuxx <name> uses switch-client instead
of attach-session.
Save & restore across reboots
tmuxx save writes a snapshot of every session group — its windows, window
names, pane splits, each pane's working directory, and the window layout —
to a flat tab-separated file, by default:
~/.local/state/tmuxx/sessions.tsv
Override the location with TMUXX_SAVE_FILE. Grouped duplicates collapse to
one entry, same as the session list.
After a reboot, tmuxx restore recreates each saved session detached:
windows in their original order and names, panes split back into the saved
layout, each pane starting a fresh shell in its saved directory. Sessions
that already exist are skipped, so restore is safe to run repeatedly.
Panes come back as shells, not running programs — the command that was running in each pane is recorded in the save file (handy for remembering what was where), but it isn't relaunched automatically.
You rarely need to run tmuxx save by hand: every tmuxx invocation
(tmuxx, tmuxx <name>, tmuxx kill, tmuxx tab, ...) quietly refreshes
the save file as a side effect, so it always reflects the state as of the
last time you touched tmuxx. Attaching saves before the attach and again
when you detach. The explicit tmuxx save is still there for forcing a
checkpoint (it's the only one that prints a confirmation).
Two deliberate wrinkles: killing a session removes it from the save file (you asked for it to be gone), but if no sessions are left the autosave skips instead of truncating, so the last good snapshot survives — e.g. when the server dies before a reboot.
License
MIT. See LICENSE.