Introduction

The core design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” dsh-nightshift is a third-party plugin designed to take advantage of the significantly lower DeepSeek model pricing at night (UTC+8) compared with daytime. Agents often run during users’ peak work hours, which can lead to high computational costs. This plugin allows tasks to be queued during peak periods and released during off-peak periods, automatically generating savings reports.

Plugin Overview

  • Name: dsh-nightshift
  • Owner: mikasaxin529
  • License: MIT
  • Core value: Queue during peak periods, release during off-peak periods, and read savings reports.

Core Features

  • One-chip enqueue: A 🌙 chip in the chat input box for enqueueing the current draft. The default target is to continue the current session; the new-session button runs in a separate session.
  • Peak freeze: Suspend scheduling within peak-period windows. If a task is already running, it will complete naturally (completed work will not be interrupted).
  • Off-peak drain: During off-peak windows, schedule one task at a time, with the interval between tasks controlled by drainGapMs.
  • Failure policy: Handle failures by reason: error/interrupted uses bounded exponential-backoff retries; max-tokens automatically sends a continuation prompt (bounded); blocked pauses and waits for manual intervention; aborted is treated as a user cancellation.
  • Savings ledger: Charge token deltas based on the actual price window (peak or off-peak) at the time they occur, ensuring accurate accounting for tasks that span windows or are retried.
  • Daily reports: Generate reports when the queue is empty or when a peak period begins.
  • Durable queue: Supports recovery after restart; unfinished tasks are requeued on restart (at-least-once semantics).
  • Panel: Sidebar entry that displays the window banner, live task rows, queue management (run/cancel), history, and the latest report.

Installation and Enablement

Ensure DeepSeek Harness is installed and that you are using the web profile (the process must remain resident). Node.js >= 20 is required.

Run the official installation command:

dsh plugin --profile web add github:mikasaxin529/dsh-nightshift

After installation, restart DSH or wait for HMR to reload.

Configuration Notes

The configuration items are located under the nightshift entry in the loader configuration. The default values are as follows:

key default meaning
timeZone Asia/Shanghai IANA timezone used to interpret windows
peakWindows 09:00–12:00, 14:00–18:00 [start, end) wall-clock windows; may cross midnight; [] means never peak
peakPricePerMTok 2 Peak-period price per million tokens (please enter a real value)
offPeakPricePerMTok 1 Off-peak price per million tokens
currency ¥ Display currency
tickMs 30000 Window-check / scheduling interval
maxRetries 3 Number of retries for error/interrupted attempts
retryBaseMs 60000 Exponential-backoff base
retryFactor 2 Exponential-backoff factor
retryMaxMs 1800000 Exponential-backoff ceiling
continuationLimit 3 Maximum number of automatic continuation prompts for max-tokens
continuationPrompt 继续 Text of the continuation prompt
drainGapMs 5000 Pause between scheduled tasks
allowRunNow true Whether to allow the “Run Now” button in the panel
reportRetentionDays 30 Report retention days
exposeTool false Reserved for v1.1 (nightshift_enqueue tool)

Typical Usage

During the daytime peak period, compose a task and click the 🌙 chip in the sidebar to enqueue it. The plugin automatically freezes scheduling. When the nighttime off-peak period arrives, the plugin processes the tasks one by one. After the tasks are completed, the system generates a daily savings report.

Notes

  • Price simplification: Cached pricing is simplified; all token categories are billed at the same window price, so savings in reports may be conservative.
  • At-least-once: Tasks are requeued after restart. Ensure that tasks are idempotent or can be safely re-run.
  • Single-task concurrency: Only one task is processed at a time.
  • Price declaration: The plugin does not check an actual pricing API; it uses your declared peakPricePerMTok and offPeakPricePerMTok.
  • Configuration changes: Modifying the configuration triggers an HMR reload.

Conclusion

dsh-nightshift binds task scheduling to price windows, helping users queue tasks during peak periods, release them during off-peak periods, and ultimately obtain a cost-savings report. The open-source repository is available at https://github.com/mikasaxin529/dsh-nightshift.