Preface¶
DSH generates a large amount of session data during the agent development process. When session directories are moved to other drive letters, or only junction/symlink references remain at the original location, standard cleanup methods often fail to locate the actual files. The dsh-session-delete plugin provides a controlled deletion workflow by injecting sidebar and workspace menu items, ensuring data is thoroughly removed.
Plugin Overview¶
Maintained by Baboo-ming and licensed under MIT, this plugin addresses the issue of residual DSH session data. It supports single deletion via the sidebar and batch deletion via the workspace, offering a seven-stage pipeline to guarantee complete cleanup.
Core Features¶
The plugin offers two deletion modes, both utilizing a shared seven-stage pipeline at the core:
-
Sidebar Session Deletion
- Injects a red “Delete Session” dangerous item into the sidebar session row menu.
- Clicking it triggers a secondary confirmation modal showing the session’s cwd, occupied size, archive status, and running status.
- Confirmation triggers the pipeline execution, followed by a refresh of the sidebar list.
-
Workspace Batch Deletion
- Provides a “Delete All Sessions” option in the workspace row menu.
- Supports batch preview, background task execution, and viewing of progress/failure details.
- Failure to delete a single session does not affect the deletion of others in the batch; results are aggregated upon task completion.
Technical Implementation¶
The plugin includes the following key capabilities:
* Seven-Stage Pipeline: Executes validation, running protection, workspace ledger removal, archive set cleanup, disk log deletion, memory detachment, and event broadcasting in sequence. Failure in any stage only triggers a warning and graceful degradation, without interrupting the overall process.
* Bypass Deletion: Supports locating actual files by bypassing junctions and symbolic links.
* Memory Detachment: Releases JSONL writers and memory references via sessions.flush and detachEntered.
* Thorough Cleanup: Permanent deletion with no recovery option.
Installation¶
You must exit the DSH desktop client before installation; otherwise, the CLI will prevent the service from starting when writing to the profile.
dsh plugin --profile desktop add github:Baboo-ming/dsh-session-delete#v0.2.2
To upgrade, switch to the new tag and rerun the command above.
Usage¶
- Delete a Single Session: In the DSH sidebar, click the
...menu on the session row and select the red-highlighted “Delete Session”. - Delete All Sessions in a Workspace: Click the
...menu on the workspace row and select “Delete All Sessions”.
Notes¶
- Permanence: Deletion operations are permanent and irreversible; use with caution.
- Permission Restrictions: Some junction/symlink cases require Windows symbolic link privileges and may fail in restricted sandbox environments.
- Timing Impact: After memory detachment, rescanning the projection cache may cause disk logs to be rewritten.
Conclusion¶
This plugin provides a standardized session cleanup solution for DSH, suitable for scenarios requiring thorough workspace cleaning or management of large volumes of sessions. Please refer to the official documentation for more details.