dsh-clear-session: Adding a /clear Command to DeepSeek Harness Web GUI

Introduction

In the DeepSeek Harness (DSH) Web GUI, switching sessions requires clicking the “New Session” button in the sidebar. If the current session already has a lot of context and you want to switch to a clean session to continue the conversation, you can only jot down the key context points first and then switch manually. Frequent switching interrupts the workflow and can easily lead to missing critical information.

This plugin adds a /clear command to the DSH Web GUI: it creates a new session in the workspace where the current session resides and switches to it, while the original session remains in the sidebar. This behaves the same as clicking the “New Session” button in the sidebar, but can be triggered directly from the chat box.

What Is This

dsh-clear-session is a client-side plugin developed by maintainer xiangzz. It adds a /clear client command to the DSH Web GUI chat box, which creates a new session in the workspace the current session belongs to and switches the view.

The plugin does not delete, archive, or clear the original session, nor does it modify log files. It simply creates a new session in the current workspace, leaving the original session untouched.

Core Features

  • Create and switch to a new session: Type /clear in the chat box and press Enter. A new session is created in the workspace where the current session resides, and the main view switches directly to it.
  • Workspace unchanged: The new session is created in the same workspace as the current one; the working directory remains the same.
  • Reuse empty sessions: If there is already an empty session (no messages sent yet) in that workspace, it is reused directly instead of creating another one.
  • Original session preserved: The original session remains unchanged—logs are retained, sidebar position is preserved, and pin/archive status stays the same.
  • Client command: /clear does not send any message to the model, does not enter the conversation history, and does not write a command/run entry. The /clear text in the input box is consumed.
  • Fallback when no workspace: If the current session has no associated workspace (shown as “Ungrouped” in the sidebar), it falls back to a parameterless “New Session” action.
  • Error handling: If the Host rejects the creation, DSH’s built-in workspace notification bar is displayed; anomalies such as the UI lacking workspace navigation capability will show an error message above the input box rather than failing silently.

Installation & Enablement

Install via any of the following methods:

# 1) From npm (available after publishing; the desktop marketplace also uses this)
dsh plugin --profile <profile> add dsh-clear-session

# 2) Directly from GitHub
dsh plugin --profile <profile> add github:xiangzz/dsh-clear-session

Or through the DSH UI: Plugins → Add plugin, then select this directory.

No restart is needed after installation. The page hot-reloads via the client module graph; newly opened browser pages will automatically pick it up.

Typical Usage

  1. Type / in the chat box of any session. A line reading “Clear Context clear” (description: “New session; original session remains in sidebar”) appears at the end of the “Commands” group in the menu.
  2. Type /clear and press Enter:
    - /clear + Enter → creates a new session and switches to it
    - /clear followed by other text → does not match this command and is sent to the model as a regular message
  3. Chinese input: You can only type /clear. Client commands have no Chinese aliases, so typing /清空 will be treated as a regular message.
  4. The UI text follows DSH’s language setting (Chinese / English).

Use Cases & Notes

Ideal for developers who need to switch sessions frequently and maintain workspace context isolation. The plugin runs with the permissions of the current DSH process. Review the source code and license before installing.

Known limitations:
- Name conflicts: If another plugin registers a Host command also named clear, DSH’s / menu will throw an error and the entire menu will fail to open. If the / menu suddenly appears empty after installing a new plugin, check for a conflicting clear name first.
- No Chinese alias for client commands: You can only type /clear; there is no Chinese equivalent like /压缩 or /计划.
- Cursor in the middle of a draft: Typing / in the middle of a draft will still show this entry in the menu. Once selected, only the /clear portion is consumed; the rest of the draft text remains in the original session.

Conclusion

dsh-clear-session makes it more convenient to create new sessions in the DSH Web GUI through a simple /clear command. It does not modify the original session—it only creates a new one in the current workspace, making it well-suited for scenarios that require context isolation.

  • Directory page: https://www.skillhub.cn/plugins/xiangzz/dsh-clear-command
  • GitHub: https://github.com/xiangzz/dsh-clear-command
羽毛球分组比赛记分
小程序二维码

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

Xiaoye