Preface

When deploying agents in DeepSeek Harness (DSH), two common requirements emerge: first, inserting stable “house rules” system prompts before the factory persona; second, allowing the model to “see” a fixed user/assistant reference conversation in each dialogue request without logging this content into the session log. Directly modifying the system prompt in the profile or manually appending messages to the session either fails to affect the assembly order before the persona or pollutes the logs, impacting turn numbering and compaction behavior.

The following custom-first-control-prompt, maintained by WM-CODER, accomplishes both tasks through deployment configuration: ordered system segments are registered before the persona, reference conversations are prepended as real alternating messages on each normal dialogue request, intercepted via llm/stream, and zero writes to the session log.

What This Is

@wm-coders/dsh-custom-first-control-prompt is a deployment-side prompt prefix plugin for DSH (with npm package name matching the Cordis registration name). It registers system prompt segments upon plugin loading and injects configured user/assistant reference conversations before each normal dialogue request. Static content is rendered byte-for-byte consistent in each request, facilitating prefix KV cache reuse. The current version is v0.2.3, licensed under MIT.

Core Features

Ordered System Prompt Segments

Each enabled sections entry is registered via ctx.systemPrompt.section() upon loading, participating in assembly just like the dsh-system-prompt factory segments: variable interpolation, scope masking, and assembly waterfall all apply. When order is less than 0, it renders before the persona (factory convention order is 0); harness identity convention is −100, tool guidance is 100–199.

Reference Conversation Injection

Ordered user/assistant pairs configured in history are built as deep-frozen Message objects upon plugin activation, then cloned, prepended as seed messages on each normal dialogue request by the llm/stream waterfall listener, and redispersed via ctx.llm.stream. The sequence visible to the model appears as:

[user]      configured user text 1
[assistant] configured assistant text 1
[user]      the real prompt…

Seed messages exist only in the request path, not in session logs; real turns start from 1, compaction does not mask reference history, and each request reinjects the same frozen sequence.

Scope Filtering and Panel

Auxiliary calls (tagged with purpose, such as session-title, compaction) and manual requests without sessionId pass through directly; by default, subagent-source sessions are skipped (includeSubagents: true to include). The settings page and the dock above the dialogue input box provide configuration editing and LLM monitoring to view the real request after injection—it is expected behavior not to see seed messages in the chat transcript.

Installation and Enabling

Install from GitHub (recommended in README, build artifacts committed):

dsh plugin --profile web add github:WM-CODER/custom-first-control-prompt

Or from npm:

dsh plugin --profile web add @wm-coders/dsh-custom-first-control-prompt

For local development, install from directory:

dsh plugin --profile web add ./path/to/custom-first-control-prompt

After installation, restart the web application:

dsh --profile web

Or run restart-web.ps1 or restart-web.sh from the repository. Uninstall:

dsh plugin --profile web remove @wm-coders/dsh-custom-first-control-prompt

The package declares dsh.bundle (via cordis.patch.yml inside the package), dsh plugin add reconciliation will activate the bundle layer and register the core line custom-first-control-prompt, no need to manually write insert lines. Obstacles and verification methods for installation, deployment, and debugging are detailed in the repository’s DEBUG-NOTES.zh.md, INSTALL.md, and INSTALL-FULL.zh.md.

Typical Usage

Write targeted overrides with id for this plugin in the profile’s cordis.patch.yml (not insert), or save via the panel “Configuration Editing” (semantically identical, only updating the custom-first-control-prompt line, preserving other entries in the file). Configuration skeleton:

- id: custom-first-control-prompt
  name: '@wm-coders/dsh-custom-first-control-prompt'
  config:
    sections:
      - name: house-rules
        order: -50
        text: |
          …stable system text…
    history:
      - user: 
        assistant: 
    includeSubagents: false

sections[].text and history text should remain static, avoiding mutable values like timestamps—any change may break prefix reuse starting from the first differing token. history user/assistant text must be non-empty and must not include reserved tags (case-insensitive: <user>, <assistant>, <exchange>, <custom-history and corresponding closing tags).

To verify injection is effective: create a new session, ask a question that can only be answered with the injected history (e.g., “Repeat our earliest user message”); if the model answers with the configured content, injection is proven effective. Absence of seed messages in session.history is normal. For finer-grained checks, use the panel LLM monitor to view the complete request.

Applicable Scenarios and Notes

Suitable for DSH operators or agent developers who need to uniformly prepend system rules at the deployment layer and stably attach reference conversations in each request—for example, global behavioral constraints written before the persona, or a fixed “example conversation” to guide model formatting.

Before use, note:

  1. The plugin runs with current dsh process permissions, review source code and MIT license before installation to ensure configuration content is trustworthy.
  2. Seed text is visible to the model, treat it as prompt material, not a trustworthy side channel.
  3. Configuration changes require a web restart to take effect for new requests; in-session mid-hot updates are not supported.
  4. Token overhead: Each system segment and the entire reference history appear repeatedly in each normal dialogue request, cost increases linearly with text length.
  5. Do not duplicate insert lines with the same id in profile patches: After the bundle is activated, residual - insert: with the same id may cause web fail-loud; use repository uninstall.ps1 to clean up remnants.
  6. Offline junction installation without reconciliation will not activate the bundle layer, requiring manual profile patch writing via install.ps1 -Offline or similar methods.

Conclusion

custom-first-control-prompt converges “system segments before persona” and “request-level reference conversations” into a single deployment configuration: assembly path matches factory segments, injection path does not enter logs, reinjects per request, and maintains stable prefixes. If you are implementing multi-tenancy or unified compliance prompts on DSH, consider integrating it as a bundle-layer plugin into your existing profile.