Introduction¶
When running long-term agent sessions in DeepSeek Harness (DSH), the sidebar accumulates a significant amount of conversation history. The default capabilities focus on archiving, pinning, and workspace categorization. If you want to delete a specific session along with its logs, caches, and files generated during the conversation, you often need to manually locate paths in ~/.dsh/sessions and the working directory. This process involves multiple steps and easily leads to missing sub-agent sub-sessions or projection caches.
The dsh-session-delete (maintained by zenghang25) introduced below adds a red “Delete Session” button at the end of the “⋯” menu for sidebar session rows. A single click performs stopping, archiving, persistence, and file cleanup. It also establishes an independent output directory convention .dsh-sessions/<session-id>/ for each conversation. When a top-level conversation is deleted, the directory and logs are moved to the Windows Recycle Bin (restorable). The plugin is categorized as a Client, currently version 0.5.1, licensed under MIT, and has approximately 1 star on the GitHub repository.
What is this¶
dsh-session-delete is a Cordis plugin for DSH: The Host side provides the deletion API and per-conversation output directory conventions, while the Client side registers menu items in the sidebar via official slots. It applies to DSH 0.2.1-rc.2 and subsequent 0.2.x / 0.4.x / 0.5.x roadmaps (Web / Desktop profiles; the README specifies it is primarily aimed at the Windows desktop client).
It does not rely on DOM cloning or React internal structures. Its extension points include sidebar.workspaces.session.menu.item, agent/created, and same-origin ctx.webServer routes.
Core Features¶
One-click Sidebar Deletion¶
| Entry | Menu Item | Behavior |
|---|---|---|
Session row ⋯ menu (last position, separator + red danger style) |
Delete Session | One-click deletion of the session, no confirmation popup; logs and output directories go to the Windows Recycle Bin and are restorable |
A single click handles:
| Content | Destination |
|---|---|
| Session logs (including sub-agent sub-sessions) | Windows Recycle Bin (~/.dsh/sessions/<project>/<session-id>/) |
| Output directory for this conversation | Windows Recycle Bin (<session workdir>/.dsh-sessions/<session-id>/) |
| Projection cache | Permanent deletion (~/.dsh/storages/session_projcache/sessions/<session-id>.json, regenerable) |
| Workspace ledger / Pin / Archive sets | detachSession, unpinSession, unarchiveSession (determines unarchiving based on whether it is still live) |
Running sessions first undergo archiving and the sessions.flush persistence barrier, waiting up to approximately 1.5 seconds for the live view to release, then continue with deletion; since 0.4.1, it no longer returns 409 active due to “session still open”. Deletion is idempotent: ghost sessions or non-existent IDs also return success; if physical deletion fails, it rolls back the archive to avoid dangling gray rows in the sidebar.
If a session remains live in host memory after deletion, the plugin keeps the archive hidden and uses client logic to hide the corresponding row, preventing a row from popping up in “Ungrouped” after deletion. After DSH restarts or the session is released, startup reconciliation cleans up residual archive entries.
Non-Windows platforms: Fallback to permanent deletion when Recycle Bin support is unavailable, with a warning included in the response.
One Numbered Directory per Conversation¶
The session ID serves as the number; it can be read in the shell as DSH_SESSION_ID (PowerShell $env:DSH_SESSION_ID, bash $DSH_SESSION_ID). The plugin creates the directory at agent/created and specifies the path in the per-agent system prompt, requiring generated files to be written to this tree; sub-agents belong to the top-level conversation via parentSession and share the same numbered directory.
<workdir>/.dsh-sessions/<session-id>/
outputs/ Files delivered to the user
memory.md Persistent memory/conclusions for this conversation
tmp/ Temporary files
When a top-level conversation is deleted, the entire .dsh-sessions/<session-id>/ and the log directory are moved to the Recycle Bin together. Content-addressed attachment objects (~/.dsh/attachments/v1/objects/…) are shared resources and are not deleted along with the session.
Host API (Troubleshooting & Integration)¶
| Route | Function |
|---|---|
POST /dsh-session-delete/delete |
Body { sessionId }, max 64 KiB JSON; with authentication/Host-Origin barriers |
GET /dsh-session-delete/ping |
Read-only: { ok: true, version } |
GET /dsh-session-delete/diag |
Read-only: Live sessions / Workspace ledger / sessionQuery list |
Installation and Activation¶
The installation command follows the README: the argument for add must be an absolute path; the dsh.bundle.patch in the manifest automatically becomes a bundle layer for the desktop profile, so there is no need to manually modify cordis.patch.yml.
git clone https://github.com/zenghang25/dsh-session-delete.git C:\Users\<you>\Documents\dsh-plugins\dsh-session-delete
dsh plugin --profile desktop add "C:\Users\<you>\Documents\dsh-plugins\dsh-session-delete"
After installation, fully exit the DSH desktop client and restart it (both Host and Client will reload the plugin).
Uninstallation:
dsh plugin --profile desktop remove dsh-session-delete
The plugin runs file deletion and archiving operations with the current DSH process permissions; please review the repository source code and MIT license before installation to ensure the paths and behavior fit your environment.
Typical Usage¶
- Open the sidebar in the DSH desktop client (or a Web profile with the bundle loaded), and locate the session to be cleaned up.
- Click ⋯ on the row, and select the last red option Delete Session (no secondary confirmation).
- The sidebar row should disappear immediately; if restoration is needed, find the directory named with the session-id in the Windows Recycle Bin and restore it, then unarchive or reopen the session in DSH “Archived” / “Ungrouped”. Projection caches do not go to the Recycle Bin and will be regenerated after a restart.
After restoring from the Recycle Bin, the logs return to the original path; projection cache deletion cannot be restored via the Recycle Bin.
Local developer verification (inside the repository):
node test\host.test.mjs
node test\client.test.mjs
Use Cases and Notes¶
Who it is for: Developers primarily using DSH Desktop on Windows who want to quickly clear sessions in the sidebar while retaining the ability to “restore accidental deletions” (logs + output directories go to the Recycle Bin). It is also for those who want agents to consolidate conversation outputs into .dsh-sessions/<id>/ rather than scattering them in the workspace root.
Important Notes:
- One-click direct deletion, no confirmation dialog; clicking wrongly initiates the deletion process (on Windows, logs and output directories can still be restored from the Recycle Bin).
- Deleting a conversation you are currently viewing will first stop running work and close the view.
- Main tests and Recycle Bin paths are on Windows; other platforms perform permanent deletion.
- UI text is determined by the current language when the page loads; a refresh is required after switching languages.
- The cost-meter ledger is not cleaned up when the session is deleted.
See the SkillHub entry for the community plugin directory; it has no official affiliation with DeepSeek / High-Flyer and is a third-party work in the DSH “everything is a plugin” ecosystem.
Conclusion¶
dsh-session-delete consolidates “session deletion, cache clearing, and output directory consolidation” into a single operation in the sidebar. It implements this using official slots and Host routes, avoiding reliance on fragile DOM injection. For source code, Issues, and version history, see GitHub: zenghang25/dsh-session-delete.