xiamubumu/dsh-context-reclaim ↗★ 0
dsh-context-reclaim
在工具结果生成和上下文增长时进行无损去噪 适合需要精简上下文、折叠工具定义以提升模型长文本处理效率的场景。
安裝
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:xiamubumu/dsh-context-reclaim說明文件
閱讀完整 README ↗Configuration
The configuration file is the profile's cordis.patch.yml:
- id: reclaim
config:
enabled: true
noise: true
bounded: true
stripLines: false
noOpGuardRatio: 0.05
maxInlineBytes: 50000
attribution: true
trimSections: false
foldTools: true
activePlugins: []
| Key | Type | Default | Effect |
|---|---|---|---|
enabled | boolean | true | Master switch (!== false counts as on) |
noise | boolean | true | Lossless purification (ANSI / trailing whitespace / CR) |
bounded | boolean | true | Bounding by content type + retrieval pointer |
stripLines | boolean | false | Strip line-number prefixes |
noOpGuardRatio | number | 0.05 | The "only act if it saves enough" threshold for bounding, 5% |
maxInlineBytes | number | 50000 | Above this byte count, content goes to spill (spill plugin required) |
readOnlyTools | string[] | see the table above | Read-only tool list, a full-table replacement |
sideEffectTools | string[] | see the table above | Side-effecting tool list, a full-table replacement |
faithfulTools | string[] | see the table above | Faithful tool list, a full-table replacement |
attribution | boolean | true | Print the [reclaim/usage] attribution line |
trimSections | boolean | false | Section trimming (note: the real gate is the environment variable DSH_RECLAIM_SECTION_TRIM, see below) |
foldTools | boolean | true | Fold the tool definition surface |
activePlugins | string[] | [] | Plugin list participating in section-ownership computation |
⚠️ The value of the
trimSectionsoption does not actually open the gate — the gate in the code only honours the environment variableDSH_RECLAIM_SECTION_TRIM, and it additionally requiresactivePluginsto be non-empty. The old documentation got this one wrong; it is stated accurately here.
Common environment variables
There are more than 40 environment variables in total, covering every internal threshold. Grouped by function, the most commonly used ones are:
| Variable | Default | Effect |
|---|---|---|
DSH_RECLAIM_NOISE | 1 | Set to 0 to turn off lossless purification |
DSH_RECLAIM_BOUNDED | 1 | Set to 0 to turn off bounding |
DSH_RECLAIM_STRIP_LINES | 0 | Set to 1 to strip line numbers |
DSH_RECLAIM_TOOL_FOLD | 1 | Set to 0 to turn off tool definition surface folding |
DSH_RECLAIM_PROMPT_LINE_MAX | 120 | Truncation threshold for a single system-prompt line |
DSH_RECLAIM_DEDUP_DENY | 1 | Set to 0 to turn off duplicate-edit interception |
DSH_RECLAIM_SECTION_TRIM | 0 | Set to 1 to turn on section trimming (works together with activePlugins) |
DSH_RECLAIM_STABILIZE | 1 | Set to 0 to turn off prefix stabilization |
DSH_RECLAIM_WRITABLE_REQUEST | 1 | Set to 0 to stop taking over llm.streamWithRegistration (see section 8); the official dsh-llm patch is only needed if you turn this off |
DSH_RECLAIM_PATCH_CHECK | 1 | Set to 0 to silence the one-line "official patch check" notice printed at startup |
DSH_RECLAIM_LOG | 1 | Set to 0 to turn off this plugin's log output |
DSH_RECLAIM_DUMP_SYSTEM | 0 | Set to 1 to dump the assembled system prompt to a temporary directory, for diagnosis |
The remaining threshold variables (sampling line counts, budget observation, pollution-detection window, archive limits, reasoning stripping, etc.) each have a per-item comment at the top of the source.