Drowning in Claude Code sessions (and how I survive)

Leer en español

The idea

Each Claude Code chat lives in its own tmux window and comes back to its conversation after a restart. The status bar tells me which one is waiting for me, and a dedicated Claude sorts the windows and hands out the work.

I went from more than 50 Chrome tabs to more than 20 Claude Code sessions, one per tmux window. That gives me five problems:

  1. not losing any session
  2. knowing which one needs me
  3. finding a session
  4. not forgetting work
  5. handing work between sessions

Here a session is a Claude Code chat. When I mean a tmux session I say so.

Before we start

The config and the cc-* scripts are in my dotfiles. You need tmux 3.8. Key bindings use the prefix, which I set to Ctrl+a, so prefix C means Ctrl+a and then C.

Not losing any session

At first I restored my sessions with tmux-resurrect and claude --continue. tmux-resurrect re-runs the command of each pane after a restart. But claude --continue opens the latest chat of the directory, so five panes in the same folder all came back to the same chat.

Each pane goes back to its chat: ccr

ccr (with alias cc=ccr) pins a session uuid in its own command line:

#!/bin/zsh
if [[ "$1" == -* ]]; then
exec claude "$@"
fi
id="$1"
if [[ "$id" =~ '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' ]]; then
shift
else
exec "$0" "$(uuidgen | tr '[:upper:]' '[:lower:]')" "$@"
fi
session_files=(~/.claude/projects/*/"$id".jsonl(N))
if (( ${#session_files} )); then
claude --resume "$id" "$@"
else
claude --session-id "$id" "$@"
fi

Autosave

set -g @resurrect-processes '~ipython ~ccr "claude->claude-restore"'
set -g @resurrect-strategy-nvim 'session'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '5'

tmux-continuum saves every 5 minutes and restores when tmux starts. It runs ccr and ipython again, and nvim with its session.

A pane saved as plain claude goes through claude-restore. This small script takes the uuid from the saved --resume or --session-id and runs ccr <uuid>. With no uuid it leaves a shell with a note. The old fallback, claude --continue, brought back the wrong chat.

prefix r is dangerous

prefix r reloads the config with source-file, which overwrites status-right. tmux-continuum saves from a command in status-right, so after a reload autosave died silently until the next restart. A restart once gave me back a layout from two weeks earlier.

The fix is to write the hook in the config by hand, with the plugin’s absolute path. #{@cc_count} is the counter from the next section.

set -g status-right "#{@cc_count}#[default]#($HOME/.tmux/plugins/tmux-continuum/scripts/continuum_save.sh) %Y-%m-%d %H:%M "

After a reload, this command must print 1:

Terminal window
tmux show-option -gv status-right | grep -c continuum_save

Knowing which one needs me

With twenty sessions I had to go window by window to see which had finished and which was waiting on a permission prompt. Window names did not help, because almost every window was named after the same repo folder.

One status icon per window

Claude Code hooks in ~/.claude/settings.json call cc-tmux-state. It keeps the state of each pane and draws an icon before the window name: yellow working, green done, red asking for permission.

Claude Code hookCommand
UserPromptSubmitcc-tmux-state working
Notification (permission_prompt)cc-tmux-state attention
PostToolUsecc-tmux-state resume
Stopcc-tmux-state done
SessionEndcc-tmux-state clear
setw -g window-status-format " #I #{@cc}#[default]#W "
set-hook -g pane-focus-in 'run-shell -b "$HOME/.local/bin/cc-tmux-state seen #{pane_id}"'

pane-focus-in marks the pane as seen, so green lasts until I look at the window. Red lasts until I answer, because only PostToolUse clears it, once the approved tool has run.

tmux status bar with one icon per window: red asks for permission, green done, yellow working, and the count of reds and greens on the right

On the right, #{@cc_count} counts the red and green panes. prefix A opens a popup with them, permission prompts first, then the finished turns I have not seen, oldest first.

Animated demo: login-timeout turns red when it asks for permission, prefix A opens the popup with it first, Enter jumps to it, answering Yes turns it yellow and the counter drops to two greens

Windows with a useful name

The Stop hook calls cc-tmux-name, which renames the window after the session title. It only touches single-pane windows with a generic name (the directory, zsh) or a name it set before, never one I set by hand.

When the automatic title is long or vague, the /tmux-name skill makes the session name itself, <ticket>-<slug> when there is a ticket or PR. It renames the window and the chat so the hook does not overwrite it.

Telegram notifications

Ghostty desktop notifications do not get through tmux (I tried OSC 9 and 777, with and without allow-passthrough). When I want to know that something finished, a bot sends me a Telegram message. It is one curl to api.telegram.org/bot<token>/sendMessage, wrapped in a skill.

Finding a session

Finding the session for a given PR, among open windows and closed chats, took a while every time. And in a single tmux session, current work got mixed with finished work and work waiting on another team.

Session index: prefix g and prefix G

sessions.py is unpublished, because it is tied to my Jira and my repos. It reads every transcript under ~/.claude/projects/ and keeps a local index with one line per session: last activity, directory and title. Each line also lists the PRs and tickets the session acted on (opened the PR, pushed, moved the ticket), with their live status.

Terminal window
python3 ~/.claude/skills/sessions/sessions.py [all] [query] [--sync]

With no arguments it opens fzf over every session. I filter with PROJ-1234, open or draft, and Enter resumes the session in its directory with ccr.

From tmux I use two bindings.

prefix G popup: fzf over every tmux pane with window, Claude session name and title, and a preview of the pane

It is also a Claude Code skill, so “go back to the session for PR 2032” works from a chat.

Three tmux sessions: doing, parked and oncall

Update, November 2026: I now run about eight tmux sessions, one per topic, and dropped parked and the board window. The idea is the same.

Claude sorts the windows

Windows change state all the time. A PR gets merged, or a parked session is needed again. From board I ask Claude to sort them with the tmux-board skill.

Claude reads the summary of each session and the status of its PRs and tickets. It proposes what goes to doing and what to parked, and better names for windows with a generic one. It only moves them when I say yes.

It uses move-window, so the window keeps its process, its ccr with the uuid and its icon. resurrect restores each tmux session by name.

Not forgetting work

I used to forget work, like a session left halfway or a deployed ticket that nobody validated.

/todo and the board window

/todo is a Claude Code skill, also unpublished. It pulls from the Atlassian MCP, gh and the session index, and puts in one view:

A hook flags the stale tickets. When a session closes, SessionEnd calls cc-session-end, which checks whether the session left a ticket out of date (a merged PR with the ticket still open, for example). It writes the ticket to ~/.claude/ticket-followups.tsv and shows it for 8 seconds in the status bar. It never touches Jira.

/todo joins everything by ticket and splits it by whose move is next:

## Your move
| Ticket | Next step | Window |
| PROJ-1234 timeout | validate in production | doing:4 |
| PROJ-1235 tokens | start (2 weeks in To Do) | |
## Waiting on others
- PROJ-1236 → review by a teammate on repo#123 · doing:6
## Done (7 days)
- Tickets: PROJ-1230, PROJ-1231

Each row names the next step and the window, so I jump there with prefix G. PROJ-1235 is the kind of ticket I used to lose, two weeks in To Do and no session open.

I run /todo from board. A pending task that needs its own session gets one with cc-spawn, or I go back to the existing one with prefix g.

Handing work between sessions

In the middle of a task I would spot a fix outside its scope, or want to split design from execution. Switching sessions made me lose the thread.

cc-spawn

Terminal window
cc-spawn [-p] [-w <branch>] <name> [dir]

It opens a new window (or a pane with -p) that runs ccr <uuid> --name <name> and prints the session uuid.

From tmux, prefix C asks for a name and runs cc-spawn in the current directory.

cc-spawn works best from a Claude session. In login-timeout I see the README is out of date and tell the session to fix it on the side. It runs cc-spawn -w docs-readme docs-readme, hands over the task in a file with a message between sessions (SendMessage) and keeps going. When the README is done, it tells me in one line.

Animated demo: in login-timeout I ask to update the README on the side, the session runs cc-spawn, window 5 docs-readme appears yellow, turns green, and one line comes back to the first session

The two sessions can keep talking in both directions. I only look at the new window if its icon turns red.

Extras

Popups

A quick command used to mean opening a pane and closing it afterwards. Popups open on top of the layout and go away when done:

KeyWhat it does
spick a session with fzf and preview
Pattach to another session
Ztmux-sessionizer (one session per project)
Obrowse sessions with tmux-oil.nvim
Dedit the dotfiles, commit and push on close
Jsearch Jira tickets
Ncreate a ticket

T is not a popup. It opens TODO.md in a 20% split on the left. tmux-fzf-session and tmux-sessionizer are in the dotfiles. jira-fzf and jira-new are unpublished scripts of mine on top of the Jira CLI.

Plugins

set -g @plugin 'tmux-plugins/tpm' # Plugin Manager
set -g @plugin 'tmux-plugins/tmux-sensible' # A set of tmux options that should be acceptable to everyone.
set -g @plugin 'tmux-plugins/tmux-resurrect' # Restore tmux environment
set -g @plugin 'tmux-plugins/tmux-continuum' # automatic restore and continuous saving of tmux env
set -g @plugin 'tmux-plugins/tmux-open' # open on selection: o, c-o, s-s
set -g @plugin 'wfxr/tmux-fzf-url' # fzf for urls in tmux: c-u

Wrapping up

Good design

I built all this without patching any tool, and to me that is good design. tmux lets any script read and change its state. Claude Code reports every event through a hook and can be launched and resumed from the terminal. fzf turns any list into a picker.

If you try only one thing, make it ccr, twenty lines that make your sessions survive a restart. Second is the status icon, five hooks and one tmux line.