deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
PROJECT README
A DSH (Cordis) plugin that auto-compacts a conversation after the current task finishes, whenever context pressure crosses a threshold you set (default 50% of the routed model's context window). Install it and stop manually clicking "compress" — and stop letting the context (and the bill) grow unchecked.
In a long conversation the model re-receives the entire history on every turn. As the conversation grows, this bites harder and harder:
/compact or the UI compress button works, but you have to remember to use it — and people only remember once things are already slow and expensive, after several huge turns have been paid for.dsh-compaction-basic only fires at 80% of the context window, and only at a step boundary while a task is running — by then you've already paid for several enormous requests, and the compaction interrupts work in progress.This plugin automates the "remember to compress" chore: after each task finishes (the agent returns to idle) it checks the pressure and compacts at your chosen threshold — dealing with cost before it hurts, not after.
Built-in dsh-compaction-basic |
This plugin | |
|---|---|---|
| When | At each step boundary (agent/pre-step), mid-task |
After the task fully finishes (agent returns to idle) |
| Threshold | thresholdRatio 0.8 (fixed) |
thresholdRatio user-set, default 0.5 |
| Role | Last-resort mid-task safety net | Routine "slim down between tasks" |
The compaction itself is identical to /compact: it calls ctx.compaction.compactNow(), produces one <compacted-summary> checkpoint, and the conversation UI shows the usual "compacted N history items" card.
dsh-base), which provides dsh-compaction-basic, dsh-token-meter, dsh-agent and dsh-llm.Copy this package into the profile and make it resolvable from the profile's node_modules (same way dshmarket is installed):
# from the DSH home, e.g. C:\Users\you\.dsh\profiles\desktop
Copy-Item -Recurse <path-to>\dsh-compact-after-task .\plugins\dsh-compact-after-task
New-Item -ItemType Junction -Path .\node_modules\dsh-compact-after-task -Target .\plugins\dsh-compact-after-task
Add the plugin row to the profile's cordis.patch.yml (your user patch layer, applied after every bundle layer):
- insert:
- id: compact-after-task
name: 'dsh-compact-after-task'
config:
enabled: true
thresholdRatio: 0.5
Declare the dependency in the profile's package.json so a later pnpm install does not prune it:
"dependencies": {
"dsh-compact-after-task": "file:plugins/dsh-compact-after-task"
}
Restart DSH Desktop for the profile change to take effect.
| Key | Type | Default | Meaning |
|---|---|---|---|
enabled |
boolean | true |
Master switch. |
thresholdRatio |
number (0.05–1) | 0.5 |
Compress when pressure reaches this fraction of the routed model's context window (0.5 = 50%). |
onlyRoots |
boolean | false |
Only compress top-level conversation agents (skip background subagents). |
Set it from "the max per-turn re-send you can tolerate ÷ the model's context window":
Tune by feel after a couple of long tasks: compressing after every little task / summaries getting coarse → raise it; still re-sending hundreds of thousands of tokens per turn → lower it. Edit thresholdRatio in cordis.patch.yml and restart.
agent/status event and acts only on the idle transition — i.e. the current task's drive has fully drained. This is the "compress after finishing the current task" moment; it never interrupts a running task.tokenMeter.measure(session).totalTokens vs contextWindow × thresholdRatio (context window resolved via llm.resolveModelInfo).ctx.compaction.compactNow(agent, signal) call — the same operation /compact runs; compactNow reserves next-turn admission, so queued messages are correctly deferred until the compaction finishes.busy (agent busy / a compaction already running) and cancelled are skipped; anything else is logged as a warning without disturbing agent lifecycle events.npm install
node test-compact-after-task.mjs
The unit test stubs the services and covers: idle + above threshold compacts, below threshold does not, running does not, busy is silent, disabled does nothing, onlyRoots filters subagents.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。