dsh-session-isolation: Assign isolated working directories to DSH sessions

Introduction

In DSH, the Workspace directory selected by a session is shared across multiple parallel sessions. If multiple Agents run simultaneously within the same project, they will write to the same set of files: a subsequent session might overwrite the changes just completed by a previous one, making conflicts difficult to avoid during parallel development.

Below is an introduction to the community plugin dsh-session-isolation (Maintainer: sweet-boby, Category: Workflow). It allocates a dedicated session-<id> subdirectory at the directory level as a writable sandbox for each new session. The project root remains visible and read-only to all sessions, thereby achieving Codex-like “per-session independent workspace” behavior without requiring major modifications to DSH.

What is this

dsh-session-isolation is a Cordis plugin for DeepSeek Harness (DSH): Under an isolated Workspace, each newly created session reads and writes within its own session-<id> subfolder, preventing mutual overwriting. The project files themselves remain readable, facilitating the sharing of code and configuration.

The plugin does not modify the DSH core; it wraps two seams at load time via Cordis composition and restores them upon unloading.

Core Features

Directory Structure and Toggles

Once isolation is enabled, the project directory roughly looks like this (excerpted from the README):

project/                          ← Your selected Workspace (readable by all sessions)
├── .dsh-isolate                  ← Toggle: empty file; deletion disables isolation
├── src/ …                        ← Project files (read-only for sessions)
├── session-1a2b3c4d/             ← Session A's writable sandbox root
└── session-9f8e7d6c/             ← Session B's writable sandbox root

Key points:

  1. Subdirectories are allocated before the session is created, named using the first eight characters of the session ID; if there is a collision, -2, -3, etc., will be appended.
  2. The session still belongs to the same project in the Workspace sidebar; AGENTS.md and project-skills are still located by traversing upward from the session’s cwd.
  3. Already running sessions are not migrated; isolation only affects newly created sessions.
  4. After disabling the toggle, no new private directories will be created for new sessions; sessions and their directories created during the isolation period are retained.

Enabling and Disabling Isolation

Isolation is a directory attribute, persisted as an empty file .dsh-isolate in the project root.

  1. Web GUI: Settings → Built-in plugins → Workspace isolation. The list displays paths, session counts, and toggles by Workspace, refreshing approximately every 5 seconds.
  2. In Conversation: Ask the Agent to call the tool session_isolation, with subcommands including status, list, enable, disable; an absolute path path is optional, defaulting to the current session’s workspace.
  3. Host Code: await ctx.isolatedSessions.setIsolated(workspaceId, true) or ctx.isolatedSessions.setIsolatedPath(path, true); use list(), isIsolated(id) to query status.
  4. Manual: Create an empty file .dsh-isolate in the project directory.

GUI and Tools

  • On the browser side, the plugin page under Settings is registered via the dsh.client bundle; it communicates with the host via /session-isolation/workspaces (GET) and /session-isolation/toggle (POST) on the Web carrier, with status derived entirely from marker files.
  • Without a Web carrier (ctx.webServer), the policy and the session_isolation tool are still available, just without the GUI page.
  • A host restart is required after installation so the client module table loads the new bundle; tools, markers, and host services are usable before the restart.

Implementation Details (Brief)

At load time, it wraps ctx.sessionController.create and another seam (the README truncation points to workspace-related logic): within the single call to create the session, the Workspace entity is temporarily pointed to the newly allocated private directory, and restored in a finally block after the call completes; if creation fails, the allocated directory is deleted. If the required DSH services are not deployed, the plugin remains pending to avoid a half-effective state.

Installation and Activation

Environment Requirements: Node.js 22+; DSH must have already composed sessionController, workspaceRegistry, and tools services (available in the standard base profile).

Install from GitHub

dsh plugin --profile <profile> add \
  https://github.com/sweet-boby/dsh-session-isolation.git

Restart the host once after installation. The plugin manager will install the package, select the bundle, and apply cordis.patch.yml.

Install from Web GUI

Open Plugins → Add plugin and paste:

https://github.com/sweet-boby/dsh-session-isolation

If the current DSH installer only accepts local bundle paths, you need to obtain the absolute path of the repository locally first and then paste it (the README explains the workaround for this build).

Manually Write to Profile

Add the dependency to ~/.dsh/profiles/<profile>/package.json and include dsh-session-isolation in dsh.profile.bundles, for example:

{
  "dependencies": {
    "dsh-session-isolation": "github:sweet-boby/dsh-session-isolation"
  },
  "dsh": {
    "profile": {
      "bundles": ["…", "dsh-session-isolation"]
    }
  }
}

For local development, you can change the dependency to file:/absolute/path/to/dsh-session-isolation, run pnpm install --ignore-scripts in the profile directory, and restart the host as well.

Typical Usage

  1. Install and restart DSH using any of the methods above.
  2. Enable isolation for the target project (via the GUI toggle, enable in conversation, or creating .dsh-isolate).
  3. Create a new session in that Workspace and have the Agent execute pwd or write a test file: the working directory should be the session-<id> subpath, and the project root should be read-only in the file policy.
  4. Open a second new session; it should receive a different session-* directory, and the files of the two should not affect each other.

To disable isolation: turn off the GUI toggle, use the tool disable, or delete .dsh-isolate.

Use Cases and Notes

Suitable for: Scenarios where multiple Agents need to run in parallel under the same DSH project (multiple tasks, multi-branch experiments, avoiding file conflicts); scenarios that desire a directory-level switch and wish to share the .dsh-isolate marker with file managers or CI.

Notes:

  1. Isolation only protects the writable root of new sessions; the paths of existing sessions remain unchanged.
  2. Changes within each session’s sandbox do not automatically write back to the project root by default; if you need to merge results, you must copy them yourself or operate via an Agent on the read-only project tree (depending on your workflow design).
  3. The plugin runs with the permissions of the current DSH host process; please read the repository source code and the MIT license before installation to assess whether to include it in your workflow.
  4. Community directories such as SkillHub have no official affiliation with DeepSeek / High-Flyer. The plugin is from community maintainer sweet-boby; for versions and compatibility, please refer to the README and package.json.

Conclusion

dsh-session-isolation uses directory markers and Cordis seam wrapping to provide optional per-session working directories for parallel DSH sessions, reducing mutual file overwriting within the same Workspace. You can get installation instructions and issue access from the community directory page or GitHub:

  • Directory Page: https://www.skillhub.cn/plugins/sweet-boby/dsh-session-isolation
  • GitHub: https://github.com/sweet-boby/dsh-session-isolation
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye