dsh-session-recycle-bin: Adding Recoverable Session Deletion to DeepSeek Harness

Preface

When managing sessions in DeepSeek Harness (DSH), the sidebar menu typically only offers rename, fork, and archive. Archiving merely hides the session from the sidebar without removing a single byte of the session log from the disk. However, to completely remove a session from the disk, the official sessionPersistence contract explicitly states: there are no delete or retention APIs; cleaning up sessions is considered out-of-band maintenance. Many users are forced to manually navigate to %USERPROFILE%\.dsh\sessions\ to delete directories, which is prone to accidental deletion and can easily cause inconsistencies in the session list, projection cache, and workspace registry state. Furthermore, empty --C-Users-...-- project folders may remain after deletion.

The community plugin dsh-session-recycle-bin (Maintainer: Afgkwyp, Category: Memory) turns “deleting a session” into a two-step process: first archive it to a recycle bin (soft delete, logs untouched) where it can be restored anytime, and only truly delete the disk logs when confirmed unnecessary. Below is an introduction to what it does, how to install and use it, and the boundaries of permanent deletion.

What is this

dsh-session-recycle-bin is a “session recycle bin” plugin for DSH: the header trash button and the sidebar “Delete Session” first move the session to the recycle bin (soft delete, logs untouched). The settings page provides centralized management for archived sessions, supporting restore, permanent deletion, and batch cleanup. Implementation-wise, it has zero dependencies and zero build steps, consisting of a single-file host (index.js) and a single-file client (client.js). The current version in package.json is 1.0.3, and the README specifies compatibility with DeepSeek Harness 0.2.1-rc.2 (Desktop / Web profile), Node >=22, licensed under MIT.

Core Features

UI Entry Points

Location Function
Session Header (Toolbar to the right of the title) Trash Button: Move the current session to the recycle bin
Sidebar Session “⋯” Menu Delete Session (Red, order 500, positioned after official pin / rename / fork / archive / session ID)
Settings → Session Recycle Bin Centralized management of archived sessions: multi-select restore, permanent delete, empty recycle bin, delete sessions older than 30 days; displays workspace path, deletion time, log size, sub-agent session count, and “Running” status

Upon confirmation of a soft delete, the session disappears from the sidebar and enters the recycle bin; logs, sub-agent sessions, and projection caches are preserved and can be restored at any time. The recycle bin membership is the union of the official archive set (the archived set in workspaceRegistry) and the plugin’s records, so items archived via the official “Archive Session” will also appear here.

Restore and Permanent Deletion

Restoring moves the session out of the archive set, returning it to its original position in the sidebar without touching disk files.

Permanent deletion is the only operation that affects the disk. The order is intentionally fixed in the README (non-commutable): Release resident session → Stop running work and wait for it to zero out → Persist flush barrier → Delete log directory / sub-agent directories / projection cache → Clean up registry references → Broadcast api-session/removed. Content deleted includes: the entire $DSH_HOME/sessions/<project>/<session id>/ directory, sub-agent log directories for that session under the same project, project directories when they become empty (1.0.1+), relevant projection checkpoints in session_projcache, and archive / pin / member references in storages/workspace.json. It does not delete attachment objects (content-addressed, shared across sessions), files in the session workspace, or fork sessions that act as independent conversations.

Batch Cleanup and Confirmation

The toolbar only contains actions for selected items (Restore Selected / Permanently Delete Selected); “Delete sessions older than 30 days” and “Empty Recycle Bin” are placed in the “Dangerous Operations” area below the list, with notes on the scope of application. Daily cleanup only deletes sessions with reliable time evidence that are sufficiently old: it prioritizes deletion records, otherwise uses the last modified time of the log; entries lacking both are preserved and reported in the results. Single permanent deletion is confirmed inline on the row (the prompt includes the session title); batch / empty / daily cleanup uses a top confirmation card, locking operations on other rows during confirmation.

Safety Boundaries (Summary)

Scenario Behavior
Session is still running Refuses to archive; may offer “Stop and Delete”, using official workspace/session-stop
Current UI is still open on this session Refuses permanent deletion, prompts to switch sessions first
Directory name does not match session ID Skips and reports, does not guess paths

The sidecar record used for recycle bin display is written to $DSH_HOME/session-recycle-bin.json; deleting it does not affect the archive status itself.

Installation and Activation

