dsh-second-opinion: A Pluggable Second Opinion for Coding Tasks

Introduction

In DeepSeek Harness (DSH), the common problem when letting an Agent modify code is often not that it can’t write it, but that it acts too quickly: reading only half of the requirements correctly, performing unintended refactoring, adding unnecessary dependencies, or covering only the “happy path” for edge cases. While writing, it feels correct, but it is difficult for the Agent to identify these issues by itself afterwards.

The community already has approaches to writing “review before acting” into the context (e.g., dsh-code-review-gate by the same author), but the reviewer is often a fixed type. Here we introduce dsh-second-opinion: following the same discipline of “analyze first, then act, and finally cross-check,” the reviewer is connected by yourself—a subagent, an OpenAI-compatible HTTP endpoint, a local command, or just the discipline without a second opinion.

What is this

dsh-second-opinion is a workflow-type plugin for DSH released by maintainer alxy1018-ctrl (Community Directory Category: Workflow). By injecting discipline and invocation conventions into the root session, it constrains the Agent: before acting, clearly write out the problem and acceptance criteria; hand the analysis over to a second “brain” for review; after code is written and verification is done, perform a review for each; for multi-module tasks, it can allow both sides to write in parallel and check each other.

The plugin process does not initiate any external calls nor bind to vendor default endpoints; the actual review is completed by the Agent using the host’s existing capabilities. The discipline text injected into the Agent is in Chinese, while the reviewer configuration and contract are language-neutral. The current package version is 0.1.0, license MIT, and requires Node.js >= 20.

Core Features

Three Main Tasks

  1. Analyze first, don’t act: Clarify the real problem to be solved, acceptance criteria, scope of changes, existing conventions that must be followed, and uncertainties.
  2. Second opinion: Hand the “original requirement text + analysis” to the configured reviewer to specifically look for faults; conclusions remain internal, what the user sees is the result and reasoning, not the full internal discussion record.
  3. Cross-check: After code is generated, review key parts of the diff; after verification runs, review again; when working on parallel multi-module tasks, agree on file ownership to avoid both sides modifying the same spot.

Example Flow

You: Modify module X to support batch import

agent: First provide analysis (problem / acceptance criteria / scope of changes / existing conventions / uncertainties)
       -> Send for requirement review -> Merge opinions -> Start coding
       -> Send for code review (key hunks of diff) -> Fix real defects
       -> Run verification -> Send for test review -> Report results

Reviewers (Four kinds)

kind Description
subagent (default) Reuses existing host subagent routing; requires configuring provider / model and authorization in settings
http Any OpenAI-compatible endpoint; apiKeyEnv is the environment variable name, not the key itself
command Custom command; contract JSON goes in via stdin and out via stdout
none Keeps only the analysis and cross-check discipline, does not send for review

For custom forms, refer to docs/reviewer-contract.md in the repository. Refer to adapters/http.mjs and adapters/exec.mjs for implementation. Strategy sections and skill body text are in lib/index.js, loaded on demand.

Session Commands

Mode switching is per-session in-process state; it does not write to session logs. Restarting the client returns to the profile default:

/second-opinion status     View current mode and reviewer
/second-opinion check      Self-check reviewer configuration and invocation method, point out missing items
/second-opinion code       Effective only for code generation requirements (config default)
/second-opinion always     Always analyze before acting
/second-opinion off        Disable for this session

defaultMode can also be overridden by the environment variable SECOND_OPINION_MODE (higher priority than configuration), but this variable is process-level; in a resident DSH, it will affect all subsequent sessions. It is recommended to use /second-opinion for daily switching rather than environment variables.

Installation and Configuration

Installation

On a machine with DSH installed, add the plugin to the desktop profile (command from official README):

dsh plugin --profile desktop add github:alxy1018-ctrl/dsh-second-opinion

Installing from GitHub requires git to be installed locally, and DSH must be started after installing git. If DSH is not restarted after installing git, 'git' is not recognized as an internal or external command may appear; restarting the client solves it. Do not worry about the misleading allowBuilds prompt.

It is recommended to read the repository source code and MIT license before installing; the plugin runs with the permissions of the current DSH process. If the reviewer uses HTTP or subagents, you manage the keys and routing in your environment.

Profile Configuration

Configure in the profile patch; reviewer is the item to care about, others have default values:

- id: second-opinion
  name: 'dsh-second-opinion'
  config:
    defaultMode: code          # code | always | off
    reviewer:
      kind: subagent           # subagent | http | command | none
      provider: <your_routing>
      model: <your_model>
      label: My Reviewer       # Optional, affects display only

subagent example:

    reviewer:
      kind: subagent
      provider: your-provider-id
      model: your-model-id

http example:

    reviewer:
      kind: http
      baseURL: https://api.example.com/v1
      model: your-model
      apiKeyEnv: YOUR_API_KEY
      timeoutSeconds: 180

command example:

    reviewer:
      kind: command
      command: node D:/tools/my-reviewer.mjs --json

After modifying the strategy sections or skill body text in lib/index.js, or the profile configuration, you must restart the DSH client and confirm with a new session; the plugin itself does not reload, so old sessions may still get the old text after file changes.

Typical Usage

  1. Follow the previous section to install and configure reviewer, then restart DSH.
  2. Start a new user root session (subagents will not receive strategy section injections), run /second-opinion check to confirm the reviewer and missing item prompts.
  3. Use /second-opinion code or always to set the mode for this session, then submit coding tasks; observe if the Agent outputs analysis before acting, and attempts requirement / code / test reviews at stage points.
  4. If you temporarily do not want a second opinion but want to keep the discipline, you can use /second-opinion off or set reviewer.kind to none.

The repository allows local self-checking without installing into DSH (no network, zero external dependencies):

node test/run.mjs

Or npm test. This verifies plugin registration and adapter logic but cannot replace the end-to-end confirmation of “installing into profile, restarting, and running once for real”—the README states the author has not completed end-to-end verification on a real DSH instance, so pay extra attention to the /second-opinion check output during the first installation.

Use Cases and Notes

Who it is for: Developers who want to fix the habit of “think clearly before writing, check after writing” in the DSH coding workflow, and already have or are willing to connect their own review channel (existing model routing, self-built API, script). Compared to dsh-code-review-gate, this plugin retains the same disciplinary skeleton, changes the reviewer from hardcoded to contract + self-connection, and degrades by stage (if a review cannot be obtained at a certain stage, it does not drag down the whole process, discipline still applies).

Boundaries (Be aware before use):

  • Reviewer opinions are for reference only; they may misread or include style preferences. You should be able to reject them and record the reasons.
  • When review times out, errors, or is not configured/authorized, the Agent continues based on its own analysis and explains the reason in one sentence; it will not repeatedly resend the same payload just to get a review.
  • The strategy section is only injected into the root session; subagents do not receive it (to prevent subagents from being unable to spawn subagents yet running white-trash reviews, or carrying extra context every round).
  • The plugin has zero npm external dependencies, using only node: built-in modules; keys are only read via environment variables, and only variable names are written in the configuration.

Ecosystem Note: DSH advocates “everything is a plugin”; SkillHub Plugin Directory is a community site and has no official affiliation with DeepSeek / High-Flyer. The current star rating on the directory page is 0; refer to the page and repository for details.

Conclusion

dsh-second-opinion turns “analyze first, then act, finally cross-check” into a configurable DSH workflow plugin. The reviewer is connected via contract and is not bound to vendors. To view the introduction and classification, open the SkillHub Directory Page; for installation commands, configuration fields, command lists, and known limitations, refer to the GitHub Repository README.

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

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

Xiaoye