AI Agent Hub
Back to plugins
🧠

dsh-usage-guard

Memory Updated 2026.08.25

Run the following command in DeepSeek Harness:

dsh plugin install GooDAnDReaDY/dsh-usage-guard

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install GooDAnDReaDY/dsh-usage-guard in DeepSeek Harness to install this plugin (source: https://github.com/GooDAnDReaDY/dsh-usage-guard), then restart the Web UI to activate protection and instantly revive any previously locked sessions.

About this plugin

DeepSeek Harness replays event logs on every session open, accumulating token counts across four buckets. The core only guards cache fields with a ?? 0 fallback, leaving inputTokens and outputTokens as raw numbers in arithmetic. A single NaN, negative value, or missing field from a third-party provider, local inference server, or custom proxy contaminates the cumulative sum, schema validation rejects the digest, and the entire conversation history becomes permanently unreadable. Because replay is dynamic, the damage is irreversible.

dsh-usage-guard intercepts the projection fold at runtime without touching any log files on disk. It ships a broad alias lexicon covering OpenAI, Google Gemini, and Ollama field names, attempts to borrow a valid value before defaulting to zero, and enforces three gates (typeof number, Number.isFinite, >= 0) to screen out NaN, Infinity, negative codes, and stringified numbers. Both already-registered and late-bound projections are wrapped with full this-context preservation, and a deduplicated diagnostic log (capped at 1,000 entries) names the exact session, turn, step, and recovery action without flooding output. After installing and restarting the Web UI, every previously bricked session is instantly restorable.

Ideal for DeepSeek Harness users who route through non-standard upstreams, multi-provider gateways, local Ollama or GPU inference, or custom proxy layers. One install line plus a single service restart is all it takes to eliminate token-poisoning failures without ever rewriting a log file.

Use Cases

  • Upstream returns NaN or negative token values, corrupting the cumulative sum and bricking history
  • Non-standard providers like Ollama or Gemini use different field names, breaking token accounting
  • Custom proxy gateways intermittently drop token fields, requiring safe zero fallback
  • Late-bound session projections need the same guard regardless of plugin load order

Best For

  • DeepSeek Harness users routing through non-standard or multi-provider upstreams
  • Operators who have experienced permanently locked, unreplayable session histories
  • Developers connecting via custom proxy gateways or local inference services