Introduction¶
The core philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” In real-world development, agents often need to perform specific tasks on a regular schedule (such as data exports or weekly report generation). Traditional approaches usually require writing standalone scripts or triggering tasks manually. The dsh-plugin-cron plugin introduces a Cron scheduling mechanism, allowing developers to automatically schedule Agent tasks using expressions, inject messages directly into the DSH session context, and trigger the full Agent execution flow.
Plugin Overview¶
This is the dsh-plugin-cron-scheduler plugin maintained by LittleBlackTong. It provides DSH with a scheduled task scheduler, supporting task management via standard Cron expressions or the sidebar UI. When a trigger time is reached, the plugin injects a User-type message into the target session, thereby triggering a full round of Agent execution (including tool calls, file reads/writes, data fetching, and so on).
Core Features¶
The plugin has the following main capabilities:
- Cron scheduling: Supports standard 5-field Cron expressions (minute, hour, day, month, day of week), including single values, ranges, steps, and wildcards.
- Session policy:
new: Creates a new session for each trigger, enabling task isolation.fixed: Binds to a specified session, preserving accumulated context.
- Dual-channel creation: Supports creating tasks in a conversation using natural language (via the
cron_managetool), or creating and editing tasks in the sidebar UI. - Persistence and concurrency: Task data is stored in a JSON file on the Host plane (
<dshHome>/cron-jobs.json). It includes a concurrency protection mechanism: if the previous execution has not finished, a new trigger cycle is automatically skipped. - Execution history: Records the status of each trigger (success/failure/skipped), error messages, and run counts, and displays them in the sidebar list.
- Manual triggering: Supports running immediately via the “Run Now” button in the list or the conversation command
cron_manage run. - Sidebar UI:
- Registered at the bottom of the sidebar (
sidebar.footer.action). - Displays the task list inline, supporting create, edit, delete, start/stop, and run-now operations.
- Uses ResizeObserver to adapt width; when the container width is less than 220px, it automatically collapses some text and displays a Tooltip.
- Registered at the bottom of the sidebar (
- HTTP API: Provides
/api/cron/*routes, supporting listing tasks, creating tasks, running immediately, and listing live sessions.
Installation and Enablement¶
Install via the DSH CLI:
dsh plugin --profile <profile> add dsh-plugin-cron-scheduler
After installation, restart the DSH process to activate the plugin. Task configuration does not require a restart after being saved; the sidebar UI updates automatically.
Usage¶
Conversation Natural Language¶
In the DSH conversation window, you can use the cron_manage command to create tasks. Example:
Azhou: Help me export last week’s ZDP data every Monday at 10:30
Xiaolan: (calling the cron_manage tool) Created “Weekly ZDP Last-Week Data Export”. Next run: next Monday at 10:30
Supported operations include create / list / update / delete / toggle / run.
Cron Expression¶
The standard Cron expression format is minute hour day month day-of-week:
* * * * *
│ │ │ │ └─ 周几 (0-7,0 和 7 = 周日)
│ │ │ └─── 月 (1-12)
│ │ └───── 日 (1-31)
│ └─────── 时 (0-23)
└───────── 分 (0-59)
Common examples:
| Expression | Meaning |
|---|---|
0 10 * * * |
Every day at 10:00 |
30 10 * * 1 |
Every Monday at 10:30 |
*/5 * * * * |
Every 5 minutes |
0 17 * * 5 |
Every Friday at 17:00 |
Session Binding¶
When using the fixed policy, you need to bind a live session. The sidebar UI provides a dropdown that directly lists the titles of all live sessions, so you do not need to enter the ID manually. If the bound session no longer exists when the trigger fires, the plugin automatically creates a new session and writes back fixedSessionId.
Configuration and Notes¶
Configuration Items¶
The Host-plane configuration of the plugin mainly includes the following two items:
| Key | Default | Description |
|---|---|---|
configFile |
<dshHome>/cron-jobs.json |
Path for task data storage |
cwd |
process.cwd() |
Working directory for new sessions created under the new policy |
Important Boundaries¶
- Process liveness dependency: Tasks only exist while the DSH process is running. If a trigger time arrives while the process is closed, that trigger is directly skipped. After restart, the next run time is recalculated from the current time (no missed runs are backfilled).
- Version compatibility: The plugin depends on DSH session format v4 (official DeepSeek Harness 0.1.7+). v4 and v3 whitelists are mutually exclusive; 0.2.9 and earlier versions will trigger errors on v4. Ensure the DSH version meets the requirements.
- Configuration conflict warning: Do not manually write
insertentries into thecordis.patch.ymlfile of aprofile. This can conflict with automatic mounting from the bundle manifest and cause startup failure. - New session requirements: When creating a task with the
newpolicy, you must fill in theagent preset(toolset), model selection (agentDefaultModel), andcwd; otherwise the Agent cannot start properly.
Conclusion¶
dsh-plugin-cron provides DeepSeek Harness with standardized scheduled task capabilities, enabling Agents to run automated workflows on a schedule like traditional applications. With the sidebar UI and HTTP API, developers can conveniently manage task flows.