DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

Context Steward — DeepSeek Harness 插件(DSH Plugin)
← Plugins

@whatsmore-nf/dsh-context-steward

Context Steward

DeepSeek Harness 插件:固定上下文容量下的认知资源调度与智能压缩系统(支持 dsh plugin CLI 安装)

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add @whatsmore-nf/dsh-context-steward@0.20.0
README兼容性版本

兼容性与来源证明

Context Steward 以 @whatsmore-nf/dsh-context-steward 发布,当前版本为 0.20.0。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
any
发布来源
npm
Registry 更新时间
2026/9/20

版本

0.20.0stable
2026/8/20
0.1.5stable
2026/8/18
0.1.2stable
2026/8/16
查看其余 1 个版本收起版本
0.1.1stable
2026/8/16
最新版
0.20.0
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
551.1 kB
文件数
46
Surface
any
许可证
MIT
发布源
npm
GitHub
★ 1
周下载
11
最近提交
2026/8/20
查看源码 ↗项目主页 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录

README

@whatsmore-nf/dsh-context-steward

English | 中文

A DeepSeek Harness plugin that treats the fixed-capacity context window as a scarce cognitive resource and schedules it: within a hard token budget it protects attention bandwidth for the agent's current key decisions, tiers compression by value density, consolidates completed phases, and keeps a structured fact vault so evicted source text stays recallable.

It ships as a Cordis Service registered at ctx.contextSteward, with a schemastery-declared static Config and static inject, following the same plugin shape as the official Harness plugins (e.g. @deepseek-ai/dsh-compaction-basic).

Relationship to official compaction

Official dsh-compaction-* compacts the conversation body itself. This plugin is the complementary layer: it schedules injected memory — deduplicating repeated observations, tiered compression, phase consolidation, key-decision bandwidth guarantees, and fact recall — before the compacted snapshot is injected into the model-visible context. Both can run side by side.

Install

Via Harness plugin CLI (same as other official plugins):

dsh plugin --profile web add @whatsmore-nf/dsh-context-steward@latest

Or directly via npm:

npm install @whatsmore-nf/dsh-context-steward

The plugin needs the Harness runtime (@deepseek-ai/cordis, @deepseek-ai/dsh-agent, @deepseek-ai/dsh-llm, @deepseek-ai/dsh-session) as peer dependencies; a Harness profile already provides them.

Load

Add a row to a cordis.yml / cordis.patch.yml bundle:

- id: dsh-context-steward
  name: '@whatsmore-nf/dsh-context-steward'
  config:
    capacity: 8000
    enabled: true
    inject: true

Loading registers the ctx.contextSteward Service and wires it automatically to the Harness lifecycle events (see Events).

Config (ContextStewardConfig)

Every key is optional; missing keys fall back to the resolved defaults below. Unknown keys, wrong types, and out-of-range ratios fail plugin load (resolveConfig rejects them, mirroring official plugins).

KeyDefaultMeaning
capacity4000Token budget of the injected compressed context (the fixed bandwidth cap).
reserved0System tokens excluded from the compressible region.
decisionGuaranteefloor(capacity × 0.35)Attention bandwidth floor: max tokens the working set may occupy while a key decision is protected.
halfLifeMs600000Time-decay half-life (10 min) for recency weighting.
adaptiveRecencytrueAdapt the half-life to observed decision cadence.
minAdaptiveHalfLifeMs10000Lower bound of the adaptive half-life.
maxAdaptiveHalfLifeMs3600000Upper bound of the adaptive half-life.
adaptiveThresholdstrueSelf-tune demote/promote thresholds from churn.
churnWindowMs60000Churn observation window for threshold tuning.
tuneStep0.03Threshold tuning step.
demoteThreshold0.35Score below which working items are demoted to the cold pool.
promoteThreshold0.55Score above which cold items are promoted back to the working set.
workingRenderRatio0.5Share of the render budget given to the working set.
maxProtectedDecisions4Max protected decision snapshots kept verbatim (older ones age out).
coldCompactScore0.4Minimum score for cold-pool tiered compression.
rehydrateThreshold0.6

Usage

Service form (inside the Harness)

import type { Context } from '@deepseek-ai/cordis'
import ContextSteward from '@whatsmore-nf/dsh-context-steward'

export const name = 'context-steward'
export const inject = ['sessions']

export function apply(ctx: Context): void {
  const plugin = ctx.plugin(ContextSteward, { capacity: 8000 })
  // Optional: plug in an LLM semantic summarizer (async prewarm during pre-step idle time,
  // upgrading compression from heuristics to structured summaries)
  // plugin.asyncSummarize = async (content, depth) => await llm.complete(
  //   buildCompactionPrompt({ context: [content] }), { maxTokens: depth >= 3 ? 160 : 80 },
  // )
}

The Service is available as ctx.contextSteward; per-session schedulers are obtained with ctx.contextSteward.scheduler(session).

Standalone form (demo / unit tests, no Harness runtime)

import { createContextStewardPlugin } from '@whatsmore-nf/dsh-context-steward'

const plugin = createContextStewardPlugin({ capacity: 8000 })
plugin.hooks.onAppend?.({ id: 'u1', kind: 'user', content: '目标是部署服务', timestamp: 0 })
plugin.hooks.onDecision?.({ goal: '部署服务', currentStep: '选型', attentionFocus: ['部署', '服务'] })
const prompt = plugin.hooks.onBeforePrompt?.() // 注入压缩后的上下文

Scheduler core

CognitiveResourceScheduler is exported standalone: ingest(), checkpoint(), setPhase(), consolidatePhase(), compiledContext(), query(), exportArchive(), exportState() / restoreState() — see the type declarations for the full surface.

Events

When enabled is true, the plugin subscribes to:

EventPurpose
session/eventFeed model-visible user/assistant/tool events into the scheduler (dedupe, tiered compression, fact extraction, bandwidth accounting). Self-injected compressed context is skipped.
agent/pre-stepTreat the upcoming step as a key decision: attention re-ranking, then inject the compressed snapshot.
agent/request-errorOn CONTEXT_WINDOW_EXCEEDED failure, feed the overflow as an observation so the next snapshot perceives it.
agent/disposedExport the archive, log closing metrics, and release the session state.

License

MIT

Archive score threshold for rehydrating facts back into the working set.
dedupetrueAggregate repeated observations into repeated ×N records.
consolidatetrueConsolidate a finished phase into one structured summary.
renderBudgetavailable capacityToken cap of the rendered injected context.
maxItemChars6000Source-text truncation cap per tool/observation item (full text stays in the vault).
reclaimPeekLimit16Candidate peek count for value-density reclamation.
enabledtruefalse registers the Service only, without event wiring.
injecttrueEnable injecting the compressed snapshot (still gated by injectThresholdRatio).
injectThresholdRatio0.8Injection engages only when measured session pressure totalTokens >= floor(window × ratio) — the same trigger semantics as the official compaction's thresholdRatio. Below it the plugin only keeps invisible in-memory bookkeeping, so normal reasoning steps are not disturbed.
injectContextWindow0Explicit context-window override (tokens). 0 = resolve from the routed model adapter's contextWindow; when the window cannot be resolved and no override is set, injection is conservatively skipped.