Skip to content

Zhenyu98/dsh-context-doctor

103Last commit Aug 13, 2026

dsh-context-doctor DSH plugin

Context Doctor is a DSH plugin that audits the injected context in every model request. It provides a native UI panel and a model-callable tool (context_audit) to analyze instruction chains, skill catalogs, tool schemas, and MCP tools. It helps identify duplicate content, hidden skill conflicts, and token waste.

How to install the dsh-context-doctor DSH plugin

dsh plugin --profile web add "github:Zhenyu98/dsh-context-doctor#main

Copying does not run this command. Review the repository and version before installing the dsh-context-doctor DSH plugin.

dsh-context-doctor DSH plugin data source

dsh-context-doctor DSH plugin snapshot date: Aug 16, 2026

discovered

What the dsh-context-doctor DSH plugin can do

  • Quantifies token costs for instruction chains, skill catalogs, tool schemas, and MCP tools per request.
  • Detects exact duplicate blocks across files and redundant skill descriptions.
  • Identifies skill name conflicts (rank shadowing) and reports winner and shadowed skills.
  • Provides actionable trimming suggestions sorted by severity.
  • Read-only audit: never modifies files or executes audit objects.

Where the dsh-context-doctor DSH plugin fits

  • Optimize DSH session context to reduce token consumption and costs.
  • Resolve skill conflicts to ensure the model uses the correct skill definition.
  • Find and remove duplicate or redundant instructions across AGENTS.md files.
  • Evaluate MCP tool surface bloat and streamline tool configurations.
  • Continuously monitor context health during DSH agent development.

Who the dsh-context-doctor DSH plugin is for

  • Developers building AI agents on DSH and needing to audit context injection.
  • Teams managing multiple skills and tool integrations within DSH sessions.

dsh-context-doctor DSH plugin limitations

  • Duplicate detection only matches exact text blocks, not semantic similarity.
  • Token estimation is heuristic (ASCII≈4 chars/token, Chinese≈1.5 chars/token); actual counts depend on the model tokenizer.
  • Native UI replacement requires DSH's conversation.input.context slot; some DSH versions may lack it.
  • Skill body statistics are disabled by default; must be explicitly enabled.

dsh-context-doctor DSH plugin: from the repository README

Quoted from the Zhenyu98/dsh-context-doctor README, the upstream source of the dsh-context-doctor DSH plugin. Copyright remains with the original authors.

DSH 会话里,模型每个请求都自动携带一批注入物:层层叠加的 `AGENTS.md` 指令链、一百多个技能的目录摘要、几十个工具 schema、MCP 工具面。它们悄悄消耗输入 token,且经常出现跨文件重复段落、同名技能互相遮蔽、工具面膨胀——但平时没人量化,问题到上下文告警时才暴露。 | 之前 | 之后 | |---|---| | 只能靠上下文计量条猜个大概,说不清是谁在消耗 | 指令链 / 技能 catalog / 工具 schema / MCP 四项逐项给出 token 估算 | | 重复指令、重复技能描述散落在各层文件里,无人察觉 | 自动检测跨文件完全相同的重复段落、描述完全相同的冗余技能 | | 同名技能多来源并存时被静默遮蔽,模型用的是哪个要靠猜 | 报告冲突胜出者与被遮蔽者(rank shadow) | | 看到告警只能手工翻文件找线索 | 模型可直接调用 `context_audit` 拿到分节报告与按严重度排序的裁剪建议 | ## Quick Start ```sh # 1. 安装(官方 bundle 插件机制;构建产物已入库,git 源安装无需构建) dsh plugin --profile web add "github:Zhenyu98/dsh-context-doctor#main" # 2. 验证合成树含该条目 dsh --profile web --dump-config | grep context-doctor # 3. 重启 dsh web,在新会话里让模型调用 context_audit ``` 预期成功信号: ```text dsh --profile web --dump-config | grep context-doctor # - insert: # - id: context-doctor # name: 'dsh-context-doctor' ``` 重启后,在**已有会话**的发送按钮左侧出现 `Context Doctor` 原生替代控件,或模型调用 `context_audit` 返回分节报告,即安装成功。面板以英文呈现,并沿用 DSH 的浅色 / 深色 / 跟随系统主题;新会话尚未分配 `sessionId` 时不会显示会话级控件。 ## Agent Setup 把下面这段发给 Codex、Claude Code、Cursor 或 DSH 里的任意 agent: ```text 请阅读 https://github.com/Zhenyu98/dsh-context-doctor/blob/main/agent-setup.md 并按照步骤帮我安装和配置 Context Doctor(DSH 上下文注入审计插件)。 目标:装好后我能在 dsh web

Read the full READMERepository license: BSD-3-Clause

dsh-context-doctor DSH plugin questions

After installing the plugin, the circle panel does not appear. What should I do?

Restart the DSH web server and open an existing session. The panel only appears in sessions that have a sessionId assigned. Also confirm that the plugin is listed in the dump config and that the native slot conversation.input.context is available. If you modified the source, rebuild with ./scripts/build.sh.

Can I use Context Doctor in a headless/CLI environment without a web UI?

Yes. The context_audit tool works independently of the web interface. The plugin automatically skips route registration when the httpServer is not present, so it functions in headless profiles like dsh --profile headless.

Why does the audit result differ from the DSH context meter bar?

The meter bar reflects actual token counts from the model, while this plugin uses heuristic estimation (ASCII ≈4 chars/token, Chinese ≈1.5 chars/token) for relative comparison and optimization priority. For precise values, refer to the model tokenizer.

Will the plugin modify my files?

No. The audit is completely read-only. It only uses the read/stat/list subset of ctx.fs, never writes, deletes, or executes any audit object. Your files remain untouched.

How are MCP tools grouped and counted?

MCP tools are grouped by server name parsed from the mcp__<server>__<tool> naming convention. The report shows the number of tools and schema tokens per server, helping identify tool surface bloat.