Preface¶
DeepSeek Harness (DSH) session logs are append-only event logs, and by default, there is no entry to “delete a specific turn.” In long conversations, if certain turns lead the context astray, involve pasting wrong content or files, or if you only want to retain the conclusion from a trial-and-error process, this content will continue to enter the model-visible surface, consuming tokens and affecting subsequent replies. The community already has plugins borrowing the “turn deletion” concept; dsh-turn-eraser is maintained by Nagiko0739. The npm package name is also dsh-turn-eraser, categorized as a context/memory-related tool. Below is an introduction to what it does, how to install and use it, and the mechanical boundaries of deletion.
What is this¶
dsh-turn-eraser is a session utility for DSH: it provides a deletion entry at the end of each turn and displays the “Turn N” number persistently. The meaning of deletion is: to mask the specified turn from the model-visible context. The original session log on disk is not modified, so deleted original text can be read back on demand. The current version in the package is 0.2.1, license MIT.
Core Features¶
The capabilities listed in the README are as follows.
| Feature | Status |
|---|---|
| Delete a specific turn (user question + entire AI response) | Implemented |
| Delete here and after | Implemented |
| Deletion entry for every turn (including “empty” turns without a formal response) | Implemented |
| Hide the turn in the UI after deletion | Implemented |
| Display “Turn N” at the end of the turn | Implemented |
| Traceability: Read back deleted original text | Implemented |
| Delete entire session | Not implemented |
| Complete erasure (physically wipe logs) | Not implemented, and not recommended by the author |
Design points: The placeholder writes the turn number (e.g., [Deleted Turns 20-22]), not a content summary. The model only knows “where the holes are” and is not informed of the original text within the holes.
Installation and Activation¶
The plugin runs with the current DSH process permissions; it is recommended to verify the source code and LICENSE in the GitHub repository before installation.
Recommended to install from npm. In DSH Settings → Plugins → Add Plugin, enter the package name:
dsh-turn-eraser
Or use the command line (replace <your-profile-name> with the actual profile name):
dsh plugin --profile <your-profile-name> add dsh-turn-eraser
The same addition interface also supports GitHub repository addresses or local directory paths; the repository is Nagiko0739/dsh-turn-eraser. The installation instructions state: zero runtime dependencies, no additional third-party npm packages brought in with the plugin.
Typical Usage¶
UI Deletion¶
There is a small trash can icon at the end of each turn. Operation steps:
- Click the icon to bring up Delete This Turn / Delete Here and After.
- After selecting one, the button changes to “Click again to confirm”.
- Click again to execute deletion; if there is no operation for about 4 seconds, it will automatically collapse to reduce accidental touches.
After deletion:
- Model: From the next turn onwards, it cannot see the deleted content, only sees the placeholder (e.g.,
[Deleted Turns 20-22]). - Interface: The entire turn is hidden (including thinking processes and tool call collapsible blocks).
- Log: The original text is fully preserved.
The turn number is displayed to the right of the trash can, taking its value from data-turn-tail on the interface. Humans and AI can use the same turn number to refer to the same turn.
Tombstone Mechanism (Brief)¶
DSH logs are append-only and cannot be rewritten in place. The plugin appends tombstone events at the end of the log, using surfaceOp: replace to replace the specified event range from the visible surface; original events remain in the file. The tombstone must be user/message with non-empty content, otherwise it may trigger DSH write validation or third-party constraints. The README provides a JSON shape example, including fields like source.producer, removed event serial numbers, turn, etc.
Read Back Deleted Content¶
Deletion does not equal destruction. The repository provides tools/trace_deletions.py, which depends on the system zstd (macOS can use brew install zstd; the script will clearly prompt if missing).
# List deletion records for all sessions
python3 tools/trace_deletions.py
# Filter by keyword and expand deleted original text
python3 tools/trace_deletions.py <keyword> --full
It can clarify what was deleted, when it was deleted, and which turn it belongs to, and read back the original text including thinking and tool results; it cannot infer “who” deleted it from the log, and there is no one-click undo for deletion. To restore visible context, you need to handle it yourself based on the read-back content, or let the agent find it from the log by turn.
Use Cases and Notes¶
Suitable for: When the context is led astray by a few turns and you want local “erasure”, sending wrong turns, organizing trial-and-error processes, reducing the length of model-visible context when you don’t want to manually compress yet, and needing to keep disk logs for auditing or reading back.
Must pay attention to (from README “Known Limitations”):
- No one-click undo; after the surface
replaceis executed, the replaced node cannot be automatically restored by subsequent events. - Traceability does not mean tamper-proofing; logs are plain text JSON.
- The deletion entry is attached to the official slot
conversation.chat.turnTail; when DSH drastically changes the UI, the plugin may need to follow up (code includes DOM reading fallback). - References
@deepseek-ai/dsh-client-ui-primitives, which official documentation does not recommend plugins depend on; there is a self-drawn fallback when the library is unavailable, functionality remains usable, appearance may degrade. - Deletion only affects the current session; running sub-Agents hold their own context snapshots and may still remember deleted content from the main session.
- Does not perform physical erasure, will not rewrite session log files.
The DSH ecosystem emphasizes “everything is a plugin”; community directories like SkillHub are independent sites, with no official affiliation with DeepSeek / High-Flyer. The facts in this article come from the project README and package metadata.
Links¶
- Community Directory Page: https://www.skillhub.cn/plugins/Nagiko0739/dsh-turn-eraser
- GitHub: https://github.com/Nagiko0739/dsh-turn-eraser