Preface¶
The cwd (current working directory) of a DeepSeek Harness (DSH) session is frozen at creation. It is part of the session identity and determines where the session is stored, the sandbox root, and the discovery root for AGENTS.md and skills. When the main focus of work moves away from the original directory for an extended period, file tools require full absolute paths, and project instructions and skill discovery may still remain in the old location. The dsh-cd plugin provides two levels of operation granularity for this purpose.
What It Is¶
dsh-cd is a plugin for DeepSeek Harness (DSH), maintained by johnnren. It adds a cd tool for the model and a /cd command for users. Its core value is to handle two scenarios: “switching only the baseline” and “actually moving the workspace.”
Installation¶
Installing the plugin requires no additional configuration. The installation command is:
dsh plugin --profile web add dsh-cd
After installation, the plugin’s built-in cordis.patch.yml is mounted automatically. The model can then use the cd tool, and users can use the /cd command in the input box.
Core Features¶
The plugin provides two switch modes at different granularities:
- Working baseline override (lightweight)
- Entry:
cd {"path": "..."} - Effect: Only changes the “baseline for resolving relative paths.” The default workdir for file tools (read/write/edit/glob/grep, etc.) and the bash tool follows the new directory, while the session identity remains unchanged (storage location, sandbox root, etc. stay the same). This is a reversible quick switch.
- Entry:
- Actual workspace relocation (heavyweight)
- Entry:
cd {"path": "...", "workspace": true, "confirmed": true} - Effect: Actually changes the session identity. The session’s storage location, sandbox root,
AGENTS.md, skill discovery, and sidebar grouping all follow the new directory. This requires the session to be idle and the user to explicitly confirm it (confirmed: true).
- Entry:
Typical Usage¶
Model Invocation¶
The model can invoke the cd tool as follows:
cd {"path": "/tmp/some-dir"}
To request an actual workspace relocation, include workspace: true and confirmed: true:
cd {"path": "/path/to/other-project", "workspace": true, "confirmed": true"}
Other usages:
* Return to the previous directory: cd {"path": "-"}
* View the current directory and queued state: cd {}
User Commands¶
Users can enter the following commands in the input box (without consuming a model turn):
* /cd <directory>: Actually relocate the session to that directory.
* /cd: View the current directory, associated workspace, override status, and queued actual workspace switches.
Technical Details and Notes¶
- State persistence: The override state is written to
$DSH_HOME/dsh-cd/state.json, and the override settings for that session are automatically restored after an instance restart. - Child agent inheritance: Child agents derived from the current session inherit the parent session’s override directory.
- Actual workspace relocation limits:
- It must be explicitly confirmed by the user (
confirmed: true), and the model must not fill it in automatically. - The session must be turn-idle when it is executed; otherwise, the current turn still operates against the working baseline, and relocation completes after the turn ends.
- Relocation rewrites the session log, and any failure rolls back.
- It must be explicitly confirmed by the user (
- Environment requirements:
- Node.js >= 22.5 is required.
- It depends on the host’s
@deepseek-ai/dsh-toolsand@deepseek-ai/dsh-home-paths.
- Sidebar synchronization: After an actual workspace relocation, the session itself is immediately usable, but sidebar grouping usually requires refreshing the page (F5) to update.
Summary¶
dsh-cd solves the frozen working directory issue for DSH sessions in a plugin-based manner. It provides both lightweight path baseline override and heavyweight workspace relocation. It is suitable for scenarios that require frequently switching context within the same session or permanently moving the work focus to another project.
- Plugin directory: https://www.skillhub.cn/plugins/john-walks-slow/dsh-cd
- GitHub repository: https://github.com/john-walks-slow/dsh-cd