DSH (DeepSeek Harness) generates a large number of session history files during runtime. As usage time increases, archived files accumulate, and some sessions may develop inconsistent states or corrupted projection caches. dsh-session-steward is designed to address these two issues: managing session history through a “Nursing Home” feature, and diagnosing session health through a “Health Check” feature.
Plugin Positioning¶
drscrewdriver/dsh-session-steward is a DSH Web plugin for managing session history files and performing health checks. It provides projection-level health checking and reversible repair capabilities for abnormal sessions.
Core Features¶
The plugin mainly provides two feature areas:
Session History Files (Nursing Home)¶
Browse the official archive collection and provides two independent operations:
1. Unarchive: modify the global.archivedSessionIds array to move the session back to its original workspace; reversible.
2. Clean up archived files: delete the physical files on disk; irreversible. Cleanup will necessarily also unarchive the session; otherwise it can create zombie IDs that are invisible in the sidebar and turn into empty sessions as soon as they are unarchived.
Session Health Check (Health Check)¶
Provides a “Four-Gate Health Check → Prescription → Discharge” workflow. Supports batch health check session-health-scan and reversible remediation session-health-repair.
Installation and Enablement¶
The installation command is as follows:
dsh plugin --profile web add dsh-session-steward
After installation, the DSH process must be restarted (refreshing the page alone has no effect).
Routes and API¶
The plugin registers under the /session-steward/api path, and method names are all session-*. After installation, a “Session Steward” entry will be added at the bottom of the sidebar.
| Method | Subdomain | Purpose |
|---|---|---|
session-health-status |
health | Toggle state and method table |
session-health-scan |
health | Batch health check |
session-health-session |
health | Four-gate report for a single session |
session-health-repair |
health | Reversible remediation |
session-history-list |
history | List the archive collection |
session-history-prune |
history | Remove archive status |
session-history-purge |
history | Clean up archived files |
Configuration Gates¶
The plugin provides two feature gates:
| Gate | Field | Default Value | Effect When Disabled |
|---|---|---|---|
| Session History Files | historyFiles |
true | Does not register session-history-* methods and does not render the “Nursing Home” tab |
| Health Check | healthCheck |
true | Does not register session-health-* methods and does not render the “Health Check” tab |
Four-Gate Health Check¶
| gate | Criteria | level |
|---|---|---|
log-integrity |
zstd multi-frame scanning, provenance expansion, seq continuity | Read issues: fail; only torn tail frame: warn |
projection-cache |
Lag between minSeq in ~/.dsh/storages/session_projcache/sessions/<id>.json and the last seq in the log + unsettled fields |
Lag plus unsettled fields: fail; either condition alone: warn |
lossless-json |
Line-by-line determination of lossless JSON for hot-state sessionProjections.checkpoint(session) |
Match: fail |
cold-read |
Reason of the last turn/end, and whether an unclosed open step exists |
Open step: fail; interrupted/no turn/end: warn |
Notes¶
-
Hard constraints:
- Listing and writing from the same source: Both listing and writing operations rely on the storage file~/.dsh/storages/workspace.json. TheworkspaceRegistryin host memory is a startup snapshot; file changes do not update memory, so DSH must be restarted for changes to take effect.
- Restart after operations: After any archive or workspace change, DSH must be restarted immediately; otherwise session state may roll back. -
Format contract:
- This plugin handles writes, and the search index is read-only. Search/standalone indexes belong to a separatedsh-search-indexmodule; this plugin does not provide search or indexing functionality. -
Prohibitions:
- Rewriting session logs, modifying historical data, and silently dropping fields are prohibited.