Clean Up Archived Sessions

Preface

The “Archived Session Cleaner” in the bottom corner of the DeepSeek Harness (DSH) sidebar: click one icon, and it expands to the right revealing “Delete Selected / Delete All,” permanently removing the selected archived sessions. The session log files are sent to the Windows Recycle Bin.


Plugin Overview

This is a DSH client plugin maintained by xiayanyu0306, targeting desktop users who struggle to clean up DSH archived sessions. DSH natively only offers “Archive / Unarchive.” Archiving is a terminal state—the session storage layer exposes no deletion API, and the UI provides no deletion entry point either. Once a large number of sessions are archived, you can neither clear them out nor easily locate specific ones. This plugin fills the one missing operation: permanently removing archived sessions, while strictly acting only on archived ones.

Core Features

  • One icon in the corner: A 28×28 trash-can icon at the bottom-left of the sidebar (above the settings row), no text label, with a tooltip reading “Clean up archived sessions.”
  • Two actions expand to the right: Clicking the icon expands two buttons on the same row: Delete Selected (N) and Delete All.
  • Checklist: A floating checklist of “Archived Sessions” appears above, grouped by workspace and sorted by most recently updated, with a circular checkbox in front of each entry.
  • Archived only: The list contains only sessions in the archived set; unarchived conversations, sub-agent sessions, and blank “New Session” entries are excluded.
  • Secondary verification: The Host-side route re-checks membership in the archived set; non-archived IDs are rejected outright (not-archived).
  • Delete All requires double confirmation: The first click changes the label to “Confirm Delete All (N),” which auto-retracts after 4 seconds to prevent accidental clicks.
  • Recycle Bin: Deletion sends session logs to the Windows Recycle Bin, where they can be manually restored; if the Recycle Bin API is unavailable, it falls back to the system temporary directory dsh-archived-session-cleanup-trash.
  • Archive record removal: After a successful deletion, the ID is synchronously removed from the archived set, and the session disappears from the sidebar, search, and all other views.
  • Bilingual UI (follows DSH’s language setting).

Installation & Activation

Environment requirements: DSH Desktop 0.2.2-rc.5 (Windows 10/11); the system’s PowerShell and Windows Recycle Bin are required.

Method A: Desktop UI (recommended)

  1. Download or git clone this repository to a local directory:
git clone https://github.com/xiayanyu0306/dsh-archived-session-cleanup.git
  1. DSH → Settings → Plugins → Add plugin → Select the repository directory.
  2. Confirm “Clean up Archived Sessions” appears in the plugin list, then refresh the page (Ctrl+R).

Method B: Via DSH’s Plugin Manager (agent / CLI)

Point the plugin manager at this repository directory to install (install_bundle). Refresh the page once installation is complete.

This plugin is a “local bundle”: package.json declares dsh.bundle.patch and dsh.client, and the repository root directory is the installable package directory.

Typical Usage

  1. Look at the bottom-left corner of the sidebar for a trash-can icon.
  2. Click it: two buttons expand to the right on the same row, and an “Archived Sessions” checklist appears above.
  3. Check the sessions you want to delete; or use “Delete All” directly.
  4. Click Delete Selected (N) to execute immediately; clicking Delete All requires a second click on “Confirm Delete All (N).”
  5. When done, a status message in the corner reads “Moved N archived session(s) to the Recycle Bin.”
  6. Dismiss the checklist: click the icon again, click the ✕ in the title bar, press Esc, or click outside the panel.

What Deletion Actually Does

  1. The browser half POSTs the selected session IDs to /api/archived-session-cleanup/purge.
  2. The Host half verifies that all these IDs are in the archived set; otherwise it rejects the request.
  3. Resolves each session’s actual log file path via sessionPersistence.list()’s location.path (no path guessing).
  4. Sends the .jsonl / .jsonl.zstd files to the Windows Recycle Bin (Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(..., SendToRecycleBin)).
  5. Calls workspaceRegistry.unarchiveSession(id) to clear the archive record.
  6. The browser calls ctx.sessions.refresh(); the list refreshes and the sessions disappear.

Restoration: Restore <session-id>.jsonl from the Recycle Bin to its original path, then refresh the page—it will reappear as a regular session since it is no longer in the archived set.

Applicable Scenarios & Caveats

  • Only touches archived sessions: The client only lists members of the archived set, and the Host route performs a secondary verification; unarchived sessions cannot be deleted through this path.
  • Running archived sessions are skipped: A running session should not be in the archived set—this is purely defensive; the footer of the checklist notes how many were skipped.
  • Checkboxes only in the popup checklist: The host provides each session row with only a single 16px leading cell, and archive rows leave that cell blank. The client plugin cannot inject a checkbox into an archived row, so the selection list is implemented as a checklist floating up from the icon.
  • Route permissions: /api/archived-session-cleanup/purge goes through DSH’s same-origin authenticated channel, but bypasses DSH’s remote permission checks; it is recommended for local desktop use only.
  • Index residuals: Deletion targets only session log files and archive records; the SQLite full-text search index may retain stale content rows. DSH’s search results are filtered by existing sessions, so these are typically invisible; if anomalous entries appear, restarting DSH will resolve it.
  • Attachments and projection caches are not deleted along with session logs (they only occupy disk space and do not affect the UI).
  • No built-in undo: Restoration depends on the Recycle Bin; please confirm before deleting.

Brief Closing

This plugin fills DSH’s one missing operation for archived sessions—permanent removal—with deletion sending logs to the Windows Recycle Bin for easy restoration. It’s ideal for desktop users who need to clean up archived sessions they no longer need. It is recommended to review the source code and license before installing.

  • Plugin directory: https://www.skillhub.cn/plugins/xiayanyu0306/dsh-archived-session-cleanup
  • GitHub: https://github.com/xiayanyu0306/dsh-archived-session-cleanup
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye