dsh-load-agent-rules: Enable DSH to understand existing Cursor and Copilot rules in the repository

Preface

When running agents in DeepSeek Harness (DSH), project conventions are typically written in AGENTS.md or CLAUDE.md, and DSH loads these files. But many repositories also carry a separate set of rules: someone added .cursor/rules/testing.mdc, someone maintains .github/copilot-instructions.md, and during a period of trying out Windsurf there’s a leftover .windsurfrules. These files are meaningful to their respective tools, but DSH does not read them by default, so the model may not know “we use Vitest, not Jest” or “do not modify old migrations,” even though the rules are already written in the repository.

Below we introduce the community plugin dsh-load-agent-rules (maintainer acus9345): it scans these common AI tool rule files and feeds them to the model according to each tool’s original semantics, so you don’t need to manually convert or copy anything.

What is this

dsh-load-agent-rules is a DeepSeek Harness plugin, categorized under model reasoning-related capabilities: it discovers and injects into context, during a session, the rule files used by tools such as Cursor, GitHub Copilot, Windsurf, Cline, Kiro, Roo Code, Gemini CLI, and JetBrains Junie. The plugin is distributed via the SkillHub catalog and GitHub, licensed under MIT, and the current package version is 0.2.3 (as per the repository’s package.json).

Which files are read

The plugin scans paths per tool conventions and also handles nested directories. The table below comes from the official README.

Tool Rule files
Cursor .cursor/rules/**/*.mdc, .cursorrules
GitHub Copilot .github/copilot-instructions.md, .github/instructions/*.instructions.md
Windsurf .windsurf/rules/*.md, .windsurfrules
Cline .clinerules (file or directory)
Kiro .kiro/steering/*.md
Roo Code .roo/rules/*, .roorules
Gemini CLI GEMINI.md
JetBrains Junie .junie/guidelines.md

The same content often appears duplicated under different filenames or via symlinks; the plugin deduplicates it and compares against the already-loaded AGENTS.md and CLAUDE.md in DSH, removing anything that is exactly identical.

How rules enter the model context

Each tool has a different definition of “when does this take effect.” The plugin tries to preserve the original meaning rather than dumping all rules into the prompt at once.

Always-on rules are written into context once at the start of a session. This includes Cursor’s alwaysApply: true, Copilot’s main instructions file, Windsurf’s always_on, Kiro’s inclusion: always, and plain-text files like .cursorrules. If a rule file changes during the session, or if context compaction causes rules to be lost, they are sent again.

File-matching rules are appended the first time the agent reads or edits a file that matches the rule’s path; they are appended only once, not re-injected every time the file is touched. Examples include Cursor’s globs: "*.tsx", Copilot’s applyTo: "src/db/**", Kiro’s fileMatch, and Windsurf’s glob. A rule located under packages/web/.cursor/rules/ takes effect only within that subtree.

Rules with only a description that require the model to judge relevance (such as Cursor’s agent-requested ones and Windsurf’s model_decision) are listed with their name and description; the model can open them via the project_rule tool when it deems them relevant. Rules that are only manually triggered also appear in this list.

On the first request, the context will roughly contain loaded always-on rule snippets and a hint that more file-level rules and on-demand items are available, for example:

These are the project rules written for this repository. Follow them like the rest of your instructions.

<rule name=".cursor/rules/style.mdc">
Use tabs for indentation. Prefer named exports.
</rule>

More project rules are available. File-scoped rules are added automatically the first time you read or edit a matching file.
Read any of them with the `project_rule` tool when it is relevant to your task:
- .cursor/rules/react.mdc (applies to *.tsx): React conventions
- .github/instructions/db.instructions.md: Database migration conventions

Installation and enablement

DSH maintains a plugin list per profile; you need to install it separately for each way you run DSH. The official install command is as follows (web corresponds to the browser interface of dsh web):

dsh plugin --profile web add dsh-load-agent-rules

If you run DSH via a script or CI, replace web with headless; if you use it via an editor integration, replace it with acp. The plugin takes effect in the next session. Removal command:

dsh plugin --profile web remove dsh-load-agent-rules

When debugging the plugin locally, the README explains you can build a tarball first and then install it (the example package name is dsh-load-agent-rules-0.2.0.tgz; the version is whatever your npm pack produces):

git clone https://github.com/acus9345/dsh-load-agent-rules
cd dsh-load-agent-rules
npm install
npm pack
dsh plugin --profile web add ./dsh-load-agent-rules-0.2.0.tgz

Configuration

You can open dsh-load-agent-rules in the DSH sidebar under Plugins, modify it, and Save; most options take effect on the next tool call, except toolName, which requires a restart.

You can also add a snippet in ~/.dsh/profiles/<profile>/cordis.patch.yml, or in the global ~/.dsh/cordis.patch.yml; keys not written retain their defaults:

- id: load-agent-rules
  config:
    sources: [cursor, copilot, windsurf, cline, kiro, roo, gemini, junie]   # drop any you don't want
    maxBaselineBytes: 48000    # budget for always-on rules; the rest are listed instead
    maxAttachBytes: 24000      # budget for rules attached on one file touch
    maxFileBytes: 200000       # skip rule files bigger than this
    toolName: project_rule     # '' to not register the tool
    touchTools: [read, write, edit, str_replace_editor]

maxBaselineBytes controls the byte budget for always-on rules; anything beyond that is not silently discarded but instead surfaced as a list, with the model reading them via the tool. A rule file larger than maxFileBytes is skipped.

Use cases and notes

This is suitable for teams that already maintain rules in the repository for Cursor, Copilot, Windsurf, etc., and would like to reuse the same conventions in DSH. The plugin does not replace AGENTS.md / CLAUDE.md; rather, it fills in the paths that DSH does not scan by default.

The DSH ecosystem emphasizes “everything is a plugin”; SkillHub is a community catalog and has no official affiliation with DeepSeek / 幻方 (High-Flyer). The plugin reads the repository and configuration with the permissions of the current DSH process. Before installing, it is recommended to review the source code and MIT license and assess on your own whether to include it in your workflow. Issues and suggestions can be raised in the GitHub Issues.

Conclusion

After the steps above, DSH can directly reuse the rules already written in the repository for other AI coding tools and inject them into context according to semantics such as glob and always-on. dsh-load-agent-rules reduces the cost of maintaining duplicate sets of instructions. Catalog page: https://www.skillhub.cn/plugins/acus9345/dsh-load-agent-rules; repository: https://github.com/acus9345/dsh-load-agent-rules.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye