Introduction¶
When doing parallel development in DSH (DeepSeek Harness), a common practice is to switch branches or repeatedly edit in the main workspace. Claude Code provides /enterworktree: it creates a new git worktree and lets the agent work in an isolated directory without polluting the main tree. In DSH, the session working directory (session.header.cwd) is read-only and cannot be switched “in place” like in a desktop IDE, so a host plugin is needed to chain “create worktree + open new session” into one step. Below we introduce the community plugin dsh-enterworktree (maintainer: scccy, category: workflow), which registers the enter_worktree tool in DSH, with behavior modeled on Claude Code’s EnterWorktree.
What Is This¶
dsh-enterworktree is a DSH Host plugin. It registers enter_worktree via ctx.tools.register(defineTool(...)), in the same way as dsh-speckit-workflow. It creates or reuses a git worktree and calls ctx.remote.session.create({ cwd }) on the worktree path to open an isolated session; opening the returned sessionId in the Web GUI is equivalent to “entering” that worktree. Repository: https://github.com/scccy/dsh-enterworktree; Community catalog page: https://www.skillhub.cn/plugins/scccy/dsh-enterworktree.
Core Features¶
Correspondence with Claude Code EnterWorktree¶
Claude Code’s EnterWorktree creates a git worktree and switches the agent into it. The equivalent flow under DSH is:
- Create a git worktree at the nested layout path
.worktrees/<branch>/or the sibling layout path../<repo>--<branch>; - Open a brand-new isolated session at that path with
ctx.remote.session.create({ cwd }); - Return the
sessionIdand the path; the current session is not moved and still points to the original directory. Subsequent changes happen in the worktree session you open in the GUI.
Tool enter_worktree Parameters¶
| Parameter | Description |
|---|---|
branch |
Name of the new branch; if omitted, wt/<timestamp> is generated automatically; if the local branch already exists, it is attached directly |
base |
Base point for the new branch, defaults to HEAD |
path |
Explicit absolute path; layout is ignored when provided |
layout |
nested (default) or sibling |
openSession |
Whether to open an isolated session, defaults to true |
inPlace |
When true, no worktree is created and the repository root is returned directly (safety valve) |
On success, the typical output fields include ok, branch, worktreePath, created, sessionId, sessionOpened, message, for example:
{
"ok": true,
"branch": "wt/...",
"worktreePath": "/abs/path/.worktrees/wt/...",
"created": true,
"sessionId": "session-xxxxx",
"sessionOpened": true,
"message": "已创建 worktree 并开隔离 session ..."
}
Bundle Configuration (cordis.patch.yml)¶
| Config | Default | Description |
|---|---|---|
layout |
nested |
nested → .worktrees/<branch>; sibling → ../<repo>--<branch> |
dotworktreesDir |
.worktrees |
Directory name for worktrees under the nested layout |
autoOpenSession |
true |
Whether to automatically open an isolated session |
Installation and Activation¶
The DSH ecosystem follows an “everything is a plugin” philosophy; community catalogs such as SkillHub are independent sites with no official affiliation with DeepSeek / High-Flyer. Before installing, it is recommended to review the GitHub source code and the MIT license; plugins run under the permissions of the current dsh process.
Method A: Install from a Git Repository (Recommended in the README)¶
Use it in the Web GUI’s plugin_manager:
plugin_manager action=install_bundle target=github.com/scccy/dsh-enterworktree
After installation, enter_worktree becomes available in sessions. If lib has been modified, restart dsh-desktop to let the host reload it.
Method B: Install from npm (Once Published)¶
plugin_manager action=install_bundle target=dsh-enterworktree
The package requires Node.js >=20 (see the engines field in package.json).
Typical Usage¶
In a DSH session where this bundle is enabled, the agent can simply call the host-registered enter_worktree — no need to hand-write git worktree commands and then manually create a session. Common use cases include:
- Specify
branchwith an optionalbaseto open a parallel line of work under the default nested directory; - Set
layout: "sibling"to place the worktree next to the repository at../<repo>--<branch>; - Pass
pathto pin an absolute path, ignoring the layout rules; - When you only need the path and do not want an automatic session yet, combine
openSession: falseorautoOpenSession: falsein the bundle (still subject to whether the profile providesdsh-api-remotes).
If the profile does not provide dsh-api-remotes (i.e., there is no ctx.remote.session), the tool may still create the worktree and return the path, but it cannot automatically open a session.
Use Cases and Notes¶
Use cases: Multi-task parallelism on the same repository (feature branches, experimental changes, agent workflows isolated from the main session); developers familiar with Claude Code’s /enterworktree semantics who prefer switching sessions instead of changing cwd in the DSH Web GUI.
Notes:
- The original session directory remains unchanged; all modifications inside the worktree take place in the newly opened session.
- Automatic session opening depends on
dsh-api-remotesin the profile. - Statistics such as stars on the community catalog are subject to what the site displays; verify behavior and installation commands against the README and the repository.
Conclusion¶
dsh-enterworktree collapses “git worktree + isolated session” into a single DSH host tool step, filling the gap in parallel workflows under DSH’s read-only cwd. Catalog page: https://www.skillhub.cn/plugins/scccy/dsh-enterworktree; Source code and detailed documentation: https://github.com/scccy/dsh-enterworktree.