dsh-result-cap
Run the following command in DeepSeek Harness:
dsh plugin install jwilson411/dsh-result-cap
Paste the following prompt into your AI chat to install this plugin:
Run dsh plugin install jwilson411/dsh-result-cap in your DeepSeek Harness environment to install; the source repository is at https://github.com/jwilson411/dsh-result-cap.
About this plugin
A fetch tool returns a four-megabyte page, the whole thing lands in the conversation, and the run is over—nothing failed, but one result consumed every slot of context. dsh-result-cap exists for exactly that: it applies a deterministic UTF-8 byte cap to tool-result strings, keeps the first N bytes, drops the rest, and lets the run continue. Three design commitments do the heavy lifting. The truncated flag is present only when a cap actually fired; an uncapped result returns byte-for-byte with no wrapper, so the flag carries real signal and nothing is ever shortened silently. The accompanying sha256 digests the full original, not the prefix, so a later complete copy can be verified against the truncated one. The cut respects UTF-8 boundaries—a multi-byte character straddling the limit is dropped whole rather than torn into replacement sequences. On top of that, the same input under the same cap always yields the same output, digest included: no clock, no counter, no randomness, no model call anywhere in the path.
What it deliberately is not deserves equal attention. It is not a context-window manager and does not decide what belongs in the conversation. It is not a compressor, an encoder, or a semantic summarizer; no relevance scoring happens, the first N bytes are simply the first N bytes. It is not a quota: it does not deny calls or fail a run. Its relationship to dsh-tool-quota is complementary—quota throws on overflow and discards the result whole; result-cap truncates and continues. The two compose: set the quota ceiling above your cap and quota fires only on shapes the cap passes through, like an oversized binary.
It is aimed at DeepSeek Harness agent developers whose tool chains include fetch, read, or API-call tools that can return large text bodies. You do not modify the tool itself; you set one number, maxBytes (default 8192), in your profile or via the DSH_RESULT_CAP_MAX_BYTES environment variable for deployment-wide control. The cap is also exported as a plain function from the package root, so it can be used in tests or on a host side that needs a truncation point outside the tool boundary.
Use Cases
- A fetch tool returns a 4 MB page—cap it before it consumes the entire context window
- Verify truncated output against the full original using the sha256 digest
- Pair with dsh-tool-quota: truncate and continue instead of discarding the whole result
Best For
- DeepSeek Harness agent developers whose tool chains include fetch, read, or API tools returning large text
- Engineers who need deterministic, reproducible byte-level truncation rather than semantic compression
- Teams orchestrating multi-agent runs where context budget protection and elimination of silent truncation are hard requirements
Related Plugins
A unified suite combining hot runtime injection, task-aware thinking-mode routing, and a graded session protocol with red-team gates to sustain model diligence across long-horizon inference.
ModLens is a vision plugin for DeepSeek Harness that gives text-only models sight by reading images pasted directly into chat, with zero-config setup and multiple vision engines.
On-demand vision for text-only DeepSeek Harness agents: built-in free keyless vision chain and 14 vision tools, routing image turns as tool calls to vision models with pixel fidelity, no Python needed, one-command install.
Give text-only models in DeepSeek Harness eyes, enabling image Q&A, long-screenshot OCR, UI restoration, and GUI visual tasks.