Preface¶
When running agents in DeepSeek Harness (DSH) for extended periods, context accumulates continuously. To control token usage, the system compresses historical messages through Compact. For deployments that rely on proxy APIs and where the backend performs account or quota rotation based on Session ID, if the outbound session identifier remains unchanged, post-Compact messages may still be treated as part of the same long session, and the rotation strategy may not trigger as expected.
Below is the community plugin dsh-session-rotate-on-compact (maintainer: Hugo16, directory category: admin-security): while keeping the DSH-side session unchanged, it only generates a new outbound Session ID after Compact succeeds, allowing the proxy to recognize the next request as a new session and thereby trigger account rotation. If Compact fails, no switch occurs, and compressed historical messages are not resent.
What is this¶
dsh-session-rotate-on-compact is a session rotation plugin for DSH. According to its README, after DSH completes an automatic or manual Compact, the plugin generates a new Session ID, causing the proxy API to recognize the next request as a new session, thereby triggering account rotation.
The current version of the plugin is 0.1.0 (see the GitHub repository description), and the runtime environment requires Node.js >= 20 (see the engines field in the repository’s package.json).
Core Features¶
The following capabilities are all drawn from the “Features” section of the repository README. After installation, they take effect in the Compact flow without requiring additional configuration files (no independent configuration items are listed in the materials).
- DSH session remains unchanged — no new DSH session is created; only the outbound LLM-side session identifier is adjusted (consistent with the description in
package.json). - Switch Session ID after Compact succeeds — rotation occurs only when compression succeeds.
- Supports both automatic and manual Compact — both trigger methods follow the same logic.
- No switch on Compact failure — avoids mistakenly changing sessions in abnormal states.
- Does not resend compressed historical messages — no replay of content removed by Compact when rotating the identifier.
Installation and Activation¶
The installation command follows the GitHub README. Run in PowerShell:
pnpm dsh plugin --profile web add "https://github.com/Hugo16/dsh-session-rotate-on-compact.git"
After installation completes, restart DSH. The plugin integrates into the DSH lifecycle via a Cordis patch (cordis.patch.yml).
Typical Usage¶
The materials do not provide separate CLI examples or configuration snippets. Typical usage is: install and restart DSH, then use Compact as usual (automatic or manual). When a Compact completes successfully, the plugin automatically generates a new outbound Session ID; the next LLM request sent through the proxy carries the new identifier, which the proxy side recognizes as a new session according to existing policies and includes in account rotation.
If Compact does not succeed, the Session ID remains unchanged, and behavior is consistent with the state before the plugin was installed (no additional side effects beyond the plugin’s own hooks).
Use Cases and Notes¶
Who it’s for
- Users who use DSH for long conversations or long-running tasks and regularly rely on Compact to control context.
- Users whose outbound traffic goes through a proxy API, and whose proxy or upstream distinguishes sessions by Session ID for account rotation or multi-key scheduling.
Usage Notes
- The plugin runs under the current DSH process permissions. Before installation, it is recommended to review
index.js,cordis.patch.yml, and the license on GitHub to confirm compatibility with your environment. - The community directory page (SkillHub) has no official affiliation with DeepSeek / High-Flyer. The plugin is community-maintained; star counts and other metadata are based on the directory and repository pages (the directory shows 0 stars).
- This plugin only solves “rotating the outbound Session ID after Compact succeeds.” It does not replace DSH’s own session management, Compact strategy, or proxy-side rotation configuration.
Links¶
- Community directory: https://www.skillhub.cn/plugins/Hugo16/dsh-session-rotate-on-compact
- Source code and documentation: https://github.com/Hugo16/dsh-session-rotate-on-compact