Introduction¶
When running long conversations in DeepSeek Harness (DSH), context usage gradually fills up. After approaching the limit, compression triggers repeatedly: completed content is replaced by summaries, which themselves occupy context. Persisting through a single session often results in denser compression, less available context, and lower answer quality. Manually creating a new session and moving conclusions is cumbersome and prone to missing states.
The dsh-auto-relay introduced below (maintainer: LXinH3RT, community category: workflow) automatically opens a clean-context new session to continue the task after triggering a set number of consecutive compressions in a high-occupancy state. It can increment the tail number of the session title according to rules. On the browser side, it can automatically switch to the new session and archive the old one. The plugin coordinates via Host + Browser halves. Version 0.6.0, License MIT.
Overview¶
dsh-auto-relay is a DSH Host plugin: it listens for compression events in session logs and, when the usage percentage reaches a threshold and the consecutive count is met, submits a relay task to the scheduling service to create a continuation session. The new session prioritizes reading continuation instructions (e.g., session header info when used with dsh-session-continuity) via the default prompt, rather than blindly re-reading the entire old log.
- Directory: SkillHub - dsh-auto-relay
- Source Code & Docs: GitHub - LXinH3RT/dsh-auto-relay
The community directory SkillHub is maintained by the community and has no official affiliation with DeepSeek / Huansuan; installation and configuration still follow DSH’s “everything is a plugin” extension model.
Core Features¶
When to Trigger Relay¶
The plugin reads the context usage percentage at the start of compression, consistent with the conversation interface usage indicator (projectedTokens ?? pressureTokens divided by contextWindow, rounded, capped at 100%).
- Compression with usage ≥
thresholdPercentcounts as one; - Compression with usage < threshold resets the consecutive count to zero;
- Compression failure neither counts nor resets;
- Unable to measure (no usage sample or context window) neither counts nor resets;
- When the consecutive count reaches
consecutiveCount, a relay session is opened.
The counter only exists in the running process and resets to zero after restart. When persistCounter is enabled, it writes to local storage (domain: auto_relay, table: counters, one entry per session). Restart can continue counting, and records not updated for 30 days are cleaned when the storage is opened.
Identifying Which Compressions¶
Different profiles implement this differently. The plugin identifies:
- DSH built-in compression:
compaction/startandcompaction/endevents; - Profiles implementing compression as model tool calls: tool names default to contain
compressormcp__bili__compress(modifiable viacompressTools). Results starting with[Compressedare considered success; results starting with[Compression FAILED,[Compression refused,[Compression no-opor marked as error are considered failure.
Title Incrementation¶
When incrementTitle is enabled:
test-3→test-4(separatordefaults to-);- If there is no tail number, start from 1, e.g.,
test→test-1; - Supports bracket number rules, e.g.,
sessionname-2(1)→sessionname-2(2); - If there is no title or increment is disabled, use
defaultTitle(default:Auto Relay).
Relay Timing and UI Follow¶
Compression often happens mid-turn. To avoid two sessions editing the same set of files simultaneously, relay tasks are created at the end of the current turn. If the session is idle, it is created immediately. Creation failure does not silently discard eligibility; it retries at the next turn boundary.
After submission, the browser half (switchToRelay, archiveOldSession) can switch to the new session first, then archive the old one. The two halves communicate via the marker line at the end of the prompt: [dsh-auto-relay] from=… open=1 archive=1. Old submissions older than two minutes are ignored to avoid interference when reopening pages.
By default, each session relays at most once (oncePerSession), and sub-agent sessions can be ignored (ignoreSubagents).
Installation and Enablement¶
The plugin requires Node ^22.19 || >=24 and DSH >=0.1.7-rc.2. Please review the repository source code and the MIT license before installing: the plugin runs under the current DSH process permissions and will read local session logs and may write to local count storage.
Install from Git repository:
dsh plugin add git+https://github.com/LXinH3RT/dsh-auto-relay.git
Install from local checkout directory:
dsh plugin add /path/to/dsh-auto-relay
After schema changes, you must disable and re-enable this plugin on the plugin page for the settings panel to read the new fields; changing source files alone does not trigger a reload.
The master switch enabled defaults to true. Go to Settings → Plugins to open the plugin details and edit items. Changes take effect immediately after saving, no need to restart DSH.
Typical Configuration¶
The table below shows the default values and meanings recorded in the README (selected common items; full fields can be found in the repository docs).
| Field | Default | Meaning |
|---|---|---|
thresholdPercent |
50 |
Usage percentage counted in consecutive count (1–100) |
consecutiveCount |
5 |
How many consecutive compressions trigger relay (1–50) |
delaySeconds |
1 |
Delay before submitting relay task (1–3600 seconds) |
oncePerSession |
true |
Max one relay per session |
persistCounter |
false |
Whether to persist counter to local storage |
switchToRelay |
true |
Automatically switch to new session after relay starts |
archiveOldSession |
true |
Archive old session that handed over the task after switching |
promptTemplate supports placeholders {sessionId}, {count}, {percent}, {threshold}, {title}. You can rewrite it for workflows; the default strategy is to read continuation instructions at the top of the new session first, then fall back to workspace status or ask the user to confirm a single task to avoid guessing and expanding the scope.
For deployments without a UI, you can override panel-unset items via environment variables, e.g., DSH_AUTO_RELAY_ENABLED, _THRESHOLD_PERCENT, _CONSECUTIVE_COUNT, _PERSIST_COUNTER, etc. (full list in README.zh.md); variables only take effect when corresponding fields are not provided in the settings panel.
Use Cases and Notes¶
Suitable for long single-session coding, research, or writing, where the profile frequently triggers compression under high occupancy. When used with plugins like dsh-session-continuity, the default prompt path is smoother; if a scheduled task service (schedule) is missing, relay cannot be created and will warn, eligibility is retained for retry.
Optional dependency @deepseek-ai/schemastery; if missing, it runs with defaults, and the panel might not provide full switches (logs will explain). iOS and native shells do not load the browser half, so UI switching and archiving do not work, but Host-side counting and creation still function.
The replay tool provided by the maintainer can be used to verify if compression recognition for the current profile is still valid (needs to be executed in the local plugin directory and only reads the local DSH session directory, data stays local):
node scripts/replay.mjs --limit 3 --threshold 50
Conclusion¶
dsh-auto-relay turns “high-occupancy consecutive compression” from a passive drag into a configurable automatic relay that opens new sessions, with optional title numbering and UI follow, alleviating the problem of long tasks being squeezed thinner and thinner in a single session. Refer to the repository README for installation and details.