Preface¶
The native mechanism of DeepSeek Harness (DSH) reads only a single AGENTS.md file at the global level, while the project level supports iterating through multiple candidate files. This asymmetry means global rules cannot be flexibly split like project rules and often must be piled up in a single file.
The dsh-global-rules plugin fills this gap through multi-file splitting and a settings page GUI. It allows global rules to be split into independent markdown files and provides a visual management interface, solving the difficulty of maintaining global instructions.
Core Features¶
This plugin primarily implements the following capabilities:
- Multi-file Splitting: Under the
$DSH_HOME/rules/directory, each independent markdown file represents a single global rule. - GUI Management: Provides a settings page GUI supporting rule addition, deletion, modification, pausing, and enabling.
- Priority Sorting: Supports four priority levels (P0-P3). High-priority rules (P0) are placed at the front of the injection sequence and are retained first when the budget is insufficient.
- Budget Allocation: Supports allocating budget limits by priority; rules exceeding the limit will be truncated or omitted.
- Security Protection: Strict path security protection to prevent path traversal attacks; does not read session data and makes no network requests.
Installation and Activation¶
To install the plugin, use the dsh plugin command. A restart of the host process is required after installation.
dsh plugin --profile web add github:kingzhz/dsh-global-rules
dsh web
Note: Host-side code is loaded at process startup; DSH must be restarted after installation.
Typical Usage¶
File Structure¶
Place rule files under the $DSH_HOME/rules/ directory, with each rule being an independent markdown file. Filenames support numerical prefixes to control sorting within the same priority level.
$DSH_HOME/rules/
├── 01-回答风格.md
├── 02-代码改动规范.md
└── 03-隐私禁区.md
Priority Configuration¶
Configure the priority field in the front matter of the rule file to set the priority.
---
priority: 0
---
# Security Red Lines
Never execute rm -rf or force push.
| Priority | Description |
|---|---|
| P0 (0) | Highest priority, injected first, discarded last if the budget is insufficient |
| P1 (1) | High priority |
| P2 (2) | Default priority (defaults to this level if not specified) |
| P3 (3) | Lowest priority, injected last, discarded first if the budget is insufficient |
Configuration Parameters¶
Plugin runtime parameters can be set in the DSH configuration file.
- id: global-rules
name: 'dsh-global-rules'
config:
rulesDir: ~/.dsh/rules # Directory for rule files
maxBytes: 32768 # Total byte limit for injected text
maxSourceBytes: 262144 # Read limit for a single rule file
order: 100 # Segment order number for P0 level
heading: Global rules # Opening description for the injection block
enabled: true # Whether to enable
Notes¶
- Pause Mechanism: Pausing a rule renames the file to
.disabled. This means the operation leaves a trace on the disk; if the directory is under version control,git statuswill show the file change. - GUI Activation: After modifying settings or rules via the GUI, you need to refresh the browser page to see the changes.
- Native Files: This plugin does not take over DSH’s native
AGENTS.md; both can coexist. - Restart Requirement: Only supports loading host-side code at process startup; DSH must be restarted after installing or modifying configurations.