Preface¶
In the DSH workflow, personas are typically written in the global ~/.dsh/AGENTS.md and injected by the @deepseek-ai/dsh-agent-instructions plugin. This injection plugin shares a 65536-byte instruction budget for “Global + Project AGENTS.md”. The rendering rule is “sorted from broadest to most specific; discard the broadest ones first if the total exceeds the limit.” If your persona happens to be in the broadest file, it becomes the first casualty once the project file grows in size. What’s more troublesome is that this process happens silently, leaving only a line Workspace instruction budget … at the top of the injected block, without throwing an error.
Existing injection configurations (such as maxBytes) do not have any pin or alwaysInclude options to preserve a specific file. Another intuitive solution, personaPrefix, also fails because in the assemble() logic of dsh-system-prompt, the default agent preset (e.g., standard) has already registered a deployment:persona-prefix section with the same name, and any new entry will be directly overwritten.
dsh-persona-anchor aims to solve this problem: by using a section name that no one else would register, it injects directly via the systemPrompt.section() channel, completely bypassing the 65536-byte budget of AGENTS.md.
What is this?¶
This is a DSH host plugin (web profile) that “pins” specified “persona” text into a system prompt section.
Core Features:
* Pins persona text into a system prompt section.
* Does not consume the AGENTS.md instruction budget.
* Dependencies: Node.js built-in modules only.
Installation¶
Before installing, please ensure the current DSH process supports --profile web.
dsh plugin --profile web add github:harmless0819-dev/dsh-persona-anchor
Configuration¶
Add the following to your DSH plugin configuration file:
- id: dsh-persona-anchor
name: dsh-persona-anchor
config:
file: 'C:/Users/<you>/.dsh/persona.md' # Required: Absolute path to the persona file
onError: log # log (default) | throw
Configuration Options:
| Key | Default | Description |
|---|---|---|
file |
Required | Absolute path to the persona file |
section |
deployment:persona-anchor |
Section name; recommend keeping the default to ensure uniqueness |
maxBytes |
524288 (512 KiB) |
Maximum read limit per session to prevent accidental reading of excessively large files |
onError |
'log' |
Behavior when file reading fails: log warns only / throw triggers an error |
order |
deployment persona slot | Sorting position of the section |
reloadMs |
0 |
If greater than 0, periodically re-read the file |
route |
true |
Whether to register a status route to report errors |
Typical Usage¶
- Create a persona file on disk, e.g.,
~/.dsh/persona.md. - Specify the absolute path to this file in the plugin configuration.
- Start a new session after modifying the configuration.
- Ask the AI “What is your name/setup?”.
- If the persona does not take effect, the plugin registers a status route reporting
state.error, where you can see the reason for failure (e.g., file does not exist, too large, or empty).
Notes¶
- For Personal Use: This is a self-use plugin that has been tested and verified locally.
- Optional Dependencies:
webServeris an optional dependency. The code usesctx.inject([...])for lazy registration, so writing it into the top-levelinjectwill not cause loading failures in headless profiles without a webServer. - Error Tolerance: File reading failures do not throw exceptions by default; they are only reported in logs and status to avoid crashing the entire profile just because one persona file cannot be opened.
Conclusion¶
dsh-persona-anchor provides a path to bypass the AGENTS.md budget limitations, suitable for developers who need to ensure persona text exists in all scenarios. For more details and source code, please refer to: GitHub.