dsh-plugin-spend-forecast: Predicting Spend from the cost-ledger Sidecar

Foreword

DeepSeek Harness (DSH) adopts a plug-in architecture. The cost-ledger plugin is responsible for recording expenses that have already occurred, answering the question “how much has been spent”. If you need to answer “how much will I spend this month at this rate” or “when will the budget run out”, additional forecasting logic is required. dsh-plugin-spend-forecast reads the ledger data from cost-ledger, providing daily average rates, trend analysis, end-of-month forecasts, and specific dates when the budget will be exhausted.

Core Features

This plugin primarily provides the following capabilities:
* Dual-window daily average and trend: Compares daily average spending between a short window (default 7 days) and a long window (default 30 days) to determine trends (accelerating, decelerating, or stable).
* End-of-month forecast: Predicts total spending for the remaining days of the current month based on the short-window rate.
* Budget exhaustion date: Calculates the specific date when the budget will be burned through based on the current spending rate and remaining budget.
* Per-model breakdown: Analyzes spending proportions of the top 5 models within the short window.

Installation and Activation

Installation steps:

  1. Use the official command to add the plugin to the profile:
    dsh plugin --profile web add github:121212165/dsh-plugin-spend-forecast
This command will automatically download and build the plugin via `pnpm`.
  1. Edit the configuration file $DSH_HOME/profiles/web/cordis.patch.yml. Merge the contents of cordis.patch.yml from the repository root directory into this file. Note: Do not simply append, as this will cause a YAML parsing error (end of the stream or a document separator is expected); entries should be placed in the same array.

  2. Restart the dsh client and server. The configuration layer and client need to be restarted to take effect.

Usage

Enter the following in the DSH interface or terminal:

/forecast

This command will output detailed information including dual-window daily averages, trend analysis, end-of-month forecasts, burnout dates, and model breakdowns.

Notes and Configuration

  • Prerequisite: pnpm must be available in the system PATH.
  • Data source requirement: Price catalogs must be configured in cost-ledger, otherwise the full-month forecast will return 0.
  • Trend dead zone: When the trend value falls between 0.8 and 1.25, the system will not determine a trend (to avoid misinterpreting daily fluctuations as trends).
  • Currency handling: Currencies are taken from ledger records; cross-currency mixing is not performed.
  • Unverified scenarios: The end-of-month extrapolation during cross-month transitions has not been verified (only tested within the current month).

Configuration options:
* windowDays: Short-window lookback days (default 7), used to calculate daily averages and model breakdowns.
* longWindowDays: Long-window lookback days (default 30), used to calculate the trend baseline.
* budgetMajor: Monthly budget (integer units), 0 or negative values are treated as unset.

Ecosystem Integration

This plugin belongs to the dsh-plugin-family and works in conjunction with cost-ledger (accounting) and price-aware (price management).

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye