Permanently deletes a Session from the sidebar: the row archive button becomes a delete action with an in-app confirmation, and the Host stops live work then removes the saved history after checking the directory belongs only to that Session.
Install
# from npm (prebuilt)
dsh plugin --profile web add @yornni/dsh-session-delete
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Yornii/dsh-session-delete
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
A DeepSeek Harness (DSH) web-client plugin that turns a Session row's hover archive button into delete: after a confirmation, the Session and its saved conversation history are permanently removed.
中文: README.md
🎯 Why
DSH's sidebar only offers archive: the Session disappears from the list but its jsonl record stays on disk forever. Cleaning up for real means digging through the sessions directory by hand, and first proving that a folder belongs to exactly one Session.
This plugin adds the missing step: trash icon on the row → confirm → the Host stops running work, validates the target directory, removes the record, and the list drops the row immediately.
✨ Features
| Capability | Detail |
|---|---|
| Row action | A trash icon replaces the shipped archive button in the same slot and position |
| Confirmation | The dialog shows the Session title and states that deletion is permanent; running Sessions also warn that their work will be stopped first |
| Keyboard support | Focus starts on Cancel; Esc and backdrop clicks close it; Tab cycles inside the dialog |
| Instant removal | On success the client drops the row via the api-session/removed event — no full page refresh |
| Safe by construction | Only a directory proven to belong to the Session is removed; any unexpected entry aborts the deletion |
| Bilingual | Ships Simplified Chinese and English dictionaries and follows the DSH locale |
| Theme-aware | All styles use DSH theme variables, so light and dark themes both work |
🖼️ Screenshots
Hovering a Session row swaps the shipped archive button for the trash icon:
Clicking it opens a confirmation that spells out the permanent removal of the Session and its saved history:
📦 Install
Requirements: a DSH 0.2.x web profile (developed and verified on 0.2.2-rc.1). The plugin has both a Host and a Client half and must be installed into the profile that serves the web UI.
Pick one:
# From GitHub (use this until it is on npm)
dsh plugin --profile web add github:Yornii/dsh-session-delete
# Once published to npm
dsh plugin --profile web add @yornni/dsh-session-delete
Replace web with your profile name (the desktop build uses desktop). You can also clone the repository and install the local directory:
git clone https://github.com/Yornii/dsh-session-delete.git
dsh plugin --profile web add ./dsh-session-delete
Restart DSH afterwards (the Host composes the profile at boot) and reload the page; the plugin appears as "Session delete" in the plugin list. Uninstalling or disabling it restores DSH's own archive button.
🗑️ Usage
- Hover a Session in the sidebar and click the trash icon on its row.
- Check the title in the confirmation dialog. A running Session adds a note that its work will be stopped first.
- Click Delete permanently. The button turns into "Deleting…"; on success the dialog closes and the row disappears.
- On failure the dialog stays open, shows the reason above the buttons, and you can retry or cancel.
Deletion is also available as a command from inside a Session (that is exactly what the dialog runs):
/delete-session <this-session-id>
The command only accepts the ID of the Session it runs in — any other ID is rejected, which makes accidental cross-Session deletion impossible. This delete-session command is the stable public entry point used by the batch-delete features of dsh-session-unfold and dsh-task-board.
🔍 What deletion actually does
Click delete
└─ Client: confirmation → run /delete-session <id>
└─ Host: the id must equal the current Session
├─ If the Session is live: archive it (so a refresh does not bring it back) → wait up to 2.5s for idle
├─ Detach it from every Workspace's session accounting
├─ Validate the on-disk directory: the file must be session[.vN].jsonl[.zstd]
│ only session logs, session.lock and *.tmp may be present
├─ Wait 400ms so the command runner's own log writes land before the directory goes away
└─ Remove the directory recursively → emit api-session/removed → the row disappears
The failure path is safe: if validation fails, removal throws, or the plugin unloads, scheduled deletions are cancelled and the archive marker this plugin wrote is rolled back.
🔒 Safety boundaries
- Only the Session's own directory: the directory is the parent of the physical log path reported by the persistence layer, and it is removed only if every entry is a Session artifact (log generation,
session.lock,*.tmp). Anything else aborts the whole deletion. - No "delete by arbitrary ID" API: the command input must match the ID of the Session it runs in.
- No recycle bin: this is
rm -rfsemantics. A deleted Session cannot be restored from the archive and does not go to the OS trash. - Deletion is delayed by 400ms so the command runner's post-handler writes finish first instead of re-creating the directory.
- Non-jsonl stores are refused with an explicit error rather than guessing a path.
⚠️ Known limitations
- While enabled, the row's archive button is replaced. Disable the plugin if you need archive.
- Permanent deletion cannot be undone; there is no "recently deleted".
- One Session per action. For batch deletion use
dsh-session-unfoldordsh-task-board. - Directory validation is strict: a Session folder polluted with unrelated files makes deletion fail until you clean it up yourself.
- Only the jsonl Session store (DSH's default) is supported; custom stores are not.
- If the Host dies mid-deletion, the directory may be partially removed; retrying normally clears the rest.
- With several clients open, the removal event reaches all of them, but another client's already-rendered transcript is not cleared until it reloads.
🧩 Implementation
| File | Role |
|---|---|
index.js |
Host half: registers the delete-session command, archive/detach/validate/delayed removal/rollback |
client.js |
Client half: row delete button, confirmation dialog, zh/en dictionaries and styles |
cordis.patch.yml |
Bundle declaration that inserts the plugin into the profile's plugin stack |
locale/*.json |
Plugin metadata (title and description) in Chinese and English |
icon.svg |
Plugin icon |
tools/host-test.mjs |
Offline Host-half test using a temporary directory and fake services |
tools/package-test.mjs |
Package-metadata consistency test: name, module id, bundle patch, exports, locales and files |
Host services: commands, sessions, sessionPersistence, workspaceRegistry.
Client services: slots, locale, sessions, remote, remote.commands.
Slots: sidebar.workspaces.session.row.action (id archive, priority -1, replacing the shipped button) and shell.overlay (the confirmation dialog).
🧪 Self-check
npm run check # syntax: node --check index.js && node --check client.js
npm test # 19 Host assertions + 20 package-metadata checks
tools/host-test.mjs needs no browser or real DSH. It covers cold-Session deletion, archiving and idle-waiting for a live Session, refusal of a foreign ID, unknown Sessions, refusing a directory with unrelated files while rolling the archive back, immediate announcement for a memory-only Session, treating session.lock / *.tmp as Session artifacts, and refusing non-jsonl stores. tools/package-test.mjs keeps the package name, Client module id, bundle patch, exports, locales and files in sync, so a rename cannot leave one of them behind.
Manual acceptance:
- Install and reload: hovering a Session row shows the trash icon and the archive button is gone.
- Open the dialog: title and description are correct;
Esccloses it; focus starts on Cancel. - Delete an idle Session: the row disappears after roughly half a second and
$DSH_HOME/sessions/<workspace>/<session-id>/is gone. - Delete a running Session: its work stops first, then the directory is removed and it stays gone after a refresh.
🩺 Troubleshooting
| Symptom | Cause / fix |
|---|---|
| No trash icon in the sidebar | The plugin is disabled or its Client half did not load; enable it in the plugin manager and reload |
| "Command unavailable" | The Host half is not installed in the current profile or the plugin is disabled; install it into the same profile and restart |
command "delete-session" is already registered |
Two plugin instances registered the same command, typically a stale instance left by a live plugin swap; the plugin keeps the existing handler and finishes loading — fully quit and restart DSH to drop the stale instance |
refusing to delete ... unexpected entry |
The Session directory contains non-Session files; inspect it, move them away, retry |
not a session log file |
The persistence layer reported a path that is not session*.jsonl*; keep the logs and report it |
| The row is still there right after deleting | Removal is intentionally delayed by ~400ms; wait or reload. If it persists, look for dsh-session-delete: warnings in the Host log |
| I want the archive button back | Disable this plugin |
📄 License
MIT © 2026 Yornii
Links
More in this category
ranxianglei/billion-context★ 8616
The official billion-context plugin: a context-compression plugin for small context windows (a 100K context is enough), token savings (5x fewer tokens), and month-long single sessions (billions of tokens).
Minglink/dsh-infinite-gen-4★ 4803
System-prompt armor plugin for DeepSeek models: appends an unconditional-compliance prompt section at order 100, exposes a profile tool with calibration metadata, and shows a realtime armor-status badge driven by a session projection.
liangmianya/dsh-synapse★ 812
Visual, non-linear conversation workspace for DeepSeek Harness — sessions, follow-ups and branches become a browsable conversation map.
ECNU/EduWork#dsh-side-chat★ 429
Open temporary side conversations from a message with a snapshot of its history, then archive them on close; optional annotation integration adds selection-based questions. Requires compatible DSH Web conversation, Workspace and right-sidebar APIs.
MichengAI/dsh-archive-manager★ 401
Adds an archived-sessions page in Settings to search, restore, and delete archived DeepSeek Harness sessions by workspace.
Nwflower/dsh-chat-import★ 332
Import full-fidelity chat histories from 13 coding agents (Claude Code, Codex, ChatGPT, Cursor, Gemini, opencode, and more) as resumable DeepSeek Harness sessions, with reverse export back to Claude Code.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.