DeepSeek Harness (DSH) is an agent development environment based on a plugin architecture. In day-to-day development, the session list often needs regular cleanup. DSH’s native archiving feature cannot fully remove data, and manual operations can easily leave behind workspace ledger entries or cache files.

dsh-session-delete is a client-side plugin maintained by yauntyour. It adds a Delete Session option to the action menu of each session row, used to completely remove a session and its related data.

Core Features

  • Menu Injection: In the ⋯ action menu of each session row, adds Delete Session directly below Archive Session. The option uses a red danger color scheme (following the theme variable --dsw-alias-state-error-primary), includes a trash can icon, and shows a danger-state hover background.
  • Confirmation Prompt: A confirmation dialog is shown before deletion. It follows DSH theme variables, and no data is deleted until confirmed.
  • Duplicate Session Selection: If multiple sessions share the same name, the dialog lists all candidates (title, ID, relative time), and the user selects the target.
  • Instant Refresh: Uses DSH’s wire push mechanism (host/session-removed, host/workspace-changed, host/archived-sessions-changed) to update the session list without reloading the page. When the current session is deleted, the view automatically jumps to New Session.
  • Clean Deletion: Besides removing the session log file, it also cleans up the workspace ledger (workspace.sessionIds), archived collection (archivedSessionIds), and projection cache (session_projcache), preventing ghost sessions from appearing after a restart.
  • Security Guardrails: Reuses the browser trust guardrail mechanism of the official /api gateway (Loopback host or trusted host + same-origin check).

Installation and Enabling

# 在插件目录构建并打包
cd D:/Developments/Workspace/DSH-SessionDelete
npm install && npm run build && npm pack

# 挂载到 web profile
dsh plugin --profile web add "D:/Developments/Workspace/DSH-SessionDelete/dsh-session-delete-0.2.0.tgz"

Verify the installation:

dsh --profile web --dump-config | grep session-delete
# 应输出包含 id 和 name 的配置项

After restarting dsh web, refresh the browser page. In the ⋯ menu of any session row in the left-hand session list, you can now see the new Delete Session option.

Usage Steps

  1. Move the mouse over a session row and click the ⋯ at the end of the row.
  2. In the popup menu, click Delete Session, which is below Archive Session.
  3. In the confirmation dialog, verify the session title (if there are sessions with the same name, first select the target from the list).
  4. Click Delete and wait for the message Session deleted — the list will automatically remove the session.

Notes and Limitations

  • Irreversible Operation: Deleting a session is unrecoverable, and log files will be permanently removed. Proceed with caution.
  • Attachment Handling: Attachments under ~/.dsh/attachments are addressed by object and have no session index, so attachment objects are not cleaned up during deletion.
  • Search Index: If session content search (session-query) is enabled, stale index entries may remain. This does not affect list display and is naturally resolved when the index is rebuilt after a restart.
  • Live Session Limitation: A session with an agent currently running will be denied deletion (the user is prompted to wait for the run to finish), to avoid an in-flight turn continuing to flush and rebuild files after the directory is deleted.
  • Menu Dependency: Menu injection is a DOM-level operation and depends on the stable label and role contract of the Archive Session menu item. If DSH’s official UI refactors this menu structure, the plugin logic must be updated accordingly.