Preface¶
When developing agents, DSH typically breaks a large task into many small tasks (the entries in the todo_write list). These small tasks vary in nature: some are planning/decomposition, some are writing functions, and some are just renaming. Using DeepSeek’s high reasoning level (max) uniformly wastes tokens, while using a low level uniformly can easily cause errors when encountering complex logic. The dynamic-thinking-chain plugin monitors the context before each model request and, based on the difficulty of the small task currently being performed, automatically selects the most appropriate reasoning level.
Plugin Overview¶
- Name:
dynamic-thinking-chain - Description: A DSH plugin that enables DeepSeek models to “think automatically based on task difficulty”
- Maintainer: LovelyDazai
- Category: Model Inference
- License: MIT
How It Works¶
The plugin intervenes before each model request by listening to the agent/request waterfall stream and modifies only the reasoningEffort field. It analyzes signals such as the in_progress small task text in todo_write, the latest human instruction, and the number of tool errors to calculate task difficulty, then maps it to the four levels: off/low/high/max.
Installation¶
- Go to the plugin directory and pack it:
cd dynamic-thinking-chain
npm pack
- Install it to the specified profile:
dsh plugin --profile desktop add file:D:/workplace/dynamic-thinking-chain/dynamic-thinking-chain-0.1.2.tgz
After installation, restart the DSH process (for the desktop version, exit the background process first and then open it; for the Web version, restart `dsh web`).
Configuration¶
Override the configuration in C:\Users\<you>\.dsh\profiles\<profile>\cordis.patch.yml:
- id: dynamic-thinking-chain
config:
enabled: true # 总开关
lowThreshold: 0.30 # 难度分 < 0.30 → low
highThreshold: 0.60 # 难度分 < 0.60 → high,否则 max
debug: false # 打印决策细节
Commonly used configuration options also include baseScore, lengthSteps, hardWeight, hardKeywords, etc. For details, see DEFAULTS in src/classifier.js.
Reasoning Levels and Use Cases¶
The plugin automatically assigns the following levels based on task difficulty:
max: Deepest thinking- Use cases: planning/decomposing large tasks, algorithms, concurrency, security, troubleshooting/debugging
high: Relatively deep thinking- Use cases: writing functions, unit tests, changing code, writing documentation
low: Light thinking- Use cases: trivial small tasks such as printing Hello World or renaming
off: Thinking disabled- Use cases: disabled by default (DeepSeek limitation, see Notes below)
Notes¶
- Model compatibility: The plugin only takes effect for models that “support reasoning levels”. Make sure the current session model is from the DeepSeek series (e.g.,
deepseek-v4-pro,deepseek-v4-flash); otherwise, it will be automatically skipped. - DeepSeek session restriction: According to DeepSeek rules, turning off thinking mid-session returns
INVALID_REQUEST. Therefore, the plugin does not use theofflevel by default (unless it is the first request of the session). - Zero dependencies: The plugin itself has zero runtime dependencies.
Conclusion¶
By dynamically adjusting reasoningEffort, the plugin maintains quality for complex tasks while reducing overhead for simple tasks. To view the complete list or source code, visit the directory page or the GitHub repository.