DeepSeek Harness Plugin

SiriLee/dsh-rewind

Stars ★ 106 Downloads (30d) 21,453 Category Sessions & Messages Added 2026-08-18 npm dsh-rewind-plugin

In-place conversation rewind in the same session window without forking (Claude Code /rewind semantics): a per-message ↶ button cuts the model context back to any user message, with an optional Claude-Code-style file restore from disk-persisted before-backups.

Install

# from npm (prebuilt)

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

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:SiriLee/dsh-rewind

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

Conversation rewind for DeepSeek Harness: rewind the conversation to any earlier user message in one click, in the same window — no new branch, no window switch, with optional workspace-file restore (full Claude Code /rewind semantics).

English | 中文

A deliberately focused plugin with one job: rewind to any user message, no matter how far back, in place — and conveniently restore the files it changed along the way.

  • In-place rewind, no new session — the target message and everything after it (replies, tool calls) are withdrawn from the model context and the rendered transcript, and the target's text is filled back into the composer for editing and re-sending. It all happens inside the original session: no new branch, no leftover copy.
  • Conversation and code rewind together — Claude Code-aligned behavior: files edited by the write tools are tracked and restored by the same rewind, and external changes to already-tracked files are restorable too. Partial tracking, before-write backup, store only on change, with no git dependency.
  • Safety guarantees — the session log only ever appends rewind markers and is never deleted or rewritten; file backup and restore are hardened; tests are comprehensive, and maintenance continues across DSH upgrades. Security model: SECURITY.md.

Preview

Every user message carries a ↶ rewind button in its action row. Clicking it opens a mode-selection popover — "rewind conversation only" or "rewind conversation and code", the latter showing the file-change list for confirmation first. You can also pick and rewind conveniently via the /rewind and /undo commands.

Install

Check your local DSH version, then find the matching plugin version in Releases.

Command line:

dsh plugin --profile <name> add dsh-rewind-plugin@<version>

Graphical interface: the Plugins page in the sidebar → Add plugin → enter dsh-rewind-plugin@<version> → install → restart DSH and refresh the browser.

The screenshot is an example only — use the version that matches your DSH version.

Updating: the command line overwrites the installed version directly; the graphical interface rejects a re-install, so uninstall the old version first, then install the new one.

[!WARNING] The npm name dsh-rewind belongs to another author's package — install with dsh-rewind-plugin.

Usage

  1. Find the user message you want to rewind to in the conversation, or type /rewind (or its alias /undo) to open the candidate picker.
  2. Select it. A small popover offers the two modes — "conversation only" or "conversation and code".
  3. The rewind takes effect immediately: the conversation returns to how it looked at the target message, and the target message's text is filled back into the composer — edit and re-send.

Keyboard: both the candidate picker and the mode popover support ↑↓ to move, Enter to confirm, Esc to cancel/back.

  • Rewinds can be repeated — with no limit on stage or count.
  • A rewind itself cannot be undone, but the withdrawn content stays in the session log.
  • Interruptions rewind too — a steering message the model hasn't read yet is also a valid rewind target, and withdrawing it does not interrupt the current run.
  • Rewinding a read message interrupts the running turn — to ensure the rewind runs safely.

Snapshot management

Snapshots (the before-write backups) are stored under <dsh home>/rewind-snapshots/ (the default is ~/.dsh/rewind-snapshots/). For the same session, the plugin deduplicates snapshots by content and keeps the newest 100 anchor groups. Deleting that directory manually only clears the file backups (chat rewinds are unaffected) and the plugin rebuilds them automatically.

A global auto-cleanup (off by default) removes the snapshot directories of long-inactive sessions, leaving the active session and chat log untouched. Configure and review it on the Plugins page, in this plugin's configuration card (the auto-cleanup switch and the idle-day cutoff), or use the /snapshot-auto-cleanup command to view, configure, and run it. See: Snapshot cleanup.

Uninstall

# Uninstall the plugin
dsh plugin --profile <name> remove dsh-rewind-plugin

# To also delete local data
rm -rf <dsh home>/rewind-snapshots
rm <dsh home>/snapshot-cleanup-last-sweep.json

The plugin's auto-cleanup settings live in the current Profile's plugin configuration. To remove them completely, delete this plugin entry's configuration.

Why it stands out

Compared with the common approaches, here is the trade-off this plugin makes on "rewind":

Dimension Common approach This plugin
Conversation rewind Fork / branch a new conversation In-place rewind — no new session, no window switch
File restore No restore feature / git-managed or whole-tree snapshot Lightweight before-backups — auto-captured before writes, one-click restore
Dependencies Often needs a Git repo or a full snapshot engine None — no git required, works on any directory
Storage footprint Whole-tree snapshots take space Lightweight — nothing is stored unless it changed, and only files touched by write tools are tracked

How it works

The whole design rests on two principles, simple but deliberate: the conversation half "masks, never deletes", using DSH's native "hide + replace" mechanism; the file half "partial tracking, lightweight before-write backup", following Claude Code's checkpoint semantics.

1. Conversation rewind: a single "mask", not a delete

append-only is a hard rule: the session log only grows and is never rewritten — the foundation of auditability and privacy. A rewind never touches history; it makes a single move: append one "empty message" marker to the end of the log and use it to "mask + replace" everything after the target message, so the model and the UI see only the part before it.

  • One and the same log — the append happens only in the current session's log: no new session, no new branch, so no residue or copy is left behind;
  • The marker is canonical — the same "hide + replace" as the official /compact: /compact compresses a span of history into a summary, while /rewind swaps in an "empty message" marker. Because it is canonical, DSH's log replay, compaction, and resume preflight all recognize it and never mistake it for a real message;
  • The replacement is imperceptible — the model ignores the marker, with no effect (verified empirically). Together with the plugin's UI handling, what you and the model see is exactly how the conversation looked at the target;
  • Content is preserved — because this is "masking, not deleting", the withdrawn content stays in the log — auditable, traceable, and in principle manually recoverable.

