Preface

The philosophy of DSH (DeepSeek Harness) is that “everything is a plugin.” When developing agents, a common requirement arises: after a few rounds of conversation, you realize you’ve gone off track and want to go back to a previous round to restart, rather than discarding the entire conversation. QinLuza/dsh-rollback-visual is a /rollback plugin repository designed to address this need: the backend uses forked sub-sessions to implement rollback, and the frontend attempts to visualize the rollback anchor points within the trajectory view.

First, the conclusion: this repository is deprecated and should no longer be used. There are two reasons: First, regarding the direction of conversation rollback, the official DSH already has built-in fork/branch functionality, so this is reinventing the wheel. Second, the DOM injection scheme used for frontend visualization has fundamental issues and has been abandoned. The repository is now kept only as an archive of “pitfalls encountered” and is no longer maintained. The replacement project is QinLuza/dsh-file-undo.

Below, I will introduce the current status of the repository based on what the backend trio does, how to use the commands, why the frontend solution was abandoned, and what can still be obtained from it.

Repository Status

  • Deprecated, no longer maintained. Version in package.json is 0.0.1, private: true, license MIT.
  • The fork sub-session rollback implemented by the backend trio was available at the time, but its direction was superseded by built-in official functionality.
  • Frontend visualization (DOM injection) has been abandoned.
  • Retained content: docs/踩过的雷.md records 10 pitfalls to help avoid them in future DSH plugin development.

How Rollback is Designed

First, let’s define the model: Rollback = selecting a boundary seq in the conversation event log and forking a sub-session. The source session history remains unchanged, and the sub-session starts a new timeline from the boundary; upon success, switch to the new sub-session in the session list to continue, while the source session remains as is and can be switched back to at any time.

Specifically, it is divided into three parts.

Checkpoint Anchors

After each turn ends, a rollback/checkpoint event is automatically appended, recording the turn number and boundary seq. With anchors, you can select based on “which turn” during rollback, without needing to remember the seq. If you don’t want anchors, configure checkpoints: false to turn them off.

Fork Rollback and Transaction Markers

Rollback forges a sub-session at the boundary, and the source session leaves paired rollback/startrollback/end transaction markers. Markers are closed for both success and failure, with no dangling brackets; everything is persisted and replayable.

Boundary Validation

Illegal boundaries are strictly rejected, including five cases: out of bounds, falling inside an open turn, falling within a compaction interval, agent busy (busy), signal aborted (cancelled). When failing, it returns a human-readable reason: busy, boundary, cancelled, persistence.

Installation and Loading

The repository is divided into two parts, with different installation methods. First, let’s talk about the backend trio: timeline-rollback / rollback-basic / command-rollback. The source code and build configuration are not in this repository but in the feat/timeline-rollback branch of QinLuza/deepseek-harness-research. Loading method:

  1. Insert two lines rollback-basic and command-rollback into cordis.patch.yml in the profile.
  2. timeline-rollback is a Service Definition, introduced automatically as a dependency; do not load it separately.

After the above steps, the backend trio will be loaded with the profile. The frontend plugin is this repository, with two steps:

pnpm build
dsh plugin --profile web add .

First build with pnpm build, then use dsh plugin to add the current directory to the web profile.

Reminder: The plugin runs with the permissions of the current dsh process. You should check the source code and license before installing (this repository is MIT). This repository is no longer maintained; the above is just an archival record.

Command Usage

Type in the GUI input box or execute in the CLI environment:

Command Action
/rollback Display usage + list all checkpoint anchors for the current session
/rollback checkpoint Roll back to the most recent anchor
/rollback checkpoint:<turn> Roll back to the anchor of a specific turn
/rollback <seq> Roll back precisely to a specific event seq (advanced usage, prone to error)

An actual example:

/rollback
 turn 3 -> seq 47
 turn 7 -> seq 120

/rollback checkpoint:3
 Rolled back to seq 47  new child session rollback-xxxx.

/rollback lists all anchors first; /rollback checkpoint:3 returns to the boundary seq 47 corresponding to turn 3, generating a new sub-session rollback-xxxx.

Two constraints to remember:

  • Rollback only forks conversation history; workspace / sandbox files will not rollback.
  • Rollback must be performed between turns: agent idle, boundary falls at the end of a turn.

Frontend Visualization: Why It Was Abandoned

The rendering layer uses MutationObserver for DOM injection. This approach has fundamental issues and has been abandoned; no further refactoring will be done. See docs/踩过的雷.md for the full record of pitfalls encountered.

The data layer was implemented correctly: the conversationEvents / conversationViews definitions in src/client/anchors.ts are reusable. The roadmap originally planned to refactor the rendering layer into native trajectory nodes, but it was not completed.

Applicable Scenarios and Notes

  • Actually need to rollback conversation: Use the built-in fork/branch functionality of official DSH directly, do not install this repository.
  • Need to undo agent file operations: Use the replacement project QinLuza/dsh-file-undo, operation-level rollback, /undo restores to before the operation.
  • Want to write plugins for DSH, especially injecting UI in the frontend: Read docs/踩过的雷.md first; the 10 pitfalls are ready-made materials to avoid them.
  • Want to study the implementation of fork rollback, transaction markers, and boundary validation: Backend source code is in the feat/timeline-rollback branch of QinLuza/deepseek-harness-research.

Note that this repository is no longer maintained and should not be relied upon in production environments.

Conclusion

The backend trio of dsh-rollback-visual verified that fork sub-session rollback is feasible, while the frontend DOM injection serves as a case study of pitfalls. The repository’s mission is complete; the remaining value lies in the pitfall records, the reusable data layer, and the replacement project.

  • GitHub: https://github.com/QinLuza/dsh-rollback-visual
  • Community Directory Page: https://www.skillhub.cn/plugins/QinLuza/dsh-rollback-visual

The Community Directory is an independent site with no official affiliation with DeepSeek / Huiquan.