~ $ man statusline-for-worktrees-and-multi-instance

Statuslines for git worktrees and parallel Claude Code sessions

6 min · updated

Once you run more than one Claude Code session — one per task, one per repo, agents in tmux panes — the failure mode changes. The question is no longer "how full is my context?" but "which session am I even looking at?" Typing into the wrong instance is how a refactor lands on the wrong branch. The statusline is the cheapest fix: put workspace identity on every line.

The four workspace segments

The statusLine payload carries everything needed to identify a session:

"workspace": {
  "current_dir": "/home/you/project",
  "project_dir": "/home/you/project",
  "git_worktree": "feature/polish",
  "repo": { "host": "github.com", "owner": "you", "name": "project" }
},
"worktree": {
  "name": "project",
  "branch": "feature/polish",
  "path": "/home/you/project/.claude/worktrees/feature-polish"
}

A layout that scales to parallel sessions

Identity belongs at one end of the line, session state at the other. A proven arrangement for multi-instance work:

project ⎇ feature/polish [wt] | Opus 4.8 | ctx 26% | 5h 42%

Identity first — your eye lands on the left edge when switching panes. In the builder, enable Directory, Git, and Worktree from the Workspace group and move them to the top with the reorder arrows; the live preview shows the result at 64, 88, and 120 columns.

Narrow widths: what to drop first

tmux panes get narrow. With three panes on a laptop you may have 70 columns each, so decide the trimming order deliberately rather than letting the line wrap:

Width handling comes through the COLUMNS environment variable — tmux sets it per pane, so each session trims independently. The generated runtime does this automatically; if you hand-roll, see the COLUMNS pattern.

Pair it with tmux

The statusline identifies the session inside a pane; your tmux status bar should identify the pane layout itself — window names, host, time. Splitting the responsibilities keeps both lines short. The companion guide, tmux + Claude Code, covers the window-per-task layout, and status bar design covers the tmux half.