Preface

DeepSeek Harness (DSH) adopts a plugin architecture, but in terms of session management and message history, existing functionality often remains at a basic level. For example, quickly retrieving the last sent message or permanently deleting unnecessary session records from the list on the left side of the workspace usually requires extra operations or relies on incomplete archiving mechanisms.

heeweelee/dsh-session-plugin is designed to solve these two specific pain points: backfilling historical messages into the input box via keyboard shortcuts, and providing file-level permanent session deletion through the right-click menu. The plugin is maintained by Heeweelee and is open source under the MIT license. It is suitable for developers who need to persistently store session data locally and perform fine-grained management.

Core Features

Input Box History Backfill

The plugin listens for keyboard events when the input box is focused and supports quickly backfilling and switching among sent messages.

  1. Basic backfill: When the input box is focused, press ↑ to backfill the last message you sent. Continue pressing ↑/↓ to move up and down through the history.
  2. Draft handling: If there is a draft in the input box, pressing ↑ first saves the draft temporarily and then backfills the previous historical message; pressing ↓ all the way to the end restores the draft content from before backfilling (if no draft exists, the input box is cleared).
  3. History list and search: Next to the “↑ History N” button in the session title bar, click ▾ to open a searchable history list. Click an entry to backfill it; click the × on the right side of the entry to hide it (this only hides the backfill prompt and does not change the session record).

Right-Click Permanent Deletion of Sessions

DSH usually provides only an archive (hide) interface, while this plugin provides file-level deletion capability.

  1. Trigger method: In the session list on the left side of the workspace, right-click a session and select “Delete this session…”.
  2. Execution logic: After a second confirmation, the plugin permanently deletes the local log file for that session (session.jsonl or session.jsonl.zstd, along with its empty parent directory), and removes that row from the workspace list (starting from version 0.1.9, no clickable ghost row is left).
  3. State check: If the session is currently generating (agent.status === 'running') or has unfinished background tasks, the deletion operation is rejected (returns a 409 error). At this point, there is no need to switch sessions; wait for the current task to complete and then try deleting again.
  4. Notes: Deletion is permanent and unrecoverable. If the session currently being viewed is the one being deleted, be sure to switch to another session after confirming the deletion. Otherwise, continuing to send messages will recreate the session record.

Installation and Enablement

Install the specified version using the official CLI:

dsh plugin add @heeweelee/dsh-session-plugin@0.1.11

Or search for and install it in the Settings > Plugins marketplace of DSH Desktop. After installation, you must restart DSH to enable the plugin.

Configuration

The plugin supports adjusting its behavior through a configuration file. Create the dsh-session-plugin.json file in the DSH home directory (default ~/.dsh):

{ "historyLimit": 100, "maxCharsPerEntry": 4000, "disableDiskCache": false }

Configuration options:

  • historyLimit (default 100, maximum 10000): Keep the most recent N user messages per session. A DSH restart is required for changes to take effect. Increasing the value will treat old caches as outdated and automatically reread them to fill the window.
  • maxCharsPerEntry (default 4000, maximum 20000): The maximum length for the text backfilled per entry, preventing oversized pastes from exhausting memory or disk. Text exceeding the limit will have “… (truncated)” appended at the end.
  • disableDiskCache (default false): When set to true, no disk cache is written (only a 1-second in-memory TTL), suitable for machines where you do not want plaintext data to be written to disk. After enabling it, old cache files are automatically deleted at startup.

Technical Implementation and Security

API Endpoints

The plugin provides three same-origin, unauthenticated in-process endpoints via the Host:

  • GET /api/dsh-session-plugin/history?sessionId=: Read-only retrieval of user message text history for the specified session.
  • GET /api/dsh-session-plugin/sessions: Read-only retrieval of the session list ({id, title}).
  • POST /api/dsh-session-plugin/delete: Permanently delete local session records (unrecoverable).

Security and Permissions

  • CSRF protection: The delete endpoint requires the request to include the custom header x-dsh-csrf: 1, and the Origin must be either empty or same-origin with the local machine. This prevents simple POST requests from cross-site pages from causing accidental deletion.
  • File validation: Before deletion, file paths are strictly validated. Only files matching the expected session artifact format (session.jsonl or session.jsonl.zstd) are allowed to be deleted, preventing accidental deletion of system files.
  • Local permissions: The plugin runs with local user permissions and has no runtime npm dependencies.

Dependencies and Environment

  • DSH version: Requires DSH runtime >=0.1.0-rc.7.
  • Node version: Requires Node.js version ^22.19.0 || >=24 (consistent with the DSH Desktop built-in runtime).
  • Compatibility: The plugin supports the Lexical editor format introduced in DSH 2.0.4 as well as the legacy <textarea> format. The input box backfill feature works in both formats.

Conclusion

By providing fine-grained input history management and file-level session deletion, heeweelee/dsh-session-plugin enhances DSH’s ability to control local data. For developers who frequently need to clean up historical records or who require strict management of local session logs, this plugin is a practical tool.

  • Plugin directory page: https://www.skillhub.cn/plugins/Heeweelee/dsh-session-plugin
  • GitHub repository: https://github.com/Heeweelee/dsh-session-plugin