dsh-delete-turn: DeepSeek Harness Message Delete Plugin

Preface

DeepSeek Harness (DSH) session logs are append-only. Once a prompt is entered incorrectly or the model provides a misaligned response, this content remains in the model context, polluting every subsequent turn. Currently, the official implementation only provides a “Compaction” (/compact) mechanism for summarizing entire segments, lacking deletion capabilities at the individual message level.

The following introduces dsh-delete-turn. This plugin restores deletion capabilities directly to the messages. Leveraging the official surface-replace contract, it removes content from the model context and hides it in the visual transcript without modifying the original append-only logs.

Plugin Overview

  • Name: dsh-delete-turn
  • Maintainer: DDDMUC
  • Category: Workflow
  • License: MIT
  • Core Mechanism: Uses the official surfaceOp: { op: 'replace', startSeq, endSeq } contract for context masking; logs are not rewritten.

Installation and Activation

Install via npm (web profile):

dsh plugin --profile web add dsh-delete-turn

After installation or update, the host-side plugin tree is loaded only upon DSH startup. You must fully restart the DSH process and perform a hard refresh of the page for the plugin to take effect.

Core Features

  • Model Context Deletion: Appends official replacement events, ensuring masked content no longer enters deriveMessages().
  • Full Turn Deletion: Deletes a complete turn (including the query, injected context, and all response steps). Subsequent turns are preserved in place and connected directly, without replay or renumbering.
  • Transcript Hiding: Utilizes official useChat snapshots and anchor point positioning. Deleted items collapse and fade out, remaining hidden after refresh or restart.
  • Log as Ledger: The basis for hiding is reconstructed directly from replacement events in the logs, without relying on local storage.
  • Security Boundary: Only accepts requests from loopback addresses where the Host is localhost; the system prompt header (surface node 0) cannot be deleted.

Usage

  1. Delete a single message:
    • Hover over any message row and click the trash can button at the end of the row.
    • For assistant replies, the delete button is located in the official action bar (next to the copy/fork buttons).
    • The confirmation dialog will explain the scope of impact. Click “Delete”.
  2. Delete a full turn:
    • On the user message row, there is an additional “Delete this turn” entry.
    • Clicking this deletes the entire turn (including your query, injected context, and all replies). Subsequent turns are preserved in place and connected directly.

Notes

  • Irreversible: Under append-only semantics, there is no “undelete.” Masked content cannot be truly restored, and deletion is irreversible (the original log remains, and you may use official tools to reconstruct the session yourself).
  • Deletion during a Turn: Deletion first stops the current generation (via the official sessionController.cancel, equivalent to pressing the stop key). It executes only after the current turn is properly finalized (turn/end is landed). Deletion will be rejected with a reason if the stop times out (default 15 seconds), if the stop is rejected, or if a compaction is currently in progress.
  • System Prompt Protection: The system prompt header (surface node 0) cannot be deleted.
  • Compacted Content: Content already removed from the model context by official compaction (/compact) no longer displays a deletion entry.
  • Scope of Full Turn Deletion: Full turn deletion removes your query. To delete only replies, use the assistant action bar; to delete only the prompt, use the trash can on the user row.

Ecosystem Context

The philosophy of DeepSeek Harness is “Everything is a Plugin.” The community directory SkillHub provides plugin retrieval and publishing services and has no official affiliation with DeepSeek or High-Flyer.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye