Introduction

DeepSeek Harness (DSH) extends functionality through a plugin mechanism. In agent development scenarios, there is a class of instructions that belong to the local machine rather than the code repository. These instructions typically include environment-specific E2E workflows, internally accessible endpoints, or personal workflow preferences. Because AGENTS.md is a shared file committed to the repository, it is not suitable for storing this kind of private information. The dsh-project-prompt plugin is designed to solve this problem. It stores such rules in the $DSH_HOME directory, where they are never committed to the repository.

What This Is

dsh-project-prompt is a DeepSeek Harness plugin for managing private, project-specific prompt rules. It is maintained by imroc and licensed under the MIT License. The plugin matches Git remote URLs, local repository paths, or current working directory prefixes and injects configured rules into the corresponding session. It applies to both the main agent and sub-agents, and is Worktree-aware.

Core Features

  • Three matchers: Supports matching by Git remote URL, local primary repository path, or a plain directory prefix.
  • Worktree awareness: Recognizes Git linked worktrees and traces back to the primary repository through the pointer in the .git file. A single configuration covers all worktrees and their subdirectories.
  • Two injection modes:
    • section: A stable system prompt section. Supports KV caching and variable interpolation for {{cwd}} and {{model}}.
    • inject: Injects into the first context message. Does not perform template interpolation and is suitable for text containing literal {{...}} (such as Helm/Go templates).
  • Covers sub-agents: Sub-agents inherit the current working directory of the session, so they follow the same rules.
  • Validation at load time: Invalid rule formatting or unknown template variables raises an error when the plugin loads, instead of failing on every request.
  • Zero dependencies: Single-file ESM, importing only Node.js built-in modules, with no build step required.

Installation and Enablement

Before installing, ensure DeepSeek Harness version >= 0.1.1-rc.2 and that the environment includes Node.js >= 18.

Install it to the specified profile using DSH’s plugin command:

dsh plugin --profile web add dsh-project-prompt

After installation, DSH needs to be restarted because plugin packages are assembled at startup.

Uninstall command:

dsh plugin --profile web remove dsh-project-prompt

Configuration Rules

The rules configuration file is located at $DSH_HOME/cordis.patch.yml (defaults to ~/.dsh/cordis.patch.yml). This file is a machine-local layer and applies to all profiles on the machine. The plugin watches for changes to this file and automatically reloads it after saving.

Basic Configuration Example

The following is a configuration file snippet demonstrating three matching methods and two modes:

- id: project-prompt
  config:
    rules:
      # 1. 通过 Git remote 匹配(支持任意克隆位置和工作树)
      - remote: github.com/my-org/my-project
        text: |
          ## E2E testing for this project (environment-specific, private)

          1. Test entry point: http://e2e.internal.example.net (internal only)
          2. Run `make e2e-prepare` before the first E2E run.
          3. On failures, check ... first.

      # 2. 通过本地主仓库路径匹配,使用 inject 模式以避免字面量 {{...}} 被解析
      - repo: /home/me/dev/another-project
        mode: inject
        text: |
          Render values like {{ .Values.replicas }} are literal here.

      # 3. 通过目录前缀匹配
      - path: /home/me/dev
        text: |
          ...

Rule Field Description

Field Type Default Value Description
remote string — Git remote URL. During comparison, protocol, user@, : separator, .git suffix, trailing slashes, and case are ignored.
repo string — Absolute path of the local primary repository. It automatically matches all worktrees and subdirectories of that repository.
path string — Current working directory prefix. It matches that directory or its subdirectories.
text string required Prompt text to be injected.
mode section | inject section Injection mode, see below.
sectionName string project-prompt (auto-incremented) Name of the system prompt section.
order number 50 Sorting order of the system prompt section. In the DSH spec, 0 is persona, and 100-199 is tool guidance.

Injection Mode Details

Feature section (default) inject
Location System prompt (systemPrompt) First context message on the user side
Visibility Every request Every request
Template interpolation Supports {{cwd}} and {{model}}; any full {{...}} otherwise raises an error Not supported; {{...}} is literal
Use cases Stable instructions, KV cache friendly Templates containing literal {{...}}

Verifying Installation

After installation, you can verify that the configuration is effective using the following steps.

  1. Check whether the plugin is loaded correctly:
    dsh --profile web --dump-config | grep -A3 project-prompt
  1. Start a session in a matched directory and ask a question, then check whether the model received the rule text.

  2. View the session log. The injected text appears in the recorded request headers, located in the $DSH_HOME/sessions/.../session.jsonl.zstd file.

Considerations

  • Static configuration: Rules are static configuration. The plugin does not read files inside repositories (which would introduce shared state). For loading in-repository files, use DSH’s built-in AGENTS.md/CLAUDE.md.
  • Submodules: Git submodule directories (where .git points to .git/modules/...) are not tracked. To match submodules, use a path rule.
  • Failure policy: Configuration errors (such as missing text or an unknown {{var}} in section mode) raise an error when the plugin loads, instead of failing silently.
  • License: MIT License.