Prevents concurrent-write session corruption: takes a per-session advisory lock on session start and every step, so a second dsh process fails loudly instead of writing a duplicate-seq gap; dead owners are taken over automatically.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:po-et/dsh-session-guard
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
Stops two DeepSeek Harness processes from corrupting one session log.
中文文档 · Companion: dsh-session-rescue (repairs the damage this plugin prevents)
The most common dsh corruption family is concurrent writing: a dsh web plus a CLI, two instances on different ports, or a desktop shell sharing one $DSH_HOME. Each process keeps its own in-memory seq cursor, the second writer lands events with already-committed seqs, and the session becomes permanently unloadable:
history unavailable for session "…": corrupt session log: seq gap in committed region …
dsh has no cross-process lock today. This plugin adds one — advisory, per-session, with automatic takeover of dead owners — so the conflicting step fails loudly with an actionable message instead of silently destroying your history.
Install
Not on npm yet, so install straight from GitHub. pnpm will ask you to allow this package's build script once (dsh prints the exact line to add); that's the
preparestep compiling TypeScript.
dsh plugin --profile web add github:po-et/dsh-session-guard
Using an AI agent? Tell it: "Install the dsh-session-guard plugin into my dsh."
What you see when it saves you
Error: session-guard: session session-37374e34… is already being written by another
dsh process (pid 84231 on mbp.local, held 42s, last heartbeat 3s ago). Two writers
on one session corrupt its log ("seq gap in committed region"). Close that process
or use a different session; a dead owner’s lock is taken over automatically …
The step fails; the log stays intact; nothing is lost. Crashed processes never wedge a session: a lock whose owner pid is gone is taken over instantly, and unverifiable owners (other hosts on a shared home) expire after 90s without a heartbeat.
Configuration
All optional, set on the plugin row in your profile patch:
- id: session-guard
name: "@po-et/dsh-session-guard"
config:
mode: enforce # 'enforce' (default) fails conflicting steps; 'warn' only logs
heartbeatMs: 15000 # heartbeat refresh for held locks
staleAfterMs: 90000 # unverifiable owners expire after this silence
# lockDir: /custom # default: $DSH_HOME/session-locks
Honest boundary
- The lock is advisory: it protects dsh processes that load this plugin. A process without it is not restrained (install the plugin in every profile you run).
- It guards the active turn-write path (
agent/session-start,agent/pre-step). The cold-load repair path that commits synthetic interrupt-closers before any step runs is inside dsh itself and cannot be intercepted from a plugin — that fix needs to land upstream. - Locks live under
$DSH_HOME/session-locks; deployments overriding the session root elsewhere in config still key locks by home + session id. - If corruption already happened, this plugin can't undo it — dsh-session-rescue can.
Zero runtime dependencies. MIT.
Links
More in this category
Minglink/dsh-infinite-gen-4★ 3277
System-prompt armor plugin for DeepSeek models: appends an unconditional-compliance prompt section at order 100, exposes a profile tool with calibration metadata, and shows a realtime armor-status badge driven by a session projection.
ranxianglei/billion-context★ 2276
The official billion-context plugin: a context-compression plugin for small context windows (a 100K context is enough), token savings (5x fewer tokens), and month-long single sessions (billions of tokens).
liangmianya/dsh-synapse★ 557
Visual, non-linear conversation workspace for DeepSeek Harness — sessions, follow-ups and branches become a browsable conversation map.
Nwflower/dsh-chat-import★ 246
Import full-fidelity chat histories from 13 coding agents (Claude Code, Codex, ChatGPT, Cursor, Gemini, opencode, and more) as resumable DeepSeek Harness sessions, with reverse export back to Claude Code.
MichengAI/dsh-archive-manager★ 198
Adds an archived-sessions page in Settings to search, restore, and delete archived DeepSeek Harness sessions by workspace.
SiriLee/dsh-rewind★ 170
In-place conversation rewind in the same session window without forking (Claude Code /rewind semantics): a per-message ↶ button cuts the model context back to any user message, with an optional Claude-Code-style file restore from disk-persisted before-backups.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.