Skip to content

02 · Terminal & Session Management

S2 · Pattern 🔬 Research 2026-04-17

Looking for the quick answer? Jump to stack.md — one-page summary of the picks at every layer (emulator through shell) with the layer diagram. This page is the deeper “why” for the mux + launcher layers.

Looking for keybindings? See hotkey-reference.md — full keymaps for every tool.

An AI coding session can last hours. It should survive:

  • Network drops — momentary disconnect shouldn’t kill the conversation
  • Device switches — start on desktop, continue on phone via SSH
  • Multiple projects — jump between projects without losing any session
  • Pane arrangements — editor, terminal with Claude, logs, all visible

A terminal multiplexer is how this happens. It decouples “the session” from “the current shell process.” Pick one, standardize it, build muscle memory around its keybindings, and the rest of the stack composes onto it.

  • Why primary: modern Rust implementation, discoverable keybindings (status bar shows shortcuts), floating panes, tabs with native visuals, works cleanly over SSH with Termux, works with OpenCode and Claude Code alike.
  • Tradeoff: less universal installed-base than tmux; configs don’t transfer.
  • Install: cargo install zellij or prebuilt binary from GitHub releases.
  • Config: ~/.config/zellij/config.kdl.
  • Why fallback: universally installed, battle-tested, works anywhere. Some tools (OpenCode in particular) have historically had quirks inside tmux — worth noting if you go that route.
  • Install: apt install tmux or equivalent.
  • Config: ~/.tmux.conf.
  • Repo: github.com/cybersader/portagenty
  • What it is: a terminal-native TUI launcher I built for agent workspaces. Define sessions in TOML, launch over tmux or Zellij, hop between devices with pa claim. Single static Rust binary.
  • Why built: the default flow — manually spawning Zellij sessions, remembering project paths, reattaching by session name — didn’t scale when I had many projects. Portagenty makes “get me back to project X” a one-key action.
  • Status: active personal tool, used daily.
DimensionZellijtmuxWezTerm
Install ubiquityNewer, requires installPre-installed everywhereMust install
Modifier conventionsCtrl + letter (status bar shown)Ctrl+B prefix (hidden)Native macOS-like shortcuts
Plugin ecosystemGrowingHuge, stableTied to WezTerm itself
OpenCode compatibilityWorks wellHistorical issuesWorks
Keybinding editingKDL configtmux.confLua config
Over-SSH behaviorGoodExcellent (oldest)N/A (terminal, not mux)
Cross-device sessionYes (zellij attach)Yes (tmux attach)No (local only)

Default pick if you’re starting fresh: Zellij. The discoverability alone saves hours of keybinding reference lookups.

Keep using tmux if: you already have years of tmux muscle memory. No reason to switch for its own sake.

WezTerm is a great terminal emulator (my preferred one on Windows/Linux). Its native multiplexer is local-only — not designed for cross-device SSH reattach. Zellij/tmux sit inside WezTerm (or any terminal) and handle the session layer; WezTerm handles the emulator layer.

These live in ../profiles/bashrc-snippets/zellij-helpers.sh and related files. Short names; long type-savings:

HelperWhat it does
z <name>cd into project + attach to its Zellij session (or create)
zk <name>kill session
zllist sessions
zr <name>resurrect a dead session
zddetach current
zfixreset a broken session
ccclaude with permission prompts (default)
ccyclaude --dangerously-skip-permissions (quick iteration on trusted tasks)
ccrresume the most recent Claude session
ccpclaude --continue with parent project detection

These assume Zellij + Claude Code are both installed. Copy the snippets into ~/.bashrc (the rebuild flow does this during setup).

Portagenty’s core model:

~/.portagenty/workspaces.toml
[[workspace]]
name = "agentic-workflow"
path = "/path/to/agentic-workflow-and-tech-stack" # wherever you checked out this repo
launcher = "zellij"
session_name = "agentic-workflow"
on_attach = ["claude --continue"]
[[workspace]]
name = "cynario"
path = "/path/to/cynario"
launcher = "zellij"

Running pa → select workspace → lands me in the right directory with the right session ready. pa claim transfers session ownership between devices when I SSH in.

pa convos — Claude Code session bridge across path changes

Section titled “pa convos — Claude Code session bridge across path changes”

Portagenty ships a sibling pa convos shim that forwards to the standalone pconv binary with the current workspace TOML auto-injected. Claude Code keys conversation history to the absolute cwd path at launch, so /resume goes blind whenever that path changes: moving or renaming a project folder, checking it out at a new path, or switching between WSL (/mnt/c/…) and PowerShell (C:\…) all produce separate encoded buckets under ~/.claude/projects/. Session bodies also bake in OS-specific absolute paths, so file-level copy/symlink merges storage but not content. pconv reads every bucket and can rewrite paths (/mnt/c/…C:\…) so a dump from the old cwd pastes cleanly into a fresh session at the new one. Deep dive in 01 · AI Coding — Session recovery across path changes.

ToolCommand
Zellijcargo install zellij or release binary
tmuxapt install tmux / brew install tmux
PortagentySee portagenty README
portaconv (pconv)cargo install --git https://github.com/cybersader/portaconv — see portaconv README
WezTermwezterm.org/install/
ServesWith
01 · AI Coding CLIsSurvives the long sessions these CLIs run
03 · Cross-DeviceZellij session survives SSH disconnect; Termux reattaches