Introduction

The design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” When using DSH to build model inference or data analysis workflows, agents often produce hallucinations due to weak fundamentals in probability theory, such as incorrectly looking up Z tables, miscalculating confidence intervals, or misinterpreting hypothesis test results. These errors can be amplified in automated workflows, leading to incorrect decisions.

dsh-probstat aims to fill this gap by providing a set of math utilities with zero runtime dependencies, replacing the parts where agents are most error-prone in probabilistic calculations.

What This Is

dsh-probstat is a plugin for DeepSeek Harness (dsh) that provides deterministic probability and statistical inference calculations, maintained by TYEclipse.

It includes six core tools, covering the full pipeline from basic distribution calculations to complex inference:
* Distribution calculations: Supports PDF, CDF, survival function, quantiles, and statistics for six distributions: normal, binomial, Poisson, exponential, uniform, and geometric.
* Z scores: Standard normal table calculations, including conversion between Z values and probabilities.
* Confidence intervals: Mean Z/t confidence intervals and Wilson proportion intervals.
* Event probabilities: Union, intersection, conditional, Bayes’ formula, and complement calculations.
* Hypothesis testing: One-sample mean Z/t tests and proportion tests, returning test statistics, p-values, critical values, and reject/do not reject decisions.
* Sample size planning: Mean Z and proportion (Wald/Wilson) sample size calculations based on target error.

Installation and Enablement

To install this plugin, use the DeepSeek Harness plugin management command:

dsh plugin --profile web add github:TYEclipse/dsh-probstat

Typical Usage

1. Distribution Calculations

The plugin supports density, cumulative probability, and quantile calculations for multiple distributions. The normal distribution CDF uses Abramowitz & Stegun 7.1.26 erf approximation, with absolute error kept below 1.5e-7.

{
  "distribution": "normal",
  "x": 1.96
}
// 返回 cdf 0.9750022 (P(Z ≤ 1.96))

2. Z-score Calculations

Supports conversion between Z values and probabilities, as well as two-tailed P-value calculations.

{
  "mode": "between",
  "z1": -1.96,
  "z2": 1.96
}
// 返回 0.9500043

3. Confidence Intervals

Supports mean Z/t and Wilson proportion intervals (suitable for small samples or extreme proportions).

{
  "kind": "mean_t",
  "mean": 72.5,
  "sd": 8.2,
  "n": 25
}
// 返回 [69.115, 75.885]

4. Event Probabilities

Includes union, conditional probability, and Bayes’ formula calculations.

{
  "operation": "bayes",
  "prior": 0.001,
  "truePositive": 0.99,
  "falsePositive": 0.01
}
// 返回 0.09016

5. Hypothesis Testing

Provides a complete hypothesis testing workflow, including test statistics, P-values, critical values, and decision conclusions.

{
  "kind": "mean_z",
  "sampleMean": 102,
  "mu0": 100,
  "sigma": 15,
  "n": 36
}
// 返回 z 0.8, two-sided p 0.4237108, critical 1.959964 → do not reject

6. Sample Size Planning

Calculates the required sample size based on the target margin of error.

{
  "kind": "mean_z",
  "sigma": 15,
  "marginOfError": 5
}
// 返回 n 35

Use Cases and Notes

This plugin is suitable for DSH workflows that require rigorous mathematical calculations, such as automated A/B test analysis, risk assessment, or data science educational tools.

Notes:
* Zero runtime dependencies: The plugin is implemented in pure JS, with no extra dependencies.
* Precision: Normal quantiles use Acklam’s inverse normal algorithm, with relative error below 1.15e-9.
* Proportion test warning: When \(n \cdot p_0 < 5\) in a proportion test, the plugin emits a warning instead of silently returning a result, helping to avoid inappropriate approximations.
* Permissions and security: The plugin runs under the permissions of the current DSH process. It is recommended to review the source code and MIT license before installation.

Conclusion

dsh-probstat reduces error rates for DSH agents handling probability and statistics tasks by providing high-precision statistical calculation tools. Developers can find additional documentation and source code through the plugin catalog or GitHub repository.