Preface¶
In DeepSeek Harness (DSH), sessions can be archived, but the product does not provide a “Delete Session” feature at the UI level. dsh-client-ui-workspace explicitly states “No Session deletion”—sessions can only be archived, not deleted. Similarly, dsh-session-persistence-jsonl states in the storage layer that “Session files are not deleted”; logs accumulate under root until removed externally, and the seam has no deletion API. Archiving merely records the ID in archivedSessionIds within $DSH_HOME/storages/workspace.json, leaving the session logs, projection caches, and attachments on disk intact.
If you frequently test sessions, fork them, or run many sub-agents locally, $DSH_HOME/sessions will continue to grow, and archiving alone cannot clear the data. The community plugin dsh-session-delete (Maintainer: LilJoeIJOYU, Category: Client) turns the “only viable external removal” mentioned in the documentation into a single line in the Session sidebar “…” menu. Upon confirmation, it deletes storage logs, projection caches, and—by default—cascades to delete related files for sub-agent sessions.
What is this¶
dsh-session-delete is a bundle plugin for DSH: The Host side provides a sessionJanitor/deleteSession remote call, centralizing the deletion logic; the Client side adds a “Delete Session” item with a destructive style to the session row menu and pops up a confirmation box in the shell.overlay. Upon successful deletion, the ID is removed from the archive and pinned sets, and an api-session/removed event is emitted, causing connected Clients to immediately remove the sidebar row.
Repository: https://github.com/LilJoeIJOYU/dsh-session-delete
Directory Page: https://www.skillhub.cn/plugins/LilJoeIJOYU/dsh-session-delete
Core Features¶
Sidebar and Interaction¶
- Adds a line to the Session “…” menu (Extension point
sidebar.workspaces.session.menu.item,order: 500, placed after built-in items like Rename / Fork / Pin / Archive, separated by a group divider above, using the host’s dangerous row color scheme). - Clicking triggers a confirmation dialog; the menu collapses but the overlay still handles the confirmation logic.
- The menu is responsible only for calling the Host Remote, without re-implementing deletion strategies.
What Deletion Removes¶
For the target Session and, by default, all its sub-agent Sessions, the plugin attempts to delete:
| Path | Meaning |
|---|---|
$DSH_HOME/sessions/<project-key>/<session-id>/ |
Storage logs (e.g., session.v4.jsonl.zstd) |
$DSH_HOME/sessions/<project-key>/<session-id>.jsonl[.zstd] |
Legacy flat layout sibling |
$DSH_HOME/sessions/<session-id>.jsonl[.zstd] |
Legacy flat root layout |
$DSH_HOME/storages/session_projcache/sessions/<session-id>.json |
Projection checkpoint |
Subsequently, the ID is removed from the archive and pin sets, and a removed event is broadcast.
Deliberately NOT deleted:
- Content-addressed attachments under
$DSH_HOME/attachmentsand$DSH_HOME/cache/attachments(multiple Sessions may share hashes; deleting one could harm others). - Session search index (reads align with
sessionPersistence.list(); if logs are gone, they automatically drop out of the index). - Registry entries in
workspaces[].sessionIds(no removal API; the sidebar is driven by Session summaries, and invalid IDs will not display rows).
Failure and Rejection (reason)¶
deleteSession returns a result object and does not throw exceptions; common reasons:
reason |
Meaning |
|---|---|
invalid-id |
Not a valid Session ID |
active |
An Agent in the current Harness process still occupies the session log (see below) |
unknown |
Storage for this ID cannot be found on disk |
partial |
Some paths failed to delete (lock or permission); failed lists residual paths |
In case of partial, the sidebar will still decommission the row, and the dialog will display the paths that could not be deleted.
Why “Previously Opened Sessions” Cannot Be Deleted¶
As long as an Agent in the current process is still bound to that Session (e.g., the controller will resume the Agent when opening or viewing history), the log writer remains active. Deleting the file may result in subsequent appends writing back or cause flush errors. Therefore, the rejection condition depends on whether the Agent is live, not on whether it is archived or currently selected. In practice: Sessions that have never been opened during this run can be deleted immediately; those that have been opened require restarting the Harness and performing deletion before opening that Session again. Archiving does not unload the Agent, nor does switching to another Session.
Installation and Activation¶
Install as a bundle in the current profile; do not manually edit the profile’s package.json, nor run pnpm manually in the profile directory. You can ask the Agent to call plugin_manager, or execute it yourself:
plugin_manager action=install_bundle target=https://github.com/LilJoeIJOYU/dsh-session-delete
If using a local checkout, replace target with the absolute path to that directory:
plugin_manager action=install_bundle target=<absolute path to this checkout>
Host-side modules (index.js, purge.js, remote.js, typert.host.js, etc.) cannot be hot-swapped after being imported into the process; changes to Host code require restarting the Harness to take effect. Client-side code can load without a restart after installing the bundle.
The plugin operates on files under $DSH_HOME with the permissions of the current DSH process; it is recommended to read the repository source code and MIT license before installation (Package version 0.1.0, Node >=22).
Typical Usage¶
- Install the bundle and start (or restart) Harness to ensure the Host plugin is loaded.
- Find the Session to clean up in the sidebar; if it has been opened in the current session, completely exit Harness and restart, and do not click on that Session first.
- Click the row’s “…” → Delete Session → Confirm in the overlay.
- If
partialis returned, check thefailedpaths as prompted in the dialog (permissions, file locks, etc.).
In-repo self-test (using a temporary Harness home, touching no real data):
node --test "test/*.test.mjs"
Use Cases and Cautions¶
Suitable for: Developers who need to truly free up disk space rather than just archiving IDs; cleaning up test-run sessions, massive forks, or sub-agent trees; local maintenance aligned with the DSH “append-only logs, no delete API in the seam” model.
Cautions:
- Deletion cannot be undone via built-in DSH capabilities; the confirmation box is the final gate.
- Sessions currently “open” in the Client cannot be deleted; Harness lacks an API to individually dispose of a Session Agent.
- Cascading sub-agents relies on
ctx.subagents.listDescendantsin the parent log; if the parent log is corrupted, orphaned Session directories may remain. - Community directories like SkillHub are independent of DeepSeek / High-Flyer and are not official app stores; plugin origin and behavior are subject to the GitHub README and source code.
Conclusion¶
dsh-session-delete fills a capability gap deliberately left in DSH: with a single confirmation in the sidebar, it clears session logs, projection caches, and (by default) sub-agent logs from the disk, and synchronizes the UI to decommission them. Archiving is still suitable for “hiding”; if you want to “delete,” use this client bundle.
- Directory: https://www.skillhub.cn/plugins/LilJoeIJOYU/dsh-session-delete
- Source Code & Full Documentation: https://github.com/LilJoeIJOYU/dsh-session-delete