Overview¶
The stock agent-instructions plugin in DeepSeek Harness injects the AGENTS.md file itself, but @path references inside the file remain plain text, so the model cannot read them. dsh-context-imports solves this problem. It reads referenced files like Claude Code does and injects their contents into the session context.
Installation¶
Install the plugin using the official command.
dsh plugin --profile web add dsh-context-imports
No additional configuration is required after installation. By default, it scans AGENTS.md and CLAUDE.md.
Core Features¶
The plugin provides the following main capabilities:
- Recursive import expansion: Supports recursive expansion of
@pathsyntax and can handle nested references. - Automatic trigger scenarios: Injection runs automatically after creating a new session, resuming a session, clearing a session, and compaction.
- History management: Maintains exactly one injected entry in the active history. If compaction removes that entry, it is re-injected on the next session start.
- Byte budget: Limits bytes for individual files and total injected content; files exceeding the limits are truncated with a notice.
- Multilingual settings card: Provides settings interfaces in six languages—Chinese, English, Japanese, French, Russian, and Korean.
- Official API only: Uses only the official DeepSeek Harness API surface and has no feature-plugin dependencies.
How It Works¶
The plugin records session scenarios at startup (startup / resume / clear / compact) and decides whether to inject before each step (pre-step). The processing flow is as follows:
- Scans instruction files (default:
AGENTS.md,CLAUDE.md) for@pathreferences. - Resolves relative paths (relative to the importing file’s directory), skips fenced code blocks, and requires paths to include a file extension.
- Merges the explicit injection list (configured via
files) with the scanned imports. - Applies byte budget limits (default:
64KBper file,128KBtotal). - Generates a
<system-reminder>message containing<file path="...">blocks and appends it to the end of the session messages.
Configuration Options¶
The following parameters can be adjusted in the settings:
| Configuration | Default | Description |
|---|---|---|
files |
[] |
Additional files to inject; relative or absolute paths are supported |
scanImports |
true |
Whether to scan @imports in AGENTS.md and other instruction files |
instructionFiles |
["AGENTS.md", "CLAUDE.md"] |
List of files to scan; these files themselves are not re-injected |
maxDepth |
3 |
Maximum recursion depth for nested imports |
maxFileBytes |
65536 |
Size limit for a single file (bytes); files exceeding it are truncated |
maxTotalBytes |
131072 |
Total byte limit for injected content; files exceeding it are skipped |
injectOn |
all four |
Session scenarios that trigger injection (new, resume, clear, compact) |
template |
"" |
Custom wrapper text; use {{content}} to mark the file content position |
Typical Usage¶
- Relative path resolution: If
AGENTS.mdreferences@docs/architecture.md, the path is resolved relative to the directory containingAGENTS.md. - Message format: The injected content is a
<system-reminder>tag containing<file path="...">blocks and nothing else. - Template customization: If additional explanatory text is needed, configure
templatein the settings and use the{{content}}placeholder.
Notes¶
- Missing files: If a referenced file does not exist, it is logged as a single-line comment instead of causing a plugin error.
- Code blocks are skipped: Paths wrapped in fenced code blocks are ignored, and paths must include a file extension.
- AGENTS.md source: The
AGENTS.mdfile itself is injected by the stockagent-instructionsplugin; this plugin only handles references inside it. - Dependencies: The plugin does not depend on other feature-plugins.
Summary¶
dsh-context-imports resolves the issue that models cannot read referenced file contents by parsing @path references in AGENTS.md and CLAUDE.md. It supports recursive imports, budget control, and multilingual configuration, making it suitable for scenarios where documents need to be injected into context in a structured way.