Skip to main content
M

dsh-archive-purge

mulholland-drive/dsh-archive-purge

Permanently deletes archived sessions, which DSH otherwise keeps on disk forever because it ships no delete API. A right-click action on an archived session, or an archive_purge tool with a dry-run preview, removes the conversation log, the projection cache row, and the workspace archive entry.

Install

dsh plugin --profile web add github:mulholland-drive/dsh-archive-purge

README

dsh-archive-purge

English | 中文

Permanently delete archived sessions in DeepSeek Harness. Right-click an archived session in the sidebar, choose Delete permanently, confirm — the conversation log, its projection cache, and its workspace entry are gone for good.

Archiving in DSH is deliberately non-destructive: the session is hidden, but its log stays on disk. DSH ships no delete API, so archived sessions accumulate forever. This plugin fills that gap.

Install

Three steps:

  1. Get the code. Download this repository (green Code button → Download ZIP, then extract) or clone it:

    git clone https://github.com/<you>/dsh-archive-purge.git
    
  2. Add it to DSH. Open Plugins → Add plugin and pick the extracted/cloned directory — the one containing package.json. If the plugin-manager tool is available, the same thing is:

    { "action": "install_bundle", "target": "/absolute/path/to/dsh-archive-purge" }
    
  3. Restart DSH. The Web half is a client bundle, and it is served only after a restart.

Once installed, the sidebar's session context menu gains a Delete permanently entry for archived sessions. Nothing else to configure.

Usage

From the sidebar

Show archived sessions (the sidebar's view filter), then right-click one. Its context menu gains a red Delete permanently entry below the built-in actions. Choosing it opens a confirmation dialog; nothing is removed until you press Delete permanently in that dialog.

The entry appears only for archived sessions — an active or unarchived session never shows it.

From the agent

An archive_purge tool is registered for the agent:

ParameterMeaning
dryRunReport what would be deleted without deleting anything
idsLimit the purge to specific archived session ids; omit for every archived session

What a purge removes

Three places hold a session id:

LocationContains
~/.dsh/sessions/<project>/<session-id>/the conversation log (session.v4.jsonl.zstd)
~/.dsh/storages/session_projcache/sessions/<id>.jsonthe projection checkpoint cache
~/.dsh/storages/workspace.jsonthe archive set and workspace session lists

$DSH_HOME overrides the home directory when set.

How it avoids the "ungrouped ghost"

Deleting the files alone is not enough. Three details make the difference:

  1. The log goes before its cache row. The cache rebuilds a missing row from the log on the next cold read, so deleting the row first lets the sidebar re-list the session immediately.
  2. A live session must leave the process too. sessionQuery.listSessions() merges persisted records with the in-memory store, so a session still held in memory survives every file delete and lingers as an ungrouped stray.
  3. The browser must re-pull. The sidebar renders a snapshot pulled by sessions.list, so a server-side delete stays invisible until the page refreshes its list — which the UI half triggers after each successful purge.

A purge also sweeps orphaned cache rows: rows whose log is gone can only re-list a deleted session, so they are removed as well.

Limitations

  • Not transactional. A locked file is reported as a failure and stays on disk; re-running the purge finishes the job.
  • JSONL backend only. Only the shipped JSONL persistence layout is handled.
  • Live sessions. Deleting a session that another window is actively running will end that window's conversation. Prefer deleting sessions you have closed.
  • Not undoable. There is no trash folder.

Development

The plugin needs no build step: index.js (Host) and client.js (Web) are hand-written ESM and plain-JavaScript respectively.

index.js            Host half: the archive_purge tool and the Client-callable purge endpoint
client.js           Web half: the context-menu action and its confirmation dialog
cordis.patch.yml    Loader patch inserting the plugin row
locale/*.json       Plugin-manager title/description (en, zh)
docs/DETAIL.md      Plugin detail page
icon.svg            Plugin icon

License

MIT — see LICENSE.

Related plugins