DeepSeek Harness 插件

dsh-rules-paths

Claude Code-style `paths:` rule injection for DeepSeek Harness (DSH): inject rules from ~/.dsh/rules, <project>/.dsh/rules and <project>/.claude/rules into the model context.(英文原文)

跳到安装方式

来源信息

GitHub 仓库
Temoa/dsh-rules-paths
最近更新
2026年8月15日
分类
工具与能力
GitHub stars
1
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/Temoa/dsh-rules-paths
插件名:dsh-rules-paths
作者:Temoa

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-rules-paths

Claude Code-style paths: rule injection for DeepSeek Harness (DSH): when the model successfully reads a file that matches a rule's paths: glob, the rule body is injected into the model context at the next step boundary. It follows the official @deepseek-ai/dsh-agent-instructions mechanics (tools/result hook, agent.inbox.nextStep inbox, agent/pre-step folding, SHA-1 dedup, byte budget).

Features

  • Path rules — a rule file declares paths: glob patterns; a successful read of a matching file injects the rule body at the next step boundary.
  • Global rules — a rule without paths (or with no frontmatter at all) is injected into the first entering step of the session, independent of any file read (like AGENTS.md).
  • Project rules — optional scan of <projectRoot>/.dsh/rules and <projectRoot>/.claude/rules (Claude Code convention), keyed on the .git project root.
  • Dedup & budget — each rule is injected once per session unless its content changes (SHA-1 digest → replace); the rendered message never exceeds maxBytes and reports Rules budget … when rules are dropped or truncated.
  • Guidance, not authority — injected content is a user-role message that does not override system, developer, or direct user instructions; literal </system-reminder> is escaped.

Install

> Requires DSH 0.1.0-rc.x (Web profile).

From GitHub

dsh plugin --profile web add git+https://github.com/Temoa/dsh-rules-paths.git

pnpm pins the package by commit with a full integrity hash. Because the package declares dsh.bundle.patch (cordis.patch.yml), the reconciler appends it to the profile's dsh.profile.bundles automatically — the plugin mounts at the PROFILE level and rules apply to every session on that profile, no preset edit needed.

To scope the rules to one agent preset instead, add this row to a user preset (a copy of standard):

- id: rules-paths
  name: '@temoa/dsh-rules-paths'
  config:
    rulesDir: "~/.dsh/rules"
    rulesDirProject: true

From a local checkout

dsh plugin --profile web add ./dsh-rules-paths

> After changing plugin code, fully restart the harness — the module is cached per process URL; preset config is re-read per session mount, but the plugin file is not re-imported. Rule files themselves never need a restart. Never edit the shipped presets (standard/code/minimal/cordis); add the preset row above to a copy instead.

Uninstall

dsh plugin --profile web remove @temoa/dsh-rules-paths

Restart dsh after removing. The hook is torn down with the plugin; rule files under ~/.dsh/rules and the project rule directories are left untouched.

How it works

Rules live in ~/.dsh/rules/*.md (configurable via rulesDir), one rule per file:

---
paths:
  - "**/*.dart"
  - "lib/**/*.ts"
description: Dart conventions (optional, metadata only)
---

Rule body: guidance the model follows after reading a matching file.

On every successful read (and once at session start for global rules), the plugin:

1. Lists the configured rule directories — the user-level rulesDir, plus <projectRoot>/.dsh/rules and <projectRoot>/.claude/rules when rulesDirProject is on. 2. Matches the read path against each rule's paths globs, against both the absolute path and the cwd-relative path (Windows \ normalized to /), so **/*.dart matches both D:/lab/proj/lib/main.dart and lib/main.dart. Rules without paths (or without frontmatter) are treated as global. 3. Renders the matched bodies into a single user-role message — SHA-1 dedup per session, unchanged rules never re-sent, changed ones sent as replace — bounded by maxBytes, then folds it into the entering agent/pre-step right after the last claimed message.

paths present but neither a string nor a list skips the file with a warning; files over maxSourceBytes are skipped. Rule bodies are untrusted input: text only, delimiters escaped, never executed. No file watcher: rule edits take effect at the next reconciliation (global) or the next successful read (path rules).

KeyDefaultMeaning
rulesDir~/.dsh/rulesUser-level rules directory (~ expands)
maxBytes65536Byte budget per injected message
maxSourceBytes1048576Max bytes read per rule file (larger files skipped)
triggerTools["read"]Tool names whose successful executions trigger matching
rulesDirProjectfalseAlso scan <projectRoot>/.dsh/rules and <projectRoot>/.claude/rules

Repository layout

dsh-rules-paths/
├── package.json        # dsh.bundle.patch manifest
├── cordis.patch.yml    # composition layer: appends the plugin to profile bundles
├── lib/
│   ├── index.js        # Host half: rule loading, matching, injection
│   └── types/index.d.ts
├── test/
│   └── index.mjs       # 50-assertion test suite
├── README.md
├── README.zh.md
└── LICENSE

Development

npm install   # fetches the devDependencies (peers + js-yaml + picomatch)
npm test      # node test/index.mjs — 50 assertions

Tests cover: config validation, frontmatter parsing, budget rendering (omit/truncate/escape), message construction, dedup + replace, zero injection, global rules, project rules (.dsh/rules + .claude/rules), and the pre-step fold position.

License

[MIT](LICENSE)