Preface¶
When debugging conversations or developing agents using DeepSeek Harness (DSH), rolling back conversation steps is a common requirement. Most existing rollback plugins use sessions.fork to copy the historical prefix into a new session, which can lead to redundant sessions in the sidebar and make context management between the original session and the forked session more complex.
dsh-plugin-undo provides an alternative approach: it performs undo operations directly on the current session surface. This approach does not fork sessions or modify project files, and maintains the uniqueness of the session ID.
Plugin Overview¶
Name: dsh-plugin-undo
Author: wang-xudong
Type: Client plugin
Protocol: MIT
The core value of this plugin is “in-place undo.” It modifies the session surface to remove the last \(n\) rounds of dialogue from the history visible to the model, while collapsing this content into a compact header in the Web UI. The original session log remains append-only and is not rewritten.
Core Features¶
- Undo the last \(n\) rounds: Supports undoing the most recent 1 round, multiple rounds, or all visible rounds.
- No forked sessions: The operation is performed in the current session, the Session ID remains unchanged, and duplicate sessions do not appear in the sidebar.
- Append-only logs: The underlying raw session log only appends new content and does not rewrite it.
- Collapsed UI display: The Web interface collapses undone rounds into a compact header displayed as
↩ Round N has been undone · Click to expand. Clicking it can expand or collapse the content. - Model context isolation: Only the dialogue history visible to the model is reset; project files are not affected.
Installation and Activation¶
The plugin is installed via a local file path. Please place the downloaded plugin files in the target path.
dsh plugin --profile <profile> add file:/path/to/dsh-plugin-undo
After installation, restart the profile to make it take effect:
dsh --profile <profile>
Typical Usage¶
While the session is idle, enter the following commands in the input box:
/undo: Undo the last 1 round of dialogue./undo 1: Same as above./undo 3: Undo the last 3 rounds of dialogue./undo all: Undo all dialogue rounds currently visible to the model.
Note: The session must be idle when the command is executed. If the UI indicates that a round is currently running, stop that round first before performing the undo.
Implementation Details¶
The plugin works through the following mechanisms:
- Surface operations: The host derives the current model-visible rounds from
turn/startandturn/end, and appliessurfaceOp: { op: 'replace', start, end }to tail rounds. - Checkpoint mechanism: An empty assistant message is created as a checkpoint outside round boundaries. Because message derivation skips empty content, the model sees only the retained history.
- UI collapsing: The client reads the
/undocommand node and uses the DOM and CSS to collapse the undone rounds, hides the command card itself, and retains only the collapsed header for user interaction.
Applicable Scenarios and Cautions¶
This plugin is suitable for scenarios where you need to quickly correct the direction of the dialogue within a single session flow. When using it, note the following:
- It only supports undoing consecutive tail rounds, not arbitrary intermediate rounds.
- It only affects the dialogue history visible to the model and does not modify or delete project files.
- The command must be executed while the session is idle.
Ecosystem Context¶
DeepSeek Harness adopts a plugin-based architecture, allowing developers to extend functionality through community catalogs or local files. This plugin is listed in the community catalog and has no official affiliation with DeepSeek or High-Flyer.