overact/dsh-multi-window-context-management ↗★ 2

dsh-multi-window-context-management

Windowed context handoffs on top of DeepSeek Harness (DSH) native compaction, with session-private notes and paged history recall

包名
dsh-multi-window-context-management
兼容性
待验证
Harness 依赖范围
>=0.1.7-alpha.1 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0
版本
0.7.0
许可证
MIT
最近更新
2026年11月9日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add dsh-multi-window-context-management

Usage

/ctx toggles the plugin; /compact runs DSH's native compaction, which then opens a new window. The toggle applies to every session of the running DSH instance, not to a single chat tab.

When the model calls new_context it gets back requested, not a reset: the switch is scheduled for the next safe step boundary, after the current step's tool results are fully written to history. Explicit switch requests are honoured even when DSH's auto compaction is off. A preset with no compaction engine refuses new_context with a clear error, while the notes/history tools stay usable.

The web "Context management" settings page uses DSH configForms and shares its backend setting with /ctx. Read failures, read-only connections and failed saves are never shown as a successful toggle. Settings changes need no restart. Every registration goes through the Cordis lifecycle, so a hot swap (dispose + re-apply) removes all five tools, the /ctx command, the prompt section, both listeners and the contextWindows service (session state and settings, read by other plugins such as dsh-autocompact), then re-installs exactly one of each while notes are rebuilt from their durable store. DSH's hmr entry watches only its configured root directories, so add this plugin's lib there to reload on source edits; otherwise reload the plugin or restart DSH, then refresh the page after upgrading the plugin code.

Configuration

- insert:
    - id: context-management
      name: 'dsh-multi-window-context-management'
      config:
        enabled: true
        overrideCompaction: true
        injectTools: true
        lazyTools: true              # notes/history appear after the first rotation
        defaultStrategy: window      # or native: models not listed in modelPolicies get no window messages
        modelPolicies: []            # e.g. [{ provider: deepseek, model: deepseek-chat, strategy: native }]
        handoffMaxChars: 6000        # 4000–32000
KeyDefaultMeaning
enabledtrueEnable context management for every session of this DSH instance; this is what /ctx toggles
overrideCompactiontrueAppend the window message after each native compaction and open a new window
injectToolstrueProvide the notes/history/new_context tools; when off, compaction is purely native
lazyToolstrueOffer notes/history only after the session's first window rotation; false keeps all five tools from the start
defaultStrategywindowDefault strategy; native makes unlisted models compact natively without window messages
modelPolicies[]Per exact provider/model strategy overrides; the first match wins
handoffMaxChars6000Maximum characters of the window message, not counting the native summary

injectTools: false removes the tools and leaves compaction purely native, so history is never trimmed without a way to recover it. overrideCompaction: false keeps the notes/history tools while compaction runs without window messages; new_context is then refused.