← Back to Projects
WSLtmuxWindows TerminalBashClaude CodeProductivity

Terminal Persistence

Windows Terminal + WSL Ubuntu + tmux setup that survives reboots. Open the terminal after a restart and you're back in the same Claude Code session, same working directories, same panes — zero manual steps.

Why this exists

Windows Terminal has no process persistence — close the window and every shell dies. For anyone doing long-running work (a Claude Code conversation, a background build, a long SSH session), that’s a constant source of lost context. The fix isn’t a terminal feature; it’s a session manager inside the shell.

How it works

Windows Terminal (startup = WSL Ubuntu)
        │
        ▼
WSL Ubuntu  →  ~/.bashrc  →  tmux attach -t claude  (or new -s claude)
                                    │
                                    └── tmux-resurrect + tmux-continuum
                                        (snapshot every 15 min, auto-restore on start)

tmux is a persistent server process that owns the shells. Terminal windows are just clients that attach and detach — closing one doesn’t disturb the processes underneath. After a Windows reboot, tmux-continuum restores the last snapshot automatically when the tmux server is started by the first new shell.

What’s in the repo

FilePurpose
scripts/bashrc-snippet.shAuto-attach block appended to ~/.bashrc
scripts/tmux.confPlugin config + sane defaults, self-bootstraps tpm
scripts/install.shIdempotent installer — tpm, bashrc patch, plugin install
scripts/windows-terminal-settings.mdJSON patch for Windows Terminal settings.json

Key design decisions

  • Default user is root in this WSL — installer respects that rather than fighting it.
  • Claude auto-start is off by default — uncommented only after installing claude CLI in WSL, so the snippet never loop-fails on a missing binary.
  • VS Code terminal is excluded — VS Code manages its own terminal lifecycle; grabbing it with tmux causes weird double-attach behaviour.
  • exit after tmux detach — closes the outer bash too, so the window doesn’t leave a detached shell hanging around.

Built April 2026.


Features

  • Auto-attach to a persistent tmux session named `claude` on every WSL launch
  • tmux-resurrect + tmux-continuum snapshot every 15 minutes so layout survives full Windows restart
  • Idempotent installer — safe to re-run, backs up existing `~/.tmux.conf`
  • Self-bootstrapping tmux config: clones tpm on first run if missing
  • Opt-in Claude Code CLI auto-start inside the session
  • Windows Terminal `persistedWindowLayout` layered on top for tab/pane UI restore

Releases

v1.0

April 2026 · Latest