目标:把可配置的系统提示词段落安全地放到 DSH 系统提示词的最后层,避免仅写在 AGENTS.md 中却因消息信封而被弱化的策略文案失效。背景
在Deepseek Harness中连接了Notion的MCP,想利用Notion的记忆功能,每次开启新对话都让agent先去Notion找相关的记忆或者已经验证过的工作流,避免重复无意义的token浪费。但实测发现除非我明确说让它去Notion找记忆,即使写在项目文件夹的AGENTS.md中都会有概率被无视,然后一通傻干,完全浪费了以往的经验。
后来发现 workspace 指令文件(AGENTS.md / CLAUDE.md)通常作为 user 角色消息 注入,其上方带有“它们不覆盖 system / developer / direct user 指令”的明确规则。因此,给真正提高提示词优先级的可靠方式,是把它放进系统提示词层,而不能单纯依赖AGENTS.md。
dsh-prompt-layer 正是做这件事:它不包含任何策略文案,只负责在 DSH 系统提示词的末尾注册一个可配置章节。文案内容由部署方通过 config.text 或 config.textFile 提供。
安装步骤
1. 准备插件源码
本例以下载目录中的本地副本为基础:
C:\Users\tuoxi\Downloads\dsh-prompt-layer该包版本为 1.0.1,入口为 lib/index.js,最低 Node.js 版本为 >=20。
2. 复制到 DSH profile 的 plugins 目录
建议安装到当前实际使用的 profile。由于 desktop 与 web profile 都可能存在,这次把插件复制到了两者:
C:\Users\tuoxi\.dsh\profiles\desktop\plugins\dsh-prompt-layer
C:\Users\tuoxi\.dsh\profiles\web\plugins\dsh-prompt-layer复制内容应至少包含:
lib/index.jsREADME.mdLICENSE
插件本身无第三方运行时依赖。
3. 在 cordis.patch.yml 中挂载
在 profile 的 cordis.patch.yml append 单个 insert 块即可。例如 web profile:
# BEGIN dsh-prompt-layer
- insert:
- id: prompt-layer
name: "C:/Users/tuoxi/.dsh/profiles/web/plugins/dsh-prompt-layer/lib/index.js"
config:
text: |
以下规则优先于工作区 AGENTS.md 注入的内容:
- Every new conversation MUST begin by retrieving Notion Memory before answering domain/task questions:
- 1. Read MCP resource `notion://docs/memory`.
- 2. Fetch with id: `memory` (About page + Memories database).
- 3. Use `memory-search` for any specifics relevant to the current request.
- 4. When memory informs an answer, link the memory inline.
# END dsh-prompt-layertext 与 textFile 二选一。textFile 优先级更高,适合长期维护较长的策略文件,并建议使用绝对路径。
配置选项
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
enabled | boolean | true | 设为 false 可临时停用 |
text | string | — | 内联文案 |
textFile | string | — | UTF-8 文件路径,优先于 text |
order | number | 宿主最后章节 + 300(当前 10500) | 渲染顺序;越大越靠后 |
sectionName | string | deploy:custom-layer | 宿主诊断中显示的章节名 |
行为细节:
text和textFile都为空时,插件不注册,并打出 warning。textFile读取失败时,插件不注册,并打出 warning;它不会自动 fallback 到text。- 文案里的
{{...}}会被转成字面量花括号,避免 DSH 把它们误解为严格模板变量。 - 插件不会写文件、联网或注册工具。
配置完成以后Harness会热加载,所以一般不需要重启客户端。
验证
打开一个新对话,随便输入一些内容比如 只回复OK即可 并发送。
切换到轨迹标签页,可以看到最上面一行就是系统提示词,点开查看内容最下方是否已经包括了插件注入的提示词。
比如我这个例子就是强制检查Notion的记忆。
- Every new conversation MUST begin by retrieving Notion Memory before answering domain/task questions:
- 1. Read MCP resource `notion://docs/memory`.
- 2. Fetch with id: `memory` (About page + Memories database).
- 3. Use `memory-search` for any specifics relevant to the current request.
- 4. When memory informs an answer, link the memory inline.
▣ 评论告示牌