dsh-session-archive: A Management Entry Point for DeepSeek Harness Session Archives

DeepSeek Harness (DSH) supports archiving sessions, but it does not officially support deletion. sessionPersistence only exposes create/open/flush/stat/list interfaces, and ctx.fs has no delete verb. After archiving a session, there is no way to fully remove it. The dsh-session-archive plugin fills that gap.

Core Features

Provides a management page for archived sessions. It can list archived sessions, sorted by last activity time; restore archived sessions to the sidebar; and permanently delete archived sessions.

The plugin runs in DSH’s Host process. The Host side handles requests through two same-origin routes: GET /dsh-session-archive/archived and POST /dsh-session-archive/delete. The Client side does not reference any host packages, and its styles use only --dsw-* theme tokens, so light and dark modes follow automatically.

Installation

The plugin is published to npm.

Make sure DeepSeek Harness is fully exited before installing. While the app is running, the profile’s package.json is locked, and command-line operations cannot acquire the lock.

dsh plugin --profile desktop add dsh-session-archive

If your profile is not named desktop, replace the name after --profile. If you prefer not to use the command line, use the UI instead: Sidebar → Plugins → Add plugin, and enter the package name.

After installation, refresh the page. For future updates, if only client.js changes, refreshing the page is enough; if index.js (the Host side) changes, restart the app—plugin Host modules do not reload when the app is recomposed.

Install from Source

After cloning the repository, install it by directory. The installed dependency is a link: dependency, so do not move the installed directory away:

git clone https://github.com/meowyuho/dsh-session-archive.git
dsh plugin --profile desktop add link:<clone 下来的绝对路径>

The path must be an absolute path. link: can also be written as file:, or you can provide a bare absolute path directly.

You can also install it directly from the repository without cloning:

dsh plugin --profile desktop add github:meowyuho/dsh-session-archive

Both methods register the plugin into the profile’s bundle layer stack. This package has no build step, so you will not encounter the allowBuilds prompt typical of git installs.

Usage

Settings → left navigation → Archived Sessions.

  • Restore: The session returns to its original position in the sidebar.
  • Delete permanently: Click the inline “Delete permanently” button to expand a confirmation card (stating which session it is and where its logs are located). The deletion is performed only after confirmation. Press Esc to dismiss the card.

Deletion Mechanism

The deletion operation removes the following:

  • The session’s log directory: <dsh home>/sessions/<项目目录>/<会话 id>/. It may contain multiple format generations, v0–v4, side by side, so the entire directory is deleted.
  • Projection cache record: <dsh home>/storages/session_projcache/sessions/<id>.json.
  • The session placeholder in the workspace, as well as records in the archived collection and pinned collection.

The plugin does not touch the following, to avoid collateral damage to other sessions:

  • attachments/ and its request cache (the content is content-addressed and may be shared by multiple sessions).
  • spill temporary files.
  • Session query indexes.
  • workspace.json as a whole.
  • User files inside the workspace directory.

The deletion process has three steps: delete files → ask the browser to refetch the session directory once → remove it from the archived collection only at the end.

This design avoids UI flicker. If everything were done at once, there would be a moment in the middle where it is no longer in the archived collection, but the client directory still remembers it—the sidebar would render it as a row, and opening it would report session/not-found. With the three-step approach, when the intermediate step completes, it is still archived, so no UI renders it; after its identity has been cleared from the client, it is removed from the archived collection, so it is never exposed even for one frame. If any step fails, it remains in a state where you can retry directly.

Notes

  • Sorting: The list is sorted by “last activity” time, newest to oldest, rather than by archive time. DSH’s archived collection contains only an id array, without timestamps.
  • Deletion restrictions: Sessions with active work (turn / job / subagent / schedule) or sessions currently open in the main view cannot be deleted. Sessions that have been loaded but are idle can be deleted. Earlier versions confused the two, which caused many sessions that should have been deletable to fail deletion.
  • Subagent: Sessions in a subagent lineage cannot be deleted individually; their logs are managed by the session that owns them.
  • Irreversible: There is no trash bin; deletion cannot be undone.
  • Sidebar: The plugin does not modify the sidebar at all. DSH hides archived sessions by default; the host’s “All Sessions (Show Archived)” and “Show Archived Only” toggles are controlled by the user, and the plugin does not change them back.
  • Abnormal cleanup: Rows whose logs no longer exist but whose archive records still remain are flagged, and you can click Delete directly to clear the stale registration.

Verification

The plugin package includes a node _verify-session-archive.mjs verification script. It depends only on Node built-in modules and points DSH_HOME to a temporary directory throughout, so it does not touch your real session data.

The script covers bundle declarations, the browser-side registration contract, same-origin and various rejection paths, real file deletion (checking disk results in a temporary HOME), activity criteria, the staged protocol, and that styles use only theme tokens. On failure, it exits with a non-zero exit code.

License

MIT License.

  • GitHub repository: https://github.com/meowyuho/dsh-session-archive
  • Ecosystem directory: https://www.skillhub.cn/plugins/meowyuho/dsh-session-archive
羽毛球分组比赛记分
小程序二维码

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

Xiaoye