Preface

Developing agents in DeepSeek Harness (DSH) often goes awry during conversations. Common solutions include forking a branch to start a new session or manually restoring the workspace using git. The former requires switching contexts, while the latter only restores files and ignores conversations already read by the model on the model side. Claude Code’s /rewind offers a different approach: within the same session window, it rolls back the conversation to any earlier user message and optionally restores files modified by write tools. dsh-rewind, maintained by SiriLee, implements this semantics in the DSH web profile, categorized as a workflow plugin. The GitHub repository sirilee/dsh-rewind currently has approximately 11 stars.

What This Is

dsh-rewind is a DSH plugin with the npm package name dsh-rewind-plugin (note: the dsh-rewind on npm belongs to another author; do not install the wrong one). It does only one thing: roll back in place to any user message within the current session window, with an option to simultaneously restore files in the workspace modified by tracked tools, aligning with Claude Code’s /rewind semantics. The plugin does not create new branches or switch windows; the session log uses an append-only strategy, and rollbacks are implemented via masking markers without deleting or altering historical records.

Core Features

In-place Conversation Rollback

The target message and all subsequent content—agent responses, tool calls—are simultaneously withdrawn from both the model context and the interface rendering. The text of the target message is filled back into the input box, allowing direct resubmission after modification. Rollbacks can be performed repeatedly without stage or count limits; interruptions (steering messages not yet read by the model) can also be targets. If the agent is running, the plugin will force-stop the current turn before executing the rollback.

Lightweight Workspace Backup and Restore

The plugin tracks file-writing tools: write, edit, str_replace_editor. Before each write operation, after the approval gate is passed, it captures the original content, groups it by conversation turn, and saves it to ~/.dsh/rewind-snapshots/, persisting across restarts (recent 100 groups per session). At each user message boundary, it rescans tracked files, recording external edits or deletions. Before restoring, it compares in real-time with the disk, processing only files that are truly inconsistent; symlinks and hard links are skipped. It does not depend on git and works with ordinary directories.

Multiple Trigger Methods

Each user message has a “↶ Rollback” button; you can also input /rewind to open a candidate list or use keyboard shortcuts. The mode overlay offers “Rollback Conversation Only” and “Rollback Conversation and Code”; the latter is available when there are restorable changes after the target, displaying a file change list before confirmation. The candidate list and overlay support ↑↓ movement, Enter to confirm, and Esc to cancel.

Security and Testing

The plugin only appends rollback markers to the session logs without deleting or altering recorded history; file backups and restores are limited to ~/.dsh/rewind-snapshots/, not touching git repositories, and no network requests are made. The project includes unit, probe, and end-to-end host verification, covering scenarios like log replay, resumption, and cross-restart operations. Third-party DOM plugins can learn about withdrawn lines via stable functions exported by dsh-rewind-plugin/client. For details, see docs/contract/client-contract.zh.md in the repository.

Installation and Enablement

Execute the official installation command under the DSH web profile:

dsh plugin --profile web add dsh-rewind-plugin

Environment requirements: Node.js ^22.19.0 || >=24.0.0; peer dependencies @deepseek-ai/* are resolved at harness runtime. The current npm version is 0.4.2, licensed under MIT. DSH and this project are both in developer preview; it is recommended to pin the exact version for production environments.

Typical Usage

  1. Locate the user message you want to rollback in the conversation, or input /rewind to select from the candidate list.
  2. In the overlay, choose “Rollback Conversation Only” or “Rollback Conversation and Code”.
  3. The rollback takes effect immediately: the interface reverts to the state at the target message, the withdrawn message text fills the input box, and you can modify and resend it.

“Rollback Conversation and Code” will first list affected files and execute restoration after confirmation. Repeated rollbacks to the same target have zero side effects on already consistent files.

Applicable Scenarios and Notes

Suitable for DSH developers who need quick iteration within the same window and do not want to fork a new session; also suitable for lightweight workspaces without git or that do not want to rely on full tree snapshots. The following are not within the plugin’s scope: full tree or Git-level snapshots, edits within sub-agent sessions, rollbacks via fork branches (built into the harness).

Before use, please note:

  • The plugin runs with the current dsh process permissions; read the source code and MIT license before installation.
  • Rollbacks themselves cannot be undone, but withdrawn content remains in the session logs and can be restored by manually editing the logs.
  • Logs exported with /export include withdrawn messages; the plugin cannot alter the export behavior.
  • Sessions rolled back in v0.2.4 and earlier may fail to load history when continuing the conversation; sessions rolled back in v0.3.3 and earlier may make compacting conversations (compact) unavailable. For details, see docs/compat/troubleshooting.zh.md in the repository.

Conclusion

dsh-rewind brings Claude Code-style in-place rollback to DSH: conversations and files can be rolled back with one click in the same window, logs are append-only, and file backups are lightweight and disk-based. Community directory and GitHub repository:

  • https://www.skillhub.cn/plugins/SiriLee/dsh-rewind
  • https://github.com/SiriLee/dsh-rewind