Preface¶
DeepSeek Harness (DSH) persists every conversation as session logs on disk. The sidebar allows listing, opening, and archiving sessions. Archiving acts as a “soft delete”—the logs remain. However, if you want to permanently remove a specific experiment, expired sub-agent trees, or space-consuming logs, the core system lacks a “delete” mechanism: SessionPersistence only provides create/open/flush/stat/list, and WorkspaceRegistry only has archive/unarchive. Neither side offers a delete function.
The community plugin dsh-session-delete (maintainer TonyZiYuan) adds a “Delete Session” option to the session menu in the Web Client sidebar. On the Host side, it removes logs and cleans up the registry according to DSH’s directory rules, cascading the deletion of the entire sub-session subtree by default. Below is an introduction to its positioning, capabilities, and installation usage.
What is this¶
dsh-session-delete is a web profile client plugin for DSH (platform: "web"). It injects menus and confirmation dialogs into the browser-side half and provides deletion services and HTTP routes on the Host-side half. Session logs are essentially directories under <DSH_HOME>/sessions/; this plugin adds auditable deletion operations with confirmation and backup guidance without modifying the DSH core.
- Directory Page: https://www.skillhub.cn/plugins/TonyZiYuan/dsh-session-delete
- Source Code: https://github.com/TonyZiYuan/dsh-session-delete
- License: MIT (see repository
LICENSE) - Current Package Version (
package.json): 0.2.2
Core Features¶
Web Interface¶
- Adds a “Delete Session” option after “Archive Session” in the “…” menu of any session row in the sidebar.
- Can delete any session, including running or currently open sessions; it dispatches
workspace/session-stopfirst to stop any running work on that session. - When deleting a parent session, it deletes the entire sub-session subtree by default (sub-sessions are not visible in the sidebar and cannot be deleted individually).
- The confirmation dialog displays: session title, creation time, log size, and number of sub-sessions; if descendants exist, it explains that N sub-sessions and their descendants will also be deleted.
- Provides a “Download ZIP archive of this session” link within the dialog for easy backup before deletion.
- Must check the confirmation box to execute deletion; the sidebar row disappears immediately after deletion without needing a page refresh.
Host-side Behavior Summary¶
Deletion follows a fixed order; if any step fails, subsequent steps are aborted (some step failures are only logged and do not block; see README “What happens when deleting a session” for details):
- Stop running work → 2.
sessionPersistence.flush()→ 3. Deterministically locate directory via header’scwd(no scanning of sessions root) → 4. Enumerate descendants viatraceSession()→ 5. Whole-tree pre-check (paths, whitelist) → 6. Recursivefs.rm→ 7. CleanworkspaceRegistryor fallback to rewritingworkspace.json→ 8. Publishapi-session/removed→ 9. Record in memory tombstone for browser “ghost reaping”.
After a page refresh, deleted sessions may briefly “resurrect” due to live session objects still retained in Host memory; the plugin clears them again in sub-second time via tombstones in GET /sessions and the client-side reaper. After a Host restart, both tombstones and ghost semantics disappear.
HTTP API¶
| Method | Path | Function |
|---|---|---|
| GET | /api/session-delete/sessions |
List of deletable sessions + tombstones |
| POST | /api/session-delete/delete |
Delete, body { "sessionId", "cascade?" }, cascade defaults to true |
Write requests require the source to be a loopback address; both routes use the ctx.connection.requestRejection() trust fence.
Explicit Non-Goals¶
- Does not delete
attachmentsshared storage. - Does not provide bulk deletion, recycle bin, or soft delete.
- Does not modify the
@deepseek-ai/*core insidenode_modules.
Installation and Activation¶
The plugin needs to be installed into the web profile (replace web in the commands for other profiles). The README is tested and works on DSH 0.2.0-rc.2 (Web GUI) and relies on several internal contracts. If after upgrading DSH you encounter session/absent errors or missing UI components for existing sessions, you need to update the path functions or component usage within the plugin based on the new version’s source code. Node version requirement: ^22.19.0 || >=24.0.0 (consistent with DSH core).
Install from Git Repository (Recommended)¶
dsh plugin --profile web add git+https://github.com/TonyZiYuan/dsh-session-delete.git
dsh plugin add forwards to pnpm and automatically appends the bundle to the profile’s dsh.profile.bundles after installation.
If installation reports that a dependency’s build script was blocked, add the following to ~/.dsh/profiles/web/pnpm-workspace.yaml:
packages:
- .
allowBuilds:
dsh-session-delete: true
Then rerun the installation command.
Update and Uninstall:
dsh plugin --profile web update dsh-session-delete
dsh plugin --profile web remove dsh-session-delete
After Installation¶
You must restart dsh web, as the browser-side half and bundles are only loaded at startup.
Verify mounting:
dsh --profile web --dump-config
The output should show a dsh-session-delete entry.
Typical Usage¶
- Start or restart
dsh web, and open the workspace containing the target session in the sidebar. - Click “…” on that session row and select “Delete Session”.
- In the dialog, check the title, time, log size, and sub-session hints; click the ZIP archive link to back up if needed.
- Check the confirmation box and confirm deletion.
- If a “ghost” row briefly appears after deletion upon refresh, the plugin will automatically reap it; you can also click “Delete Session” on that row again, and the dialog will show that the log is no longer on disk.
To delete only a single session without cascading to descendants, you can call POST /api/session-delete/delete via HTTP with "cascade": false (default is true to avoid leaving unreachable orphan logs of sub-sessions).
Use Cases and Notes¶
Who it is for: Developers who use DSH via the Web GUI long-term, need to completely remove disk usage of sessions, or want to clean up hidden sub-session trees generated by sub-agents.
Version & Compatibility: The plugin directly replicates path logic such as encodeSegment / projectKey from the JSONL backend and does not assume compatibility with unverified upstream versions. The failure mode leans towards safety (e.g., falsely reporting session/absent rather than falsely deleting).
Security & Permissions: Deletion is irreversible; the plugin reads and writes session directories and registries under the permissions of the current DSH Host process. You should read the repository source code and MIT license before installation to ensure the behavior complies with your environment and compliance requirements. The deletion API additionally restricts write operations to loopback sources, reducing the risk of other machines on the LAN deleting history with just a Web token.
Troubleshooting Quick Reference:
| Symptom | Common Cause |
|---|---|
| No “Delete Session” in menu | Not installed or dsh web not restarted |
unexpected-contents |
Session directory contains non-whitelisted files; cascade aborts the whole tree |
session/in-use |
File is occupied; close the session or process and retry |
session/absent |
Directory does not exist; will still attempt to clean registry |
Community directories like SkillHub are maintained independently by the ecosystem and have no official affiliation with DeepSeek / High-Flyer; the plugin also follows DSH’s “everything is a plugin” extension approach rather than being a built-in capability.
Conclusion¶
DSH only archives by default and does not delete from disk; dsh-session-delete supplements the Web side with deletion capabilities featuring confirmation, backup guidance, and cascading subtrees, while handling the registry and ghost sessions after refresh. If you need to permanently clear session logs in the GUI, you can install it to the web profile via the README and restart dsh web.