Preface¶
In DeepSeek Harness (DSH), assistant outputs are routed based on the blockType reported by the provider: a chunk of content goes either into the “Thinking” area or the “Answer” area. If the provider marks reasoning as ordinary text, or writes the entire response into the reasoning field, the interface, conversation storage, and subsequent replays will show misaligned data—this is not a problem that the frontend rendering can fix alone.
Below is the community plugin dsh-thinking-channel-guard (maintainer laoyingfuhuole). It hooks into the outermost layer of the llm/stream waterfall, correcting channel markers within the stream so the fixed content aligns with the interface, records, and replays. Categorically, it belongs to the “Model Reasoning” class of DSH plugins; the project is released under the MIT license and has no affiliation with DeepSeek Harness.
What is it¶
dsh-thinking-channel-guard is a channel repair plugin for DeepSeek Harness: taking thinking that leaked into the text channel back to the thinking channel, and showing replies that were entirely written into thinking as replies.
The plugin modifies the blockType criterion in the stream, rather than modifying the displayed text post-hoc. The README documents the current status as v1.3.0; when the author replayed 83 sessions and 8,077 recorded assistant messages locally, it fixed 77 messages with 0 block reorders, and the rest were byte-for-byte identical (see the “Evidence” section of the repo README; numbers may differ from your environment).
The three categories of problems it fixes¶
| # | Phenomenon | Criterion (Summary) |
|---|---|---|
| 1 | A whole block of thinking appears in the answer area, often starting with tags like <thinking> |
Text block starts with a thinking tag or fenced code ```thinking |
| 2 | Thinking is cut off mid-way, and the continuation appears in the answer area without markers | The previous block was reasoning and the sentence ended abruptly; the current text block starts with punctuation that cannot begin a sentence |
| 3 | The entire block of answer is in the thinking area, invisible after folding | Ends with stop, no text, no tool calls, and thinking text >= 40 characters |
The second category is often just two adjacent blocks in the logs, with the punctuation position being the only clue—especially common when the model turns off the reasoning channel and continues outputting the remaining thinking as text.
Core Rules and Behavior¶
Five rules are enabled by default and can be individually disabled via the configuration file:
| Rule | Default | Effect |
|---|---|---|
tagRouting |
On | Text blocks starting with thinking tags are sent entirely as reasoning |
continuationRouting |
On | Text blocks continuing a previous thinking block are sent as reasoning |
deliberationRouting |
On | Text blocks meeting conditions like a “deliberative tone” are sent as reasoning |
stripTags |
On | Removes tags only from blocks just reassigned; visible text is not rewritten |
answerRescue |
On | When an answer is left in the thinking channel, a copy of the text is sent, while the thinking line retains the original |
Healthy traffic is forwarded byte-by-byte per README instructions: no block reordering, no text correction, no synthesis of new blocks. The repaired stream will discard the adapter’s replayState, and Harness will treat it as a degraded replay, which is expected behavior.
Installation and Enablement¶
First install in the DSH Plugin Market (local profile). The installation identifier comes from the repo README:
github:laoyingfuhuole/dsh-thinking-channel-guard
It tracks main by default; to pin a version, add a tag after the identifier, for example #v1.1.0.
For development, you can also use the plugin manager to point to a local directory:
plugin_manager({ action: "install_bundle", target: "/path/to/dsh-thinking-channel-guard" })
After installation, Thinking Channel Correction should appear in the DSH “Plugins” page. If a record with guardVersion appears in ~/.dsh/thinking-channel-guard.log, the plugin is loaded. Uninstalling or reinstalling will reload the module; old sessions already open in the host need to wait for the next startup to load the new module.
package.json requires Node >=22.19, DSH >=0.2.2-rc.1 <0.3.0.
Configuration and Logs¶
Config file path: $DSH_HOME/thinking-channel-guard.json. It auto-reloads on modification (mtime + size) without restarting DSH (behavior subject to current Harness).
{
"version": 1,
"rules": {
"tagRouting": true,
"continuationRouting": true,
"deliberationRouting": true,
"stripTags": true,
"answerRescue": true
},
"dryRun": false,
"trace": false,
"sessions": { "session-xxxx": { "tagRouting": false } }
}
dryRun: Only logs “what would be fixed”, forwards the stream as-is, useful for observation without changing output.trace: Writes a log line for every model call, used to confirm the plugin is running (default off).sessions[sessionId]: Overrides arbitraryruleskeys anddryRun/tracefor specific sessions.
Repair log: $DSH_HOME/thinking-channel-guard.log, appended JSON Lines, stops appending after 4 MiB. repairs[].kind includes reasoning-in-text-channel, reasoning-continuation, answer-rescue, markup-stripped.
Typical Usage¶
- Install the plugin and confirm
guardVersionappears in the logs. - If you only want to observe without changing output, set
dryRuntotrue, and comparerepairsin the logs with the interface behavior. - If a provider refuses to accept blocks reassigned as thinking during replay, you can disable
tagRoutingfor that session insessions(see “Limitations” section of README).
The repo provides node --test (34 test cases) and node scripts/audit.mjs <unzipped session directory> for auditing local session libraries; the latter requires you to prepare the session directory yourself and is not a required step after installation.
Applicable Scenarios and Notes¶
Who it’s for: DSH users who frequently use multiple providers and have encountered thinking/answer partition confusion, or inconsistencies between replay and the interface at the time.
Limitations (from README):
- Leaks where the provider writes no markers and sentences are self-consistent cannot be determined; README claims 0 cases in actual testing, fundamentally requiring provider-side correction.
- Historical messages before installation are not retroactively modified, only newly generated streams take effect.
- Moved blocks will enter the provider history with a thinking identity; if a provider replay rejects foreign thinking blocks, please disable
tagRoutingfor that provider or session.
Safety & Permissions: The plugin runs with the same permissions as the current DSH process. It reads/writes config and logs under $DSH_HOME and processes all model outputs via llm/stream. Please read the GitHub source code and MIT License before installing to confirm it meets your audit requirements. The community directory SkillHub Plugin Page is an independent site with no official affiliation with DeepSeek/Quant.
Closing¶
dsh-thinking-channel-guard corrects blockType according to rules at the llm/stream layer, addressing three phenomena: missed tags, untagged continuations, and replies mistakenly entering the thinking area, while maintaining byte-by-byte pass-through for healthy streams. When referring to installation identifiers, configuration fields, and limitations, refer to the repo README.
- Community Directory: https://www.skillhub.cn/plugins/laoyingfuhuole/dsh-thinking-channel-guard
- Source & Docs: https://github.com/laoyingfuhuole/dsh-thinking-channel-guard