Introduction¶
When running Agents long-term and switching between multiple workspaces in DeepSeek Harness (DSH), sessions continuously accumulate under $DSH_HOME: logs, projection caches, and workspace registrations all pile up. If the host side lacks a complete “delete session” entry, users can only manually hunt for directories or endure an ever-growing list. The community-maintained dsh-session-cleanup-pro (maintainer: gcluffy, SkillHub category: Memory) provides hierarchical browsing by workspace, search, multi-select, and batch deletion under Settings → Session Cleanup, and exposes three cleanup tools to Agents. The deletion scope covers session artifacts and registrations, and after deleting cold sessions, the UI can update immediately. This article introduces its positioning, capabilities, and installation/usage instructions. Facts are subject to the GitHub repository README.
What Is This¶
dsh-session-cleanup-pro is a DSH community plugin (MIT license, not affiliated with DeepSeek official). In one sentence: it lists all sessions hierarchically by workspace on the settings page, supports search, single/multi-select, and batch deletion; deletion is “real deletion” — session log directories, projection caches, and workspace registrations are all handled together, and under appropriate conditions, removal events are pushed to connected clients. Current version 0.2.0, requires DSH ≥ 0.2.1-rc.1 (engines.dsh in package.json).
Core Features¶
Settings Page: Session Cleanup¶
After installation and restart, use under Settings → Session Cleanup (the settings section title in package.json is “Session Cleanup”).
- Grouped by workspace, collapsible; group headers show session count and occupied size.
- Search by session name, path, or id.
- Single-select, multi-select (click the entire row to toggle, Shift for consecutive selection), select all in group / select all / clear.
- Each row can be expanded: full id, directory, creation time, cumulative tokens, turns.
- A confirmation dialog before deletion lists the sessions to be deleted; if running sessions are involved, a restart prompt appears.
- “Protect running sessions” is enabled by default to avoid accidental deletion of current sessions.
Deletion Scope¶
| Target | Location |
|---|---|
| Session logs | $DSH_HOME/sessions/<project>/<id>/ (including session.vN.jsonl.zstd, etc., entire directory) |
| Projection cache | $DSH_HOME/storages/session_projcache/sessions/<id>.json |
| Workspace registration | Prefer the host workspaceRegistry (detachSession / unarchiveSession / unpinSession); fall back to directly modifying workspace.json when this service is unavailable |
When registration goes through the host API, after deletion completes the plugin has the host broadcast api-session/removed, so connected clients can remove the corresponding items from the session list; cold sessions generally do not require a page refresh.
Whether Restart Is Needed After Deletion¶
| Situation | Behavior |
|---|---|
| Deleting a cold session (not in memory) | After registration, files, and push complete, the UI can update immediately |
| Deleting a running session | The list row disappears first, but the host SessionStore still holds the instance → need to restart DeepSeek Harness to fully release |
Whether instant update is supported can be checked by whether the features returned by GET /dsh-session-cleanup-pro-4c1d/health includes host-registry and emit-removed.
Agent Tools¶
These can be called by the Agent during conversation:
| Tool | Purpose |
|---|---|
session_delete_list |
Hierarchically list all workspaces and sessions (name / size / time / status) |
session_delete_scan |
Statistics only: total count, running count, per-workspace usage |
session_delete_remove |
Batch deletion; when needRestart in the result is true, remind the user to restart |
HTTP API (Settings Page Backend)¶
GET /dsh-session-cleanup-pro-4c1d/api/tree → hierarchical workspace tree
POST /dsh-session-cleanup-pro-4c1d/api/delete { ids: [...] } → batch deletion
GET /dsh-session-cleanup-pro-4c1d/health → health check + features
Installation and Activation¶
Method 1: In-app Plugin Manager (Recommended, Desktop / Web)¶
Settings → Plugins → Add plugin, paste the repository address:
https://github.com/gcluffy/dsh-session-cleanup-pro
After installation, restart DSH once (on first install the host half needs to reload), then use it under Settings → Session Cleanup.
Method 2: Command Line (Pure Web Profile Only)¶
dsh plugin --profile web add github:gcluffy/dsh-session-cleanup-pro
Replace web with your actual profile name. Desktop (Electron) profiles are managed by the app; please install via the in-app plugin manager.
Don’t Confuse It with the Same-Named npm Project¶
The dsh-session-delete on npm is maintained by other authors and is unrelated to this plugin. This plugin’s package name is dsh-session-cleanup-pro; version 0.2.0 is currently distributed via GitHub — do not install it using the wrong npm package name.
Typical Usage¶
- Install and restart DSH, then open Settings → Session Cleanup.
- Expand by workspace and use the search box to locate old sessions or paths.
- Check the sessions to delete (or Shift-select consecutively), and execute deletion after the confirmation dialog.
- If prompted about running sessions or
needRestart, follow the on-screen instructions to disable protection or schedule a restart. - In an Agent conversation, you can ask the model to first run
session_delete_scanto check usage, then runsession_delete_removefor batch cleanup (the model needs the corresponding tool permissions).
Applicable Scenarios and Notes¶
Who it’s for: Development scenarios that need to regularly clean up DSH session disk usage, organize multi-workspace session lists, or automate scanning/deletion in Agent workflows.
Security boundary (per the README): The plugin only reads and deletes session artifacts; it does not modify DSH code, the config tree, or other plugin data. Workspace registration uses a temporary file + rename for atomic write-back, and registration write-back is serialized during concurrent deletion; failures will show the reason on the settings page. Deletion is irreversible — please confirm before checking the boxes.
Permissions and trust: The plugin accesses $DSH_HOME with the current DSH process’s permissions. Before installation, it is recommended to read the source code and the MIT license, and only install from the official repository address above.
Ecosystem: DSH advocates “everything is a plugin”; the SkillHub directory page and dsh-plugin.org are community-curated sites, not official DeepSeek / High-Flyer app stores.
Conclusion¶
dsh-session-cleanup-pro fills the missing session-deletion loop on the DSH side: hierarchical management on the settings page, real deletion of disk artifacts and registrations, instant UI updates for cold sessions, and three Agent tools. Install it from the directory page or GitHub when needed, and remember the first-time restart and the default “protect running sessions” behavior.