Introduction¶
The session logs of DeepSeek Harness (DSH) use an append-only write model. Once a log entry is written, it cannot be overwritten in place. This means that if a message is accidentally sent to the wrong session, rolling back or trimming the conversation is extremely difficult—requiring external scripts or manual intervention, which is both inefficient and error-prone. The yoyoluming1/dsh-delete-chat plugin leverages DSH’s public Session API to trim conversations by generating a new session while keeping the original session intact. It offers two trimming modes: delete only the current turn while preserving all subsequent turns into a new session, or delete the current turn and everything after it, keeping only the earlier turns.
Plugin Overview¶
This is a plugin that provides conversation turn deletion capabilities for DeepSeek Harness, developed by maintainer yoyoluming1 and categorized under “Memory.” The plugin registers a Host command and a per-turn chat control item, allowing users to delete conversation content on a per-turn basis within a session. The original session remains unchanged; a new session is automatically opened and the original session is archived, enabling cleanup of erroneous conversations without losing historical context.
Core Features¶
- Per-turn deletion: Supports deleting a single conversation turn, or deleting the current turn and all subsequent turns.
- Preserved historical context: Deletion is implemented by generating a new session; the original session remains untouched.
- Automatic archiving: After deletion, the original session is archived and the new session opens automatically.
- Toggleable control: Disable this control in Settings → General → Delete control to prevent accidental operations.
Installation & Activation¶
- Clone the repository to any directory:
git clone https://github.com/yoyoluming1/dsh-delete-chat.git
- In DSH, open Plugins → Add plugin, select the cloned directory, then enable the plugin.
- Open or create a session and send at least one message to complete a conversation turn. At this point, a “Delete / Delete” control will appear beneath each completed turn.
After updating the plugin source code, simply refresh the page. If replacing an already installed package, a DSH restart may be required.
Typical Usage¶
- In the session, locate the turn you want to delete. Hover the mouse over the last assistant reply.
- Click the “Delete” button and choose from the options in the popup:
- Delete only this turn and keep the following conversation: Deletes the current turn and migrates subsequent turns into a new session.
- Delete this turn and everything after: Preserves all content before the current turn, deletes the current turn and all subsequent content, and opens the result in a new session. - The new session opens automatically and the original session is archived. To compare or return to the original session, unarchive it from the archive list.
Use Cases & Cautions¶
- Use cases: Accidentally sending a message to the wrong session, correcting conversation structure mid-session, cleaning up redundant conversation turns.
- Cautions:
- The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license (MIT) before installation.
- Only whole-turn deletion is supported; individual messages or tool calls cannot be deleted.
- The keep-later operation will reject turns that have been replaced by subsequent system/message entries or are referenced by real-time compression transactions. In such cases, use the “delete current turn and after” mode instead.
- If the session itself is a fork (created via branching or produced by a previous trim operation), keep-later will still be rejected.
- After an intermediate deletion, subsequent turn numbers will be renumbered (e.g., from 351 to 350). This is a requirement of the disk format.
- Trim operations delete all records after the cut point, including the latest title, audit records, background task records, and delivered cards.
- If the session has incomplete turns, the delete command will be rejected.
- Titles that reference deleted messages will also be removed.
- The plugin is compatible with DSH 0.2.2-rc.5 (Session format v4). Future version updates may require plugin adaptation.
Value Recap¶
The dsh-delete-chat plugin provides DSH with the ability to delete conversations on a per-turn basis, making it possible to correct errors or clean up redundancy within a session in a controlled and traceable manner. By generating a new session rather than modifying the original log directly, it ensures the safety and auditability of the original session. Combined with a toggleable control switch, usage becomes even safer. It is well-suited for agent developers who need fine-grained management of conversation history and want to avoid the impact of accidentally sent messages on downstream reasoning.
- Plugin directory page: https://www.skillhub.cn/plugins/yoyoluming1/dsh-delete-chat
- GitHub repository: https://github.com/yoyoluming1/dsh-delete-chat