Skip to content

Show active cwd, worktree, and git branch at the bottom of each session #17

@goyamegh

Description

@goyamegh

Summary

Show the active session's cwd, the enclosing git worktree (when different from the cwd), and the current git branch in a small status strip at the bottom of the session view (below the message list, above or alongside the composer).

The existing status bar at the top of the session shows the session title and connection state. It doesn't tell you where the agent actually is on disk or which branch is checked out — information that is critical when you have many concurrent sessions across different repos / worktrees / branches.

Why this matters

  • Many sessions, many checkouts. Power users keep multiple worktrees per repo (one per in-flight feature/PR). A glance at the bottom of the screen should answer "which worktree and which branch is this session driving right now?" without running pwd / git branch in a tool call.
  • Branch context drives intent. A session on main is usually for reading; a session on feat/<x> is usually for writing. Surfacing the branch makes the current intent obvious and reduces "wait, did I commit to the wrong branch?" mistakes.
  • Cross-checks the session metadata. The session row in the drawer shows the cwd it was created in. The agent's active cwd can drift (the agent itself can cd into a sibling directory mid-session). The status strip should reflect the live state, not the create-time cwd, so it stays honest.
  • Click-through. A nice side benefit: clicking the path could open it in a file manager / terminal, and clicking the branch could open the PR (when gh / origin metadata is available). Out of scope for the first cut, but worth designing the strip to allow it.

Proposed UX

A single-line strip at the bottom edge of the session view, inside the composer column:

  📁  ~/code/<repo>/<worktree>
  🌿  feat/<branch-name>   ↗ #123   ← branch + linked PR (optional)
  • Cwd: show the active cwd, with a tilde-collapsed path. Truncate the middle of long paths (head + tail), full path on hover.
  • Worktree: if the active cwd is inside a git worktree distinct from the main repo path, show the worktree's directory name. Otherwise show only the cwd.
  • Branch: show the current branch with a git-branch icon. If the working tree is dirty, append a small dot/marker. If HEAD is detached, show detached @ <sha7>.
  • Optional PR link: when the upstream remote is GitHub (origin matches …github.com…) and a PR exists for the branch, render it as a small ↗ #N chip linking to the PR. Best-effort; skip silently when offline / not GitHub / no PR.
  • Empty state: when the session is detached from any cwd (e.g. brand-new session before first message), show a muted "no working directory" hint rather than blank.

Where it would live

  • New module: src/status/repoInfoBar.ts (or src/composer/repoInfoBar.ts since it sits above the composer).
  • New CSS: src/styles/repoInfoBar.css, hooked into the existing app grid.
  • Server-side helper to extract { cwd, worktreePath, branch, isDirty, headSha, prUrl? } for a given cwd. Use plain git CLI calls; no extra deps. Cache per-cwd with a short TTL since the user can switch sessions rapidly.
  • Live updates via the existing realtime channel: emit a repo_info_changed event when the active session's cwd or branch changes.

Non-goals

  • Editing branches / running git commands from the bar. Read-only display.
  • Showing diff stats, ahead/behind, stash count. Could come later behind a hover popover.
  • Replacing the top status bar's session title — they coexist.

Acceptance criteria

  • A status strip at the bottom of the session view shows cwd, worktree (when different), and branch.
  • Values reflect the live active cwd, not just the session-creation cwd.
  • Long paths are truncated middle-style with full path on hover.
  • Detached HEAD and dirty working tree are visually distinguishable from a clean checked-out branch.
  • No measurable lag added to session switches; repo info loads asynchronously and the strip reserves its layout space so the composer doesn't jump.
  • Works (or degrades cleanly to "no working directory") for sessions whose cwd is not a git repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions