DeepSeek Harness Session Deleter Plugin (dsh-session-deleater)

Preface

In DeepSeek Harness (DSH), sessions, projection caches, workspace references, and client state are all written to local storage. When a session is no longer needed, manually cleaning it up can easily miss files or break reference relationships, affecting the stability of subsequent sessions. This plugin provides deletion entry points in the session title bar and the “More” menu in the sidebar, performing safe deletion of session logs, projection caches, workspace references, and client state in local DSH storage, with an optional cleanup of media that exclusively belongs to that session.

Plugin Overview

The plugin is named dsh-session-deleater, with the package name @local/dsh-session-deleater and the Loader entry id dsh-session-deleater. Developed by maintainer hluica, it is categorized under admin-security. The plugin version is 0.1.3, targeting DSH version 0.2.2-rc.5. It depends on DSH’s webServer, connection, and sessionPersistence, as well as the non-public interfaces for sessions, agents, and sessionProjectionCache required for live deletion. This plugin does not provide any npm runtime dependencies and only uses Node built-in modules.

Core Features

  • Deletion entry: Provides a “Delete Session” option in the right side of the session title bar and in the “More” menu of each session row in the sidebar.
  • Pre-check and confirmation: On the first deletion, displays the number of sub-sessions, running status, and scheduled task references, and warns that “provider/backup copies cannot be revoked.”
  • Safe mode: By default, preserves attachments and external copies, only stopping running scheduled tasks.
  • Secure Purge: When “Also clean up attachments that exclusively belong to this session” is checked, it deletes all scheduled tasks referencing this session (including paused/finished/associated tasks), and immediately cleans up media if no live sessions exist, otherwise defers to the next startup; shared attachments are always preserved.
  • Cascading deletion: Deleting a top-level session cascades to sub-sessions with origin=subagent; regular forks and session-reference copies are not automatically deleted.
  • Auto-navigation: After deleting the current session, automatically opens the most recently updated other session in the same workspace; if no other session exists, creates/reuses a blank session; if the currently open session is a sub-session deleted via cascading, it also navigates away; on navigation failure, a prompt is retained and the user can manually select from the sidebar.
  • How it works: Before deletion, performs pre-checks on session identity, sub-session tree, paths, activity status, and required capabilities; stops turns/jobs/subagents/scheduled tasks; installs a lifecycle tombstone for the projection cache; persists the deletion intent (journal) and renames the session directory to ~/.dsh/.session-deleter-trash/; live sessions use non-public interfaces to detach from registration and close write handles; deletes the isolated directory, cleans up caches, workspace, pin/archive, scheduled tasks, and client localStorage; replays unfinished journals on startup, and cleans up orphan caches, isolated directories, and dangling pin/archive; a process crash or partial failure will not result in “files still exist but the entry has disappeared.”
  • Scope: Only deletes local DSH storage (~/.dsh/sessions, ~/.dsh/storages/session_projcache, workspace/scheduled task references, client localStorage); does not delete workspace files under the session cwd, project directories, or Git worktrees; does not delete official copies sent to the model provider, remote files, OTel/analytics/exports/backups, or snapshots.

Installation and Activation

Install from the GitHub repository:

dsh plugin add github:hluica/dsh-session-deleater

After activation, refresh the page to see the deletion entry in the session title bar and the “More” menu in the sidebar. Confirm the bundle is enabled and check dsh.client and slot registration.

Typical Usage

  1. Open the session to be deleted, then select “Delete Session” from the right side of the title bar or the “More” menu of the session row in the sidebar.
  2. The first deletion displays preview information; confirm to proceed with the deletion flow.
  3. In default Safe mode, the plugin only stops running scheduled tasks while preserving attachments and external copies.
  4. For thorough media cleanup, check “Also clean up attachments that exclusively belong to this session” and confirm no live sessions exist to immediately execute Secure Purge.
  5. After successful deletion, the system automatically opens the most recently updated other session in the same workspace; if no other session exists, it creates/reuses a blank session.

Use Cases and Cautions

  • Suitable for developers who need to clean up local session data, free storage space, and avoid session pollution.
  • The plugin runs with the current DSH process privileges; it is recommended to review the source code and license before installation.
  • After deletion, the provider may still retain the content; local deletion cannot be revoked. The plugin explicitly states that the deletion semantics are “local safe deletion,” not provider/backup-level complete erasure.
  • When deleting a hot session, logs and caches are deleted, while the Agent’s scoped resources are cleaned up upon process exit; if critical non-public capabilities are missing, hot deletion is rejected (returns 503), while cold deletion remains available.

Troubleshooting

Symptom Resolution
No deletion entry in title bar/menu Confirm the bundle is enabled and refresh the page; check dsh.client and slot registration.
Prompt says “Current DSH version lacks hot deletion capability” Use cold session deletion, or restart DSH and retry; do not forge events.
Session row still visible after deletion Refresh the session/workspace list; if hot session registration cleanup fails, restart DSH to let the journal finish.
Still on old content after deleting current session Confirm the Client bundle is updated and refresh/restart; if the dialog shows “Failed to auto-open another session,” manually select from the sidebar.
Attachments still exist Default safe mode preserves attachments; with secure purge checked, cleanup is immediate if no live sessions exist, otherwise deferred to next startup; shared attachments are never deleted.
Prompt indicates active tasks still exist Stop running turns/jobs/reminders first; deletion will not force-bypass work that cannot be stopped.
Provider still retains content Local deletion cannot be revoked; this is clearly stated in the README/dialog.

Summary

This plugin provides DeepSeek Harness with a safe and controllable session deletion solution. Through pre-checks, Safe mode, Secure Purge, and cascading deletion mechanisms, it ensures the consistency and recoverability of local storage. Developers can quickly clean up unneeded sessions from the session title bar and sidebar menu while avoiding accidental deletion of critical files or breaking reference relationships.

  • Plugin directory page: https://www.skillhub.cn/plugins/hluica/dsh-session-deleater
  • GitHub: https://github.com/hluica/dsh-session-deleater
羽毛球分组比赛记分
小程序二维码

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

Xiaoye