dsh-session-delete: DSH Session Deletion and Recycle Bin Recoverable Cleanup

Introduction

On desktop, DeepSeek Harness (DSH) persists each conversation as a session record. The sidebar supports archiving, forking, and renaming, but as of the official release 0.2.0-rc.2 there is still no way to “delete this conversation”: the sessionPersistence contract only defines create / open / stat / list / flush — there is no delete; the only session-level removal is archiveSession, which merely hides the record while logs and projection caches remain on disk. As conversations accumulate, both the list and the disk get cluttered, yet users are hesitant to touch the files directly.

There is also a same-named package on npm called dsh-session-delete (author vtxf, unrelated to this project); if you install it by mistake, session records will be permanently deleted and cannot be recovered. The dsh-session-delete plugin released on GitHub by maintainer wuuuuu123-32 takes a client-side plugin approach: it provides single-delete and batch-delete actions in the “⋯” menu of the session list, moves records into the Windows Recycle Bin so mistakenly deleted items can be restored, and scans the deliverables produced by the session before deletion so you can decide whether to move them to the Recycle Bin as well. The following sections describe how to locate, install, and use it.

What Is This

dsh-session-delete is a client-side plugin for DSH (category: client), repository wuuuuu123-32/dsh-session-delete, current package version 0.1.2, MIT license, requires Node >=20. It fills the gap in official session-deletion support and deliberately distinguishes itself from the same-named npm package: it must be installed from GitHub only, and its deletion semantics are Recycle Bin-based rather than permanent deletion.

How to Choose Between Archiving and the Same-Named npm Package

Approach Session record Deliverable files Recoverable
Official “Archive” Kept, only hidden Untouched —
dsh-session-delete on npm (vtxf, unrelated to this project) Permanently deleted Untouched Not recoverable
This plugin Moved to Recycle Bin Scanned then optionally selected by you; default untouched Restore from Recycle Bin

Core Features

The “⋯” menu on a row in the session list has two actions:

Menu item Behavior
Delete session Deletes this one. First scans deliverables, then shows a confirmation dialog with the deliverables list + per-item size + record size; you must check “I understand the consequences” before confirming
Batch delete sessions… Opens a panel for multi-selection (supports select-all/clear, running sessions cannot be selected); after confirming, scans the selected items first, then proceeds to the confirmation dialog

Deliverables are kept in place by default; only when you check “Also move the deliverable directory above to the Recycle Bin” will the deliverable directory be touched.

How “Deliverables” Are Defined

The plugin only recognizes dedicated subdirectories under the workspace (cwd) (e.g., lab-report-9\, my-plugin\) as deletable deliverables; loose files directly under the cwd root (e.g., AGENTS.md, 升级日志.md, prompt-*.md, temporary scripts, etc.) are listed separately in a “will not be moved” notice area and will never be touched. The reason is that DSH’s built-in turn-deliverables rules count any file “written by” a conversation as a deliverable, which can include shared assets tied to some conversation; since it is impossible to reliably distinguish shared files from temporary files at the root, safety comes first — they are never moved.

The scanned event sources include: tool/call events for direct model write / edit operations, and tool/ptc-dispatch events corresponding to tools.write inside run_code (PTC), so that conversations where all work goes through run_code are not counted as having zero deliverables.

Batch Panel

  • Order matches the sidebar: arranged according to the sessionIds maintained by DSH in workspace.json.
  • By default only main sessions visible in the sidebar are listed; items not in sessionIds (such as sub-agents) are collapsed by default; you can uncheck “Only show sessions in the sidebar” to expand them (marked with 子代理/未分组).
  • Switching back to “Only show sessions in the sidebar” automatically unchecks any hidden items, avoiding deletion of things you cannot see.

Deletion Chain (Host Side)

Running sessions are rejected immediately (409). Before deletion, deliverables are scanned, the active session is flushed, then the session log directory and projection cache are moved to the Recycle Bin, and the Recycle Bin $I entry count is verified to have increased (to prevent silent permanent deletion under restricted tokens). Afterwards, workspace bookkeeping is removed and api-session/removed is emitted so the list row disappears immediately; after deletion you must not re-fetch the list, otherwise the host baseline would merge the row back in.

The menu items use the official slot sidebar.workspaces.session.menu.item (order 500 / 501); the delete action is performed host-side via an HTTP route; the client calls it via fetch.

Installation and Activation

⚠️ The installation command must include the github: prefix, otherwise you will install someone else’s permanent-deletion package from npm:

dsh plugin --profile desktop add dsh-session-delete          # ❌ installs someone else's package
dsh plugin --profile desktop add github:wuuuuu123-32/dsh-session-delete   # ✅ this plugin

Standard desktop installation (replace the profile name with your own):

dsh plugin --profile desktop add github:wuuuuu123-32/dsh-session-delete

You must restart DSH after installation. HMR for newly added slot items in client plugins is not reliable; without a restart the menu may not appear.

Typical Usage

  1. After restarting DSH, open the “⋯” menu to the right of a conversation in the sidebar.
  2. Choose “Delete session”: review the deliverables list and sizes in the confirmation dialog, optionally check whether to move the deliverable directory to the Recycle Bin along with the record, then check “I understand the consequences” and confirm.
  3. To clear multiple entries: choose “Batch delete sessions…”, multi-select (running sessions cannot be selected), and execute only after the same scanning and confirmation steps.

If a session record is deleted by mistake, simply restore it from the Windows Recycle Bin; if deliverables were not checked for deletion along with it, they remain at their original workspace paths.

Use Cases and Caveats

Who it’s for: users who run many long-lived sessions on a DSH 0.2.0-rc.2 desktop profile, need to truly remove records but want them recoverable; users who need to batch-organize the sidebar and are willing to review the deliverables list in the confirmation dialog.

Environment and compatibility:

  • DSH 0.2.0-rc.2 (desktop), depends on services such as webServer / sessionPersistence / workspaceRegistry / sessions.
  • Windows only: the Recycle Bin logic depends on Shell COM and $Recycle.Bin metadata; it does not apply to non-Windows environments.
  • The older web client 0.1.5-rc.2 does not support the front-end slot system, so menu injection does not work (host-side capabilities can run independently, but the full experience requires the new client).

Security and trust: the plugin runs with the permissions of the current DSH process, and both deletion and scanning access session logs and workspace paths. Before installing, it is recommended to review the source code and MIT license at the GitHub repository; back up your data yourself before any real deletion. The repository provides offline tests and optional e2e deletion scripts for developers’ self-testing only; for everyday use, rely on the client menu.

When manually editing ~/.dsh/profiles/desktop/package.json to register the bundle, do not include a BOM in the JSON, otherwise DSH may fail to start with a JSON.parse error and the interface may not open.

Conclusion

dsh-session-delete fills DSH’s missing delete capability through the official session menu slot: records go to the Recycle Bin and can be restored, deliverables are scanned before selection and root-level loose files are never touched, and it is explicitly distinguished from the same-named permanent-deletion package on npm. The community plugin directory has no official affiliation with DeepSeek / High-Flyer; installation and versioning are governed by your local DSH and the repository’s instructions.

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

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

Xiaoye