Introduction

The goal system in DeepSeek Harness (DSH) persists the goal itself and its lifecycle stages to the session log so that context can be restored after a restart. However, the authorization to continue execution (activation) is not persisted. After the DSH process restarts or upgrades, the goal is disarmed, causing goal-round-driver to stop working. Developers must manually send a command to reactivate the goal.

The dsh-auto-goal-resume plugin aims to eliminate this manual intervention step. After a DSH restart, it automatically scans and resumes execution for all active goals, allowing the agent to seamlessly continue its previous work until the goal is completed, blocked, or reaches its round limit.

Core Features

  • Automatic continuation: After a restart, actively checks and resumes active goals without any manual command.
  • Cold agent recovery: Restores the agent and its preset bundle from persisted session logs, ensuring context consistency.
  • Idempotency: Sessions that are already armed are automatically skipped, so repeated scans do not produce side effects.
  • Fault tolerance: A failure in one session does not affect other sessions; automatic retries are performed when the service is not ready.
  • Zero dependencies: The logic is self-contained and does not introduce extra packages or dependency-resolution chains.
  • Guardrails preserved: Strictly respects goal round limits and does not touch goals in the paused, blocked, or complete state.

Installation and Enablement

The plugin is published on npm and can be installed quickly with the following command:

dsh plugin --profile web add auto-goal-resume

After installation, restart DSH to activate it. The plugin automatically takes over active-goal recovery after a restart.

How It Works

The plugin uses a two-layer mechanism to ensure reliable recovery:

  1. Real-time layer: When a session is opened or an agent cold-starts, the plugin immediately checks the session’s active goals and performs recovery.
  2. Startup scan: About 20 seconds after DSH starts, the plugin scans all persisted sessions, parses goal events within them, and resumes any active goals.

During recovery, the plugin prioritizes parsing the preset from the logs, because this better reflects the actual state of the session than the header from creation time.

Notes and Limitations

  • Round limit: Automatic recovery does not run indefinitely; it only applies when roundsStarted < maxGoalRounds.
  • State filtering: Only goals in the active state are resumed; paused, blocked, and complete states are always skipped.
  • Single-instance limitation: Recovery does not cross machines or instances; it only targets persisted sessions on the current DSH instance.
  • Side-effect risk: Automatic continuation may have side effects (such as writing files or calling external APIs). Before use, confirm that the task can safely continue automatically.
  • Ordinary conversations: Ordinary conversations without an active goal do not trigger the automatic recovery logic.