Introduction¶
When using DeepSeek Harness (DSH) for agent development or long-running services, persistent sessions and archived documents accumulate over time. This residual data can consume storage space and may also affect system performance. Manually cleaning up these files or removing them from the data layer usually requires operating the filesystem or modifying configuration. The dsh-session-cleanup plugin provides a graphical entry point, allowing you to view and clean up this data directly from the DSH settings page.
Plugin Overview¶
dsh-session-cleanup is a DSH profile package maintained by ShiraGawaAnri under the MIT license. Its core value is adding two settings pages to the DSH Web profile: Sessions Cleanup and Archive Cleanup. These pages let you view current in-memory sessions, persisted but not active residual sessions, and all archived sessions, while also providing deletion operations.
Core Features¶
Sessions Cleanup¶
In the Settings, navigate to the Sessions Cleanup page, where you can:
1. Refresh Sessions: Update the list data.
2. Current Sessions: Display sessions currently running in memory. This section is view-only and does not provide delete buttons.
3. Residual Sessions: Display persisted sessions that are currently not open. Each item includes a delete button.
Archive Cleanup¶
On the Archive Cleanup page, you can:
1. Refresh Archives: Update the archive list.
2. All Archives: List all archived sessions, including ID, summary, and date. Each row includes a delete button.
3. Delete All: Remove all archived sessions with one click.
4. Running Badge: Sessions in a running state show a “Running” badge and cannot be deleted.
Safety Mechanism¶
All deletion operations are protected by a dual-confirmation mechanism (confirm first, then execute, with the option to cancel before completion).
Installation and Enablement¶
The plugin is installed via the dsh plugin command. Before installing, make sure pnpm is installed and the DSH Web service is available.
# 1. 将解压后的文件夹放置到指定目录,例如 D:/plugins/dsh-session-cleanup
# 2. 安装到 web 配置文件
dsh plugin --profile web add file:D:/plugins/dsh-session-cleanup
# 或者直接从解压目录的父目录运行
dsh plugin --profile web add ./dsh-session-cleanup
After installation, restart dsh web. You can then find the Sessions Cleanup and Archive Cleanup options in the Settings menu.
Uninstall¶
To remove the plugin, use the following command:
dsh plugin --profile web remove @dsh-external/dsh-session-cleanup
Technical Notes and Considerations¶
Deletion Behavior¶
The plugin performs deletion on the host side using Node.js’s fs.rm API. The deletion logic is limited to the path returned by sessionPersistence.locate(); the client only submits the session ID. The deletion operation will:
1. Reject deletion of running sessions.
2. Remove the persisted session log file or directory.
3. Detach the session from the workspace account.
4. Remove the ID from the global archive collection and synchronize the cache.
Important: Deletion is irreversible.
Dependencies and Services¶
The plugin requires the host to provide the following services: sessions, sessionPersistence, workspaceRegistry, and storageDomain. The client requires the slots service. An optional service is webServer.
Security and Limitations¶
- API Security: The deletion endpoint (
POST /_dsh/session-cleanup/api) rejects cross-site requests. - Permissions: Deletion is an admin action, triggered only from the settings page, and does not interact with DSH sandbox policies or model tool calls.
- Dependencies: The plugin does not include any third-party npm dependencies.
Summary¶
dsh-session-cleanup provides DSH users with a visual session-management tool. If you need to manage a large number of residual sessions or clean up archived data, using the settings page is safer and more convenient than operating the filesystem directly.