Preface¶
Every session in DeepSeek Harness (DSH) leaves behind a log directory, projection cache, and workspace accounting. If sub-agents were spawned, a “subtree” attributed to the parent session appears on disk and in listings. In the official workflow, “archiving” or closing the UI does not equate to wiping data from storage. During long-term development, this leads to an accumulation of useless sessions that consume space and make it difficult to distinguish which ones are safe to delete in the sidebar.
The plugin introduced below, @liuyu-f/dsh-plugin-session-cascade-delete, addresses this pain point: it permanently deletes specified sessions via the Web UI or agent tools and cascades the cleanup of owned sub-agent sessions according to DSH’s attribution rules; forked sessions are not affected. The maintainer is liuyu-f, the current npm package version is 1.0.5, and the license is MIT. The documentation specifies compatibility with DeepSeek Harness V0.2.0-rc.2 to 0.2.1-rc.2. Since slot names and service signatures change with DSH versions, verification is required for other versions.
What is this¶
In short: A client-side plugin that thoroughly deletes sessions and related data from the DSH UI or the session_delete tool.
It originates from the DSH adaptation and enhancement of @huanlin/dsh-plugin-session-delete (see upstream at lsz-asd/dsh-plugin-session-delete). The modifications focus on sub-agents: cascade deletion, fork protection, stopping running sessions before deletion, and handling both formats of session IDs.
Core Features¶
UI Entry Points¶
| Entry | Location |
|---|---|
| Header Trash Icon | Action area next to the session title |
| Menu Item | Sidebar session row “…” → “Delete Session” |
Confirming triggers a complete cleanup; once deleted, the session disappears immediately from the UI and the session list without needing a DSH restart. This applies to the Web interface and any client based on the Web shell.
What is cleaned up in a single deletion¶
The order is roughly: if the session is running, stop the task and release the running Agent and session; then delete the session log directory, projection cache (cache rows and disk documents), and workspace accounting (workspace membership, archives, pins); then delete the sub-agent sessions owned by this session from “deepest to shallowest”; finally, notify the UI to remove the corresponding row.
Failure at any step is not silent: the result report will show INCOMPLETE, indicating which step failed and the reason. The documentation emphasizes: accounting is only touched after logs are confirmed clean, avoiding “half-deleted, session falls into ungrouped” bad rows.
Sub-agents and Forks¶
- When deleting a parent session, the sub-agent sessions it owns are deleted by default (deepest ones first).
- Forked sessions (forks) are independent: deleting a fork does not delete anything else, nor does it affect sub-agents.
- Sub-agents belong to the “session that created them”: if a sub-agent is created in session A, and B is forked from A, deleting B does not affect the sub-agent, while deleting A will delete them.
Agent Tool session_delete¶
Agents can also call this tool to delete sessions and report what was actually deleted in the result.
| Parameter | Function |
|---|---|
sessionId |
Directly specify the session id to delete (recommended) |
title |
Use when only the title is known; deletes only if the title is unique, otherwise errors and lists candidates |
discover |
Only lists sessions known to this profile, does not delete; current session marked with > (current session) after title |
discoverTree |
Only lists the sub-agent tree owned by a certain session (id, depth, parent), does not delete |
keepSubagents |
Only delete the current session, keep its sub-agents (default deletes sub-sessions as well) |
Two safety constraints:
- Refuses to delete the session where this tool call is located (and sessions in whose tree this session is contained).
- If the session currently open in the UI is not the same as the “session where the tool call is located,” it can be deleted normally.
Installation and Activation¶
Choose one of two installation methods.
UI (Recommended): Open DSH → “Plugins” at the top left → “+ Add Plugin” at the top right, enter:
@liuyu-f/dsh-plugin-session-cascade-delete
Terminal:
web profile:
dsh plugin --profile web add @liuyu-f/dsh-plugin-session-cascade-delete
desktop profile:
dsh plugin --profile desktop add @liuyu-f/dsh-plugin-session-cascade-delete
When changing versions, you must remove then install (installing directly while already installed will report ambiguous-install):
dsh plugin --profile desktop remove @liuyu-f/dsh-plugin-session-cascade-delete
dsh plugin --profile desktop add @liuyu-f/dsh-plugin-session-cascade-delete
Typical Usage¶
- Select the session to delete in the sidebar, click the trash icon next to the title, or select “Delete Session” in the “…” menu of that row, and confirm in the popup.
- If the session is still running an agent, the plugin will first stop and release it, then clean up disk and lists.
- When programmatic deletion is needed in an agent conversation, prioritize passing
sessionIdto callsession_delete; if the id is uncertain, usediscoverordiscoverTreeto view first, then delete (deletion itself cascades and reports what was deleted in the result, so preview is not a mandatory step).
Optional Configuration¶
Written in the profile’s cordis.patch.yml (this plugin does not export a Config schema, so there is no form on the settings page):
- id: session-delete
name: "@liuyu-f/dsh-plugin-session-cascade-delete"
config:
deleteSubagents: false # Default true: delete sub-agent sessions along with the parent session
sessionsRoot: "" # Optional: override session log root directory, default $DSH_HOME/sessions
Setting deleteSubagents to false is equivalent to the “delete only this session, keep sub-agents” behavior in the UI/tool.
Use Cases and Notes¶
Who it is for: Developers who frequently run long sessions in DSH, spawn sub-agents for exploration or parallel tasks, and wish to cleanly remove entire session chains from disk and the sidebar.
Permissions and Safety: The plugin runs with the current DSH process permissions and deletes logs and related caches/accounting under $DSH_HOME/sessions (or your configured sessionsRoot). It is recommended to read the source code and MIT license of the GitHub repository before installation to ensure the behavior meets expectations; deletion is irrecoverable.
Ecosystem Note: The DSH community plugin directory is listed on the SkillHub Plugin Page and elsewhere. It has no official affiliation with DeepSeek / High-Flyer and is not an official app store.
Conclusion¶
If you need to “clean delete” in the Harness rather than just closing the UI, @liuyu-f/dsh-plugin-session-cascade-delete strings together the UI entry, session_delete, cascading sub-agents, fork protection, and stop-then-delete for running sessions into a single path. For more details and screenshots, see the repository README; Listing page: SkillHub, Source code: GitHub.