Introduction¶
When developing agents in DeepSeek Harness (DSH), frequent API calls increase costs. If heavy computation is performed during high-fee periods (peak periods), costs can rise significantly. The dsh-peak-valley-queue plugin helps reduce API call costs by intercepting input, queuing messages, and automatically executing them in order during low-fee periods (off-peak periods).
Core Features¶
This plugin mainly addresses the tension between “on-demand execution” and “cost control,” with the following capabilities:
- Input interception and queuing: A toggle on the left side of the input field lets you switch between queue mode and direct-send mode. When enabled, chat messages are not sent directly but placed into the task queue; when disabled, messages are sent directly.
- Off-peak automatic scheduling: Queued tasks are dispatched in FIFO order and automatically executed only during off-peak periods (low-fee periods officially defined by DeepSeek) and when the next peak period is more than the configured number of minutes away.
- Peak/off-peak countdown: The panel displays the time remaining until the next peak period (shown during off-peak periods) or the next off-peak period (shown during peak periods) in real time.
- Flexible peak period configuration: By default, peak periods on weekdays are 09:00–12:00 and 14:00–18:00. You can add or remove periods (overlaps are supported), set whether weekends count as peak periods, and specify a timezone. If the list is cleared, the entire day is treated as an off-peak period.
- Queue management: The panel supports adding tasks, editing, deleting, drag-and-drop reordering, merging adjacent tasks, manually sending, and forcing completion for in-progress tasks.
- Accurate completion detection: A redundant multi-signal mechanism is used (
turn/end,agent/status, watchdog, client polling) to precisely classify task status into four categories: completed, interrupted, failed, and blocked. - Pending confirmation task integration: When used with
dsh-todo-enhancer, if a<!-- dsh-todo:start -->marker is detected, the task enters a “pending confirmation” state and the queue pauses until the user makes a decision. - Pause and resume on failure: If a task fails or is interrupted, the queue pauses and a browser notification is sent. Clicking “Continue task” resumes the queue and re-sorts the tasks.
- Strict validation (optional): When dispatching, you can inject a convention requiring the response to end with
__TASK_DONE__. If it is not detected, the task is considered incomplete. - Independent multi-session support: Each session (including different workspaces) has independent toggles, queues, and persisted data, without interfering with others.
- Local persistence: Queues and configurations are stored in the DSH data directory
~/.dsh/peak-valley-queue/(preferring$DSH_HOME) and are never written to user workspace files.
Installation and Activation¶
You must install both plugins with a single command: dsh-peak-valley-queue (core queuing logic) and dsh-todo-enhancer (decision checklist panel). After installation, you must restart the DSH service to load the bundle layer.
dsh plugin --profile web add github:EmptyCollin/dsh-peak-valley-queue github:EmptyCollin/dsh-todo-enhancer
After installation:
1. Restart the DSH service: This is required to load the bundle layer.
2. Refresh the browser: Re-fetch the plugin manifest.
3. Configure dependencies: If you need the “pending confirmation” feature, ensure dsh-todo-enhancer is installed and loaded correctly.
For offline or local development, you can install using local paths with the same effect.
Typical Usage¶
- Batch processing during off-peak: Accumulate non-urgent tasks (such as bulk rewrites, inspection checklists, and report generation) and execute them during off-peak periods to benefit from lower rates.
- Automatic peak-period queuing: Enable queuring during morning and afternoon peak periods on weekdays. When off-peak periods begin, tasks are automatically executed in order without manual monitoring.
- Manual intervention and fallback: Manually add tasks, reorder them by dragging, or force-completing tasks in an abnormal state from the panel.
- Strict mode: Enable strict validation to require responses to end with
__TASK_DONE__, ensuring task execution results are captured correctly.
Applicable Scenarios and Notes¶
- Applicable scenarios: Suitable for batch task processing, tasks that require serial execution, or scenarios where API costs are critical.
- Not applicable scenarios: Not suitable for real-time conversations requiring immediate responses, urgent tasks during peak periods, or highly interactive debugging workflows.
- Important notes:
- Queued messages do not appear directly in the chat area and must wait for execution.
- Installation is supported only from GitHub or local paths.
- The plugin runs with the permissions of the current
dshprocess. Check the source code and license before installation.
Summary¶
dsh-peak-valley-queue provides DeepSeek Harness with a complete peak/off-peak task management solution. Through local persistence, multi-session isolation, and precise completion detection, it helps developers effectively reduce API call costs while preserving task order and safety.