
FlashingChen/dsh-worktree
50Last commit Aug 13, 2026
dsh-worktree DSH plugin
This plugin enables permanent git worktrees that survive sessions and restarts, similar to Codex CLI's `codex worktree create --permanent`. It provides agent tools and chat commands to create, list, open, and remove worktrees. Worktrees are stored in a hidden directory `.dsh-worktrees` within the repository root, with a manifest for persistence.
How to install the dsh-worktree DSH plugin
dsh plugin --profile web add dsh-worktreeCopying does not run this command. Review the repository and version before installing the dsh-worktree DSH plugin.
dsh-worktree DSH plugin data source
dsh-worktree DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-worktree DSH plugin can do
- Create a permanent detached worktree via agent tool or `/worktree create` command
- List registered worktrees with live git state (exists, HEAD, branch)
- Remove a worktree with optional `--force` to discard uncommitted changes, prevents removal of the current session's worktree
- Open a worktree as a DSH workspace (register it in workspaceRegistry)
- Automatically detect when a session runs inside a registered worktree and provide context notes to the agent
Where the dsh-worktree DSH plugin fits
- Maintain separate long-running branches for feature development without affecting the main working tree
- Agent forking a permanent workspace mid-task for experimentation or parallel work
- Resuming work after a session restart in the same worktree, preserving state across sessions
Who the dsh-worktree DSH plugin is for
- DSH users who want persistent git worktree management similar to Codex CLI
- Developers working with AI agents that need to isolate changes in dedicated worktrees
dsh-worktree DSH plugin limitations
- Requires git ≥ 2.31 (uses `git rev-parse --path-format=absolute --git-common-dir`)
- Requires a DSH profile with the `tools`, `commands`, and `subprocess` services (e.g., the `web` profile)
- Plugin dependencies are pinned to harness version 0.1.0-rc.6; using a different DSH version may require installing from source and adjusting dependencies
- When a session starts from a subdirectory of the repository, `.dsh-worktrees` may land outside the session's workspace, limiting write access to worktree files
dsh-worktree DSH plugin: from the repository README
Quoted from the FlashingChen/dsh-worktree README, the upstream source of the dsh-worktree DSH plugin. Copyright remains with the original authors.
English | [中文](README.zh.md) [](LICENSE) Codex-style **permanent git worktrees** for DeepSeek Harness — a Cordis plugin that gives a DSH profile the same durable-worktree workflow as `codex worktree create --permanent`. A permanent worktree is a real `git worktree add --detach` checkout that **survives sessions and restarts**. You (or the agent) create it once, and any later session can be opened inside it to keep working where the previous one left off — without ever touching your main working tree. ## What you get | Codex CLI | dsh-worktree equivalent | |---|---| | `codex worktree create --permanent <name> [<base>]` | agent tool `worktree_create`, or `/worktree create <name> [<base>]` | | `codex worktree list` | agent tool `worktree_list`, or `/worktree` / `/worktree list` | | `codex worktree open <name>` | `/worktree open <name>` (registers the worktree as a DSH workspace; start a new session there) | | `codex worktree close/delete <name>` | agent tool `worktree_remove`, or `/worktree remove <name>` | | worktree shown in session context | one-shot context note when a session runs inside a registered worktree
Read the full READMERepository license: MIT
dsh-worktree DSH plugin questions
How do I install dsh-worktree?
Run `dsh plugin --profile web add dsh-worktree` to install the plugin from npm. Then add the plugin configuration to your profile's cordis.patch.yml file (see the README for the exact YAML snippet). Finally, restart the DSH profile (e.g., restart the `dsh web` process).
How do I create a permanent worktree?
You can use the agent tool `worktree_create` with parameters `{name, baseCommit?}` or the chat command `/worktree create <name> [<base-commit>]`. The worktree will be created as a detached HEAD at the specified base commit (defaults to current HEAD).
How do I list all registered worktrees?
Use the agent tool `worktree_list` or the chat command `/worktree` (or `/worktree list`). It will display all registered worktrees along with their live git state (whether they exist, their HEAD commit, and branch name).
How do I delete a worktree?
Use the agent tool `worktree_remove` with the name, or the chat command `/worktree remove <name>`. You can also use `/worktree close/delete <name>`. If you want to discard uncommitted changes, add `force: true` (or `--force` in the chat command). The plugin will refuse to remove the worktree that the current session is running inside.
Will my worktrees survive after I restart DSH?
Yes, worktrees are permanent. They are stored in a manifest file at `<repo-root>/.dsh-worktrees/manifest.json`, which persists across DSH restarts. When you start a new session inside a registered worktree, the plugin will detect it and provide context to the agent.