Introduction¶
The design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” When using DSH to build agent workflows, an agent may perform long-running tasks (for example, developing its own plugins). If the host service running the DSH process is interrupted (for example, due to a crash restart or a manual restart), active goals remain persisted, but their “armed state” is lost. This means the goal-round driver stops working until someone manually runs /goal resume.
The dsh-goal-restart plugin addresses this issue. It allows the agent to automatically resume work after a service restart, without manual intervention.
Plugin Overview¶
- Name: dsh-goal-restart
- Owner: joshryandavis
- Category: Workflow
- License: MIT
This plugin automatically detects and re-arms persisted goals that are still active and have remaining budget when the DSH service restarts. It calls ctx.goals.resume, allowing the goal-round driver to seamlessly take over and continue executing subsequent rounds.
Installation and Enablement¶
Installing the plugin requires using the DSH plugin management command with a specified profile.
- Run the installation command:
dsh plugin --profile <profile> add dsh-goal-restart
*Note: Replace `<profile>` with the name of the profile you are currently using.*
- Restart the DSH service to load the new plugin.
Disabling the Plugin¶
If you need to temporarily disable this functionality, you can disable it by modifying the patch in the profile configuration.
Add the following configuration to the profile’s cordis.patch.yml file:
- id: goal-restart
disabled: true
How It Works¶
The core logic of the plugin is handled in the agent/session-start event handler. The plugin only intervenes when the session resume source (payload.source) is 'resume'.
Check Conditions¶
The plugin determines whether to re-arm a goal based on its policy:
- Trigger condition:
agent/session-startandpayload.source === 'resume'(the session was just loaded from persistent storage). - Action: Call
ctx.goals.resume(agent, ref). - Persistence: Re-arming writes a persisted
resumemutation (revision +1) to the session log, matching the write produced by manually running/goal resume.
Driver Responsibilities¶
Note that the goal-round driver already includes persistence and cancellation-safety mechanisms. This plugin is only responsible for deciding “whether to continue”; the actual execution logic and round scheduling are handled by the driver.
Limitations and Policy¶
The plugin does not apply to every scenario. It skips the following cases:
- A brand-new session start (
source: 'startup'). - A session derived from another process (such as a forked session or subagent session, where the lineage is held in-process).
- A goal whose state is
paused,blocked, orcomplete(determined by the persisted stage state). - A goal that is already
armed(idempotency, so skip it). - A goal whose round count has reached the limit (
roundsStarted >= maxGoalRounds).
Verification and Testing¶
This policy has been sufficiently validated. The codebase includes 13 in-memory unit tests (npm test), as well as a smoke test script that runs without network access or live processes (npm run smoke).
Summary¶
The dsh-goal-restart plugin removes the need for manual intervention by automatically calling resume after a service restart. For agent workflows that require long-running execution or autonomous development, this is a critical “self-healing” mechanism.