Preface¶
When working on long tasks in DSH, a common practice is to switch to a new session window to continue. If you want to carry context over, you can @ reference the previous session: with a million-token context window, the single-source limit is roughly on the order of 200K tokens, at the cost of consuming a large amount of history in one go. Another approach is to have the model write a handoff summary when wrapping up, which requires one extra generation every time you switch windows. dsh-session-continuity (maintainer ymck-x) takes a different path: it injects a very small continuation pointer at the first model step of the new session, without calling the model and without any extra generation; when there is no workspace handoff document, it prefers to reuse DSH’s existing compaction summary (compaction/summary), changing “carry the full text around” to “pointer + on-demand read”.
What This Is¶
Plugin package name dsh-session-continuity, categorized as memory, current npm version 0.3.2, MIT license. It solves the problem of how to know, at low cost, “who was the previous session and what should be read” when starting a new conversation in the same workspace. The pointer begins with “ignore if irrelevant to the current request” — semantically it is background, not the current task. The default language is language: auto, which follows the current user message (if CJK characters are present, a Chinese pointer is used).
Directory page: skillhub.cn/plugins/ymck-x/dsh-session-continuity
Source code and documentation: github.com/ymck-x/dsh-session-continuity
Core Features¶
Injection Timing and Failure Strategy¶
Injected only once at this session’s turn 1 / step 1; sessions resumed with --continue will not be injected. On any failure (session query unavailable, file cannot be read, title cannot be read), no injection occurs — the request passes through as-is, without affecting normal conversation. The injected message carries the source kind: 'session-continuity', which can be identified in session records.
Three Tiers of Materials (by Priority)¶
When there are no other sessions in the workspace, nothing is injected. When a previous session exists, take the first available tier of materials in order:
- Workspace handoff document: take the first existing file among the paths configured in
handoffPaths(default includes.dsh/handoff.md,HANDOFF.md, etc.). When a document exists, the pointer only points to the path and metadata — measured at roughly 55 tokens (about 220 bytes). - Previous session’s compaction summary: when there is no handoff document, pick sections from DSH’s generated summary by importance (
Current Work→Next Step→Pending Jobs→Primary Request and Intent→Critical Context), constrained by thesummaryBytesbudget; the README measures roughly 250 tokens (about 900 bytes). - Last two messages: when there is not even a summary, include one closing message each from the user and the assistant (constrained by
tailBytes), and prompt the user to use@to reference when full history is needed.
If you only want a pure pointer without summary or ending, set summaryBytes: 0 and tailBytes: 0.
How the “Previous Session” Is Selected¶
Get the list from sessionQuery.listSessions(): prefer the session with the same working directory that comes first; if none in the same directory, fall back to the globally most recent. Sub-agent sessions (headers carrying parentSession) are not counted as the previous session, to avoid the pointer pointing to a tool call.
Comparison with @ Reference and Freshly Written Summaries¶
Comparison from the README (with a million-token window, the @ single-source limit is about 800K bytes ≈ 200K tokens; this plugin is about 55 tokens with a handoff document, about 250 tokens when reusing the summary, with zero generation):
| Approach | New session one-time consumption |
|---|---|
@ reference the previous session |
Limit about 200K tokens |
| Call the model to write a handoff summary | About 1k–2k tokens, incurred every time at wrap-up |
| This plugin (with handoff document) | About 55 tokens, once |
| This plugin (reusing compaction summary) | About 250 tokens, once, zero generation |
After being injected once, the pointer remains in history, and subsequent turns can hit the prefix cache; the model can read the handoff document itself when it needs details.
Installation and Enablement¶
The plugin runs with the current DSH process’s permissions; please review the source code and the MIT license yourself before installing. After installation, run dsh --profile <profile> --dump-config to confirm the bundle has contributed its configuration layer, then start; if DSH was already running before installation, a restart is required for the new bundle to load.
Install from npm (Recommended)¶
dsh plugin --profile <profile> add dsh-session-continuity
Version-locking example:
dsh plugin --profile <profile> add dsh-session-continuity@0.3.2
Install from GitHub¶
Pinned tag:
dsh plugin --profile <profile> add https://github.com/ymck-x/dsh-session-continuity/archive/refs/tags/v0.3.2.tar.gz
Remove¶
dsh plugin --profile <profile> remove dsh-session-continuity
Desktop / Web can also install the bundle from the sidebar Plugins page, or have the Agent call plugin_manager’s install_bundle with target set to the absolute path of this directory; after installation, open a new session to verify whether the first step carries the pointer.
Configuration¶
Override the plugin config in the profile’s cordis.patch.yml, for example:
- id: session-continuity
name: dsh-session-continuity
config:
enabled: true
language: zh
handoffPaths: ['.dsh/handoff.md', 'HANDOFF.md']
maxTitleChars: 48
| Field | Default | Meaning |
|---|---|---|
enabled |
true |
When false, stop injection; no need to uninstall |
language |
auto |
Follow the user message, or hardcode en / zh |
handoffPaths |
See the README default list | Relative to the working directory; takes the first existing path |
maxTitleChars |
48 |
Truncate if the title is too long |
summaryBytes |
1500 |
Maximum bytes for reusing the compaction summary; 0 means not to use it |
tailBytes |
500 |
Byte budget for the last two messages; 0 means not to use it |
Typical Usage and Companion Setup¶
Among the three tiers of materials, only the handoff document requires human maintenance; the compaction summary and the last two messages are handled automatically by the plugin.
- Convention in the project’s
AGENTS.md: at wrap-up, write progress, next steps, and unresolved issues into.dsh/handoff.md(add it to.gitignoreif you don’t want it in the repo). - Or use the
/handoffskill but change the destination to the workspace — DSH’s built-inhandoffdefaults to writing in the system temp directory, which this plugin cannot find; you need to modify the skill or copy one to write into.dsh/handoff.md. - You can pick up the conversation even without writing a handoff document (via the summary or the last two messages); with a document, the pointer is more accurate and saves more tokens.
With a handoff document, the pointer form under Chinese queries is similar (README example):
(背景,与当前请求无关就忽略)这个工作区里,你上一个会话是「给 DSH 写一个会话接续插件」(2026-10-13,id 1f759b89)。如果确实接着它做,动手前先读 HANDOFF.md(2026-10-14)。
Applicable Scenarios and Notes¶
Suitable for: DSH users who frequently open new windows in the same workspace, want the model to know “the previous session title + which handoff to read or the key points of the summary”, and do not want to @ the entire history each time or have the model rewrite summaries.
Notes:
- The model cannot
@reference a session on behalf of the user; without a handoff document, the pointer can only remind the user to reference it. - The “previous session” is sorted by creation time, not by last activity time.
- When there is no handoff document and the session is very short, the pointer may only contain the title and time, with limited value.
- Known uncovered cases: multiple profiles running in parallel, workspace file visibility under restricted sandboxes, etc.
Logic tests: node test/run.mjs (the README records 30 passing). The repository currently has 1 star on GitHub.
Conclusion¶
dsh-session-continuity turns window-switch continuation into a one-time minimal injection: about 55 tokens of pointer when HANDOFF.md exists, or a zero-cost carry of DSH’s compaction summary when it does not, without calling the model throughout. For installation commands, configuration fields, and behavior details, refer to the README.
- Community directory: https://www.skillhub.cn/plugins/ymck-x/dsh-session-continuity
- GitHub: https://github.com/ymck-x/dsh-session-continuity