Worktree sessions under a channel #50

Closed
opened 2026-10-31 11:36:57 +00:00 by pedromcaraujo · 0 comments

Today a channel is one repo = one tmux session, declared statically in Nix. There is no way to run a second Claude session on the same project without it editing the same checkout.

Proposal

Let a channel spawn worktree sessions: each is a git worktree on its own branch with its own Claude session, shown as an indented row under its channel in the sidebar, with its own status dot. No NixOS rebuild per session.

  • Naming: a worktree session is the tmux session <channel>~<worktree>.
  • Viewing: through the channel's existing ttyd, started with --url-arg. The iframe loads /<channel>/?arg=<worktree>, and the launcher script validates the arg, then attaches to it. No new systemd units, ports, or nginx routes per session.
  • Lifecycle: the forge-tmux sidecar creates, opens, closes, and lists worktree sessions (/worktrees). Closing kills the session, then removes the worktree if it's clean. If it's dirty, Forge asks before forcing. The branch is always kept.
  • Location: a new worktreeDir option. It defaults to .claude/worktrees, which is relative to the channel cwd and matches Claude Code's own --worktree. Any linked worktree of the repo is listed, so ones made with claude --worktree or by hand show up too.
  • UI: a "Create worktree" action in the palette, indented worktree rows in the sidebar (and worktree pills next to their channel's pill on mobile), and "Close worktree".
  • Per-channel worktrees = false to opt out.

Groundwork for #40, which would start a worktree session from an issue.

Today a channel is one repo = one tmux session, declared statically in Nix. There is no way to run a second Claude session on the same project without it editing the same checkout. ## Proposal Let a channel spawn **worktree sessions**: each is a `git worktree` on its own branch with its own Claude session, shown as an indented row under its channel in the sidebar, with its own status dot. No NixOS rebuild per session. - **Naming:** a worktree session is the tmux session `<channel>~<worktree>`. - **Viewing:** through the channel's existing ttyd, started with `--url-arg`. The iframe loads `/<channel>/?arg=<worktree>`, and the launcher script validates the arg, then attaches to it. No new systemd units, ports, or nginx routes per session. - **Lifecycle:** the forge-tmux sidecar creates, opens, closes, and lists worktree sessions (`/worktrees`). Closing kills the session, then removes the worktree if it's clean. If it's dirty, Forge asks before forcing. The branch is always kept. - **Location:** a new `worktreeDir` option. It defaults to `.claude/worktrees`, which is relative to the channel cwd and matches Claude Code's own `--worktree`. Any linked worktree of the repo is listed, so ones made with `claude --worktree` or by hand show up too. - **UI:** a "Create worktree" action in the palette, indented worktree rows in the sidebar (and worktree pills next to their channel's pill on mobile), and "Close worktree". - Per-channel `worktrees = false` to opt out. Groundwork for #40, which would start a worktree session from an issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pedromcaraujo/forge#50
No description provided.