Introduction

DSH’s plugin ecosystem treats session management, sidebar tools, and CLI tools as extensible components. For users of DeepSeek Harness, there are two specific types of problems: one is that certain sessions cannot load, with common causes including seq gap, torn zstd frames, and lone surrogates; the other is the desire for new sessions to reference old session context rather than starting from scratch.

dsh-session-surgeon provides capabilities around these two issues: copying session IDs in DSH, inspecting, dry-run repair, and also provides CLI and agent tools. Below, it is elaborated on positioning, features, installation, usage, and notes.

What is this

dsh-session-surgeon is a DSH plugin maintained by xiaoshenming, licensed under MIT. Its core positioning is:

Repair DeepSeek Harness sessions that refuse to load (seq gap, torn zstd frames, lone surrogates).

At the same time, it also provides a “copy session ID” path, allowing users to paste the old session ID in a new session, making the new session reference the old session context.

Verified compatibility information is as follows:

Compatible with @deepseek-ai/dsh@0.1.0-rc.6

package.json sets @deepseek-ai/dsh-tools to:

^0.1.0-rc.6

and is optional.

Core Features

  • Provides in the DSH session menu:
  • Copy Session ID
  • inspect
  • dry-run repair

  • Provides in the sidebar “Session surgeon / 会话医生”:

  • Browse sessions
  • Copy ID
  • dry-run repair
  • apply repair
  • compact preview
  • export JSONL

  • Repairs unloadable DSH sessions, involving:

  • seq gap
  • torn zstd
  • lone surrogates
  • missing message id

  • inspect reports:

  • seq gap
  • missing id
  • dangling tool/call

  • For dangling tool/call, inspect only warns and does not fabricate tool/result.

  • CLI provides:

scan
inspect
repair
compact
export
index
  • repair is dry-run by default; when using --apply, it writes .bak.<utc> first.

  • Provides agent tools after installation:

session_scan
session_inspect
session_repair

where the apply of session_repair defaults to false.

  • export redacts secrets by default, and can be disabled with --no-redact.

Installation and Enablement

The installation command is as follows:

dsh plugin --profile web add "github:xiaoshenming/dsh-session-surgeon#main"

Restart dsh web after installation.

After restarting, you can see the entry points provided by the plugin in the DSH session menu and sidebar.

Typical Usage

1. Copy Session ID to let new sessions reference old context

First, click the session menu and select “Copy Session ID”.

Then paste content similar to the following in a new chat:

Continue from session session-1e66cda9-a046-4893-8f4b-b817080acbea.

If the current agent has tools, you can also write:

session_inspect id=session-1e66cda9-a046-4893-8f4b-b817080acbea

This method is suitable for letting new sessions reference old session context without directly copying session files.

2. Scan, Inspect, and Repair using CLI

First, scan:

npx --yes github:xiaoshenming/dsh-session-surgeon scan

Then inspect the specified session:

npx --yes github:xiaoshenming/dsh-session-surgeon inspect <session-id>

By default, repair is dry-run:

npx --yes github:xiaoshenming/dsh-session-surgeon repair <session-id>

When you need to confirm writing, add --apply:

npx --yes github:xiaoshenming/dsh-session-surgeon repair <session-id> --apply

--apply writes .bak.<utc> first.

3. Run from a local checkout

If you are already in a local checkout, you can run:

node bin/dsh-session-surgeon.mjs scan

Applicable Scenarios and Notes

Suitable for the following users:

  • Need to repair sessions that refuse to load.
  • Hope to reference old session IDs and context in new sessions.
  • Need to view Session surgeon in the sidebar.
  • Need to perform scan, inspect, and repair via CLI.
  • Need to call session_scan, session_inspect, session_repair in agents with tools.

Notes to be aware of:

  • Default is read-only; writing requires --apply and writes .bak.<utc> first.
  • On Windows, fsync on read-only backup handles is handled as best-effort.
  • Do not put @deepseek-ai/dsh-tools into dependencies.
  • export redacts sk-*, PEM blocks, and home paths unless --no-redact is used.
  • Do not commit raw files from ~/.dsh/sessions as they contain user text and secrets.
  • This plugin is not a marketplace, token heatmap, memory plugin, or Codex task store.
  • The plugin runs with the current dsh process permissions; source code and the MIT license should be checked before installation.
  • The DSH community directory is an independent site with no official affiliation with DeepSeek / Inception.

GitHub:

https://github.com/xiaoshenming/dsh-session-surgeon

Directory page: Search in the DSH plugin directory:

dsh-session-surgeon