Preface¶
When running long-running tasks with DeepSeek Harness (dsh), a common dilemma is: shutting down the machine on schedule kills work that is still in progress, while keeping it on wastes resources when tasks crash or are no longer being monitored. The built-in dsh-schedule is suitable for throwing reminders back into the session to let the model decide the next step, but it cannot help with “directly reclaiming resources” when the model is unavailable or the quota is exhausted. This article introduces the community plugin dsh-deadman: once armed, it periodically asks “Is anyone still making progress?”; if no activity is reported, it executes the shell command you specify, bypassing model decision-making.
What is this¶
dsh-deadman is a deadman switch plugin for dsh, maintained by 0gl20shk0sbt36 and categorized as Workflow in the SkillHub directory. In short: once armed, it periodically inspects whether any agent is still making progress; if not (and release conditions are met), it executes the command hardcoded during arming—such as shutting down, stopping instances, or triggering local scripts.
Comparison with built-in automation (excerpted from the official README):
dsh Built-in dsh-schedule |
dsh-deadman | |
|---|---|---|
| Action on schedule | Message sent to inbox, decided by model | Directly executes shell command |
| Prevention mechanism | None | Heartbeat gate: Postpones if progress is reported |
| Typical scenario | Scheduled reminders, waking up sessions | Unattended loss-stopping: Automatically reclaims resources after work finishes or crashes |
The two are complementary; the deadman switch targets moments where “resources should be reclaimed, but the model might not be able to process messages.”
Core Functions¶
Model Tools¶
| Tool | Function |
|---|---|
deadman_arm |
Arm: Parameters include name, command, after_minutes, interval_minutes, description. First inspection occurs after after_minutes; if a hold is reported, it reschedules by interval_minutes; task finishes upon one successful execution |
deadman_hold |
Signal life: “I am still working”, skip this round. Any session can report activity (fail-safe) |
deadman_disarm |
Disarm. Only available by default in the arming session or its direct sub-agents; other sessions require force=true, which is logged. |
Task names are globally unique within the process; arming with the same name will be rejected with a message indicating the occupied session.
Slash commands: /deadman (current session), /deadman all (all sessions), /deadman cancel <name>.
Trigger and Release Order¶
- Resolve owner session: Resume if necessary before delivery to avoid missing prompts.
- Deliver inspection query to agents (requiring no disturbance to the user, no confirmation requests, only reporting activity or silence).
- Loop based on activity: If any agent has advanced
session.seqsince the last inspection, continue waiting; if all show no progress, enter grace period; if there are questions awaiting user answers, time them separately; total duration must not exceedmaxHoldMinutes(fail-open release at the limit). - If released, execute the command; the task ends automatically upon success; if a hold is reported, reschedule for the next cycle.
Ways to Signal Activity¶
- Call the
deadman_holdtool; - Create
.deadman-hold-<name>in the working directory (usable by sub-agents lacking the tool); - Create a file with the task name under the
hold/directory in the plugin data directory (for external scripts or manual use).
Multi-Session and Concurrency¶
- Each task binds to an owner session, and inspection queries are mainly sent to the owner; default
progressScope: global, meaning if any progress exists on the whole machine, all watchdogs are postponed; if only the owner’s group matters, setprogressScope: owner. - Multiple watchdogs expiring simultaneously can execute their respective commands concurrently; configure
serializeCommandsfor serial execution.
Installation and Activation¶
Requires dsh 0.2.0-rc.2 (peerDependencies strictly aligned; dsh will refuse installation on version mismatch).
# Local path
dsh plugin --profile web add /path/to/dsh-deadman
# Or from GitHub
dsh plugin --profile web add github:OWNER/dsh-deadman
Replace OWNER with the repository owner (e.g., 0gl20shk0sbt36). Enable dsh-deadman on the plugin page in Web / Desktop; for CLI uninstall: dsh plugin --profile <name> remove dsh-deadman.
It is recommended to install in a long-running profile (e.g., web): The scheduler lives within the dsh process, and no inspection occurs after a one-off headless process exits. When installing from GitHub, pnpm resolves dependencies automatically; for local path installations, run pnpm install in the plugin directory first to generate node_modules.
Configuration¶
Override bundle defaults in the profile’s cordis.patch.yml, for example:
- id: deadman
config:
holdWindowSeconds: 60
| Key | Default | Description |
|---|---|---|
holdWindowSeconds |
60 |
How long to wait to execute after all agents show no progress |
checkIntervalSeconds |
20 |
Inspection cycle |
maxHoldMinutes |
30 |
Total limit from trigger; always release at the limit |
questionBlockSeconds |
600 |
Max wait time when blocked by pending user questions |
onUndeliverable |
execute |
Action when owner session is unreachable: execute / skip |
progressScope |
global |
global for whole machine / owner for owner and direct sub-agents only |
serializeCommands |
false |
Whether to serialize multiple action commands |
commandTimeoutSeconds |
300 |
Timeout for a single command |
dataDir |
$DSH_HOME/plugins/dsh-deadman |
Task table tasks.json and hold/ |
Tasks are persisted in tasks.json and survive restarts; overdue tasks are processed immediately on the next inspection.
Typical Usage¶
- In unattended scenarios (nightly compilation, training, batch rendering, cloud instance batch jobs), the agent calls
deadman_arm, specifying the time for the first check, the cycle, and the command to execute when “no progress is made” (e.g., a shutdown script). - While the task is still in progress, the main agent or sub-agents periodically call
deadman_hold, or rely on global seq advancement for automatic postponement. - When the task finishes normally and the watchdog is no longer needed, use
deadman_disarmor/deadman cancel <name>in the arming session; if the command has already executed successfully once, the task will also finish automatically.
The README does not provide fixed example commands; the actual command should be an audited, trusted shell snippet on your local machine.
Applicable Scenarios and Notes¶
Suitable for: Long-running dsh instances that require “automatic loss-stopping actions if no one is making progress”; distinct division of labor with dsh-schedule—the former reminds the model, the latter acts directly on the shell.
Important to note:
- Action commands are entirely specified by the armer, and the plugin runs with the current dsh process privileges; read the source code and the MIT License before installation, and only schedule commands you trust.
- Default fail-open: Executes if no one reports activity, which is the deadman semantic; set reasonable cycles and grace periods for critical actions.
- Single writer:
tasks.jsonis not suitable for arming by multiple processes simultaneously; the plugin is designed for single-instance, long-running profiles. progressScope: ownerdoes not include deeper grandchild agents; question blocking relies on the host’suserQuestionsprojection, and this gate does not function without the projection.- The plugin does not connect to the internet or collect data; data is written only to the local
dataDir.
The DSH ecosystem emphasizes “everything is a plugin”; the SkillHub Directory is a community site and has no official affiliation with DeepSeek / High-Flyer.
Conclusion¶
dsh-deadman turns “Is anyone still working?” into a configurable periodic inspection and activity-reporting gate, using shell commands to reclaim resources in unattended long tasks without relying on the model being online. Directory page: https://www.skillhub.cn/plugins/0gl20shk0sbt36/dsh-deadman; Source code and full documentation: https://github.com/0gl20shk0sbt36/dsh-deadman.