DEV Community

rebornace
rebornace

Posted on

DSH Agent Enhancer: bringing write, edit & rollback to the DeepSeek Harness desktop

An MIT-licensed plugin for the DeepSeek Harness (DSH) desktop client that makes the official chat input area better at writing, editing and rolling back: prompt history · one-click prompt optimization · next-prompt prediction · conversation & file rollback — all embedded in the official UI, no extra windows. It borrows the interaction habits of mainstream agents (Claude Code / ChatGPT / Cursor) rather than re-implementing a whole product.

GitHub — rebornace/dsh-agent-enhancer | npm — dsh-agent-enhancer (v0.2.0, "Agent Enhance") | MIT, listed on awesome-dsh-plugin

Note: since v0.2.0 the package was renamed from dsh-composer-enhancer to dsh-agent-enhancer; if you still have the old package installed, uninstall it before installing the new one.

Why

If you've used Claude Code, ChatGPT or Cursor, you're probably used to: recalling a prompt you already sent and sending an edited version; turning a vague draft into something concrete and actionable with one click; the editor predicting your next question after a reply; and going back to an earlier state when the conversation — or the code — goes wrong.

The official DeepSeek Harness desktop client's early input area had none of this: sent prompts were hard to retrieve, drafts were hand-typed, a wrong turn meant opening a new session, and broken files could only be rescued with Git or manual backups.

dsh-agent-enhancer takes a deliberately narrow approach:

  • No fork, no patching the DSH core, no waiting for upstream PRs — it uses the official plugin mechanism (Cordis + Typert RPC);
  • It fills the write / edit / rollback gap inside the official desktop UI.
Workflow Pain point Feature
Recall Sent prompts are gone forever Prompt history (↑↓ + Alt+R)
Draft Vague drafts are hard to execute Prompt optimization (one-click rewrite, undoable)
Reply You don't know what to ask next Next-prompt prediction (gray text, Tab to accept)
Mistakes Wrong turns can't be undone Conversation & file rollback (checkpoints + undo restore)

Feature highlights

All four features live in the official session input area and message stream — no extra window. They are enabled by default, the UI language follows the desktop (zh / en), and each one can be toggled independently in Settings → Built-in plugins → Agent Enhance.

1. Prompt history — like a shell

  • ↑ on the first line / ↓ on the last line cycles through the prompts you already sent in the current session; Esc exits. Alt+R opens history search (Ctrl+R is kept where available), and Enter only fills the draft — it does not send.
  • Scoped to the currently loaded session; drafts containing chips (reference blocks) are not accidentally triggered.

2. Prompt optimization — completes vague drafts, keeps clear ones minimal

  • Click Optimize on the right of the input area; with a selection, only the selection is optimized; Undo is available if you don't like it.
  • Vague or too-short drafts get execution steps, scope, constraints and structured-output requirements; drafts that are already clear receive only minimal edits.
  • Chips/references and their order are preserved through __DSH_REF_n__ placeholders — undo also restores the reference structure.
  • You can assign a cheaper model to optimization via the model pill.

3. Next-prompt prediction

  • After a reply, a gray suggestion appears; Tab fills the draft (no auto-send). At most one per turn; it clears as soon as you start typing or switch sessions.
  • The system prompt constrains it to predicting only the next user prompt — it never generates an assistant reply.

4. Conversation & file rollback — preview, then undoable

This is the heaviest feature, an attempt to align with Claude Code's /rewind and Cursor checkpoints:

  • A checkpoint (conversation + tracked-file snapshot) is written locally at the end of every turn;
  • Restore to here next to a message opens a preview (what will be rolled back, affected files, conflicts) — nothing changes before confirmation. Scope is conversation only or conversation + tracked files; the target turn's user prompt is restored into the editable draft, not auto-sent;
  • Undo restore (input + or / menu) reverts the latest restore;
  • Explicit boundaries: processes, terminals, untracked files, databases and network requests are not restored; the preview lists these gaps — it does not claim to be a "full checkpoint".

