Introduction¶
DeepSeek Harness (DSH) accumulates a large number of archived sessions over extended use. These sessions are scattered across different workspaces, making it inefficient to search for and delete them one by one through the UI. This plugin adds a new “Archived Sessions” tab to DSH’s Settings page, listing archived sessions grouped by workspace. It supports searching, single deletion, multi-select deletion, and bulk deletion.
Plugin Overview¶
dsh-archived-sessions is a DSH client plugin maintained by HitMargin. It addresses the problem of “archived sessions being scattered and difficult to clean up.” Rather than relying on any public API, it implements its deletion logic by operating on DSH’s internal storage domains and the local file system.
Core Features¶
- Adds an “Archived Sessions” tab to the Settings page, listing archived sessions grouped by workspace
- Only displays workspaces that actually have archived sessions; empty workspaces are omitted to save space
- Search box filters sessions by name in real time (case-insensitive)
- Single deletion: click the “Delete” button at the end of a row
- Batch deletion: check multiple sessions, then click “Delete Selected”
- Delete All: click “Delete All” in the top-right corner to remove every session in the current filtered result
- Permanent Deletion toggle: when enabled, deletions bypass the trash and data is erased directly (disabled by default)
- A confirmation dialog appears before deletion, showing the number of sessions to be removed; when the toggle is on, the button label and prompt change to “Permanent Delete” with a bold warning stating “This action cannot be undone”
- The list refreshes automatically after a successful deletion
Deletion Behavior & Safety Mechanisms¶
Default Safety: Move to Trash¶
By default, the delete operation does not erase data outright. Instead, the session directory is moved to:
~/.dsh/trash/archived-sessions/<sessionId>-<timestamp>/
This preserves user data and prevents accidental deletion of unrelated content due to any discrepancies in replicating the directory naming logic (projectKey / encodeSegment).
Permanent Deletion¶
When the “Permanent Delete” toggle is enabled, deletion uses fs.rmSync(dir, { recursive: true, force: true }), erasing the data directly.
The toggle’s configuration file is located at:
~/.dsh/plugin-data/dsh-archived-sessions/settings.json
If the file is missing, corrupted, or malformed, the default is treated as off. The toggle state in the UI is always synced with the host: if a write fails, the change is rolled back, so the UI never displays a state the host is unaware of.
Deletion Order & State Handling¶
DSH does not expose a public “delete session” API. The plugin achieves deletion by manipulating two pieces of state:
| State | Location | How It’s Modified |
|---|---|---|
| Registry | ~/.dsh/storages/workspace.json |
Modified via the workspace domain of ctx.storageDomain |
| Session Data | ~/.dsh/sessions/<workspace>/<session>/ |
Moved to trash (default) or erased directly (toggle on) |
The registry is intentionally updated before the data is touched, to avoid leaving behind a half-record where “the registry still references the session but the data is already gone.” If the data deletion fails, the registry is already clean, and any remaining orphaned directories can be handled manually.
Edge Cases¶
- Orphan IDs in the archive index:
archivedSessionIdsmay contain historical entries that no longer belong to any workspace. These are not shown in the list, and there is nowhere to delete them from. - Unavailable title: The title is read from the session log; if it cannot be retrieved, the session ID is displayed in its place.
- Workspace domain not enabled: A clear error is returned instead of an empty list.
Installation & Activation¶
Install from the GitHub repository:
dsh plugin add github:HitMargin/dsh-archived-sessions
After installation, restart DSH. The “Archived Sessions” tab will appear on the left side of the Settings page.
Typical Workflow¶
- Open DSH Settings and click “Archived Sessions”
- Type a session name in the search box to filter the list
- Check the sessions you want to remove, then click “Delete Selected”
- To wipe everything, enable the “Permanent Delete” toggle and click “Delete All”
Use Cases & Notes¶
- Ideal for developers who need to bulk-organize or clean up a large number of archived sessions
- The plugin runs with the permissions of the current DSH process; review the source code and the license (MIT) before installing
- The Permanent Delete toggle is off by default to prevent accidental, irreversible data loss
Summary¶
dsh-archived-sessions provides a centralized entry point for viewing and cleaning up archived sessions. Grouping, search, and batch operations reduce maintenance overhead. The default safety policy and explicit confirmation prompts keep the cleanup process fully under the user’s control.