Introduction

DeepSeek Harness (DSH) extends its functionality through a plugin system. In development or daily use, repetitive operations for specific scenarios—such as periodic data checks and automatic report generation—are inefficient to perform manually. The dsh-knj-scheduler plugin solves this problem by allowing users to automatically start prompt sessions or KNJ workflow tasks using Cron expressions or other trigger methods.

Plugin Overview

dsh-knj-scheduler is a scheduled task dispatcher plugin. It addresses the need for automated execution and supports launching sessions or workflow tasks on a schedule. The plugin is maintained by yangdongzhen590 and is released under the MIT open-source license.

Core Features

  1. Automatic Triggering: Supports automatically starting prompt sessions or KNJ workflow tasks using a Cron expression, a specific one-time time, or an interval in minutes.
  2. Panel Entry: Provides a “More → Scheduler” entry in the left sidebar (depends on the dsh-knj-menu plugin).
  3. Two Tabs and Pagination: The panel includes “Task List” and “Execution Records” tabs, both supporting pagination with 10/25/50/100 entries per page.
  4. Working Directory Configuration: Supports configuring the working directory. Prompt sessions may specify a workspace, while workflow tasks must specify one.
  5. KNJ Workflow Integration: Optionally integrates dsh-knj-workflow and supports referencing file inputs by path.
  6. Status and History: Records execution status (success/failure/skipped) and duration. Execution history is limited to 500 entries.
  7. Persistence: Task definitions are persisted in the profile directory and are automatically restored after restart.

Install and Enable

Installing this plugin requires installing the dsh-scheduler core package and the dsh-knj-menu dependency.

dsh plugin --profile web add dsh-scheduler dsh-knj-menu

Typical Usage

  1. Open Panel: Click “More → Scheduler” at the bottom of the left sidebar.
  2. Create a Task:
    • Click “New Task”.
    • Select the task type: “Prompt Session” or “KNJ Workflow”.
    • Fill in the relevant fields: prompt, workflow, title, working directory, and file input path (required in workflow mode).
  3. Scheduled Execution: After saving the task, the system will schedule it automatically according to the plan. Prompt mode creates a session, while workflow mode launches a workflow task via dsh-knj-workflow.
  4. Task Management: For a task row, you can edit it, enable or pause it, run it immediately, view its history, or delete it.
  5. View Details:
    • In “Execution Records”, click “Open Session” for a prompt task.
    • For a workflow task, click “View Workflow Task” to go directly to the workflow run details.

Notes

  1. Security Validation: Write operations only accept same-origin POST/PUT/DELETE requests (Origin and Host validation). Task definition parameters must be validated before writing, and writes use atomic persistence.
  2. File Inputs: File input parameters are only shape-validated; path existence is not validated (it is validated before launch by dsh-knj-workflow).
  3. History Records: Execution history only records status, duration, session ID, or workflow task ID. It does not record the original prompt text or session content.
  4. Concurrency Control: Task execution consumes model quota. Tasks do not run concurrently by default to prevent reentry; if the previous run has not finished, the current trigger is automatically skipped.
  5. Data Locations:
    • Task definitions: $DSH_HOME/profiles/<profile>/dsh-scheduler/tasks.json
    • Execution history: $DSH_HOME/profiles/<profile>/dsh-scheduler/history.l

Conclusion

dsh-knj-scheduler provides DSH with automated execution capabilities through Cron scheduling and persistent configuration. Developers can automate background tasks by configuring workflows and sessions. For more details, see the GitHub repository.