Introduction¶
When performing multi-turn agent tasks in DSH, the common requirement is not simply to undo a single reply, but to roll back the workspace changes introduced by a specific user message and continue from that message. File changes and conversation history must be processed together: files need to be restored, and the conversation must be able to continue.
dsh-rewind is a session rollback plugin designed for DSH. It restores files changed by the selected turn and continues via DSH’s sessions.fork / sessions.create in a new session. Below are its capabilities, installation method, and boundaries to be aware of.
What is it¶
- Repo:
2501136589/dsh-rewind - License:
MIT - Positioning: DSH session rollback plugin
- Target Scenario: Restoring files by turn in non-git workspaces and continuing the conversation in a forked session
Core Capabilities¶
- Create new sessions via
sessions.fork/sessions.createto continue the conversation after the selected turn. - Use
sha256content-addressed snapshots to restore files in non-git scenarios; supports add, delete, modify, permissions, text, and binary. - Provide a rollback button below user messages; clicking it previews the file changes to be restored.
- Provide the
/rewindcommand, supportingrewind,list-files, anddry-runsubcommands. /rewind listor/rewindlists all rollback-able user messages in the current session.- Forked sessions can continue rolling back parent session messages along the
header.parentSessionlineage chain. - Rollback scope is limited to files touched by the session, providing cross-session isolation.
- Archive the original session by default; can be disabled with
archiveOriginalSession: false.
Installation and Enablement¶
Installation requires dsh and pnpm to be in the PATH.
After entering the plugin repository directory, execute:
dsh plugin --profile web add .
The README also mentions the installation method after npm publishing; since it is not clear whether it has been published, if the package is installable, you can try:
dsh plugin --profile web add @xiaoxin/dsh-rewind
Note: The bundle line needs to be wrapped in - insert: in cordis.patch.yml, otherwise the loader may silently ignore it, causing the button not to appear.
After installation, you need to completely stop and start dsh web, then perform Ctrl+F5 in the browser to force refresh.
Browser Rollback Flow¶
-
Open the session and find the rollback button below the user message.
-
Click the button to preview the file changes to be restored.
-
Upon confirmation, the plugin first restores the files, then creates a new session via
sessions.fork/sessions.create. -
Fill the original text of that user message into the input box of the new session; you can modify and resend it.
-
The original session is archived by default; after archiving, it disappears from the sidebar and search, but the data remains on disk. If you do not want to archive it, you can set:
archiveOriginalSession: false
Command Rollback Flow¶
List rollback-able user messages in the current session:
/rewind list
Or directly execute:
/rewind
Execute rollback:
/rewind <messageSeq|messageId> rewind
Only preview file changes:
/rewind <messageSeq|messageId> list-files
Or:
/rewind <messageSeq|messageId> dry-run
Note: seq is the raw event stream number of the session log; you can get available values via /rewind list.
Rollback Boundaries¶
- Can only rollback to turns after collection started; turns before the plugin was enabled have no snapshots and cannot be rolled back.
- Snapshot boundary is the turn; the first turn has no previous turn
turn/end, sosessions.createis used. - Workspace traversal skips
.git,node_modules, and the ledger directory; fails clearly for very large or total volume. - Cross-session isolation is heuristic; shell changes in the last turn might not be attributed, falling back to the full diff if session events are missing.
- If two sessions modify the same file, the one rolled back later can overwrite the other’s file changes.
Use Cases and Notes¶
Suitable for:
- Using DSH web for multi-turn development, hoping to restart from a specific user message.
- The workspace is not a git repository, or you do not want to rely on git status for file rollback.
- Need to complete preview and rollback using the /rewind command in scripts or non-UI environments.
Notes:
- The plugin runs with the current dsh process permissions; it is recommended to check the source code and MIT license before installing.
- DSH does not have an RPC to delete a single session; after archiving by default, the original session disappears from the sidebar and search, but data remains on disk.
- Cross-session isolation relies on session events and snapshot drift; shared workspaces, shell side effects, and concurrent modifications can affect the rollback scope.
- The community directory page is a separate site, not an official app store; verify the repository and license yourself when selecting a plugin.
Related Links¶
- GitHub: https://github.com/2501136589/dsh-rewind
- Community Directory: https://www.skillhub.cn/plugins/2501136589/dsh-rewind