Design highlight: the entire conversation rewind is a single append. It's deterministic, auditable, and — because the log was never broken — a "clean" time-travel. Minimal action, complete semantics. The compatibility subtleties with DSH (replicating /compact, the empty-message mask) are where this plugin is genuinely professional.

2. File restore: lightweight checkpointing, "before-write backup"

The file half follows Claude Code's checkpoint semantics — partial tracking + before-write backup, plus a re-scan of tracked files at each message, not a whole-tree snapshot. This trade-off saves space, and it's actually more complete:

  • Before-write backup: tracks only the write-class tools (write, edit) — backs up the original content before a write and records/tracks the files it touches; it never backs up the whole workspace, so it's lightweight; a single file that is too large is not backed up.
  • External changes count too: at every user-message boundary the plugin re-checks all tracked files — external changes such as a command run or a manual edit are recorded as well and restored by a later rewind. "Lightweight" but not "incomplete".
  • Unchanged-not-recorded: an entry is written only when something changed — at the message-boundary re-check, an unchanged file is never backed up (no record); at before-write time, when the new content matches the path's prior record, only a link to it (ref) is stored instead of a copy.
  • Accurate restore: backups are the sole standard, checked against the real disk — only files that actually differ are touched. Backups are stored byte for byte, so the restored result matches the backups exactly, with no "ghost impact". There is a limit, though: File-rewind tracking boundary.
  • Safety and integrity: paths are sanitized so nothing ever escapes the backup root; symlinks / hard links are skipped so one restore can't clobber another name of the same file; a per-file failure never aborts the pass; backups and the restore journal are written atomically and kept across restarts, so a half-applied restore after a crash can be continued or rolled back.

Design highlight: this checkpoint's light footprint comes from recording only what was actually touched and really changed — before-write backup makes it restorable, unchanged-not-recorded and content-as-link drop the repetition; only the files that differ are touched at restore time.

What it deliberately does NOT do

This plugin deliberately stays lightweight and focused on one thing — "conversation rewind". The following are out of its scope:

  • Whole-tree / Git-level snapshots — only write-class tool edits plus external changes to already-tracked files are backed up; files never touched by a tool are not restored. For a worktree-level full snapshot rollback, use a more specialized snapshot tool (git).
  • Subagent edits — not tracked, and no rewind inside a subagent session (same as Claude Code): a subagent runs its own session, so its backups could never be restored by a rewind of the parent session, and none are kept for one.
  • Fork / branch rewind — DSH already provides this ("branch in new chat"); no need to reinvent the wheel.

Compatibility

  • Node.js ^22.19.0 || >=24.0.0.
  • Compatibility definition, verification method, and version alignment: see docs/compat/audit.md; supported DSH versions are declared by package.json peerDependencies.

[!WARNING] This project and DeepSeek Harness are both in developer preview. Pin exact versions in reproducible environments and review the behavior notes above.

Client contract

Third-party DOM plugins that need to know which transcript rows a rewind withdrew should consume the stable, locale-independent helpers exported from dsh-rewind-plugin/client — never parse outcome.text. The data-dsh-rewind-hidden attribute marks withdrawn rows (observational only). Details: docs/contract/client-contract.md.

Known issues

  1. Exported logs are complete — a rewind only removes messages from the model context and the view; the exported session log (/export) still contains withdrawn messages. This plugin cannot alter exports.
  2. Lightweight file rewind has a cost — in specific cases not all changes can be rewound. Consistent with Claude Code. See: File-rewind tracking boundary.
  3. The turn-rail shows rewound turns — the right-side rail added in DSH v0.1.2 keeps ticks for withdrawn messages, and hovering shows the withdrawn text. Only a display difference; no functional impact.
  4. Old rewind markers are no longer compatible — DSH v0.1.3 rejects the rewind markers from the old plugin (≤ 0.8.0). Later versions resolve this and provide an in-session update. See the update guide.

[!NOTE] Browser diagnostics are available; see Browser diagnostics.

Security

This plugin only appends rewind-marker events to the session log; it never deletes or rewrites logged history. Workspace files are written only when you choose "conversation and code"; backups are stored under <dsh home>/rewind-snapshots/; restores draw only from those backups. It never touches your git repository, makes no network requests, and accesses no credentials. For sessions you've left inactive for a long time, a global auto-cleanup (off by default) can remove their snapshot directory in whole, leaving the active session and the chat log untouched. Full security model: SECURITY.md.

Development

npm install            # devDeps from the npm registry
npm run check          # one-shot full gate: typecheck + test + build + verify:host + pack --dry-run
npm run typecheck      # tsc on all three surfaces (host + client + client-test)
npm test               # vitest: all unit and compatibility suites
npm run build          # esbuild: lib/index.js (host ESM) + lib/client.js (loader closure) + .d.ts
node scripts/verify-host.mjs   # end-to-end verification of the built artifact

prepare runs the full build, so git installs and npm pack / npm publish always produce a complete lib/ and the LICENSE.

Maintainers: the module map and harness interface reference live in docs/harness-reference.md.

Contributing guide: CONTRIBUTING.md.

Release

Releases go out through GitHub Actions Trusted Publishing (OIDC, no stored NPM_TOKEN): push a v<version> tag and CI publishes with Sigstore provenance.

npm version patch && git push origin <branch> --tags

One-time npm-side setup and the full workflow details: docs/release/release.md.

License

MIT

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.