Introduction¶
Coding on DSH for a long time will eventually max out the context window; when changing sessions or handing a task to someone else, relying solely on chat history often forces the receiver to re-explore directories, branches, and uncommitted changes. A common approach is to attach an independent skill to the agent, using SKILL.md to agree on how to write handover documents—adding a package, adding a set of installation, rules and tool descriptions are prone to conflicting narratives.
HandYourSession (maintained by mafawu, classified as a Workflow in the community) integrates the handover protocol directly into the plugin: one-time installation, no extra skill required. It handles writing handovers, pre-handoff validation, registering switches only after explicit user consent, and creating new sessions based on pending status at the end of a turn. This article introduces its capabilities and usage based on its GitHub README and SkillHub directory page.
What is it¶
HandYourSession is a session handoff plugin. The npm package name and Cordis plugin ID are hand-your-session (naming constraint), display name is HandYourSession. It is positioned as: a protocol-built-in, self-contained session handoff, targeting coding agents running in DSH.
Maintained by mafawu; classified as a workflow plugin on SkillHub.
Why not install a separate skill¶
Instead of writing rules into a separate SKILL.md, the protocol enters the session through three ways:
- Injected once at the first step of the session: A 6-part structure, 3-state determination, handover and pickup steps;
- Written into tool descriptions: When the model selects a tool, it sees the key points of the corresponding section;
- Can retrieve the full text anytime: Calling
handoff_guidereturns the complete protocol.
This keeps handoff steps and tool capabilities from drifting (having “documentation one set, plugin another”).
Core Tools¶
| Tool | Purpose |
|---|---|
handoff_guide |
Returns the full protocol |
handoff_write |
Write handover: collect git context, assemble header, save to disk, run check, return error if not passed |
handoff_pickup |
Read latest handover: file, task, drift, check, body, first message |
handoff_switch |
Register switch (requested) or cancel (declined); does not switch immediately |
handoff_status |
Diagnose: current config, pending, latest handover, recent switch logs |
Implementation-wise, lib/index.js provides the above 5 tools and 2 hooks; lib/protocol.js stores the protocol body; lib/store.js handles git context, handover files, pending, and drift; scripts/handoff.mjs provides the CLI: write / check / list / resume.
Workflow: Ask first, then write¶
The plugin only runs the full process when the user explicitly requests a handover, switching sessions, or handing it to someone else; it does not write files, call tools, or actively ask “do you want to hand over” without explicit request. Context overflow is not a reason to trigger a handover.
User explicitly requests handover / switch sessions / hand to someone else
↓
① Ask once (3 choices) ← Asking is at the front, answers decide how detailed the writing is
Handover now and start new session / Generate only / No handover
↓
② Run git status commands → ③ Split changes → ④ handoff_write → check
↓
⑤ Only call handoff_switch if user selects "Handover now", write pending.json
↓
Turn ends ──→ Plugin reads pending → Create new session → Deliver first message → Mark switch: done
“Generate only” can be written briefly; “Handover now and start new session” must ensure a stranger can start work independently.
Configuration¶
When enabling the plugin in the profile, the following fields can be configured (consistent with README):
- id: hand-your-session
name: hand-your-session
config:
autoRemind: true # Inject protocol + handover reminder at first step of session
injectProtocol: true # Turn off to keep only the handover reminder
switchOnPending: true # Switch when pending is found at turn end; false only registers without switching
dirName: .handoff
switchOnPending is enabled by default: pending is only written if the user selects “Handover now and start new session” and the model calls handoff_switch. Finding pending at the end of the turn is considered as the user having agreed to switch. To completely turn off auto-switch, set it to false (old autoSwitch: false is still compatible).
Handover and switch-related files default to the .handoff directory under the workspace (renamable via dirName).
Installation and Update¶
The installation method given in the README is to build the npm package first, then install that tgz via the DSH plugin manager; do not simply concatenate dsh plugin add github:owner/repo based on the repository name.
npm pack # Generate hand-your-session-x.y.z.tgz
# Install that tgz via DSH plugin manager
The package.json version in the documentation is 0.1.2. The profile’s dependency should point to the specific tgz file; do not delete this dependency, otherwise pnpm install will fail next time.
The plugin runs in environments such as @deepseek-ai/cordis and @deepseek-ai/dsh-agent (peer dependencies); please check the repository source code and LICENSE yourself before installing to confirm it meets your security and licensing requirements—the plugin accesses the workspace and git context with the permissions of the current DSH process.
Typical Usage (Reproducible Steps)¶
Summarized below according to the README workflow for easy reproduction on a real device.
- After the user explicitly requests a handover or switch, the agent first confirms intent with a choice of three.
- After running git status commands and splitting changes in the repository, call
handoff_writeto generate the handover file and pass the check. - If the user selects “Handover now and start new session”, call
handoff_switchto registerrequested(write topending.json); do not switch sessions immediately. - At the end of the current turn, if
switchOnPendingis true and there is a pending, the plugin creates a new session, delivers the first message, and marksswitch: donein the handover. - The new session side can call
handoff_pickupto read the latest handover; usehandoff_guideto verify the full protocol; usehandoff_statusto troubleshoot issues.
The CLI can also be used locally (consistent with scripts/handoff.mjs): write, check, list, resume.
How to check when switching fails¶
The plugin writes steps to .handoff/.switch.log (time + event), and failure is not silent. handoff_status can view the tail of the same log.
| Log Phenomenon | Meaning |
|---|---|
No Start switching |
No pending, or cwd cannot be read at turn end |
Switch failed: ... |
All forms of agents.create failed, logs will write reasons one by one |
Handover failed check |
The handover file has hard errors, need to fix the file first |
The “Known Unresolved” section in the README explains that agents.create tries multiple forms for the cwd parameter sequentially; the client will not automatically jump to the new session, manual GUI focus is still required; the turn/end payload form is compatible, actual branch can be seen in real device logs.
Testing¶
The maintainer runs 8 groups of assertions in the repository (tool list, write/read, inject, pending switch, check, declined, etc.):
npm test # node test/setup.mjs && node test/mock.mjs
Suitable Scenarios and Notes¶
Suitable for: Multi-person or multi-session relay of the same repository; DSH workflows that require structured handovers (including git context and checks); teams that want the protocol and tools integrated and do not want to maintain a separate skill anymore.
Notes:
- Do not expect the plugin to automatically generate a handover without explicit user instruction.
- Auto-starting a new session depends on
handoff_switch+switchOnPendingand the turn end hook; environmental differences may causeagents.createto fail, rely on.switch.log. - SkillHub is a community plugin directory and has no official affiliation with DeepSeek / Horizon Quantum Computing; stars and popularity are based on real-time data from each site.
Conclusion¶
HandYourSession puts the session handover protocol into a single DSH plugin: five tools cover writing, reading, registering switches, and diagnostics, defaulting to saving to .handoff and handling pending at turn boundaries. If you are doing coding agents with long sessions, you can first understand the classification and introduction from the directory page, then go to GitHub to view the README and cordis.patch.yml to complete the installation.
- Directory page: SkillHub — mafawu/HandYourSession
- Source code and documentation: github.com/mafawu/HandYourSession