Introduction¶
When managing multi-project, multi-branch development tasks with DeepSeek Harness (DSH), the native sidebar (sidebar.workspaces) treats each workspace as a peer-level group. Worktrees pointing to different branches of the same repository get scattered apart, and unregistered worktrees are simply invisible. As repositories and branches grow, the sidebar quickly becomes cluttered.
dsh-worktree-groups takes over the sidebar.workspaces slot with priority: -1, uses Git commonDir to group multiple worktrees under the same repository into a single project node, and provides automatic discovery of unregistered worktrees, lazy registration, worktree creation/removal, a history session recycling bin for deleted worktrees, three-level drag-and-drop reordering, and progressive expansion.
What Is This¶
This is a DeepSeek Harness plugin maintained by lvrayman, categorized as a client plugin. It organizes DSH workspaces and sessions into a three-level tree of Project → Git Worktree → Session, solving the problems of flat sidebar clutter, invisibility, and manual registration overhead in multi-worktree scenarios.
Core Features¶
Three-Level Tree: Project → Worktree → Session¶
The plugin parses the commonDir of a Git repository and automatically merges multiple DSH workspaces pointing to the same repository into a single project node. Each Git project uniformly produces worktree child rows, while non-Git plain directories remain flat. Single-worktree Git repositories also maintain the three-level structure.
Auto-Discovery of Unregistered Worktrees & Lazy Registration¶
The plugin directly parses git worktree list --porcelain, so all worktrees appear in the sidebar without needing to add each workspace individually in DSH beforehand. A workspace is only registered with the host when you first click the + button on that worktree to create a new session, avoiding redundant registration records.
Same-Location New Session Draft Preservation¶
When clicking + to create a new session under the same worktree/workspace, if a blank session with unsent messages already exists, it is automatically reused and navigated to, preventing loss of unsent draft input.
history-worktree-session Recycle Bin¶
After a worktree is removed (via the UI or an external rm -rf), its sessions do not fall into “Ungrouped.” Instead, through dual-source identification — the plugin ledger ($DSH_HOME/worktree-groups.json) plus path-prefix heuristics (same parent directory, <main-repo-name>-<suffix> pattern) — sessions are automatically routed into the owning project’s history-worktree-session bucket.
Automatic Cleanup of Dead Workspaces¶
Workspace registration records that are non-primary worktrees and whose disk directories no longer exist are automatically deregistered from DSH. Only the registry is cleaned; disk files and session logs are left untouched.
In-Place Worktree Creation & Removal¶
- Create: Project row
…→New worktree…→ choose to create or reuse a branch, select the base branch and path (default:<parent-dir-of-main-repo>/<main-repo-name>-<branch-name>) → automatically runsgit worktree add, registers the workspace, and opens a new session. - Remove: Worktree row
…→Remove worktree→ if uncommitted changes exist, a warning dialog appears with a force-delete option → after removal, the workspace is automatically deregistered (the Git branch is preserved).
Running Task Highlighting & Top Pinning¶
When a session itself or any sub-agent at any level beneath it is actively running, the owning project folder icon and worktree branch icon are highlighted in real time. The running session is pinned to the top of its group (drag is locked while running and unlocked upon completion).
Three-Level Drag-and-Drop Manual Ordering¶
Projects, worktrees, and sessions all support in-container drag-and-drop reordering. The first drag switches to manual ordering mode (persisted in the browser’s localStorage), and “Restore Default Order” is always available from the menu.
Progressive Session Expansion & Bottom “Recent” Section¶
Each container displays the first 5 sessions by default. Click “Expand 5 more” to progressively reveal additional sessions in steps of 5 (with a “Collapse” link on the same row). The sidebar bottom provides a “Recent” section, listing sessions globally in reverse order of last activity time (including streaming output and sub-agent events).
Workspace Archiving & Restoration¶
Supports archiving (hiding) projects/workspaces that are temporarily unused from the sidebar, with one-click restoration available under “Settings → Archived Workspaces” at any time.
Installation & Activation¶
Method 1: DSH Desktop Plugin Manager (Recommended)¶
Open DeepSeek Harness Desktop and go to Plugins → Add Plugin:
- Install from npm:
dsh-worktree-groups
- Install from GitHub:
github:lvrayman/dsh-worktree-groups
Method 2: Install via dsh plugin CLI¶
- Desktop Profile:
dsh plugin --profile desktop add -w dsh-worktree-groups@latest
- Web Host Profile:
dsh plugin --profile web add -w dsh-worktree-groups@latest
You can also replace dsh-worktree-groups@latest with github:lvrayman/dsh-worktree-groups. After installing or switching the source, restart DeepSeek Harness as prompted.
Method 3: Local Source Development & Debugging (pnpm link)¶
git clone https://github.com/lvrayman/dsh-worktree-groups.git
cd dsh-worktree-groups
npm install
npm run build
In DSH Desktop under Plugins → Add Plugin, select the local repository directory directly, or manually link it to ~/.dsh/profiles/web/package.json:
# 1. In ~/.dsh/profiles/web/package.json:
# - Append "dsh-worktree-groups" to the dsh.profile.bundles array
# - Add "dsh-worktree-groups": "link:/path/to/dsh-worktree-groups" to dependencies
# 2. Update Profile dependencies
cd ~/.dsh/profiles/web && pnpm install
The cordis.patch.yml bundled with this package is declared via dsh.bundle.patch in package.json and is automatically merged when the Profile starts. There is no need to manually modify the Profile’s cordis.patch.yml. A DSH restart is required after adding a new bundle for changes to take effect.
Typical Usage¶
After installation, the sidebar automatically organizes content into the three-level Project → Worktree → Session tree. For multiple branch worktrees of the same repository, the plugin merges them into a single project node. Click the + on a worktree row to create a new session; unregistered worktrees are lazily registered automatically. Click the project row … → New worktree… to quickly add a new worktree under the current Git repository; click the worktree row … → Remove worktree to delete that worktree (a prompt appears if uncommitted changes exist). Sessions from deleted worktrees are automatically routed into the history-worktree-session bucket rather than “Ungrouped.” A “Recent” section appears at the bottom of the sidebar, ordering sessions globally by most recent activity.
Use Cases & Notes¶
Ideal for DSH users who need to manage multiple Git repositories, each with multiple branch worktrees — especially when using DSH for code assistance, debugging, and parallel multi-branch development. The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license (MIT) before installing.
Closing¶
dsh-worktree-groups restructures the multi-worktree DSH sidebar from a flat list into a three-level tree, ideal for session grouping and quick switching in Git multi-branch scenarios. For more information, refer to:
- Directory page: https://www.skillhub.cn/plugins/lvrayman/dsh-worktree-groups
- GitHub: https://github.com/lvrayman/dsh-worktree-groups