Model pill & cost. Optimize and Predict each have a model pill — "Follow session" by default, or pick a provider / model / reasoning level. The plugin itself is MIT (free); what you save is model API cost: route the frequent auxiliary calls to a lightweight model while the main conversation keeps using your flagship model.


When it pays off

  • Long sessions: 30 turns in, you need the key prompt from turn 8 — Alt+R to search, Enter to fill, edit, resend.
  • Vague drafts: you know what you want but can't structure it — click Optimize for steps and constraints; Undo if needed; chips survive intact.
  • Wrong turns: the agent changed several files in the wrong direction — Restore to here after previewing; undo restore if it was a mistake.
  • Cost control: route optimize/predict to a lightweight model, keep the flagship model for the main conversation.

In one line: the official input area goes from "a box that sends messages" to a workbench — write (history + prediction), edit (optimization + undo), rollback (checkpoints + undo restore) — all local, all inside the official UI, without touching DSH's append-only session log.


How it works under the hood

dsh-agent-enhancer-architecture

  • Plugin shape: @deepseek-ai/cordis plugin system; dsh.bundle.patch injects the session UI bundle; slots add buttons, overlays and message nodes; plugin ID agent-enhancer.
  • Two sides: src/host/ handles models, RPC and checkpoints; src/client/ handles UI and the Coordinator state machine (edit / history / search / predict / optimize); requests carry an owner guard.
  • Model routing: resolves the session model choice; optimize maxTokens=1200, predict 120; streamed output is validated by BlockAssembler before being written back.
  • Checkpoints: committed at the end of each turn; phases preparing → session-flushed → workspace-captured → committed; ≤20 per session, ≤2 MiB per file (plain text); excludes .git, node_modules, .env / .env.*, build dirs, binaries, symlinks and paths outside the workspace; carries a schemaVersion — incompatible formats refuse restore; legacy path is auto-migrated since v0.2.0.
  • Transactional rollback: a safety snapshot before restoring; files first, journal compensation on failure, no appended conversation events; pending journals are processed on the next startup; conflict detection — if a file hash differs from the checkpoint's afterHash, the whole restore is refused rather than silently overwriting.
  • Privacy: history never calls a model; optimization sends only "draft/selection + latest turn"; prediction sends only the latest turn; cache is per-session memory; audit events (plugin:agent-enhancer/request) are local only — no telemetry upload.
  • Quality: ~30 Vitest files cover checkpoints, rollback transactions, RPC, structured references, components and locale.

Quick start

Stop all Desktop windows and tray processes before install / upgrade / uninstall. The plugin targets the Desktop / desktop profile — don't install into the web profile (the command may report success while the desktop shows nothing).

  1. In-app (recommended): DSH desktop → Settings → Plugins, search dsh-agent-enhancer or "Agent Enhance", install, fully quit and restart Desktop.
  2. dsh-market (optional): if you want a standalone marketplace UI / one-click upgrades, first install the community market dsh-market (Settings → Plugins → search dshmarket), then install the plugin from the Plugins Marketplace tab.
  3. CLI: dsh plugin --profile desktop add dsh-agent-enhancer@0.2.0 (version optional).
  4. Local dev:
corepack pnpm install --frozen-lockfile
corepack pnpm build
dsh plugin --profile desktop add ((Resolve-Path .).Path)
Enter fullscreen mode Exit fullscreen mode

Compatibility: DSH >=0.2.1-rc.5 <0.3.0-0 (0.2.1-rc.3 won't load); Node ^22.19.0 || >=24.0.0. If you previously installed dsh-composer-enhancer, uninstall it first.


Wrap-up

DeepSeek Harness is already capable on the model side; dsh-agent-enhancer adds the interaction mindset on the session side — write, edit and rollback embedded in the desktop through the official plugin mechanism. MIT, no telemetry, local-first. Try it, and issues / PRs are welcome.

Top comments (0)