dsh-session-budget-guard
Run the following command in DeepSeek Harness:
dsh plugin install erya2000/dsh-session-budget-guard
Paste the following prompt into your AI chat to install this plugin:
Run dsh plugin install erya2000/dsh-session-budget-guard inside DeepSeek Harness to install this plugin, source available at https://github.com/erya2000/dsh-session-budget-guard , then restart the Harness once to activate.
About this plugin
A single prompt in DeepSeek Harness can fan out into three levels of subagents, thousands of model calls, and drain an API balance in twenty minutes. A cumulative budget alone is too slow to matter because the tree is burning several dollars a minute and may never reach a high threshold before the balance is gone. dsh-session-budget-guard puts two independent gates on every session tree: a cumulative-spend cap and a sliding-window burn-rate cap. Whichever trips first acts first, without waiting on the other.
When a limit is crossed, behaviour depends on the configured mode. In notify mode the plugin logs the event and fires a desktop notification, which is ideal for observing real traffic before committing to enforcement. In enforce mode it returns reject at the agent/pre-step hook so the next model request never fires, denies over-quota delegations, workflow calls, and web searches at tools/pre-execute with a model-visible reason so the agent adapts rather than retries blindly, interrupts descendants deepest-first, and cancels the current turn while preserving queued inbox messages. Structural gates such as maximum delegation depth, maximum tree nodes, and per-session search limits keep the tree from growing without bound. Cost data is read from the dsh-cost-meter ledger when available, including user-edited prices; otherwise the guard prices calls itself from DeepSeek peak and off-peak list rates. Lineage is resolved from the first record of each session log, and no message content is ever read.
If you run multi-agent research, batch content generation, or automated workflows in DeepSeek Harness and want an insurance fuse against runaway API spend, this plugin is that fuse. Start in notify mode for a day, read the log, tune the thresholds to your real traffic, then flip on enforce with confidence.
Use Cases
- A multi-agent research tree drains an API balance in twenty minutes and needs an instant circuit breaker
- Subagent fan-out goes out of control during batch generation, causing unattended overnight spend
- Production deployments require a hard, non-negotiable cap on team API quotas
- A safe transition from observation to enforcement by monitoring real traffic for a day first
Best For
- DeepSeek Harness users running multi-agent research or generation workflows
- Platform admins who need hard caps on team API quotas
- Solo developers worried about runaway subagent spend burning through balances
Related Plugins
A network security red-team benchmark plugin for DeepSeek-V4.1/Flash featuring dual-layer kernel injection and zero-tool architecture for controlled model safety assessment.
A security red-team prompt plugin for DeepSeek-V4 that uses code-formal mapping and zero-trigger system prompts to enable unconditional output, intended for authorized testing and research only.
Adds an Auto approval mode on the official workspace-write sandbox, classifying semantic risks, asking when ambiguous, and denying destructive operations.
Undo/rollback system for DSH: config & plugin snapshots, one-click undo/redo/restore, message-level revert, secret masking, safe mode, and offline WebUI/GUI/CLI rescue tools for when DSH won't start.