dsh-structured: Enable default structured output for DSH responses

Introduction

When developing agents in DeepSeek Harness (DSH), many people write rules like “conclusion in the first sentence, tables/lists/steps in the body” into ~/.dsh/AGENTS.md. However, having rules written in a file does not guarantee the model will follow them every turn. An actual test recorded in the README shows that out of 56 replies meeting the trigger conditions, only 21 were truly structured (approx. 37.5%), and this rate degrades further in long contexts.

Below is an introduction to the community plugin dsh-structured (maintainer feigo313, GitHub / Directory Page). It places the same structured rules into a system prompt section that is re-evaluated for every request and appends a lightweight reminder at the end, without relying on the model to “remember” old agreements from history. It is categorized as a client-side plugin: besides prompt injection, it adds a layer of typography for conversation Markdown on the DSH client side (desktop is the primary target, Web is for compatibility).

What is this

The positioning of dsh-structured is: to ensure every substantive reply in DSH defaults to a fixed output shape—label-less title cards, tables/lists/steps—while supporting a per-session toggle. The built-in rules are derived from Section 7 of ~/.dsh/AGENTS.md (conclusion in the first sentence, componentized body, prohibition of process narrative and repetition, structure does not equal verbosity, 500-character limit, etc.).

The plugin does not take over GenUI or modify the agent loop; any anomalies follow a fail-open approach to let the original request pass. In the roadmap, Phase 1 (Structuring) is complete; Phase 2 covers visual hotspot specifications and card systems, see docs/ROADMAP.md in the repository for details.

Core Features

Prompt Injection

  • Injects an approximately 400-character rule segment + a 50-character tail reminder into the system prompt (tail reminder can be disabled via config).
  • Sub-agent sessions are not injected by default (includeSubagents: false) to avoid wasting context.
  • Custom rules: After writing content to $DSH_HOME/dsh-structured/style.md, if the file is not empty, it completely overrides the built-in text, taking effect in the next turn; if the file is empty or deleted, it falls back to the built-in text.

Per-session Toggle

Enabled by default for new sessions; state is persisted in $DSH_HOME/dsh-structured/state.json (atomic write). /structured only controls prompt injection and does not turn off the client visual layer.

Client Visual Layer (Desktop Primary Target)

The client half adds typography for conversation Markdown: heading levels and icon blocks, table headers/thin horizontal lines/status columns, code block language colors and fit banners, card types (Risk/Acceptance/Conclusion), lists/links/separators. The accent color is fixed to #2563eb (#60a5fa for dark mode). It only adds classes/attributes to host nodes and does not modify message content. Headless/CLI environments do not load the client half.

Phase 2 has implemented 2.1–2.4: multiple card types, data-dsh-structured-card-type attribution markers; when GenUI is set to auto, it appends the dsh-ui route only if detected, otherwise it falls back to pure Markdown.

Impact Metrics (Repo’s Own Description)

The repository provides scripts/measure-prose.mjs for re-running the measurement criteria. Key comparisons excerpted from the README include: the historical prose rate before modification (first 300 characters) was about 38.7%, close to the task specification baseline of 37.5%; after modification, the prose rate for 12 new sessions under paired sampling was 0.0% (0/12). See docs/METRICS.md for full samples and limitations.

Installation and Activation

Requirements: DSH 0.2.x (@deepseek-ai/cordis 4.x), Node ≥ 22. Current package version 0.7.4 (MIT). The plugin hard-depends on the host’s systemPrompt (provided by @deepseek-ai/dsh-base for desktop), commands is an optional service.

Before installation, you can run a pre-check in the repository root (if already installed in the profile, the path is node_modules/dsh-structured/scripts/):

node scripts/desktop-check.mjs

The default target is the desktop profile. Since desktop is exclusive to Electron, the global CLI command dsh plugin --profile desktop ... will be rejected; it is recommended to install via the DSH plugin management entry, or manually use pnpm according to the README after completely quitting Desktop.

Method 1: Plugin Marketplace (After Release)

Search for dsh-structured in DSH plugin management to install.

Method 2: npm (After Release)

dsh plugin --profile <profile> add dsh-structured

For the desktop profile, please use the plugin management search/install; do not run --profile desktop.

Method 3: GitHub Release (After Release)

Download dsh-structured-0.7.4.tgz from GitHub Releases and select the local package in plugin management.

Development: Local tgz / Manual pnpm (Desktop)

After quitting Desktop, manually pnpm add the tgz in the profile directory and add dsh-structured to dsh.profile.bundles in package.json (add only once). See the README Installation Section for specific backups and commands.

Configuration

Override plugin config in the profile’s cordis.patch.yml (complete replacement, not deep merge):

- id: dsh-structured
  config:
    defaultEnabled: true    # Enabled by default for new sessions
    tailReminder: true      # Append a reminder sentence at the end of the system prompt
    includeSubagents: false # Do not inject into sub-agent sessions
    genui: auto             # auto | on | off

Typical Usage

Intra-session commands:

/structured            # View current session status
/structured off        # Turn off for this session (takes effect next turn)
/structured on         # Turn back on
/structured status     # Same as /structured

Verify if injection hits the system message (repository script):

node scripts/session-inspect.mjs --grep "结构化输出(本会话已启用"

When enabled, it should hit 1 system/message; after /structured off, it should be 0 in the next turn of the same session.

To uninstall, you can use:

node scripts/uninstall.mjs --profile <profile> --dry-run
node scripts/uninstall.mjs --profile <profile>

Use Cases and Notes

Who it is for: Those who write proposals, troubleshoot, or draft replies for colleagues to read in DSH desktop (or compatible Web clients) long-term, desire stable output shapes with less prose piling up, and need the ability to temporarily turn off structured rules per session.

Permissions and Security: The plugin runs with the current DSH process permissions, reading and writing to $DSH_HOME/dsh-structured/ and modifying the system prompt in every qualifying request. Before installation, please review the Source Code and License (MIT) to decide if it should be included in your workflow.

Compatibility Note: engines.dsh and dsh.compatibility.dshReleases are advisory; the README records local testing with DSH CLI 0.1.7-rc.2 and desktop 0.2.1-rc.2. The community directory SkillHub is an independent site with no official affiliation to DeepSeek/High-Flyer.

Conclusion

dsh-structured uses a “rule segment re-injected every turn + optional tail reminder” approach to fix the structuring degradation issue found when relying solely on AGENTS.md, and uses a client visual layer to render tables, status columns, and card types into readable typography. /structured and style.md provide session-level and rule-level control.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye