Preface¶
DeepSeek Harness (DSH) by default only provides archiving for session management: sessions can be hidden from the sidebar but are not removed from the disk, causing conversation logs to accumulate continuously. For developers running agents and sub-agents under the same project for a long time, the lack of a “real delete” feature leads to disk space consumption and retrieval noise when cleaning up experimental sessions or entire sub-agent lineages.
dsh-session-delete-cascade is a community-maintained client plugin. It integrates via the official plugin mechanism and does not modify DSH source code; it can be uninstalled when not needed. The following sections describe its capabilities, installation methods, deletion scope, and safety behavior.
What is this¶
- Name:
dsh-session-delete-cascade(npm package name matches GitHub repository name) - Maintainer: Changqin1024
- Category: Client (Host + Browser Client, communicating via Connection HTTP routes)
- License: MIT
- Positioning: Adds a “Delete Session” option to the
⋯menu of sidebar sessions. Upon confirmation, it recursively deletes by sub-agent lineage and cleans up logs, projection caches, search indexes, and workspace accounting.
Official DSH does not provide deletion; this plugin restores deletion capability as an independent bundle.
Core Features¶
Sidebar and Confirmation Flow¶
- A new “Delete Session” option is added to the session row
⋯menu, positioned after “Archive Session” (specified as the last item in the verification checklist). - A confirmation dialog appears before deletion, explaining the content to be deleted and listing the sub-sessions that will be deleted along with it (previewed by title).
Recursive Deletion and Retention Boundaries¶
- Sub-agents (
origin: 'subagent') are deleted recursively, including sub-agents of sub-agents. - Forks are not considered sub-sessions: Fork sessions with a
parentSessionbut without asubagentorigin are retained, consistent with DSH’s built-in archive gating rules. - When deleting a specific sub-session, only its own subtree is deleted; parent and sibling sessions remain unaffected.
Thorough Data Cleanup¶
For the target session and its sub-agent lineage, the following are removed upon confirmation:
| Content | Location / Storage | Handling Method |
|---|---|---|
| Conversation History | ~/.dsh/sessions/<project>/<session_id>/ (append-only JSONL) |
Delete directories one by one |
| Projection Cache | session_projcache |
Delete row by row |
| Search Index | Session search SQLite index | Automatically reconciled and cleared after log deletion |
| Workspace Accounting | sessionIds in each workspace, global archive set, pinned set |
Remove items individually |
Not Deleted: Caches that cannot be directly addressed by session ID, such as the attachment request graph cache (~/.dsh/cache/attachments/request-images/). The README explains that clearing it requires reading logs for content hashes, which is disproportionate in cost; since the interface will no longer reference them after session deletion, they can be regenerated as needed.
Safety Guardrails¶
If any session within the lineage still has active tasks (ongoing turns, running sub-agents, background tasks, scheduled reminders, etc.), deletion is rejected with session/delete-active, and the details list the ID and activity type for each problematic session; no data is deleted during a rejection.
Installation and Activation¶
The package is published on npm: https://www.npmjs.com/package/dsh-session-delete-cascade.
The engines.dsh field in package.json is >=0.2.1-rc.2; the README states that the plugin’s usage of ctx.connection.fetch.register is verified on DSH 0.2.0-rc.2. Please check your local DSH version before installing.
Desktop (DeepSeek Harness App)¶
Go to Settings → Plugins → Add Plugin and enter the package name:
dsh-session-delete-cascade
Alternatively, paste the repository URL https://github.com/Changqin1024/dsh-session-delete-cascade.
After installation, fully exit and reopen the App. The “Delete Session” option will appear in the sidebar session ⋯ menu.
The desktop profile cannot be installed via CLI; DSH has exclusive protection for the desktop profile, resulting in the error error: profile "desktop" is managed exclusively by the Electron application. Use “Settings → Plugins” for the desktop version.
Web / CLI profile¶
dsh plugin --profile <profile> add dsh-session-delete-cascade
Example:
dsh plugin --profile web add dsh-session-delete-cascade
Restart the profile after installation.
Install from GitHub (pinned to a specific commit):
dsh plugin --profile <profile> add github:Changqin1024/dsh-session-delete-cascade
Uninstallation¶
- Desktop: Settings → Plugins, find this plugin and uninstall it.
- CLI:
dsh plugin --profile <profile> remove dsh-session-delete-cascade.
Typical Usage¶
- Hover over any session row with content in the sidebar, open the
⋯menu, and select “Delete Session”. - If there are sub-agents under the session, review the list and count of sub-sessions that will be deleted alongside it in the confirmation dialog.
- After confirmation: Sessions within the lineage disappear from the sidebar, and the corresponding
~/.dsh/sessions/<project>/<session_id>/directories should be removed; fork sessions derived from the same parent session should remain. - Searching in the sidebar for text that exists only in deleted sessions should yield no results.
If deletion fails with a prompt about active sessions, finish or wait for tasks on the relevant sessions and then retry.
Execution Order (Implementation Level)¶
The Host-side POST /api/session-delete.delete executes in a fixed order to avoid tearing in intermediate states:
- Collect Lineage — Read from persistent headers, not the runtime Subagent catalog.
- Rejection Check — If any session in the lineage is active, the entire operation fails without deleting anything.
- Release Agents — Deep-first (children before parents) to prevent late settlements from hitting non-existent parents.
- Clear projection cache rows → Delete log directories → Remove from workspace accounting.
Steps 3–6 are fault-tolerant implementations (log failures without throwing errors) to reduce the risk of sessions still appearing in the sidebar due to derived storage exceptions.
Plugin structure overview: lib/index.js is the Host; lib/client.js handles the browser-side menu and dialogs (controls are inline, no Harness package dependency); cordis.patch.yml inserts the Host plugin line.
Use Cases and Caveats¶
Suitable for: Users who need to permanently remove experimental sessions and entire sub-agent trees in DSH and free up disk space under ~/.dsh/sessions.
Important Notes:
- Deletion is irrecoverable; the sub-session list in the confirmation dialog is the final check before the operation.
- The entire lineage follows an “all or nothing” principle: if any descendant is running, the whole lineage cannot be deleted to avoid orphan sessions caused by partial deletion.
- Lineage traversal is based on persisted sessions; purely in-memory sub-sessions that haven’t been materialized and aren’t in
session.list()theoretically won’t be traversed (the README notes that sub-sessions are persisted first in actual usage). - The plugin runs with the permissions of the current DSH process; please review the source code and MIT license on the GitHub repository before installing.
- The client UI is an inline implementation; if DSH adjusts sidebar control specifications in the future, the plugin may need updates.
The DSH ecosystem emphasizes “everything is a plugin”; the community directory SkillHub Plugin Page is an independent site with no official affiliation with DeepSeek / High-Flyer.
Conclusion¶
dsh-session-delete-cascade restores “Delete Session” to the sidebar without touching official code, performing cascading cleanup and safety gating based on sub-agent lineage. It can be installed from npm or GitHub when needed and uninstalled after use.
- Directory Page: https://www.skillhub.cn/plugins/Changqin1024/dsh-session-delete-cascade
- Source Code & Docs: https://github.com/Changqin1024/dsh-session-delete-cascade
- DeepSeek Harness: https://www.deepseek.com/harness/