The plugin accesses sessions and storage under $DSH_HOME with the permissions of the current DSH process; it is recommended to read through the repository source code and MIT license before installation. SkillHub is a community directory and has no official affiliation with DeepSeek / High-Flyer; installation follows the README, requiring the plugin directory to be placed locally first, then mounted according to the profile.

Method A: GUI (Recommended by README)

  1. Place the repository in a local directory (the README example clones it to a local path).
  2. Sidebar → Plugins → Add Plugin → Enter the absolute path of the directory.
  3. Takes effect semi-instantly on the host side; refresh the page once on the browser side.

Method B: CLI

dsh plugin --profile <profile-name> add "C:/path/to/dsh-session-recycle-bin"

Replace C:/path/to/dsh-session-recycle-bin with the actual path on your machine.

Method C: Manually edit profile

Insert the plugin line into <DSH_HOME>/profiles/<profile>/cordis.patch.yml, and add "dsh-session-recycle-bin": "file:C:/path/to/dsh-session-recycle-bin" to the dependencies in the package.json of the same profile (the path must also be an absolute local path). Refer to the insert example in the README for specific fields.

Update: After pulling the new version, disable and re-enable the plugin on the plugin page and refresh the page; restarting the application is safer when replacing installed packages. Uninstall: Simply remove it on the plugin page; optionally delete the session-recycle-bin.json sidecar record.

Verify Activation

  • A trash can appears in the session header; “Delete Session” appears in the sidebar “⋯” menu;
  • Settings → Session Recycle Bin lists archived sessions;
  • After host activation, an activation record (build number, seam, timestamp) is written to $DSH_HOME/plugin-session-recycle-bin.json; check this file first when troubleshooting “code changes didn’t take effect”.

Optional Configuration (Written under the plugin line’s config, all optional):

- id: session-recycle-bin
  name: 'dsh-session-recycle-bin'
  config:
    home: 'C:/Users/me/.dsh'   # Defaults to $DSH_HOME or ~/.dsh
    stopWaitMs: 8000           # Max wait time (ms) for work to zero out after stopping

Typical Usage

  1. Daily “Delete session from sidebar”: Open a session, click the header trash can; or sidebar session “⋯” → Delete Session → Confirm. The session enters the recycle bin, and disk logs are not deleted.
  2. Recover from accidental deletion: Settings → Session Recycle Bin → Select item → Restore Selected.
  3. Confirm deletion is unnecessary: Select session on the same page → Permanently Delete Selected (or inline confirm for single item) → Follow prompts; if the session is still running, you must first use “Stop and Delete”.
  4. Regular maintenance: Use “Delete sessions older than 30 days” or “Empty Recycle Bin” in “Dangerous Operations”, noting the scope described; entries with unknown times will not be mistakenly deleted by daily cleanup.

The host semi-provides routes like /api/session-recycle-bin.{health,list,archive,restore,purge}; the browser side calls them via same-origin fetch and the request header x-dsh-session-recycle-bin: 1, consistent with the official plugin method.

Developers can run self-tests in the plugin directory (without starting the full Harness):

node test/host-test.mjs

Or npm test (the test script in package.json points to the same file). The README records fixture checks as 39/39.

Use Cases and Notes

Who it is for: Desktop / Web profile users who accumulate a large number of sessions in DSH over the long term, need controlled disk cleanup, and want deletion to be revocable; relies on connection, sessionPersistence, workspaceRegistry, and several client slots (sidebar menu, session header tools, settings block, etc.). The README has been tested on 0.2.1-rc.2 (Windows Desktop, web profile).

Important Notes: The plugin runs with the same process privileges as DSH, and permanent deletion is irreversible (except for attachments and workspace files retained by design). With multiple profiles, installation in a specific profile only affects that profile. If the sidebar does not refresh immediately after permanent deletion, switch sessions or refresh the page; starting from 1.0.1, empty sessions/--C-Users-...--/ project directories are cleaned up, if empty directories are still seen after upgrading, reload the plugin.

Conclusion

dsh-session-recycle-bin fills the gap in the DSH session lifecycle between “restorable deletion” and “real disk cleaning” using a recycle bin, and unifies official archiving with plugin archiving for management in the settings page. For further details, please refer to the community directory page and the GitHub README for installation details, permanent deletion lists, and changelogs (current package version 1.0.3).

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

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

Xiaoye