dsh-session-rehome: In-place conversation migration to another workspace

Preface

In DeepSeek Harness (DSH), which workspace a conversation belongs to cannot be changed by clicking in the interface: membership is derived from the cwd in the session log header, and the directory name is inferred from the same path. If you want to keep the same session ID, full history, and title while changing workspaces, simply copying the transcript and creating a new session changes the ID; if you forcibly move the directory during a turn where the agent is still running, subsequent writes might land on paths that no longer exist.

dsh-session-rehome targets “true relocation”: moving log files, rewriting the cwd of the first frame header, and updating the workspace registry, without copying or creating new sessions. Conversations in the middle of a turn will be explicitly rejected rather than moved over with risk. Below, installation, usage, and boundaries are explained to show what this plugin can and cannot do.

What is it

The maintainer byChen47 open-sourced the DSH plugin dsh-session-rehome on GitHub (current version 0.1.0, license MIT). It provides Move to another workspace… in the … menu of the sidebar session row. After moving a conversation that has been saved to disk to a target workspace, the session ID, history, title, and archive status remain unchanged; when opening it to continue chatting, cwd, the file sandbox root directory, and the tool working directory all point to the new folder.

The core DSH does not have an API to “change the workspace a session belongs to”; this plugin performs a low-level _relocate. For more complete Chinese documentation, see README.zh.md in the repository.

Core Features

  • In-place relocation: Move from <sessions root>/<projectKey(old cwd)>/<session id>/ to <sessions root>/<projectKey(new cwd)>/<session id>/, and only re-compress the first frame of the log to rewrite cwd, while subsequent event frames remain byte-for-byte identical.
  • Registry consistency: attachSession in the target workspace, detachSession in the source workspace, and re-index the header cache before attaching to avoid validation failures at startup.
  • Running session protection: Reject relocation when the agent state is running, return the stable error code session-running, and do not modify any files.
  • Client entry point: The Web client injects menus and dialog boxes; the host side is a Node module, providing same-origin, owner-only callable HTTP endpoints (see “Logs and Interfaces” below).

Comparison with other approaches in the same ecosystem (original text): dsh-session-relocate has more features, can move running sessions and supports drag-and-drop, batch operations, etc.; dsh-move-to-workspace copies the transcript to a new session and archives the original session (the ID will change). This plugin deliberately keeps a minimal implementation: true move, same ID, reject mid-turn, facilitating line-by-line audit.

Installation & Enablement

Execute the official installation command under the corresponding profile:

dsh plugin --profile <profile> add dsh-session-rehome

DSH Desktop can also input dsh-session-rehome (or local repository path) via Plugins → Add plugin.

After installation, restart DSH once – the host is half a Node module and is loaded only after restart; then refresh the page, and the sidebar menu item will appear.

Environment requirements (from package.json): Node ≥ 22.15 (built-in zstd); DSH ≥ 0.2.1-rc.2 and < 0.3.0-0. The README states it has been verified on DSH 0.2.1-rc.5 (Windows / Node 24), other versions untested.

The plugin runs with the permissions of the current DSH process; before installation, it is recommended to read the source code in the repository and the MIT license to ensure it complies with your security policies.

Typical Usage

  1. Hover the mouse over a conversation in the sidebar and click …;
  2. Select Move to another workspace…; the dialog box lists only other workspaces;
  3. Select the target and confirm; the sidebar updates, and the conversation appears under the target workspace;
  4. Open it to continue the conversation: the working directory and sandbox root have switched to the new folder.

If the conversation being moved is the one currently open on the screen, refresh the page once before opening it again, otherwise the browser may still hold the old copy.

Rejection Cases

The following situations return fixed error codes and do not write any bytes:

Situation Error Code
Conversation mid-turn (agent running) session-running
Not yet stored (never sent a message) session-not-stored
Sub-agent session subagent-session
Same ID appears in multiple project directories duplicate-log
Session directory has multiple generations or unknown extra files multiple-generations / session-dir-has-extras
Target workspace directory does not exist workspace-missing
Buffer write cannot flush flush-failed

Mid-turn rejection is a design trade-off: writes could be appended to that turn at any time, so moving the directory during the window period could lead to writes going to non-existent paths.

Applicable Scenarios & Notes

Suitable: You switch projects between multiple DSH workspaces but want to retain the original session ID and full log, continuing the chat in the same thread; you can accept “waiting for the current turn to end before moving”.

Not suitable: You must change the workspace immediately while the agent is still running – you should switch to solutions mentioned in the materials, such as dsh-session-relocate; or accept a copy-style migration with a new ID.

Known Limitations (README):

  • One session belongs to only one workspace, which is the DSH model, not a plugin-specific assumption.
  • Depends on several package-private entry points, degrading or aborting based on feature detection; may vary between DSH rc versions.
  • The community plugin directory SkillHub entry and GitHub repository are published by the maintainer; there is no official affiliation with DeepSeek / Huaxuan; the DSH ecosystem principle is “everything is a plugin”, and the directory site is an independent community site.

Logs and Interfaces (useful for troubleshooting relocation issues):

Plugin logs are by default at $DSH_HOME/logs/session-rehome.log (i.e., ~/.dsh/logs/session-rehome.log), each line recording the mount status, relocation path, and byte count or rejection error code.

Endpoint Method Description
/session-rehome/workspaces GET List workspaces and session IDs
/session-rehome/move POST body: { sessionId, workspaceId }

Failure responses look like {"ok": false, "code": "...", "message": "..."}.

Ending

dsh-session-rehome uses log relocation plus header cwd rewriting to implement “changing workspaces with the same ID” without significantly altering the DSH core; rejecting running turns trades for predictable storage consistency. For menu operations and implementation details, you can check the GitHub repository and SkillHub directory page.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye