Introduction¶
In the DeepSeek Harness (DSH) desktop version, the session list gradually expands with usage. When manually deleting sessions, workspace accounting left by the host, pinned markers, and projection cache rows (including backup files) often cannot be cleaned up synchronously. This leads to “dirty data” appearing in the sidebar or archive list. dsh-session-cleaner focuses on solving this problem by upgrading the sidebar “Delete” action to “Move to Recycle Bin.” It supports search, restore, and permanent deletion, ensuring the deletion process is controllable and reversible.
Feature Overview¶
This plugin is maintained by jackxiao17, is currently open source, and uses the MIT license. It is installed within the DSH desktop client; it does not alter the host’s core logic but intervenes in session lifecycle management solely through the plugin interface.
The core capabilities are concentrated in the following areas:
1. Recycle Bin Mechanism: When deleting a session, the files are entirely renamed to the recycle bin directory (a near-instantaneous operation on the same disk, without copying), retaining a 30-day rollback window.
2. Trace Cleanup: Upon deletion, it synchronously removes workspace accounting slots, pinned and archived markers, and clears projection cache rows (including .bak backup files left by the host).
3. Sub-session Handling: For sessions with sub-agents, the plugin processes the entire tree together, ensuring that parent-child relationships do not break during the delete/restore workflow.
4. Permanent Deletion: Clicking “Permanently Delete” within the recycle bin will additionally clean up scheduled tasks bound to that session and emptied project directories.
5. Viewing and Search: The recycle bin panel supports searching by title/body, workspace filtering, and sorting by time/size/turns. Clicking a session allows viewing the complete conversation log (Markdown rendered, with middle sections of overly long replies omitted).
Installation and Activation¶
The installation process requires modifying the DSH desktop configuration directory. Please ensure the current DSH version is 0.2.1-rc.2 (other versions may have compatibility issues).
- Copy the plugin folder (
dsh-session-cleaner) to%DSH_HOME%\profiles\desktop\local\dsh-session-cleaner. - Edit
%DSH_HOME%\profiles\desktop\package.json:- Add to
dependencies:"dsh-session-cleaner": "file:./local/dsh-session-cleaner" - Add
"dsh-session-cleaner"to thedsh.profile.bundlesarray.
- Add to
- Run the pnpm installation command provided by DSH in that directory:
node "%DSH_HOME%\dsh-runtimes\dsh-primary-runtime\dependencies\pnpm\bin\pnpm.cjs" install -C %DSH_HOME%\profiles\desktop
- Restart DSH. A red Delete option will appear in the
···menu of the sidebar session list, and a Session Recycle Bin entry will appear at the bottom of the sidebar.
Usage¶
The workflow is divided into two parts: “Deletion” and “Recycle Bin Management.”
Deleting Sessions¶
Click the ··· menu on a session in the sidebar and select Delete:
* The session is moved directly to the recycle bin, and a “✓ Session deleted to recycle bin” prompt appears at the top.
* Any ongoing answers in the conversation will be terminated (canceling the current turn + tearing down the agent) before being moved to the recycle bin.
* If the session has sub-sessions, they will be moved to the recycle bin as well.
Recycle Bin Management¶
Click the Session Recycle Bin button at the bottom of the sidebar:
* Search and Filter: Supports real-time title filtering; checking “Search body” allows searching question and reply content. Supports filtering by workspace and sorting by deletion time/title/size/turns.
* Restore: Check sessions and click restore; directories are moved back to their original location, accounting is hooked back to the original workspace and returns to its original slot, and projection cache rows are restored as is. If the session was archived before deletion, it will return to the archive list after restoration.
* Permanent Delete: Check sessions and click permanent delete; this will clear scheduled tasks bound to the session and emptied project directories.
* View Log: Click a session to view the turn-by-turn conversation record.
Notes¶
- Host Contract Dependencies: The plugin relies on DSH v4 session log format, zstd frame layout, v7
session_projcachestorage domain,workspaceRegistry/schedule/storageDomain/webServerservices, as well as frontend slots and__ModuleLoader__. These contracts have been verified one by one against the 0.2.1-rc.2 source code. - Compatibility Commitment: Backward compatibility has not been verified one by one, so no promises are made. On older versions, functionality may be weakened (e.g., slots cannot be restored, causing it to return to the top), but it will not cause data corruption or erroneous deletions.
- Version Limitations: 0.1.x is unverified and not recommended for direct use. After a major version upgrade, the plugin may fail (manifesting as disappearing menu items), but it will not damage session data.
- Retention and Cleanup: The recycle bin is retained for 30 days by default, cleaned once at startup, and then every 6 hours thereafter. Scheduled tasks are not cleared while the session is in the recycle bin (the host does not support rebuilding tasks as-is).
- Data Consistency: Restoration does not guarantee byte-for-byte identity with the pre-deletion state; operations will be refused if there are two log directories with the same ID; the plugin possesses crash safety mechanisms (snapshots written first, files moved later).
Summary¶
dsh-session-cleaner provides controllable session lifecycle management. This is a practical tool for developers who need to frequently clean up sessions, maintain a tidy sidebar, or need to thoroughly clean up host traces. The plugin source code and documentation can be found at: GitHub.