dsh-shake
通过手动指令持久化减少 DSH 对话上下文长度的插件。 适合需要手动精简上下文以节省 Token 的用户,通过发送 /shake 指令触发。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:EveGoodEvening/dsh-shake说明文档
阅读完整 README ↗Usage
-
Wait until the current session is idle, then send the following in the Web message input:
/shake -
Once you receive the confirmation “Scheduled; will run before the next model request,” the cleanup request has been saved. This does not call the model or immediately reduce the context.
-
Send your next normal message. The plugin replaces eligible older text before DSH sends the model request.
If execution has not started, you can cancel:
/shake cancel
Cancellation applies only to pending requests. It cannot undo completed replacements.
| Situation | Meaning and action |
|---|---|
| “No cleanup needed” message | There is currently no eligible text that would save tokens. No further action is needed. |
| The session is busy or under maintenance | Wait until the session is idle and retry. The command neither interrupts existing work nor queues itself. |
| A request is already pending | Each session can have at most one pending request. Repeating /shake does not reselect content. Cancel first if you want to schedule a new selection. |
| Attachments or other arguments are included | Only /shake and /shake cancel are supported; neither accepts attachments. |
Configuration
Keep the defaults unless you need to change them. To adjust settings, add a configuration override to the target profile's cordis.patch.yml. Do not insert a second plugin instance.
The default configuration is shown below:
- id: dsh-shake
config:
protectedTokens: 4000
toolTextMinTokens: 1000
assistantBlockMinTokens: 400
readDefaultLimit: 2048
readMaxLimit: 4096
| Parameter | Default | Purpose |
|---|---|---|
protectedTokens | 4000 | The amount of recent history to protect, counted using locally estimated tokens, with whole messages preserved. |
toolTextMinTokens | 1000 | A tool result is considered for cleanup only when its total text reaches this threshold. |
assistantBlockMinTokens | 400 | An individual code or XML block in an assistant reply is considered for cleanup only when it reaches this threshold. |
readDefaultLimit | 2048 | The page size for shake_read when limit is omitted, measured in Unicode code points. |
readMaxLimit | 4096 | The maximum page size allowed by shake_read, in the same units. |
The first three values must be non-negative safe integers. Pagination settings must be integers satisfying 1 ≤ readDefaultLimit ≤ readMaxLimit ≤ 4096. No other configuration fields are accepted.
Restart DSH after making changes. Requests that have already been scheduled retain the configuration and candidate fragments saved when they were scheduled.