dsh-session-policy

中文文档
0.5.3发布于 2026/11/03MITES Module

MiOpIIk: session-scoped hard rules (session_rule) and DSH seam/token diagnostics (session_doctor) — the model-visible surface DSH deliberately withholds. Named recovery points moved to dsh-agent-rewind.

原始使用文档
文档目录6 节
  1. Install
  2. Tools
  3. What each tool actually adds
  4. Not in scope
  5. Retired upstream conditions
  6. License

dsh-session-policy

MiOpIIk's session-scoped rules and diagnostics for DeepSeek Harness (DSH). Native-first: DSH already provides the primitives, so this package only adds the model-visible surface DSH deliberately withholds.

Depends on dsh-agent-rewind (the named recovery ledger), so one install brings both.

Install

dsh plugin --profile <profile> add dsh-session-policy

Restart DSH afterwards.

Tools

ToolParametersBehavior
session_ruleaction! ∈ inject | show | clear, text?Injects / shows / revokes a hard rule that applies only to the calling session, registered through agent.ctx.systemPrompt.section. Memory-only, zero files, revocable with one call.
session_doctormode! ∈ seams | stats, sessionId?seams: probes DSH seam availability with real non-destructive calls and writes .dsh/memory/capabilities.md. stats: reads the tokenUsage projection (uncached input / cache read / cache write / output).

No tool surface: rule cleanup on agent/disposed plus an ctx.effect backstop, and a one-shot seam probe for root sessions on agent/created.

What each tool actually adds

session_rule — DSH's systemPrompt.section() is a plugin API, and the upstream README states plainly that "there is no end-user prompt-editing API". The persistent alternative, AGENTS.md, is a global, cross-session, on-disk document; it cannot express "applies to this session only, and can be revoked right now". That gap is what this tool fills.

session_doctor(seams) — the native cordis_inspect_* tools report API shape and state explicitly that they "cannot invoke business Service methods". This mode performs real non-destructive calls (sessions.list(), sessionPersistence.open() + read()) so a seam reports two evidence levels: present (the primitive exists) and invoked-ok (a real call succeeded). It also writes the manifest to disk so a whole team — and you — can inspect it, not just the one model that ran the query.

session_doctor(stats) — dsh-token-meter registers tokenUsage, contextPressure and contextBreakdown; dsh-session-stats registers sessionStats. Upstream documents both as registers nothing model-facing. This mode is the only model-visible path to those counters, and it works for any sessionId including child sessions and cold (disposed) ones.

Honest scoping: stats is not filling a capability gap in the way the other two do — it is only adding a model-facing view over a reading DSH already exposes to clients and the compactor. If this package is ever cut to the bone, delete that mode first.

Not in scope

Everything DSH already provides positively is out of scope, even when it could be done differently: subagent dispatch and lifecycle, Agent Teams and the shared task board, model authorization and allowlists, session persistence and crash recovery, session search and traces, skill catalog / discovery / loading, sandbox and approval policy, permission presets, compaction, plan mode, goals and todos, workflow orchestration, the Ralph loop, plugin inventory and config editing.

Retired upstream conditions

Remove a piece as soon as DSH opens the corresponding door — never adapt it:

  • DSH exposes a session-level prompt editing entry point → delete session_rule
  • DSH adds a model-facing surface for token projections → delete session_doctor(stats)
  • DSH adds a model-visible sessions.fork tool → delete dsh-agent-rewind entirely

License

MIT

版本与发布记录

dsh-session-policy 共发布 5 个版本,首次发布于 2026/10/13;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.5.3latest2026/11/03今天
0.5.22026/10/2113 天前
0.5.12026/10/1321 天前
0.5.02026/10/1321 天前
0.0.0-stage2026/10/1321 天前

关于 dsh-session-policy 的常见问题

dsh-session-policy 是什么?

MiOpIIk:会话范围内的硬规则(session_rule)和DSH接缝/令牌诊断(session_doctor)——DSH故意保留的模型可见表面。已命名的恢复点移动到dsh-agent-rewind。

如何安装 dsh-session-policy?

在项目目录运行 npm install dsh-session-policy,或使用 pnpm add / yarn add / bun add。

dsh-session-policy 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dsh-session-policy 是否存在。

dsh-session-policy 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

dsh-session-policy 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.15。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

dsh-session-policy 可以商用吗?

dsh-session-policy 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

dsh-session-policy 还在维护吗?

最新版本 0.5.3 发布于 2026/11/03(今天);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/10/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。