Introduction¶
DeepSeek Harness (DSH) includes a built-in archiveSession feature that allows for session archiving. However, session records that “cannot be deleted” may persist in the interface for a long time. There are two common scenarios: when only deleting a workspace, the confirmation text specifies that folders and session logs are retained, and the session falls back to Ungrouped; the persistence layer documentation also states that there is no API to delete session files, meaning logs accumulate under root and can only be cleaned up externally. If you wish to truly remove a conversation from both the sidebar and the disk, additional capabilities are required. This article introduces the community plugin dsh-session-delete (maintained by spidu-lee), which adds a “Permanently Delete Session” option to the session “⋯” menu. Upon confirmation, it cleans up the disk directory, projection cache, and associations across various workspaces.
What is this¶
dsh-session-delete is a bundle plugin designed for DSH Web configuration (platform: web), currently at version 0.1.0 and licensed under MIT. It inserts a dangerous operation item into the “⋯” menu for each session in the sidebar. It uses a Modal for confirmation (similar to the official archive feature) rather than a native window.confirm. Once confirmed, the host-side routing handles the deletion and notifies all clients via api-session/removed to immediately remove the corresponding row from the list.
Unlike session menu plugins that only perform UI operations, this plugin deletes session records on disk (log directories, etc.) and cleans up associations pointing to that session. This is the key difference highlighted in the README compared to DSH’s built-in capabilities.
Core Features¶
Sidebar Menu and Confirmation Dialog¶
| Item | Description |
|---|---|
| Slot | sidebar.workspaces.session.menu.item |
| Row ID | dsh-session-delete.session.delete |
| Order | 500 (Positioned after built-in pin 100 / rename 200 / fork 300 / archive 400) |
| Style | ui-primitives MenuItemButton, danger + separatorBefore, icon IconTrashOutlineRegular |
The confirmation layer is attached to shell.overlay, with the entry ID dsh-session-delete.session-delete-confirm. The row and the dialog are decoupled via a module-level pending request store to prevent leakage of in-progress state. The dialog indicates whether the current window still has the target session open or holds it via ctx.get("sessions").retainInfo(id).
If you are currently viewing the session to be deleted in the Main View, the plugin will first navigate to another session (or call startSession() if there are no other rows in the workspace). It waits for the mainView reference count to drop and allows the host to release it before executing the deletion. If the release is not completed within 5 seconds, the deletion is cancelled and the user is prompted with dialog.stillOpen to prevent the session from being written back after deletion.
Host-Side Deletion Flow (Overview)¶
The README lists 12 logical steps in a table. The core steps include:
- Validate
sessionId(must be a single path segment,..is forbidden). - Locate the directory under
<sessionsRoot>/<projectKey>/<sessionId>(projectKey is a lossy encoding of the cwd, identified by scanning rather than decoding). - Return
404if the target does not exist. - Query activity via the
workspace/session-activitywaterfall to see if there is still activity (same asarchive); if so, dispatchworkspace/session-stopand poll until stable. - If the activity refuses to stop, return
409and explain in the message what is still running. - Dispatch
workspace/session-stopeven for sessions only loaded in memory, to prevent the header from writing back to disk after deletion. - Delete the directory using
fs.rm(dir, { recursive: true, force: true }). - After deletion, check the directory again for up to 4 rounds with a 350 ms interval; if it has been written back, return
delete-resurrectedinstead of success. - After successful file deletion, detach and unpin from various workspaces via the registry entity API.
- Best-effort deletion of
storages/session_projcache/sessions/<id>.json(failures are reported as warnings). - Check if the host store or persistence layer still lists the session and report it as a warning, rather than claiming it is completely clean (the plugin cannot call the sessions removal API).
- Emit
api-session/removed, prompting all open windows to immediately remove the sidebar row.
The README also notes: Activity determination uses workspace/session-activity rather than simply checking the Agent registry, because DSH retains Agents for any session opened in a window, which would cause idle sessions to be falsely identified as “still running.”
Installation and Activation¶
Install from the market (the README notes this is available “once listed”):
dsh plugin --profile web add github:spidu-lee/dsh-session-delete
You can also manually insert it in a profile patch:
# cordis.patch.yml
- insert:
- id: session-delete
name: 'dsh-session-delete'
The package declares both dsh.bundle.patch and dsh.client (platform: web) and is installed as a standard bundle. DSH must be restarted after installation: the host-side routes are mounted at startup.
The README explains: The "private": true in package.json is intentional. Since an unrelated package already occupies the name dsh-session-delete on npm, this plugin is distributed only via GitHub.
Typical Usage¶
- Install the plugin for the web profile using the command above and restart DSH.
- Open the “⋯” menu on the target session in the sidebar and select the permanent delete option (the text depends on the plugin’s locale).
- Read the information in the Modal regarding whether the current window still has the session open/retained, and confirm to execute the deletion.
- If deleting the session currently in the Main View, wait for the plugin to automatically switch sessions and complete the release before deleting; if it fails, the dialog remains open and displays the error returned by the host (e.g., activity could not be stopped, logs were written back, etc.).
No additional configuration files are required; the behavior is handled by the plugin bundle and host APIs.
Use Cases and Notes¶
Who is it for: DSH users who need to clean up accumulated logs under $DSH_HOME/sessions and remove a session from all workspace sidebars; this complements scenarios where you only archive or only delete workspace folders.
Permissions & Security: The plugin runs with the permissions of the current DSH process and directly recursively deletes session directories. Before installing, please read the source code and the MIT license on the GitHub repository to ensure you accept its behaviors, such as stopping activities, deleting from disk, and detaching workspaces.
Capability Limits: After deleting files, pending entries in the host’s in-memory store or persistence layer may still exist briefly; the README explicitly states that the plugin cannot clear these internal structures and will note this in the results as a warning. Permanent deletion is irreversible; please confirm the session ID and content before proceeding.
Ecosystem Note: The DSH community plugin directory (e.g., SkillHub) is an independent site and is not officially affiliated with DeepSeek or High-Flyer. The installation commands in this article are based on the repository’s README.
Conclusion¶
dsh-session-delete fills the gap not covered by DSH’s native archiveSession: it provides a confirmable permanent deletion in the sidebar and synchronously cleans up disk logs, projection caches, and workspace associations. For more information, see the directory page skillhub.cn/plugins/spidu-lee/dsh-session-delete and the source code github.com/spidu-lee/dsh-session-delete.