Introduction¶
The plugin-based architecture of DeepSeek Harness (DSH) allows developers to extend features flexibly, but session log corruption remains a risk. Even with a plugin that prevents concurrent writes, data corruption can still occur due to process crashes or cold loading. dsh-session-snapshot aims to close this remaining gap. It validates whether the log is loadable at the end of each turn and, if it is, promotes it to a snapshot. This limits the loss to the turn currently in progress when the log becomes corrupted.
Positioning¶
This is a plugin that provides session backups for DeepSeek Harness. It offers rolling, integrity-verified backups to minimize the impact of corruption. The plugin is maintained by po-et and belongs to the “Memory” category.
Core Capabilities¶
- Automatic snapshots: Automatically creates snapshots at turn boundaries.
- Integrity validation: Validates whether the live log is still loadable before promoting it to a snapshot.
- Good copy retention: Ensures that a validated good copy is retained at turn boundaries.
- Lightweight runtime: Zero runtime dependencies.
Installation and Enablement¶
This plugin is currently not published to npm and must be installed directly from GitHub.
dsh plugin --profile web add github:po-et/dsh-session-snapshot
After installation, the plugin runs automatically at turn boundaries. If using an AI agent, you can instruct it to install this plugin.
Usage Examples¶
Even if DSH itself cannot start, this plugin can be run using npx.
List snapshots and health status for all sessions:
npx github:po-et/dsh-session-snapshot
List snapshots for a specific session (by ID fragment):
npx github:po-et/dsh-session-snapshot list 37374e34
Restore the latest validated snapshot:
npx github:po-et/dsh-session-snapshot restore 37374e34
Note: The restore command first backs up the current file as <artifact>.pre-restore-<time>, and only restores snapshots that pass validation.
Manually create a snapshot immediately:
npx github:po-et/dsh-session-snapshot snapshot 37374e34
Configuration¶
The plugin supports YAML configuration to control retention policy and execution frequency.
- id: session-snapshot
name: dsh-session-snapshot
config:
keep: 5 # 每个会话保留的快照数量,超过此数量将删除最旧的
minIntervalMs: 0 # 同一会话快照间的最小间隔(毫秒),0 表示每次变化都创建
# home: /custom # 默认为 $DSH_HOME (~/.dsh)
Snapshot files are stored in the $DSH_HOME/session-snapshots/<session-id>/ directory.
Scope and Notes¶
- Backup scope: Snapshots contain only a point-in-time copy of the session log and do not back up workspace files.
- Format support: Supports session format version 0 (
.land.l.zstd). Since DSH is pre-1.0 (preview), format compatibility is not guaranteed. - Unknown versions: When an unknown version is encountered, the tool refuses to process it and reports an error, rather than attempting to guess.
- Dependencies: MIT License, zero runtime dependencies (compression handling relies on Node.js built-in zlib).
Conclusion¶
dsh-session-snapshot is part of the session integrity suite. Used together with session protection and rescue plugins, it can effectively reduce the risk of losing session data. For more details, visit the plugin catalog page or the GitHub repository.