AI Agent Hub
Back to plugins
🧩

dsh-session-guard

admin-security Updated 2026.09.05

Run the following command in DeepSeek Harness:

dsh plugin install po-et/dsh-session-guard

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install po-et/dsh-session-guard in DeepSeek Harness to install this plugin; source code: https://github.com/po-et/dsh-session-guard

About this plugin

The most common dsh corruption scenario is concurrent writing: a dsh web instance plus a CLI, two instances on different ports, or a desktop shell sharing the same $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. dsh ships no cross-process lock today, and dsh-session-guard exists to fill exactly that gap.

It adds an advisory, per-session process lock so that the conflicting step fails loudly with an actionable message instead of silently corrupting your history. 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 90 seconds without a heartbeat. Lock files live under $DSH_HOME/session-locks. Zero runtime dependencies. MIT licensed.

Ideal for anyone running multiple dsh processes concurrently across terminals, ports, or a shared home directory, especially in team environments where machines share the same $DSH_HOME. Worth noting: the lock is advisory, meaning it only constrains processes that have loaded this plugin; processes without it are unrestricted. It guards the active turn-write path (session-start, pre-step), while the cold-load repair path that commits synthetic interrupt-closers is handled inside dsh itself and cannot be intercepted by a plugin. If corruption has already occurred, pair it with dsh-session-rescue to repair the damage.

Use Cases

  • A dsh web instance and a CLI writing to the same session and colliding on seq
  • Multiple dsh ports sharing one $DSH_HOME writing concurrently
  • Desktop shell and a terminal committing events to the same session in parallel

Best For

  • Solo developers running multiple dsh processes at the same time
  • Teams sharing a $DSH_HOME in collaborative setups
  • Heavy dsh users who treat session history as non-recoverable data