Introduction¶
Using DSH for daily development, session management is mostly trivial work: old sessions pile up in the sidebar, and deleting one requires scrolling through the list; it is not convenient to peek at the content of an archived session; if a specific turn goes off track, you want to restart from that turn rather than reopening the session and pasting the context again; you want to inject a fixed system prompt across all sessions without modifying the core source code.
The dsh-session-kit introduced below is built around these scenarios. It does not modify the DSH core source code but mounts the entire suite of session page management capabilities—such as deletion, archiving, turn operations, topic navigation, local memory and recall, and runtime prompts and compression configuration—onto DSH via official extension points.
What is it¶
dsh-session-kit is a DeepSeek Harness plugin maintained by ltxlong, current version 1.1.0, License MIT. One-sentence positioning: does not modify the DSH core package, enhances daily management capabilities of DeepSeek Harness session pages via official extension points.
Following DSH’s design philosophy of “everything is a plugin,” adding or removing plugins should not affect the core. dsh-session-kit adheres to this: global prompts and other runtime registrations are released when the plugin is disabled, uninstalled, or not loaded, and DSH returns to the original system prompt and compression configuration.
Installation¶
Install from npm (recommended):
dsh plugin --profile web add dsh-session-kit
Also install from GitHub:
dsh plugin --profile web add github:ltxlong/dsh-session-kit
After installation, enter the session page, and the header will display a “Session Management” button, indicating the plugin is mounted.
Core Features¶
Session Management Menu¶
The menu opened by the “Session Management” button covers the following operations:
- Delete Session: Delete after confirming the session has stopped; running sessions are protected, and whole session deletion is always disabled. Windows/macOS move to the system Recycle Bin/Trash; platforms without Recycle Bin integration delete the session directory directly.
- Rename: Modify the current session title via the official Session API.
- Fork Session: When forking is allowed at the current turn, create a new session from the current session.
- Archive Session: Add the current session to the workspace archive list and hide it from the sidebar.
- Open Directory / Export Session: Open the current session log directory with a system file manager; Export invokes DSH’s Session Log export capabilities.
- Call Statistics: Statistically count tool calls in the current session by tool name, showing total, success, failure, and incomplete counts.
Archive Session Management¶
“Open Archive” in the menu enters the archive management modal. For archived sessions (hidden from the sidebar):
- Search archived sessions by title;
- Preview content directly in the modal without restoring the session; preview shows tool call statistics and supports pagination for loading more messages;
- Fork archived sessions into a new chat to continue;
- Restore archived sessions so they reappear in the session list;
- Open the folder where the archived session is located;
- Confirm and delete. Running archived sessions cannot be deleted.
Turn Deletion and Regeneration¶
The plugin adds two operations next to completed top-level assistant turns and at the end of some failed turns:
- Delete from this turn onwards: Starting from the selected turn, delete the content of the current turn and all subsequent completed turns in the current conversation surface and the subsequent model context; it will not delete the entire Session.
- Regenerate: First delete subsequent content starting from the selected turn, then re-queue the original user question for that turn, allowing the model to answer from that position again.
These are operations that directly modify session state, so the plugin adopts a conservative strategy:
- Deletion: Instead of erasing append-only logs, it appends a persistent replacement tombstone. The tombstone’s provider/model is
dsh-turns-del/tombstone. The collapsed active surface no longer shows the deleted range, and the subsequent model context no longer includes this content, but the original events are still retained in the session log. - Live Session Modification: Before modifying the live session, obtain an Agent maintenance lease and execute
sessions.flush()before returning successfully. - Validation: Each target turn is verified to still correspond to an independent, continuous surface interval; if the turn has been compressed, mixed with retained history, or overlaps with existing deletion ranges, it is directly rejected without guessing.
- Regeneration Conditions: Regeneration is only executed when the Agent is not running, the input queue has no pending content, and the selected turn contains a unique plain-text user question.
Topic Quick Navigation¶
A topic navigation similar to chat.deepseek.com is displayed on the right side of each session page:
- Default: Collapsed into a column of flat line markers; expands into a fixed-size scrollable panel on mouse hover or keyboard focus;
- Titles: User questions are displayed as single-line truncated titles; full titles are only shown via system tooltips;
- Interaction: Automatically highlight the current topic when scrolling the session; click the topic to smoothly jump;
- Responsive: Automatically hides on small screen widths.
Memory Management and Recall¶
The “Memory” button in the sidebar opens the memory management modal, operating on a local SQLite memory database located at <profile>/.dsh-session-kit/memory.sqlite:
- Projects: Memories are grouped by project, with a built-in
defaultproject; support for creating/renaming/deleting projects, and configuring auto-enabled session IDs for projects. - Temporary / Permanent Memory: Temporary memories distilled from each turn of dialogue are not stored in the database by default; confirmed “Store” writes them to the local database; support activating/disabling, editing, moving across projects, and deleting.
- Tags: Predefined tags (user personas, project constraints, module paths, etc.) and custom tags, can be activated/disabled instantly.
- Activation Ratio: A ring chart at the bottom of the left navigation displays the activation ratio of permanent memory in real-time.
- Recall Switch: Automatically distills every dialogue, enables all sessions with
default, and automatically matches projects for dialogue (incremental matching per turn, only notifies newly enabled projects).
Auto recall executes on every user message: uses jieba + CJK bigram tokenization (tokenization depends on @node-rs/jieba), FTS5 BM25 relevance ranking, stacking tag weights and time decay; hits are injected into the model context by turn, weak input rounds inherit memory from the previous round; automatically falls back to substring scanning if FTS is unavailable. Indexes are rebuilt asynchronously in batches in the background stamped by tokenizer version, not blocking startup.
Also provides a memory_search tool for the Agent to proactively retrieve memory, and displays a memory panel next to each message showing the memory actually carried in that round’s context. Injections are persisted as snapshots with session logs; can be viewed after restart (including temporary memory hits); subsequent edits/deletions of memory do not affect the display of historical rounds.
Runtime Global Prompt and Compression Configuration¶
- Global Prompt: Session Management → Global Prompt, opens the “Global Prompt Settings” modal, allows enabling/disabling, editing prompt content, and shows a message upon successful save. The Host registers the prompt into runtime system prompt assembly via
ctx.systemPrompt.section(), without modifying DSH official code or overriding the officialsystem-promptconfiguration. When the plugin is disabled, uninstalled, or not loaded, this runtime registration is released and no longer takes effect. - Compression Configuration: Only overrides the current compression engine at runtime, without writing to official or preset configuration files.
Typical Use Cases¶
Combining these capabilities, several common workflows are as follows:
- Manage piled-up sessions: Click “Session Management” → “Archive Session” in the session page header to hide old sessions from the sidebar; later, when needed, click “Open Archive”, search by title, preview content in the modal, and decide whether to restore, fork into a new chat, or delete.
- Retry after a turn goes off track: Select “Regenerate” next to that turn. The plugin validates that the turn is not compressed, has no mixing with retained history, and contains a unique plain-text user question; upon passing, it deletes subsequent content for that turn and replays the original question.
- Inject fixed prompt: Session Management → Global Prompt, edit content and turn on the switch. The prompt takes effect via runtime registration, does not modify official config files, and becomes invalid when the plugin is disabled.
- Accumulate project memory: Click the “Memory” button in the sidebar to open the memory management modal, maintain temporary/permanent memory and tags; each round of dialogue automatically distills and recalls, and the Agent can also actively retrieve via the
memory_searchtool.
Implementation and File Structure¶
If you want to review source code before installation, you can compare these files in the repository:
lib/index.js: Host routes, global prompt runtime registration, archive/session operations, turn deletion and regeneration logic.lib/client.js: Web UI Slot, global prompt modal, other modals, topic navigation, turn operations, styles, and locale dictionary.lib/memory.js: Local memory database (SQLite), jieba/bigram tokenization recall, distillation and background index rebuild logic.cordis.patch.yml: Plugin bundle insertion patch.
Suitable Scenarios and Precautions¶
Suitable users: Heavy DSH users with many sessions who need archiving and retrieval; people who frequently need to retry from a specific turn; teams or individuals who want to accumulate project memory locally and recall it automatically; people who need to inject global prompts at runtime but don’t want to modify core configuration.
Please note before use:
- The plugin runs with the permissions of the current dsh process and can read/write session logs and local files. It is recommended to review the source code and license (MIT) yourself before installation.
- The memory database is a local SQLite file (
<profile>/.dsh-session-kit/memory.sqlite). Deleting a project or memory is irreversible; uninstalling the plugin does not automatically delete the memory database file. - Entire session deletion is always disabled for running sessions; turn deletion/regeneration adopts a conservative strategy and will directly reject if it encounters compressed or unsafe history.
- Deleted content is simply no longer displayed and no longer enters the subsequent model context; original append-only events are still retained in the session log. Users with requirements for log retention need to be aware of this.
Summary¶
dsh-session-kit puts the trivial tasks of session management—deletion, archiving, turn retry, memory accumulation—into one plugin. It uses official extension points throughout, does not touch DSH core source code, and restores a clean environment after uninstallation. Repository and listing page:
- GitHub: https://github.com/ltxlong/dsh-session-kit
- Community Directory Page: https://www.skillhub.cn/plugins/ltxlong/dsh-session-kit (The community directory is an independent site and has no official affiliation with DeepSeek or Hypothesis)