dsh-session-trash: DSH Session Trash

Introduction

DeepSeek Harness (DSH) stores Sessions in the local file system, but the official UI only provides an “Archive” function with no “Delete” option. A workspace used over a long period can accumulate hundreds of Sessions, and archiving them consumes disk space and is difficult to manage. The dsh-session-trash plugin adds a “Delete Session…” option to the DSH Session menu, moving Sessions into a locally recoverable trash instead of permanently wiping them from disk.

Plugin Overview

This is a DeepSeek Harness plugin maintained by jjjhrl. It turns Session deletion from an “irreversible” operation into a “recoverable” one by creating a trash directory outside the session directories and renaming the Session directory rather than overwriting it. The plugin provides both a UI and an agent tool, supporting listing, restoring, permanently deleting, and emptying the trash.

Core Features

Session Deletion and Trash

In the DSH Sidebar Session list, a “Delete Session…” option appears in the … menu of any Session row. After selecting it and confirming “Move to Trash,” the Session row immediately disappears across all open clients, but the stored conversation history is not deleted—instead, it is moved to the trash directory.

Trash Management

Navigate to Settings → Session Trash to view the list of deleted Sessions. Each entry displays the title, deletion time, size, original directory path, and action buttons:

  • Restore: Moves the Session directory back to its original location. After refreshing the page, it reappears in the Sidebar with its original archive/pin status preserved.
  • Purge: Deletes the trash entry permanently. This action is irreversible.
  • Empty Trash: Deletes all trash entries at once.
  • Refresh: Re-reads the trash directory.

Agent Tool

The plugin provides a session_trash tool to the Agent with the following subcommands:

  • list: List the contents of the trash.
  • delete: Delete a specified session.
  • restore: Restore a specified entry.
  • purge: Empty the trash.

Examples:

List the session trash.
Delete session "session-db0f39d1-41c4-491c-9740-ce244f3ed601" (it is archived and unused).
Restore trash entry 20261123-134016-session-bd51ec4c-1ee7-4e0f-a86a-a7c0abd4e2a1.

Safety Restrictions

The plugin enforces protections on deletion operations and rejects the following cases:

  • Running Sessions: A Session currently open in the Host process cannot be deleted, because its writer may continue appending to the file. Close the Session first or use archive instead.
  • Non-standard storage: If the Session’s storage directory does not follow the <project>/<encoded id>/ format, or if the directory contains files other than session*.jsonl* and session.lock, deletion is rejected and the reason is displayed.
  • Irreversible operations: “Purge” and “Empty Trash” cannot be undone once executed.

Technical Implementation

A Session corresponds to a directory under the JSONL persistence root, with a typical structure of:

$DSH_HOME/sessions/--<project>--/<encoded session id>/
  session.v4.jsonl.zstd
  session.lock

When deleting, the plugin first validates the Session storage path, then rejects running or non-standard sessions. It then renames the directory to $DSH_HOME/session-trash/<yyyyMMdd-HHmmss>-<session id>/data and writes a meta.json file in the sibling directory, recording metadata such as version, entryId, sessionId, title, cwd, createdAt, deletedAt, sizeBytes, and sessionDir.

On restore, the data/ directory is moved back to its original location, and the meta.json file and entry are removed. Purging simply deletes the directory outright. Cross-device moves use a “copy then delete” approach.

The trash directory is deliberately placed outside the persistence root to avoid being misidentified as a project by the backend.

Installation and Activation

In the DSH Web GUI, open Plugins → Add Plugin, and paste the repository URL:

https://github.com/jjjhrl/dsh-session-trash

After confirming, refresh the page.

Ask the Agent to Install

Send the following in a conversation:

Install the DSH plugin from https://github.com/jjjhrl/dsh-session-trash

The Agent will call the plugin manager’s install_bundle to perform the installation and report the result.

Local Development Install

git clone https://github.com/jjjhrl/dsh-session-trash.git
cd dsh-session-trash

Then select the absolute path in Plugins → Add Plugin, or ask the Agent to install /absolute/path/to/dsh-session-trash. Local installation creates a link. After modifying files, close and re-enable the plugin row to reload the Host-side code, and refresh the page to load the Client-side code.

System Requirements

  • DeepSeek Harness >= 0.2.2-rc.1 (Web GUI).
  • Node.js >= 20 on the Host.
  • JSONL session persistence backend (@deepseek-ai/dsh-session-persistence-jsonl); the plugin accesses sessions via the $DSH_HOME/sessions path.

Use Cases

Ideal for users who manage a large number of Sessions in DSH and need “soft delete” rather than permanently erasing history. For long-running workspaces, the trash allows cleaning up unwanted sessions while preserving data recoverability.

Notes

  • The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license (MIT) before installing.
  • Deleting a Session permanently removes its history; it can only be restored while it exists in the trash.
  • Running sessions must be archived or closed before they can be deleted.
  • A restored Session will not automatically appear in already-open clients; a page refresh is required.

Conclusion

dsh-session-trash transforms DSH’s Session deletion from an “irreversible” operation into a “recoverable” one, implementing a trash feature through local directory renaming and metadata recording. For developers who need to manage a large volume of sessions, this is a practical tool. More details can be found on the plugin directory page and the GitHub repository.

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

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

Xiaoye