Expand description
Teaching tmux-resurrect which conversation each pane was on.
tmux-resurrect saves a pane’s command line and restores it verbatim, which for a claude pane means a NEW session in the right directory: the conversation is lost. This rewrites the save file so each pane comes back on the conversation it was actually having.
Every rule here exists because the failure mode is losing a saved layout, and that is not recoverable:
- The join is of one moment. The save file names a pane by
session/window/pane INDEX,
print-cmdsnames it by pane ID, and only tmux joins the two, so both are read while the panes are still live. - Only field 11 is ever touched, so the line count cannot drop, and a rewrite that lost lines is refused rather than written.
- The temporary file lives beside the target, not in
/tmp: across filesystemsmvstops being a rename and stops being atomic. Two continuum saves DO overlap in practice, so a half-written save is a real outcome. - The symlink is followed, not replaced:
lastpoints at the timestamped save and resurrect reads it through that link. - A pane with nothing to replay still comes back as claude, in the right directory. An empty pane where a session used to be is silent; a claude prompt there says come and look at this one.
Structs§
Functions§
- commit
- Write the rewritten save file over the target, atomically, refusing anything that lost lines.
- decide
- Work out what each pane should come back as.
- fresh_
from_ saved - The command a save file holds for one pane, stripped back to a FRESH claude: everything it was launched with except the flags that claim a conversation.
- rewrite
- The save file with each mapped pane’s command replaced.