dsh-context-imports: Inject Files Referenced by AGENTS.md at Session Startup

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:

  1. Recursive import expansion: Supports recursive expansion of @path syntax and can handle nested references.
  2. Automatic trigger scenarios: Injection runs automatically after creating a new session, resuming a session, clearing a session, and compaction.
  3. 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.
  4. Byte budget: Limits bytes for individual files and total injected content; files exceeding the limits are truncated with a notice.
  5. Multilingual settings card: Provides settings interfaces in six languages—Chinese, English, Japanese, French, Russian, and Korean.
  6. 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:

  1. Scans instruction files (default: AGENTS.md, CLAUDE.md) for @path references.
  2. Resolves relative paths (relative to the importing file’s directory), skips fenced code blocks, and requires paths to include a file extension.
  3. Merges the explicit injection list (configured via files) with the scanned imports.
  4. Applies byte budget limits (default: 64KB per file, 128KB total).
  5. 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.md references @docs/architecture.md, the path is resolved relative to the directory containing AGENTS.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 template in 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.md file itself is injected by the stock agent-instructions plugin; 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.

  • Maintainer: ciskonc
  • License: MIT
  • Source: GitHub
  • Plugin directory: SkillHub
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye