Preface¶
When using DSH (DeepSeek Harness) for project development, team conventions are often scattered across READMEs, verbal habits, or temporary reminders to the agent during conversations. When rules become numerous, they either flood the context window or get omitted in specific sessions, leading to inconsistent behavior. Common workarounds include manually writing a “User Rules” section into the profile or maintaining separate prompt snippets for each project. Modifying rules requires changing configurations, and restarting a chat is often necessary for stable application. Additionally, switching between repositories requires manually swapping the text.
Introducing dsh-ian-rules: An open-source DSH plugin (MIT licensed) that provides a “Development Rules” panel in the right sidebar of the Web GUI. It allows for the visual maintenance of global rules and per-project rules. During system prompt assembly for each session, it parses and injects the effective rules based on the session’s working directory. Rules can also be directly saved to the database via the ian_rules tool within the conversation. The plugin is maintained by community maintainer Wraindrock and is listed in the directory skillhub.cn under the admin-security category. For source code and documentation, see GitHub (the repository currently points to Grant-Felix/dsh-ian-rules).
What is this¶
dsh-ian-rules is a standard DSH profile bundle (comprising both host and browser halves). It follows the native DSH sidebarRightTabs + sidebar.right.pane.tab contracts, adding a “Development Rules” tab alongside entries like “Docker Containers.” Rule data is read and written only to the local machine’s $DSH_HOME/ian-rules.json (default ~/.dsh/ian-rules.json); it performs no network operations or uploads. If no rules are effective, an empty string is injected, imposing no additional burden on the session.
Core Features¶
Rule Organization and Matching¶
| Capability | Description |
|---|---|
| Global Rules | Effective for all sessions, serving as baseline conventions across projects. |
| Project Rules | Each project has an independent tab; rules participate in matching if the session’s working directory falls under the project path. Multiple projects are chained by path length (shortest to longest), with rules stacking sequentially. |
| Append / Override | Project-level append (Global + This Project) or override (Only This Project); the last override in the chain blocks global rules and layers from shorter paths above it. |
| Grouping | Each rule can be assigned a group name; the panel organizes rules by group, and the injected text formats them as ### Group, under a parent header of ## Global Rules or ## Project: Name (Path). |
| Single Rule Toggle | Each rule can be disabled (content retained but not injected); a capsule at the top of the panel serves as the master switch. |
Paths support ~ and are normalized to absolute paths upon saving. If the working directory involves symbolic links, realpath is used for matching. Manual edits to the JSON are watched and reloaded by the host (with a 15-second polling fallback).
Panel (Right Sidebar “Development Rules”)¶
The tabs follow a 3 + N structure: Global Rules / Projects (Roster) / One tab per project / Preview; the tab bar scrolls horizontally without wrapping.
- The top displays the current rule count. The primary button is Save & Apply (enabled only when there are changes;
Ctrl/Cmd + Sworks as well). Export, Import, and Reload are available in the “More” menu. - When empty, an onboarding guide is provided, allowing you to “Insert 4 fictional examples first” before replacing them with your own conventions.
- The “Projects” tab manages directories, aliases, relationships with global rules, enabling, and deletion; rules are edited on the specific project pages.
The “Preview” allows selecting any directory to view the text that will actually be injected (including unsaved changes, matched projects, and truncation status), along with character count and estimated tokens. When there are many rules, search by title, body, or group is supported. Saves include a revision; if the disk file has been modified externally, a 409 is returned, allowing you to choose to load the disk version or overwrite it. A ian-rules.json.bak is written before saving.
Auto-Injection and Scene-Based Logic¶
- L1 Persistent: Rules with
mode: "always"are fully injected into the system prompt section (plugin:ian-rules, order100). - L2 / L3: Rules with
mode: "auto"can keep only the title and tags persistent, while the body is sent to the end of the conversation only when the current task matches (requires enablingsceneMatchingin “More → Scene-based Injection”, default isoff).
The single injection text limit is 12,000 characters. If exceeded, global rules are trimmed first to preserve project rules, and the beginning of the prompt indicates which entries were omitted. The injection preview and cards display the approximate character count and impact on the token budget.
ian_rules Model Tool¶
You can directly say “record this in development rules” within the conversation. The tool’s action supports list, lookup, add, update, remove, specifying global/project and group. list provides a bounded summary by default; for the full injection text, use full: true. After saving, the running session applies the changes in the next step (or you can choose “Only for new sessions” to avoid recomputing prompt caches in long conversations).
Security and Others¶
The HTTP interface validates Origin / Sec-Fetch-Site (403 for cross-site requests), and POST requires Content-Type: application/json. If the plugin marketplace is installed, an update prompt appears at the top of the panel when a new version is available.
Installation and Enablement¶
Prerequisites: dsh CLI installed (npm install -g @deepseek-ai/dsh) and pnpm. This plugin has not been published to the registry under the npm package name dsh-ian-rules. Install via git source (README original commands below, choose based on your network):
# Direct connection to GitHub
dsh plugin --profile web add github:Grant-Felix/dsh-ian-rules
# Gitee mirror for China (pnpm doesn't support gitee: shorthand, use full URL)
dsh plugin --profile web add git+https://gitee.com/Grant-Felix/dev-rules.git
# Repository development/debugging: link to local checkout
dsh plugin --profile web add link:$PWD
After installation, restart the profile (↻ at the bottom of the sidebar). “Development Rules” should appear in the right sidebar page list. To upgrade, use dsh plugin --profile web update dsh-ian-rules or the update entry in the panel/plugin marketplace. To uninstall:
dsh plugin --profile web remove dsh-ian-rules
ian-rules.json remains in $DSH_HOME after uninstallation and is not deleted with the plugin.
If you previously used the old package name dsh-agent-rules, you must remove the old package before add-ing the new address. Upon startup, if only agent-rules.json / dev-rules.json exist, they will be automatically copied to ian-rules.json (original files are preserved).
Typical Usage¶
1. Create Global and Project Rules in the Panel¶
Open the right sidebar “Development Rules” → “Global Rules” to add entries (Title + Content + Optional Group) → Create a new project in the “Projects” tab (fill in directory and alias, choose append or override) → Enter that project’s tab to maintain rules → Save & Apply.
2. Verify a Directory with Effect Preview¶
Switch to “Preview”, input or select a directory, click “View”, and confirm the matched project chain, whether global rules are blocked by overrides, and the final injected Markdown and character count.
3. Data File Structure (Excerpt)¶
Rules are persisted in ian-rules.json, with the version field version: 2. Illustration (field meanings based on README):
{
"version": 2,
"enabled": true,
"sceneMatching": "off",
"global": [
{
"id": "g1",
"title": "Run tests before commit",
"content": "npm test must be green",
"group": "Commit",
"enabled": true,
"mode": "always",
"tags": []
}
],
"projects": [
{
"id": "p1",
"path": "~/projects/foo",
"label": "Example Project",
"enabled": true,
"mode": "append",
"rules": [
{
"id": "r1",
"title": "Use pnpm in this project",
"content": "npm install is forbidden",
"group": "Dependencies",
"enabled": true,
"mode": "auto",
"tags": ["Dependencies", "Package Management"]
}
]
}
]
}
Project-level mode is append or override; rule-level mode is always (persistent) or auto (scene-based). Supports exporting/importing JSON or Markdown (replace or merge).
4. Maintenance within Conversation¶
Instruct the agent to write rules to global or a specific project via the ian_rules add / update actions. Use lookup to verify full text, and list to enumerate projects (passing all: true if necessary).
Applicable Scenarios and Notes¶
Who it is for: Developers working on multiple repositories in DSH long-term who want the agent to stably adhere to a unified set of commit standards, dependency strategies, and directory conventions without repeating prompts manually every time.
Permissions and Trust: The plugin reads and writes to the local $DSH_HOME and provides Web APIs with the current dsh process privileges. Before installation, review the source code and MIT license on GitHub (NOTICE.md clarifies that ian-rules.json belongs to the user). The DSH ecosystem emphasizes “Everything is a plugin”; skillhub.cn is a community directory and has no official affiliation with DeepSeek / High-Flyer.
Change Activation: After modifying host or browser half-source code, standard installation deployment requires restarting the profile to load the new bundle. For daily rule changes, saving via the panel or editing the JSON takes effect immediately or according to the selected strategy.
Conclusion¶
dsh-ian-rules consolidates “Project Development Rules” from scattered documents and repeated reminders into a visually managed right sidebar panel. It automatically injects them into every session’s system prompt (optionally appending body text based on the scene), reducing omissions and context waste.
- Directory Page: https://www.skillhub.cn/plugins/Wraindrock/dsh-ian-rules
- GitHub: https://github.com/Grant-Felix/dsh-ian-rules