dsh-session-delete
A DeepSeek Harness plugin that adds a Delete session action to the Session menu, next to Archive session. Archive only hides a Session; this action actually removes it — together with its subagent Sessions and the durable artifacts that belong to them.
Third-party plugin. It is not part of DeepSeek Harness and is not published by DeepSeek.
Requirements
- DeepSeek Harness 0.2.2-rc.5 or newer within the
0.2.xline (engines.dsh). - The Web surface:
dsh web, or the Desktop app. The plugin adds a browser-side menu item and dialog; it has no CLI or agent-tool surface. - No build step: the package ships plain JavaScript (
index.js,client.js), so a git install needs no build-script permission.
Install
Install straight from GitHub into the profile your app boots with:
# Web app profile
dsh plugin --profile web add github:napa3um/dsh-session-delete
# Desktop app profile
dsh plugin --profile desktop add github:napa3um/dsh-session-delete
Then restart the Harness (or the Desktop app) and reload the page. The profile gains the bundle dsh-session-delete, and its row mounts automatically.
Pin the commit you reviewed, so a later push cannot change what runs:
dsh plugin --profile web add github:napa3um/dsh-session-delete#<commit-sha>
A git install fetches sources rather than a published tarball. This package needs no prepare/build script, so pnpm has nothing to allowlist; if a future version adds one, pnpm will refuse until the package is allowlisted in the profile's pnpm-workspace.yaml — treat that allowance as permission to execute code on your machine.
Uninstall
dsh plugin --profile web remove dsh-session-delete
Then restart and reload. Deleting a Session is permanent and unaffected by uninstalling the plugin.
From a local checkout
git clone https://github.com/napa3um/dsh-session-delete
dsh plugin --profile web add ./dsh-session-delete
Usage
- Open the menu on a Session row in the Sessions list — right-click the row, or use its menu button.
- Choose Delete session: it is red, sits below Archive session, and is separated from it by a divider.
- Confirm in the dialog. It names the Session, shows its working directory, and warns that subagent Sessions and attachments only they used are removed too.
The item is disabled while the Session is marked as running. The Conversation you are currently viewing has no Delete action at all, so the open Session cannot destroy itself.
What is removed
- The Session log directory — every stored format generation,
session.lock, and anything else the Session owned there. - Every subagent Session descending from it, at any depth: its log, cached records, attachments and reminders. Lineage comes from the immutable
parentSessionheader field plus theorigin: subagentclassification, so ordinary forked conversations (which also record their source inparentSession) are left alone. - Attachments that only the removed Sessions used. Attachment objects are content-addressed and shared, so an object is deleted only when no other stored Session's log mentions it, and never when that scan could not finish.
- Scheduled reminders that target the removed Sessions or were created in them.
- The cached projection checkpoint and that cache's
.bakgeneration copies (<id>.json.bak.<stamp>). - Archive and pin entries for the removed Sessions.
The completion notice reports how many subagent Sessions, attachments and reminders were removed.
What is refused
- The Session you are viewing — no menu item, by design.
- A Session with running work (a turn, a subagent, a job, a reminder), including a running subagent Session inside the deleted tree: the whole deletion is refused before anything is removed.
- A Session stored by a backend without a per-Session JSONL log: only the default JSONL storage is understood.
- A Session whose stored files are not where the backend says they are: refused without deleting anything.
A Session that was opened earlier in the Harness process stays resident in memory after it leaves the screen, and the Host's Session list reports resident Sessions from memory. That is why deletion also hides the row in the browser that deleted it: the browser remembers the deleted ids and re-applies the Host's own removal, so the row does not return after a page reload. The running process cannot unload a resident Session, so until the Harness restarts:
- another browser or device that never deleted the Session can still list it and open it from memory;
- the Sessions search can still find its indexed text;
- new messages sent to such a resident copy would not be written to disk, because its stored log is already deleted.
Restarting the Harness clears those leftovers for good.
What is not removed
- Git worktrees. A worktree the Session created stays on disk; archive the Session first to run the archive-time worktree cleanup, then delete it.
- Spilled tool output. The spill backend keeps oversized tool results under a per-Session directory outside the Harness home and reclaims them by age, not by Session.
- Staged uploads. Files the browser staged for the Session live in the running Host's memory only.
- Derived image caches.
DSH_HOME/cache/attachments/request-images/keeps images re-encoded per model route, named by a digest of the attachment reference plus route parameters, so a file cannot be mapped back to an attachment id; the shipped packages never prune this cache. Dead variants are never shown and never reused, and clearing that directory by hand is safe. The DeepSeek Files API upload index (DSH_HOME/llm-deepseek/files-v3.json) and the uploads it names live outside the Session and expire on their own. - Forked conversations. A fork is a separate Session: deleting its source leaves it intact, and deleting the fork later removes the fork's own artifacts (including attachments it shared with the already deleted source).
How it works
index.js(Host half) registers one owner-onlyPOST /api/session-delete/deleteroute. It validates the Session's stored log path against the Session id before removing anything, walks the subagent lineage, deletes the log directories, then re-checks attachment references across the remaining stored Session logs and drops the orphaned objects, reminders, cache records and registry entries.client.js(browser half) registers the context-menu item, its trash glyph, and a confirmation dialog built from the host Modal's geometry and theme tokens. It posts the Session id, remembers removed ids so their rows stay hidden, and reports the outcome.cordis.patch.ymlmounts both halves through the bundle.
Limits
- Deletion is permanent: no trash, no undo, no archive entry.
- The attachment reference scan is bounded to ten seconds; if it cannot finish, the attachments are kept rather than guessed away.
- A custom
DSH_HOMEis honoured for projection-cache copies; a deployment that relocates the JSON storage root elsewhere keeps those.bakcopies. - On Windows, removing a directory whose files a resident Session still holds open can be refused by the operating system; the dialog reports the failure.
- The deletion route accepts only the owner Peer of the Harness connection; a shared viewer cannot call it.
- The action is user-only: it is not exposed as an agent tool, so the model cannot delete Sessions by itself.
Development
├── index.js # Host half: the deletion route
├── client.js # Browser half: menu item, dialog, row hiding
├── cordis.patch.yml # Bundle layer mounting both halves
├── locale/*.json # Plugin card metadata (8 languages)
├── icon.svg # Plugin icon
└── README.md
Check the JavaScript and the manifest before committing:
node --check index.js
node --check client.js
node -e "JSON.parse(require('node:fs').readFileSync('package.json','utf8'))"
The runtime UI strings live inside client.js; the plugin card title and description live in locale/*.json.
License
MIT — see LICENSE.
还没有评论,来写第一条。