Introduction¶
In DeepSeek Harness (DSH), long sessions continuously accumulate history within the context. The official system triggers compactIfNeeded when token pressure becomes sufficiently high, retaining the tail within a budget and compressing earlier content into a summary. If you are more concerned with “conversation turns” rather than token curves—for example, if you want to proactively compress old history after a certain number of real user questions while fixedly retaining the original text of the recent few turns—you need to attach a floor-counting trigger logic to the harness. Below is an introduction to the community plugin floor-limiter (maintained by MengXinSu, GitHub repository MengXinSu/floor-limiter). It implements “floor rolling + summary compression” on the DSH session, sharing the same ctx.compaction engine as the official pressure-based compression.
What is this¶
floor-limiter is designed for DeepSeek Harness. It inspects surface history at the agent/pre-step boundary—just before a user question enters and the assistant reply begins. When the number of real user floors reaches M, it retains the original text of the most recent N floors and compresses the earlier range into a single summary. The plugin is categorized as “Memory”; the current repository version is 0.1.4, and the license is MIT. Directory page: SkillHub - floor-limiter.
Core Parameters & Mechanism¶
M and N¶
- M (
triggerFloors, default 20): Triggers a compression when the surface accumulates M real user floors. One floor = one user question + all replies and tool calls triggered by it (multiple transcript nodes still count as one floor). - N (
keepFloors, default 5): Retains the original text of the most recent N floors upon triggering, compressing only the earlier range.
Floor counting is based on user/message where source.kind === 'user'. Plugin source nodes generated by summary replacement do not count towards the floor count, preventing compression results from triggering further compression.
Execution Flow (pre-step)¶
- Count the number of real user floors on the surface.
- If the floor count ≥ M, select the range: retain the most recent N floors, and set the compression boundary from the surface head to “before the Nth floor”.
- Call
ctx.compaction.compactRegion(start, end, agent, signal)to generate the summary. - If any step fails (unbalanced boundaries, compression already in progress, summary not smaller than original, cancellation, etc.), skip this round without interrupting the conversation; retry in the next pre-step.
Relationship with Official Compression¶
These are not two independent systems: The official system calls compactRegion via compactIfNeeded under token pressure; floor-limiter directly calls the same compactRegion when the floor count is met. They share the compression lock (compaction/start); if triggered simultaneously, it follows a first-come-first-served basis, and the later requester skips this round. The enabled setting only disables the floor trigger and does not affect official pressure-based compression.
Retention Semantics (Common Point of Confusion)¶
- Range selected by the plugin:
compactRegiononly validates boundaries and tool-pairing; it does not modify the range again. “Keep N floors” is the output of the plugin’sselectCompactionRange(in the README example with M=20, N=5, it compresses the first 15 floors, asserted bytests/selftest.ts). - “Floors” are user turns, not message counts.
- Extreme boundaries: If the start point of the Nth floor falls next to an unpaired tool call, the plugin will backtrack to the left to find a balanced boundary before compressing. This may result in actually retaining N-1 floors, prioritizing safety.
Settings¶
Path: Settings → Floor Limiter (independent entry on the left).
| Configuration Item | Meaning |
|---|---|
enabled |
Whether to enable floor triggering |
triggerFloors |
M |
keepFloors |
N |
The above items take effect online: After modification, the new values are used in the next pre-step without needing to restart the DSH process.
Installation & Activation¶
This plugin is attached to the profile via local vendor (the README uses the web profile as an example). The package.json declares compatibility with DSH >=0.1.7-rc.1 ranges, and profiles is currently web; Node >=20.18 is required. Please review the source code and LICENSE before installing; the plugin runs under DSH process permissions.
- Copy the plugin directory to:
<DSH_HOME>\profiles\web\vendor\floor-limiter\
- Edit
<DSH_HOME>\profiles\web\package.json(change both places, adding only todependencieswill not load the plugin):
"dependencies": {
"floor-limiter": "file:./vendor/floor-limiter"
}
And add the following to dsh.profile.bundles:
"floor-limiter"
- Execute in the profile root directory (not the vendor subdirectory):
pnpm install
Then restart DSH.
Runtime dependencies rely on @deepseek-ai/dsh-* services provided by the harness (settings, agents, agentPresets, compaction); no need to run npm install for business dependencies inside the vendor directory again.
Typical Usage¶
- Complete the vendor installation as described in the previous section and restart.
- Open Settings → Floor Limiter, enable
enabledas needed, and adjusttriggerFloors/keepFloors(e.g., default M=20, N=5). - Conduct normal multi-turn conversations; each user question passes through pre-step. When real user floors reach M, old history is compressed into a summary, and the recent N floors are kept as original text for subsequent reasoning.
If official token pressure compression occurs simultaneously, both share the same engine and lock, preventing double compression in the same round.
Use Cases & Notes¶
Suitable for: Long-duration, multi-turn web profile sessions where you want to control context volume using “turn limits” alongside official token compression; scenarios requiring fixed retention of the complete original text (including toolchains) of recent turns.
Notes:
- Web profile only; other profiles require self-checking against
dsh.plugin.json/ README compatibility. - Different dimensions from official compression (floors vs. tokens), can be complementary, but still subject to shared locks at any given moment.
- The community directory SkillHub is an independent ecosystem site and has no official affiliation with DeepSeek / High-Flyer; stars and versions are subject to the repository.
- Development build:
npm install,node build.mjs,npm test; after updating the client bundle, the browser requires a hard refresh to clear the cache.
Conclusion¶
floor-limiter turns “accumulate M floors of real user dialogue then compress old history, retain recent N floors of original text” into a configurable pre-step hook, sharing compactRegion with DSH’s built-in compression. If you want to manage memory by conversation turns on the harness, you can start by installing via vendor and adjusting M/N in the settings page.
- Directory Page: https://www.skillhub.cn/plugins/MengXinSu/floor-limiter
- Source Code & Documentation: https://github.com/MengXinSu/floor-limiter