Introduction¶
When using gemini / claude model groups in DeepSeek Harness (DSH), upstream providers may return a 429 error directly if the system prompt contains identity text such as “DeepSeek Harness,” even when the quota is sufficient. To fix this type of issue, the identity information must be stripped before the request is sent upstream, and then restored when the response comes back.
DSH itself does not provide a writable request assembly hook, so a plugin is required to intervene. dsh-prompt-filter is a standalone plugin that intercepts requests at the llm/stream stage, rewrites system prompts and tool descriptions based on rules, and supports renaming and restoring tool names/skill IDs.
Plugin Overview¶
- Plugin Name:
dsh-prompt-filter - Maintainer: lihongxu0221
- Category: Model Inference
- GitHub: https://github.com/lihongxu0221/dsh-prompt-filter
- Description: Before a request is sent to the upstream model gateway, matches rules by model name to strip Harness identity information from the request, and supports renaming and restoring tool names and skill IDs.
Core Features¶
The plugin intercepts requests at the llm/stream stage and rewrites the following content:
- System prompts, runtime context, and memory blocks (system role)
- Text blocks in the developer role and
<system-reminder>messages of typeruntime-context - The
descriptionfields at each level ofparametersin tool schemas - Tool names and skill IDs: renames outbound via
nameMapand restores them in the response stream - Brand terms in paths: by default, replaces quoted paths with
[path]
The plugin provides two types of rewriting:
- Outbound-only rewriting, no restoration:
stripLines,replace,identityOverride. Used for identity statements, explanatory text, and brand terms in body content. - Outbound renaming + inbound restoration:
nameMap.toolsandnameMap.skills. Used for identifiers that DSH needs to resolve and execute by their original names, such as tool names and skill IDs.
Installation & Enablement¶
Option A: Via plugin_manager (Recommended)¶
In the GUI, select Plugins > Add plugin and choose the plugin directory. After installation, restart DSH (or reload the plugin entry). The plugin will appear as Prompt Filter in the plugin list.
Installation works by “linking a local directory,” so subsequent code changes only require a restart to take effect—no reinstallation needed.
Option B: Manually write into profile¶
Manually modifying package.json or cordis.patch.yml in the profile is not recommended. If you must do it manually, link the directory into the profile under the dependency name @deepseek-ai/dsh-prompt-filter, keeping the bundle entry’s id as dsh-prompt-filter and name as @deepseek-ai/dsh-prompt-filter.
Configuration Reference¶
The plugin’s default configuration is installed alongside cordis.patch.yml and can be used as-is. To override the configuration, modify the entry with id: dsh-prompt-filter in the profile’s cordis.patch.yml; an entry with the same id will replace the entire bundle configuration.
- id: dsh-prompt-filter
config:
sidebarEntry: true # Show an entry in the left sidebar
enabled: true # Master switch for filtering
dryRun: false # When true, only logs/prints without actually sending the request
debug: true # On every rule hit, writes the filtered request to the trace directory
applyToSubagents: true # When false, subagents are not filtered
traceDir: '' # Empty = $DSH_HOME/dsh-prompt-filter/trace
rules:
- id: default-gemini-claude
modelMatch:
- gemini
- claude
identityOverride: You are a helpful coding assistant.
noRetryOn:
- Resource has been exhausted
- RATE_LIMIT
scope:
system: true
toolDescriptions: true
toolNames: true
skillCatalog: true
memoryReminders: true
paths: true
skillToolName: skill
stripLines: []
replace: []
nameMap:
tools:
ops_bash: run_bash
ops_grep: search_text
plugin_manager: plugin_registry
skills:
dsh-badge: assistant-badge
dsh-doc: product-doc
Two Types of Rewriting Must Be Kept Separate¶
- Type 1:
stripLines,replace,identityOverride— outbound-only rewriting, no restoration. Used for identity statements, explanatory text, and brand terms in body content. - Type 2:
nameMap.toolsandnameMap.skills— outbound renaming with restoration in the response stream. Used for identifiers that DSH needs to resolve and execute by their original names.
Do not put tool names or skill IDs in replace; a compile-time warning will prompt you to move them to nameMap.
Important Notes¶
- The plugin runs with the current DSH process permissions. Review the source code and license before installation.
- Configuration is compiled and validated when the plugin loads. Restart DSH after making configuration changes for them to take effect.
- Known limitation: sessions using a filtered model will no longer auto-generate titles. All other features are unaffected.
- The plugin does not modify the DSH core, does not modify
@deepseek-ai/dsh-system-prompt, and does not write filtered text into session logs. When the plugin is disabled, requests behave exactly as they do now.
Summary¶
dsh-prompt-filter provides writable request assembly capabilities at the llm/stream stage, helping fix the 429 issue with gemini / claude model groups on the magpie upstream caused by identity text. It supports text stripping and renaming/restoring of tool names and skill IDs, with the two rewriting approaches configured independently. It is suitable for scenarios where brand terms need to be masked or model names need to be unified.
- Directory Page: https://www.skillhub.cn/plugins/lihongxu0221/dsh-prompt-filter
- GitHub: https://github.com/lihongxu0221/dsh-prompt-filter