Introduction¶
When running multi-step agent tasks in DSH, a common type of degradation occurs: the model repeatedly re-derives conclusions it has already reached in its chain of thought, writes tool calls as plain text, repeats the same paragraphs in place, or outputs meaningless incremental number streams. These issues often occur within a single generation stream. When starting the next step, the context does not explicitly leave “established conclusions” right in front of the model, so it has to start the deduction from scratch after every tool round trip.
The community plugin dsh-cot-anchor (Maintainer: JiewiW, Category: Memory) addresses this pain point: after a tool result is returned, it extracts established conclusions from the previous thought segment and inserts them back into the context; simultaneously, during generation, it identifies patterns such as spinning, repetition, and pseudo-tool calls based on local rules, and performs a soft-cut of the current request when necessary, allowing the turn to resume from the breakpoint. It does not replace cross-step step governance—that belongs to the sister plugin dsh-step-governor.
What is this¶
dsh-cot-anchor is a DeepSeek Harness (DSH) plugin. In one sentence, its positioning is: Thought Anchor—extracting established conclusions from the model’s previous thoughts and injecting them after tool results to reduce repetitive derivation; it also identifies spinning and pseudo-tool calls.
- Directory Page: https://www.skillhub.cn/plugins/JiewiW/dsh-cot-anchor
- Source Code: https://github.com/JiewiW/dsh-cot-anchor
- Current Package Version: 0.2.4 (MIT)
The plugin runs with the permissions of the current DSH process; please review the repository source code and license yourself before installation.
Core Features¶
Conclusion Backflow (Enabled by Default)¶
After every tool result is returned, the plugin extracts established conclusions from the latest thought (default max 3 items, each ≤ 220 characters), appends them as a user role after the tool result and before the next request, and writes them to the session log at the tail. It does not rewrite existing content, thus preserving prefix cache.
The workflow can be summarized as:
Model Thought → Tool Execution → [Plugin] Extract established conclusions and insert back into context → Next Step Thought
↑
Inject only at tool boundaries
Conclusions are obtained by extracting sentences from thought text via rules; before entering the pool, pure discourse marker sentences and route intent declaration sentences are removed. However, it will not remove transition words like “Wait” or “Actually” from the model output; it only prevents them from being fed back as conclusions.
Generation Mid-way Interruption (Soft Cut)¶
During generation, it checks every 32 characters; upon discovering spinning, in-place repetition, pseudo-tool calls, or number streams, it can immediately cut the current request, save the generated portion as a normal message, arrange the conclusion anchors, and allow the turn to resume from the breakpoint.
The soft cut relies on the DSH kernel’s agent/soft-cut hook: Only available out-of-the-box in 0.1.5-rc.1 / rc.2; from 0.1.5-rc.3 onwards, the capability silently fails as the kernel removed the hook—refer to the settings page display, do not assume it is working just because the switch is on. For new kernels, the bundled tool can be used to port the soft-cut mechanism (see “Compatibility and Soft-cut Kernel” below).
Both mechanisms take effect within a single step boundary: the soft cut only looks at the current generation stream, and the count resets to zero upon entering the next step; it treats intra-stream redundancy but cannot treat cross-step back-and-forth running.
Installation and Activation¶
The following uses the official installation command from the README (replace <your-profile>):
dsh plugin --profile <your-profile> add github:JiewiW/dsh-cot-anchor#v0.2.4
After restarting the DSH instance, if the “COT Anchor” tab appears on the settings page, it indicates the plugin is loaded. Conclusion injection requires no configuration; whether soft cut requires additional kernel support is subject to the prompt on the settings page.
Peer dependencies (from package.json): @deepseek-ai/dsh is >=0.1.5-rc.1 <0.2.0 || >=0.2.0-rc.1 <0.3.0-0.
Typical Usage and Setup Essentials¶
Most scenarios work fine with defaults. The “COT Anchor” section on the settings page has 61 items, displayed in groups; only common items are listed below.
Master Switches¶
| Key | Default | Description |
|---|---|---|
enableToolInject |
On | Inject conclusion anchors after tool results; this is the main value |
enableSoftCut |
On | Allow mid-generation interruption; automatically invalid if kernel does not support it |
enableExecDisciplineBlock |
On | Command execution discipline reminder; since v0.2.1, uses a fixed runtime context snapshot segment (once per turn), no longer stacking linearly by tool count |
Soft Cut Judgment (Can be disabled individually)¶
When all are disabled, the plugin only performs conclusion injection. The five items correspond to: enablePseudoTool (pseudo-tool call text), enableRepeat (byte-by-byte repetition), enableChurn (“re-analysis” with different wording), enableTransition (transition sentences, easy to misjudge), enableNumberRunaway (long number streams).
If interruptions are too frequent: first turn off enableTransition, or raise thresholds like churnMinHits (default 18). Since v0.2.4, the transition sentence judgment includes softCutGapThreshold (default 80), used to reduce “small conclusion + subsequent analysis + transition declaration” from being cut off halfway.
Anchor Content¶
| Key | Default | Description |
|---|---|---|
minReasoningChars |
250 | Do not extract if thought is shorter than this length |
maxPoints |
3 | Maximum number of conclusions |
maxPointChars |
220 | Character limit for a single conclusion |
Optional enableLlmRefine (default Off): An extra call to a small model per assistant turn to refine conclusions; if provider/model is left blank, it follows the current session. CoT harvesting related items (enableHarvest etc.) are all off by default; enabling them retains thought text locally, please assess privacy before use.
Cost and Capability Boundaries¶
Default with only conclusion injection: one short message after every tool result, upper limit approx. 660 characters (3×220), no extra model calls; the injected block enters subsequent requests with the context, occupying a small amount of window at every step, but since it appends to the tail without rewriting the prefix, it can participate in cache hits except for the first occurrence. The README provides a measured explanation of injection ratio at the 0.23% order of magnitude on a long session of about 9.24 million tokens, which can be recalculated on your own session logs using messages with source.summary as cot-anchor:*.
Soft cut is pure local string calculation, zero tokens; it may increase the number of turns slightly, and does not reduce step count. Sometimes the model knows it is spinning but cannot stop—the injection assumes the model reads the context and obeys.
Privacy aspect: Conclusion injection and soft cut judgment are done locally; only LLM refinement sends thought text to the configured provider (if left blank, follows current session).
Compatibility and Soft-cut Kernel¶
| Capability | Supported DSH Version |
|---|---|
| Conclusion injection, Settings page | From 0.1.5 |
| Generation mid-way interruption (Soft cut) | Only out-of-the-box in 0.1.5-rc.1 / rc.2 |
If the settings page shows “Current kernel lacks cut capability”, conclusion injection is unaffected. If soft cut is needed, stay on the aforementioned rc versions, or use the bundled porting tool:
node node_modules/dsh-cot-anchor/tools/apply-softcut-port.mjs --check # Check status
node node_modules/dsh-cot-anchor/tools/apply-softcut-port.mjs # Apply
Restart the instance after porting; for full steps and risks, see docs/softcut-kernel-port.md in the repository.
Applicable Scenarios and Notes¶
Suitable for: DSH agent tasks with multiple tool round trips, long single-stream thought chains, and repeated “rediscovery” of the same conclusion; hoping to alleviate repetitive derivation via context engineering without changing the model.
Not suitable for or needs coordination: Cross-step back-and-forth running, step count and context bloat governance—please combine with step-governor plugins or workflow design.
FAQ: When the model seems not to have received the reminder, confirm that enableToolInject is turned on and the thought length exceeds minReasoningChars.
Conclusion¶
dsh-cot-anchor pins “established conclusions” at tool boundaries and optionally soft-cuts obvious degradation within generation streams, aiming at single-stream CoT redundancy rather than omnipotent long task optimization. The DeepSeek Harness ecosystem is based on the philosophy of “everything is a plugin”; community directories like SkillHub are independent sites and have no official subordinate relationship with DeepSeek / High-Flyer.