DeepSeek Harness DSH Conversation History Cleanup Plugin

Introduction

When cleaning up historical sessions in DSH, you can typically only delete them one by one or rely on host tools. There is no unified session management entry point, bulk operations are difficult, and deleted sessions cannot be recovered. For users who need to maintain multiple projects over the long term, this experience is further amplified.

Plugin Overview

wangshuangtong/dsh-chat-history-cleaner is a DSH memory-type plugin that provides safe session deletion capabilities for DSH. It enables both single and bulk deletion through the session menu and settings page. Deleted sessions are first moved to a recoverable trash bin, and permanently deleted only after confirmation. It also provides features such as filtering by project, searching by title, and resuming a session.

Core Features

Session menu deletion: Right-click a session row / select “…” → “Delete Session…”. After confirmation, the session is moved to the trash.

Search by title and resume: In the settings page search box, filter sessions by title. The search scope follows the selected project. Click “Open” on a matching row to go directly back to that session and continue. Archived sessions are restored before being opened.

Settings page – “History Sessions”: Filter via a project dropdown (All Projects, each individual project, No Project Directory); search by title; filter by deletable, archived, or restricted status; sort by update time / size / title; select multiple sessions for bulk move to trash; view trash entries, restore or permanently delete them, and clear the trash entirely.

Deletable sessions shown by default: Open/running sessions are viewable under “All” or “Restricted”; attempting to delete them will directly explain the reason without entering a confirmation flow.

Trash: Located at ~/.dsh/trash/chat-history/ by default. On restore, sessions are moved back to their original project directory.

Safe rejection: Running or opened sessions, and sub-agent sessions, cannot be deleted directly. When deleting a parent session, its sub-agent sessions are included in the same trash entry.

No external services: The host router uses an in-process random token; all operations occur locally only.

Installation & Activation

Requires DSH 0.2.2-rc1 or a newer 0.2.x release. The release artifact is a Release tarball with pre-built artifacts included—no build step is required at install time.

Plugin page installation (recommended): Open DSH → Settings → Plugins → Add plugin, and paste the current version’s Release URL:

https://github.com/WangShuangTong/dsh-chat-history-cleaner/releases/latest/download/dsh-chat-history-cleaner.tgz

After installation, enable it as prompted. If a restart is required, restart DSH / Desktop.

CLI installation:

dsh plugin --profile <profile> add https://github.com/WangShuangTong/dsh-chat-history-cleaner/releases/latest/download/dsh-chat-history-cleaner.tgz

Replace <profile> with web, desktop, or whatever profile you are using.

Typical Usage

Single deletion: Right-click a session row / select “…” → “Delete Session…” → “Move to Trash”.

Search by title and resume: Settings → History Sessions → Select project → Type the title in the search box; click “Open” to go back to that session and continue. The search includes opened/running/archived sessions; archived sessions are restored before being opened.

Per-project cleanup: Settings → History Sessions → Select a project from the top project dropdown; the list, filter counts, and bulk deletion all apply to that project only.

Bulk cleanup: Check sessions → “Move to Trash”.

Restore / Permanently delete: Settings → History Sessions → Trash section.

Open sessions: Agents still held by the Desktop process will block deletion. Switching/closing the session or restarting Desktop will release them. Sessions currently running a turn must first be finished or stopped.

Configuration

Override by line id in the profile’s cordis.patch.yml (the patch replaces the entire config, so you must include all keys you want to retain):

- id: chat-history-cleaner
  config:
    debug: false
    maxBatch: 200
    toastMs: 4000
    # trashDir: D:\dsh-trash\chat-history   # Optional, absolute path
Key Default Description
debug false Output diagnostic logs on client load
maxBatch 200 Maximum number of sessions / trash entries processed per request
toastMs 4000 Browser toast display duration in milliseconds
trashDir <DSH home>/trash/chat-history Trash root directory; must be an absolute path and must not overlap with the sessions directory

Security Boundaries

Before deletion, sessions are validated against sessionPersistence.list(), and the real directory is derived from stat.location.path; only that session directory is moved—project directories or the sessions root are never deleted.

Trash entry names, relative paths in meta, and stored directory names are all validated as a single safe path segment. Before restore or permanent deletion, the path containment relationship is re-verified, and symbolic links / junctions are rejected.

If a bulk move fails midway, already-moved directories are rolled back; meta.json is written atomically.

The host router uses a randomly generated token per process (x-dsh-chat-history-token). The token is injected only into the page; requests without the token receive 403, invalid requests receive 400, and oversized request bodies receive 413.

The projection cache (storages/session_projcache) is derived data and is best-effort deleted when moved to trash; it is automatically rebuilt by cold reads after restore.

Known Limitations

Only the JSONL persistence backend shipped with DSH is supported; other backends return unsupported-storage.

Loaded/running sessions cannot be deleted; the host must release the Agent first.

Sub-agent sessions cannot be deleted individually; they are handled together when the parent session is deleted.

Trash restore depends on the current sessions root directory; after a profile home migration, restore uses the current root + relative path.

Projection cache is not restored on trash restore (derived data).

Workspace archive/pin markers are preserved while in the trash; they are cleaned up on permanent deletion only if the session truly no longer exists.

UI copy is determined at page load time; switching the UI language requires a page refresh.

There is no automatic trash cleanup policy; manually “Clear Trash” when needed.

Use Cases & Notes

Suitable for users who need to manage sessions by project, avoid accidental deletions, and want to retain the ability to recover. This plugin runs with the current dsh process permissions; review the source code and license before installing.

Conclusion

This plugin provides the ability to filter by project, search by title, and resume sessions through the settings page and history sessions entry. Deletion operations first move sessions to a recoverable trash, and permanent deletion occurs only after confirmation. It is well-suited for scenarios requiring safe management of DSH historical sessions.

  • Directory page: https://www.skillhub.cn/plugins/WangShuangTong/dsh-chat-history-cleaner
  • GitHub: https://github.com/WangShuangTong/dsh-chat-history-cleaner
羽毛球分组比赛记分
小程序二维码

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

Xiaoye