On 21 September Mistral announced that GLM 5.3 would be served on its own infrastructure, and that tipped me off Claude Code and onto Vibe. The model is the reason I switched, but the habit that stuck is a small function I wrote the same week.
An agent that works for ten minutes on its own is a different animal from a REPL you type into. The session now outlives the terminal you started it from, and if the terminal dies — SSH dropped, lid closed, train through a tunnel — the work should not die with it. tvibe is the four-line answer:
tvibe() {
if [ -n "$TMUX" ]; then
echo "already inside tmux" >&2
return 1
fi
local n="${PWD#"$HOME"/workspace/}" # strip the common prefix
n="${n#/}" # only left for paths outside the prefix
n="${n//\//_}"
n="${n//[.:]/_}" # tmux rewrites . and : in session names
n="${n:-workspace}" # bare $HOME/workspace edge case
if tmux has-session -t "=$n" 2>/dev/null; then
tmux attach -d -t "=$n"
else
tmux new -s "$n" vibe --resume
fi
}
Type it in any project and you get one tmux session named after that project’s folder, with Vibe running inside it.
What the name encodes
The session name is derived from $PWD, not chosen by hand: everything below ~/workspace becomes a name with /, . and : mapped to _. So ~/workspace/riphixel/blog gives riphixel_blog and ~/workspace/riphixel/My.Did gives riphixel_My_Did.
Two details in there are worth keeping rather than simplifying. tmux does rewrite . and : in session names on its own — I created dot.name and col:on against a throwaway server and both came back as dot_name and col_on — but doing the substitution explicitly keeps the mapping predictable and documents the intent. And has-session -t "=$n" uses tmux’s = prefix for an exact session-name match; the plain form falls back to prefix matching, which is exactly how you end up attaching to the wrong session when two projects share a prefix.
The connection drops
This is the case the function exists for. The agent keeps running on the server while SSH is gone, and the transcript keeps growing. When the link comes back, tvibe in the same folder reattaches to the same session and you pick up where you left off, with the agent’s output already scrolled past.
The -d on tmux attach -d is what makes that bearable: it detaches any other client first, so the machine you are typing on takes the session over instead of failing to attach because a stale desktop client still holds it.
From laptop to phone
The session is bound to the folder, not to the terminal that opened it, which is what makes device-hopping work. From the laptop I am cd ~/workspace/riphixel/blog && tvibe; from the phone, ssh into the same box, same cd, same command, same session. Nothing has to be saved, synced or resumed by identifier — the folder is the key.
It also means two projects in two terminals are genuinely two sessions. tmux ls reads like a list of projects rather than a list of numbered terminals, so tmux attach -t riphixel_blog from anywhere gets you back into the right context.
Two things to know
vibe --resume without a session id opens an interactive picker, so running tvibe again in a folder that already has a session lets you choose which of that project’s sessions to continue. If you would rather have the most recent one automatically, vibe --continue is the flag to swap in — it continues this terminal’s last session in the folder, falling back to the folder’s most recent.
The other one is a housekeeping habit: rename or move a project directory and the next tvibe creates a new session under the new name, leaving the old one running. tmux ls still shows it, and tmux kill-session -t <old-name> cleans it up. Outside ~/workspace the prefix strip does not match and you get a longer name built from the full path — ugly, but still stable, so the behaviour degrades without breaking.