Open
Conversation
Add session mode and session-prefix configuration so session commands can target either panes or per-worktree windows. Layer global and repo-local TOML files field-by-field and ignore malformed files without dropping valid config.
Add enter, attachment, kill-session, live-session discovery, and per-worktree window setup helpers so wt can manage panes and per-worktree sessions through one tmux wrapper.
Move session command handling into a dedicated module and persist windows-mode sessions so wt can add, list, attach, and remove per-worktree tmux sessions without relying on name scanning. Preserve windows-mode state when panes-mode sessions are cleaned up.
Document the new --mode flow, state-backed windows discovery, and the panes-only watch behavior so users can choose layouts without guessing how session lookup works.
Use 'session:' when creating a new tmux window so tmux allocates the next unused index instead of resolving the target to window 0. Add a regression test for the target syntax to prevent 'index 0 in use' when adding windows to an existing session.
Add an ignored tmux regression test that creates a session and then adds a second window, covering the bug where new-window targeted window 0 instead of the next free slot. Reuse a small cleanup helper across the existing ignored tmux tests.
Clarify that --mode only applies to the command it is passed to so README examples do not imply sticky windows-mode behavior. Also explain that tmux window navigation in windows mode stays within one worktree session and that switching worktrees uses wt session again.
Probe panes and windows session state before returning from rm so the user sees when the chosen layout does not contain the target worktree. Keep removal mode-specific, but suggest the correct command for the other layout and make stale windows-mode cleanup explicit.
Centralize the windows-mode empty-state message and the load-plus-prune flow so attach and ls share the same behavior. This removes duplicate empty checks without changing session command behavior.
Extract shared panes-mode tmux setup so the command dispatcher and panes add/remove flows stop rebuilding the same session wrapper and status-window logic inline. This keeps the panes paths shorter without changing behavior.
Drop unused probe state and split panes and windows hint generation into focused helpers. This keeps the remove guidance logic easier to follow while preserving the same user-facing advice and tests.
Factor the windows layout names and agent-window status lookup into small helpers so windows-mode listing and persistence stop duplicating role strings inline. Add a unit test for the layout-name helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
session.mode,session_prefix, layered config loading, and state-backed discovery/persistence for per-worktree sessionssrc/session_cmd.rs, keeping panes and windows flows separate and improving cross-layoutrmguidance.codexmetadataTesting